A point can be defined in relation to it’s position towards a light. How to determine if it’s on the line, on the left or right side?
This computational algorithm which is basically just applying a simple mathematical equation will determine on which side a particular point is in reference to a line.
The matematical equation for this (in XY plane) is d=(x−x1)(y2−y1)−(y−y1)(x2−x1) provided that the point has the coordinates (x, y) and the line [(x1, y1), (x2, y2)]
In Python the code for DynamoBIM is :
def PointSide(point, line):
sp = line.StartPoint
ep = line.EndPoint
d = (point.X - sp.X) * (ep.Y - sp.Y) - (point.Y - sp.Y)*(ep.X - sp.X)
if d > 0:
elif d == 0:
#Assign your output to the OUT variable.
OUT = PointSide( IN,IN)