Hi Nigel
Unfortunately, there is no a few lines answer. It takes a bit fiddly coding, but there is a good tool.
A simple loop reduces the problem to: How to check if an edge is inside a wire.
Let us assume for discussion's sake that the wire has two edges.
Geometrically edges are curves. and wires are sequences of joined curves. This reduces the problem to:
How to check if a curve (let's call it curveThis) is inside a pair of joined curves.
ICurve_DG.GetIntersection1() is a good way to tack this. Here is the declaration:
Code: Select all
bool GetIntersection1(ICurve_DG curve, double tolerance, ISetR1_DG paramsThis, ISetR1_DG paramsCurve, IArrayBool_DG flagsTangential)
You could check intersections of curveThis with both curves from the wire. Return false or any flagsTangential are false means the curve does not belong geometrically to each other. So, the final answer would be no.
The interesting case is when one part of curveThis is collinear to the first curve of the wire and another part is collinear to the second curve of the wire. Let us assume (easy to check) you know that if curveThis is inside the wire then it is inside completely.
Let us suppose also that you have called GetIntersection1() on curveThis like
Code: Select all
curveThis.GetIntersection1(curveEdge0, tolerance, paramsThis0, paramsEdge0, flagsTangential0);
curveThis.GetIntersection1(curveEdge1, tolerance, paramsThis1, paramsEdge1, flagsTangential1);
The answer would be: curveThis is inside the other two if and only if paramsThis0 and paramsThis1 both are single range sets, and the ranges are contiguous like rg0.max = rg1.min (up to a ~1e-10 tolerance)
Regards