Calculate what points are on the right side of a line and on the left side of the same line

Dears,

I’m trying to identify the points are in the left and right side of a line.

You could watch what I’m trying to do in that instance.

What I’m thinking consist of getting a normal vector from the line to all points. Vectors are positive, points are on the right side, vectors are negative, points are on the left side.

With de negative or positive vector to each point it could be easy to filter the points.

But, how could I calculate a normal vector between the line and points, and identify which one is negative or positive.

Regards,

  1. Geometry.ClosestPointTo node to find the point on the curve which is closest to each point.
  2. Vector.ByTwoPoint to build a vector from the point on the line to the associated point in space.
  3. Curve.ParameterAtPoint to find the parameter of the curve where the points on the line (step 1) are located.
  4. Curve.Tangent at Parameter and Curve.Normal at parameter to find the direction the curve is moving at that point and the normal of the curve at that point.
  5. Vector.AngleAboutAxis using the tangent as the first vector, the vector by points as the second, and the normal as the axis.
  6. If angle < 180, “Right Side”, otherwise “Left Side”.

Note that this does not account for the edge case where the point is on the curve or in line with the extended tangent (the 0 or 180 degree angles, or null values when trying to draw the vector by two points)

Jacob,

Using your method, I’m getting in both cases 90 grades

When I have two points, one on the left side the another one on the right side.

Hi @frodriguezmXYFSS,
Following this post:
https://stackoverflow.com/questions/1560492/how-to-tell-whether-a-point-is-to-the-right-or-left-side-of-a-line#:~:text=Using%20the%20equation%20of%20the,point%20is%20on%20the%20line.

I could get this

If this doesn’t work out, take a look at other the suggestions on that page and use the one that you think will work best for you!

4 Likes

I’m going to try it following this method, I’ll let you know the results.

Thanks in advance