}
std::shared_ptr<GeomAPI_XY> aLineVec = aPoints[2]->decreased(aPoints[1]);
std::shared_ptr<GeomAPI_XY> aPtLineVec = aPoints[0]->decreased(aPoints[1]);
- if (aPtLineVec->cross(aLineVec) * aConstraint.valA < 0.0) {
+ if (aPtLineVec->cross(aLineVec) * aConstraint.valA < 0.0 || myIsNegative) {
aConstraint.valA *= -1.0;
myStorage->updateConstraint(aConstraint);
+ myIsNegative = true;
}
}
}
private:
int myType; ///< type of constraint (applicable: SLVS_C_PT_PT_DISTANCE, SLVS_C_PT_LINE_DISTANCE)
double myPrevValue; ///< previous value of distance (for correct calculation of a distance sign)
+ bool myIsNegative; ///< \c true, if the point if placed rightside of line direction (SLVS_C_PT_LINE_DISTANCE only)
};
#endif