Line2F

A 2D line geometric object defined by two 2D points.
Single precision.

Public Fields

p1
Point2F
The end points of the line.
p2
Point2F
The end points of the line.

Properties

AnyDefined
readonly

System.Boolean
True if either end point is defined

IsUndefined
readonly

System.Boolean
True if the line is undefined (i.e. if either end point is undefined).

Undefined
static,readonly

Line2F
An instance of an undefined line.

Methods

DistanceToLine
Double DistanceToLine (Point2F p)
Finds the shortest distance between a point and the line.
Parameters:
p: The point to test.
Returns: The shortest distance.
Intersect
static
Line2F Intersect (Line2F A, Line2F B, Double tolerance)
Return the intersection point of 2 lines
Parameters:
A: 1st test line.
B: 2nd test line.
Returns: The intersection point or Point2F.Undefined if the lines don't intersect.
Intersect
static
Line2F Intersect (Line2F A, Line2F B)
Intersect
static
Point2F Intersect (Line2F A, Point2F p, Vector2F v)
Returns the intersection of a line and a uni-directional ray.
Parameters:
A: The line to test.
p: End point of the ray.
v: The ray direction vector.
Returns:
IsInside
Boolean IsInside (Rect2F rect)
Length
Double Length ()
Calculate the length of the line segment
Returns: The line length
NearestPoint
Point2F NearestPoint (Point2F p, Double& distance)
Find the nearest point on the line to given point.
Parameters:
p:
Returns:
NearestPoint
Point2F NearestPoint (Line2F line, Double& distance, Double tolerance)
Overlaps
static
Point2F[] Overlaps (Line2F A, Line2F B, Double tolerance)
ProjectionIntersect
static
Point2F ProjectionIntersect (Line2F A, Line2F B)
Find the intersection of 2 bidirectional rays.
Parameters:
A: 1st ray (described by a line).
B: 2nd ray (described by a line).
Returns: The intersection point or Point2F.Undefined if the rays do not intersect (i.e. parallel).
RegionInside
Boolean RegionInside (Rect2F rect)
ToString
String ToString ()
String representation of the line.
Returns: (X1,Y1)-(X2,Y2)