Cancel
Showing results for 
Search instead for 
Did you mean: 

Check if point is on edge

Experimenter
Experimenter

Dear community,

 

I try to check if a 3d point P is located on an edge E of a face.

My approch was to:

 

1. get the min and max parameters from the edge E,

2. get the parameters for the point P on E

3. check if the parameter for point P is in the range of min and max parameters of E

 

Here is my c# code:

public static bool ContainsPoint(Edge edge,double x, double y, double z)
        {
            Array arr = Array.CreateInstance(typeof(double), 0);

            edge.GetParamExtents(out double min, out double max);
            edge.GetParamAtPointEx(1, new double[] { x,y,z}, ref arr);

            double param = (double)arr.GetValue(0);
            return param >= min && param <= max;
        }

unfortunately this does not work always.  For some external points it returnes true.

Does anyone have an idear how to perform such a check?

I thought about creating multiple points on the edge and compare the distances to the point to check.

 

Regards,

Alex

1 REPLY 1

Re: Check if point is on edge

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

A quick & dirty workaround:

You could place a coordinate system or a point3D object in the coordinates you want to check and run MeasureDistance from the curve to the Coord. system or point., then delete the auxiliary object

Hope this helps,

Julian

Julian Guillo
Pixel Sistemas SL
Spain