Hi,
I'm a bit confused and I have to confess, that I don't understand your "PointInPolygon" at all.
In my understanding I don't have any point that I could use for your calculations.
2D-math is fine, as I don't plan to do any 3D milling ...
... but if I follow the math from opencascade docs (brep specification), than it does not make a big difference, if calculation is done in 2D or 3D space.
From opencascades brep specs I got these formulas:
Code:
line: anyPoint(u) = Origin + u * Dir
circle: anyPoint(u) = Origin + r * cos(u) * Dir{x} + sin(u) * Dir{y}
ellipse: anyPoint(u) = Origin + r_{maj} * cos(u) * Dir{maj} + r_{min} * sin(u) * Dir_{min}
plane: anyPoint(u, v) = Origin + u * Dir{u} + v * Dir{v}
My days in school are long ago - sometimes I think it was another life before ...
... but if I remember well, cutpoints are calculated by setting both formulas as equal.
Speeking in general, my raw material is either round or rectangle.
Iterating over all edges of the contour wire I need to perform 2 calculations on each:
- calculate cutpoint(s) between edge and rectangle/circle from raw material. If there are cutpoints, I have to split edge into several peaces (one more for each cutpoint)
- determine for each edge (original if no cutpoints or all edges created from cutpoints) if the edge is inside the raw material shape or outside
So I think, calculations should be possible without cutting the edge into dots and than calculate the same for each vertex.
As opencascade uses parameters for all geom objects I guess it should be possible to calculate parameters from formula and then validate the result based on the parameters.
Well, I'm only talking about an idea. Don't know, whether it is possible and I'm not able to do the required maths on my own.