}
}
- double anAngle = aLine[0]->direction()->angle(aLine[1]->direction()) / PI * 180;
- if (anAngle * aConstraint->value() < 0.0)
- aConstraint->setValue(-aConstraint->value());
- if ((90.0 - fabs(anAngle)) * (fabs(aConstraint->value()) - 90.0) > 0.0) {
- if (aConstraint->value() < 0.0)
- aConstraint->setValue(-180.0 - aConstraint->value());
- else
- aConstraint->setValue(180.0 - aConstraint->value());
- }
+ bool isReversed = false;
+ for (int i = 0; i < 2; i++)
+ if (aLine[i]->direction()->dot(aDir[i]) < 0.0)
+ isReversed = !isReversed;
+ if (isReversed)
+ aConstraint->setValue(aConstraint->value() - 180.0);
}
void makeMirrorPoints(EntityWrapperPtr theOriginal,
&& aCIt->second->isUsed(theFeature))
std::dynamic_pointer_cast<SketchSolver_ConstraintMulti>(aCIt->second)->update(true);
else if ((aType == CONSTRAINT_TANGENT_CIRCLE_LINE ||
- aType == CONSTRAINT_SYMMETRIC)
+ aType == CONSTRAINT_SYMMETRIC || aType == CONSTRAINT_ANGLE)
&& aCIt->second->isUsed(theFeature))
aCIt->second->update();
}
// while changing angle value several times
double cosA = cos(aConstraint->value() * PI / 180.0);
double sinA = sin(aConstraint->value() * PI / 180.0);
- if (aDir[0]->cross(aDir[1]) < 0.0)
- sinA *= -1.0;
+ //if (aDir[0]->cross(aDir[1]) < 0.0)
+ // sinA *= -1.0;
int aLineToUpd = 1;
if (isFixed[1][0] && isFixed[1][1]) {
sinA *= -1.0;
const std::list<EntityWrapperPtr>& anUpdPoints = (*anUpdLine)->subEntities();
std::list<EntityWrapperPtr>::const_iterator aPIt = anUpdPoints.begin();
for (int i = 0; aPIt != anUpdPoints.end(); ++aPIt, ++i) {
- double aCoord[2] = {aNewPoints[i]->x(), aNewPoints[i]->y()};
- const std::list<ParameterWrapperPtr>& aParams = (*aPIt)->parameters();
- std::list<ParameterWrapperPtr>::const_iterator aParIt = aParams.begin();
- for (int j = 0; aParIt != aParams.end(); ++j, ++aParIt)
- (*aParIt)->setValue(aCoord[j]);
+ std::shared_ptr<GeomDataAPI_Point2D> aPnt2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>((*aPIt)->baseAttribute());
+ aPnt2D->setValue(aNewPoints[i]);
}
}