Table of Contents

Struct Line2D

Namespace
Pinwheel.Vista.Geometric
Assembly
Pinwheel.Vista.Runtime.dll

Represents a finite 2D line segment.

public struct Line2D : IEquatable<Line2D>
Implements
Inherited Members

Remarks

Even though some helper methods derive an infinite line equation from the segment endpoints, intersection tests in this type treat the segment as bounded by startPoint and endPoint.

Constructors

Line2D(float, float, float, float)

Creates a segment from four coordinates.

Line2D(Vector2, Vector2)

Creates a segment from two endpoints.

Properties

Center

Gets the midpoint of the segment.

Direction

Gets the normalized direction from startPoint to endPoint.

Length

Gets the segment length.

SqrLength

Gets the squared segment length.

endPoint

Gets or sets the segment end point.

startPoint

Gets or sets the segment start point.

Methods

Equals(Line2D)

Tests whether two segments represent the same endpoints, ignoring direction.

GetX(float)

Solves the infinite line equation for X at a given Y.

GetY(float)

Solves the infinite line equation for Y at a given X.

Intersect(Line2D, Line2D, out Vector2)

Tests whether two finite segments intersect and returns the intersection point when they do.