Change the calculation of the b parameter of the hyperbolic arc (#12467)

* Change the calculation of the b parameter of the hyperbolic arc
so that it does not give 0/0 when cos(phi) = 0

This gave problems if the first two points defined in the sketcher had
the same x-coordinate.
This commit is contained in:
Ed Williams
2024-02-27 10:38:05 -10:00
committed by GitHub
parent 50d254e7a2
commit 4bb28e543c

View File

@@ -102,8 +102,9 @@ public:
double angleatpoint = acosh(((onSketchPos.x - centerPoint.x) * cos(phi)
+ (onSketchPos.y - centerPoint.y) * sin(phi))
/ a);
double b = (onSketchPos.y - centerPoint.y - a * cosh(angleatpoint) * sin(phi))
/ (sinh(angleatpoint) * cos(phi));
double b = ((onSketchPos.y - centerPoint.y) * cos(phi)
- (onSketchPos.x - centerPoint.x) * sin(phi))
/ sinh(angleatpoint);
if (!boost::math::isnan(b)) {
for (int i = 15; i >= -15; i--) {
@@ -140,8 +141,9 @@ public:
double angleatstartingpoint = acosh(((startingPoint.x - centerPoint.x) * cos(phi)
+ (startingPoint.y - centerPoint.y) * sin(phi))
/ a);
double b = (startingPoint.y - centerPoint.y - a * cosh(angleatstartingpoint) * sin(phi))
/ (sinh(angleatstartingpoint) * cos(phi));
double b = ((startingPoint.y - centerPoint.y) * cos(phi)
- (startingPoint.x - centerPoint.x) * sin(phi))
/ sinh(angleatstartingpoint);
double startAngle = angleatstartingpoint;
@@ -240,8 +242,10 @@ public:
double angleatstartingpoint = acosh(((startingPoint.x - centerPoint.x) * cos(phi)
+ (startingPoint.y - centerPoint.y) * sin(phi))
/ a);
double b = (startingPoint.y - centerPoint.y - a * cosh(angleatstartingpoint) * sin(phi))
/ (sinh(angleatstartingpoint) * cos(phi));
double b = ((startingPoint.y - centerPoint.y) * cos(phi)
- (startingPoint.x - centerPoint.x) * sin(phi))
/ sinh(angleatstartingpoint);
double startAngle = angleatstartingpoint;