From af8d9ba570f25952028235c4001f9c7f9effd48f Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 28 Dec 2017 13:12:10 +0300 Subject: [PATCH] Improve constraints placement --- src/SketcherPrs/SketcherPrs_PositionMgr.cpp | 25 +++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 21b6dacb1..669d67745 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -396,16 +396,34 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( } } } - aVectors.push_back(aVec); - aAngles.push_back(aMinAng); + if ((aMinAng * 2) >= aAngleStep) { + aVectors.push_back(aVec); + aAngles.push_back(aMinAng); + } + } + + gp_Ax1 aRotAx(aP, aNormDir); + gp_Vec aVecPos; + // If number of angle less then number of symbols then each symbol can be placed + // directly inside of the angle + if (aAngles.size() >= aPos[1]) { + int aId = aPos[0]; + std::list::iterator aVIt = aVectors.begin(); + std::advance(aVIt, aId); + aVecPos = *aVIt; + + gp_Vec aShift = aVecPos.Rotated(aRotAx, aAngleStep); + aShift.Normalize(); + aShift.Multiply(theStep * 1.5); + return aP.Translated(aShift); } + // A case when there are a lot of symbols int aPosCount = 0; double aAng; std::list::const_iterator aItAng; double aAngPos; - gp_Vec aVecPos; bool aHasPlace = false; //int aIntId = 0; // a position inside a one sector while (aPosCount < aPos[1]) { @@ -431,7 +449,6 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( break; } - gp_Ax1 aRotAx(aP, aNormDir); if (aHasPlace) { // rotate base vector on a necessary angle gp_Vec aShift = aVecPos.Rotated(aRotAx, aAngleStep + aAngleStep * aPos[0]); -- 2.39.2