SketchSolver_Constraint(theConstraint),
myNumberOfObjects(0),
myNumberOfCopies(0),
- myAdjusted(false)
+ myAdjusted(false),
+ myIsFullValue(false)
{}
/// \brief Update constraint
protected:
int myNumberOfObjects; ///< number of previous initial objects
int myNumberOfCopies; ///< number of previous copies of initial objects
+ bool myIsFullValue; ///< value whether the angle/distance is a full or single for objects
bool myAdjusted; ///< the constraint is already adjusted (to not do it several times)
myCenterCoord[0] = aParams.front()->value();
myCenterCoord[1] = aParams.back()->value();
- myRotationVal[0] = sin(myAngle * PI / 180.0);
- myRotationVal[1] = cos(myAngle * PI / 180.0);
+ double anAngleValue = myAngle;
+ if (myIsFullValue && myNumberOfCopies > 0)
+ anAngleValue /= myNumberOfCopies;
+
+ myRotationVal[0] = sin(anAngleValue * PI / 180.0);
+ myRotationVal[1] = cos(anAngleValue * PI / 180.0);
SketchSolver_ConstraintMulti::adjustConstraint();
}
private:
AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation
double myAngle; ///< angle of rotation
- bool myIsFullValue; ///< value whether the angle is a full or single for objects
double myCenterCoord[2]; ///< coordinates of rotation center
double myRotationVal[2]; ///< sinus and cosine of rotation angle
EntityWrapperPtr aEnd = myStorage->entity(
myBaseConstraint->attribute(SketchPlugin_MultiTranslation::END_POINT_ID()));
std::list<ParameterWrapperPtr> aEndParams = aEnd->parameters();
+
myDelta[0] = aEndParams.front()->value() - aStartParams.front()->value();
myDelta[1] = aEndParams.back()->value() - aStartParams.back()->value();
+ if (myIsFullValue && myNumberOfCopies > 0) {
+ myDelta[0] /= myNumberOfCopies;
+ myDelta[1] /= myNumberOfCopies;
+ }
+
SketchSolver_ConstraintMulti::adjustConstraint();
}
private:
AttributePoint2DPtr myStartPointAttribute;
AttributePoint2DPtr myEndPointAttribute;
- bool myIsFullValue;
double myDelta[2]; ///< increment of translation
};