Click or drag to resize

UtilsCheckThreePointsOnLinearityWithDistance Method

Checks if point P is on the same line as defined by points S and E. The distance h must not be bigger than delta, and b must be bigger than c.

Namespace: RAYLASE.Marker.VectorGraphicElement
Assembly: RAYLASE.Marker.VectorGraphicElement (in RAYLASE.Marker.VectorGraphicElement.dll) Version: 2.19.0
Syntax
C#
public static bool CheckThreePointsOnLinearityWithDistance(
	dvec3 s,
	dvec3 e,
	dvec3 p,
	double delta
)

Parameters

s  dvec3
The start point of the line.
e  dvec3
The end point of the line.
p  dvec3
The point that is checked to be on the line.
delta  Double
Point P is considered to be on the line if the perpendicular of p to the line between s and e is less than delta.

Return Value

Boolean
true, if point p is on the line defined by s and e.
Remarks
^                                                               I
|                                                               I
|                                                               I
|                          P                                    I
|                          *          -------                   I
|                     .   /                 |                   I
|               b .      /                  |                   I
|             .  \      / a                 | h                 I
|         .  phi  |    /                    |                   I
|   S *---------------*               -------                   I
|             c       E                                         I
|                                                               I
|                                                               I
+---------------------------->                                  I
h is given by h = b * sin(phi). phi can be calculated by the dot product (E-P)*(E-S) = a*c*cos(phi). Put these together h can be calculated by:
PE = P-E , PS = P-S , ES = E-S,
 a = |PE|,  b = |PS|,  c = |ES|

           PE*ES               
phi = acos ------, 
            a*c                      

h = b*sin(phi)
See Also