I'm interested in doing exact math in my solid generator. Or, as exact as is possible.
I have stumbled upon this interesting problem which involves circles, spheres, rotations, gnomonic projections, and lofts. It's related to bevel gears and cones.
We start with a "root circle" (in this case only a circular arc) which has its center somewhere on the z axis. Then we sweep that arc downwards by an angle theta around y axis of rotation such that the rightmost point of circle is now at south pole. Image below illustrates this.
Next we do a gnomonic projection of the rotated circular arc onto the horizontal plane which touches the bottom-most point of this arc. Next we loft this projection to a vertex, which is the origin of space. Here I've lofted only partially, not all the way to the origin:
Please note that the loft to origin vertex and the gnomonic projection are in essence the same mathematical concept, therefore we get natural alignment between the loft and the circle from which gnomonic projection was made.
Lastly I rotate the loft by the reverse angle theta, again around the y axis, and I note that indeed the cross section of the loft is a perfect circle.
So far so obvious.
However how do I draw the gnomonic projection "curve", whose loft is taken? How do I draw this path? In my specific case I took about 64 sample points and drew a spline through them, using the Workplane.spline() function that we all know so well.
In order to make mathematics more accurate and less verbose, I noted that the curve I'm approximating is actually a hyperbola!
So I am wondering, are there hooks in CadQuery to outline a perfect hyperbola, in the same way that there exists threePointArc() for a circular arc? It would make sense that such a hyperbola() function would take N points, and I'm not sure at this point, whether N is 4 or 5, because I have not studied the math too much. In other words I'm not sure exactly how you would concisely specify a hyperbola.
If I'm able to specify an exact hyperbola, then the underlying OpenCascade layers can keep this precise math, instead of introducing approximations to curves at this very early stage in the game.
I saw some clues that the notion of "HYPERBOLA" is supported in OpenCascade, but does anyone have any tips how I could plot a 2D hyperbola from the CadQuery layer, in the same way that I use Workplane.lineTo(), Workplane.threePointArc(), and Workplane.spline()?
Thanks for any insights.