This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 416
7cf263af 759d 5191 0a9c 6d8234614c80
haplokuon edited this page May 6, 2023
·
1 revision
netDxf 3.0.0 Library
Checks if a point is inside a line segment.
Namespace: netDxf
Assembly: netDxf (in netDxf.dll) Version: 3.0.0
C#
public static int PointInSegment(
Vector2 p,
Vector2 start,
Vector2 end
)
VB
Public Shared Function PointInSegment (
p As Vector2,
start As Vector2,
end As Vector2
) As Integer
C++
public:
static int PointInSegment(
Vector2 p,
Vector2 start,
Vector2 end
)
F#
static member PointInSegment :
p : Vector2 *
start : Vector2 *
end : Vector2 -> int
Int32
Zero if the point is inside the segment, 1 if the point is after the end point, and -1 if the point is before the start point.
For testing purposes a point is considered inside a segment, if it falls inside the area from start to end of the segment that extends infinitely perpendicularly to its direction. Later, if needed, you can use the PointLineDistance method, if the distance is zero the point is along the line defined by the start and end points.