Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

7cf263af 759d 5191 0a9c 6d8234614c80

haplokuon edited this page May 6, 2023 · 1 revision

PointInSegment(Vector2, Vector2, Vector2) Method

netDxf 3.0.0 Library

Checks if a point is inside a line segment.

Definition

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 

Parameters

  Vector2
A point.
  Vector2
Segment start point.
  Vector2
Segment end point.

Return Value

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.

Remarks

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.

See Also

Reference

MathHelper Class
PointInSegment Overload
netDxf Namespace

Clone this wiki locally