davideberly / GeometricTools

A collection of source code for computing in the fields of mathematics, geometry, graphics, image analysis and physics.
Boost Software License 1.0
1.08k stars 202 forks source link

feature request - advice needed #59

Open owai1980 opened 1 year ago

owai1980 commented 1 year ago

Hello... again!

I need a 2D geometric primitive that you don't have in your library. It is similar to a polygon2 composed of linear "segment2" and curved "arc2" (convex / concave). I somehow found a way to create this "2D potatoe" object, and use your functions independently to calculate intersections (loop through all the segment2/arc2, and test if anyone has an intersection with the other object, ...)

that's ok.

now i would like to create a Prism (extrusion through Z axis) of this Potatoe2D object, so it will be 3D. (with up and bottom equals, perpendicular to Z axis, all other sides parallel to Z axis). And i need to calculate the intersection of this "PrismPotatoe" with a cylinder. The axis of my cylinders will always be in the XY plane, perpendicular to the Z axis.

Do you have any advice? maybe i could use "IntrTriangle3Cylinder3.h" to test each vertical rectangle (split in 2 triangles) with my cylinder...

but i still have no solution to calculate the instersection of a cylinder3 and an "extrudedArc3" (a part of a cylinder3). Any idea for this last question?

Thank you again, and don't worry if you don't have time to write this!!

Johan

davideberly commented 1 year ago

How do you envision the interface for the "polyedge" object (edge = segment or arc)?

Regarding your 3D problem, I need to think about an algorithm for intersection. My technical support load has been significant these days, so I doubt I can get to this problem for a while.

owai1980 commented 1 year ago

Thank you for your answer.

The 2D Polyedge is just a list (std::vector?) of "segment2" and/ or "arc2". It could also be 1 "circle2". i like to see those segment2/arc2 turning clockwise into a closed loop (non crossing) . (each end is the start of the next one, and the last ends where the first start)

I also imagine this 2d polyedge in a "non closed" version. (all segment2/arc2 connected, except the last and the first one).

About the 3d problem... It is not super urgent, but it would be a wonderful improvement if i can use it in a few months. I know it is a big problem, with many sub problems (we will need this polyedge2 in a 3d version!!)...

Thank you again...

Johan