Native hyperbola?

20 views
Skip to first unread message

neri-engineering

unread,
Oct 31, 2024, 4:32:43 AM10/31/24
to CadQuery
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.

gnomonic1.png

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:

gnomonic2.png

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.

gnomonic3.png

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.

Sent with Proton Mail secure email.

neri-engineering

unread,
Oct 31, 2024, 6:04:21 AM10/31/24
to neri-engineering, CadQuery
My bad, turns out these curves can also be elliptical and not just hyperbolic, see image below.

gnomonic4.png

So in essence my question is, can one specify such curves natively/exactly instead of approximations using splines.  That way after transformations etc. the curve returns to its original and intended state.

Sent with Proton Mail secure email.

--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cadquery/MOAtPIKa1lTMZ2bsPhT3kKq1u-jZfTTuKkE4gPNVKKJAp56DQvQ34UksPE22185_gZYuyj6ZbSUocb_QYEqhVewqL4OgI6v6r_NiAkDlYs4%3D%40protonmail.com.

Adam Urbanczyk

unread,
Nov 1, 2024, 12:45:06 PM11/1/24
to CadQuery
Only using OCP/OCCT directly for now. BTW: NURBS can represent conics exactly, so using splines is not always an approximation.
Reply all
Reply to author
Forward
0 new messages