Sketcher: fix logic flaw in ConstraintLineByAngle
This commit is contained in:
committed by
Chris Hennes
parent
96e4071e2d
commit
a0847c22c7
@@ -750,16 +750,11 @@ void SketcherGui::ConstraintToAttachment(
|
||||
void SketcherGui::ConstraintLineByAngle(int geoId, double angle, App::DocumentObject* obj)
|
||||
{
|
||||
using std::numbers::pi;
|
||||
double angleModPi = std::fmod(angle, pi);
|
||||
double angleModHalfPi = std::fmod(angle, pi / 2);
|
||||
|
||||
if (fabs(angleModPi - pi) < Precision::Confusion()
|
||||
|| fabs(angleModPi + pi) < Precision::Confusion()
|
||||
|| fabs(angleModPi) < Precision::Confusion()) {
|
||||
if (fabs(std::remainder(angle, pi)) < Precision::Confusion()) {
|
||||
Gui::cmdAppObjectArgs(obj, "addConstraint(Sketcher.Constraint('Horizontal',%d)) ", geoId);
|
||||
}
|
||||
else if (fabs(angleModHalfPi - pi / 2) < Precision::Confusion()
|
||||
|| fabs(angleModHalfPi + pi / 2) < Precision::Confusion()) {
|
||||
else if (fabs(std::remainder(angle, pi / 2)) < Precision::Confusion()) {
|
||||
Gui::cmdAppObjectArgs(obj, "addConstraint(Sketcher.Constraint('Vertical',%d)) ", geoId);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user