Table of Contents

Struct LineSegment

Namespace
HelixToolkit.Wpf
Assembly
HelixToolkit.Wpf.dll

Represents a line segment in two-dimensional space.

public readonly struct LineSegment : IEquatable<LineSegment>
Implements
Inherited Members
Extension Methods

Constructors

LineSegment(Point, Point)

Initializes a new instance of the LineSegment structure.

public LineSegment(Point p1, Point p2)

Parameters

p1 Point

The first point of the line segment.

p2 Point

The second point of the line segment.

Properties

Length

Gets the length of this line segment.

public double Length { get; }

Property Value

double

P1

Gets the first point of the line segment.

public Point P1 { get; }

Property Value

Point

The point.

P2

Gets the second point of the line segment.

public Point P2 { get; }

Property Value

Point

The point.

Methods

AreLineSegmentsIntersecting(Point, Point, Point, Point)

Checks if there are any intersections of two line segments.

public static bool AreLineSegmentsIntersecting(Point a1, Point a2, Point b1, Point b2)

Parameters

a1 Point

One vertex of line a.

a2 Point

The other vertex of the line a.

b1 Point

One vertex of line b.

b2 Point

The other vertex of the line b.

Returns

bool

true, if the two lines are crossed. Otherwise, it returns false.

Equals(LineSegment)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(LineSegment other)

Parameters

other LineSegment

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

IntersectsWith(LineSegment)

Indicates whether the specified line segment intersects with the current line segment.

public bool IntersectsWith(LineSegment other)

Parameters

other LineSegment

The line segment to check.

Returns

bool

true if the specified line segment intersects with the current line segment; otherwise false.

Operators

operator ==(LineSegment, LineSegment)

public static bool operator ==(LineSegment left, LineSegment right)

Parameters

left LineSegment
right LineSegment

Returns

bool

operator !=(LineSegment, LineSegment)

public static bool operator !=(LineSegment left, LineSegment right)

Parameters

left LineSegment
right LineSegment

Returns

bool