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
Properties
Length
Gets the length of this line segment.
public double Length { get; }
Property Value
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
a1PointOne vertex of line a.
a2PointThe other vertex of the line a.
b1PointOne vertex of line b.
b2PointThe other vertex of the line b.
Returns
- bool
true, if the two lines are crossed. Otherwise, it returnsfalse.
Equals(LineSegment)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(LineSegment other)
Parameters
otherLineSegmentAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
otherLineSegmentThe line segment to check.
Returns
- bool
trueif the specified line segment intersects with the current line segment; otherwisefalse.
Operators
operator ==(LineSegment, LineSegment)
public static bool operator ==(LineSegment left, LineSegment right)
Parameters
leftLineSegmentrightLineSegment
Returns
operator !=(LineSegment, LineSegment)
public static bool operator !=(LineSegment left, LineSegment right)
Parameters
leftLineSegmentrightLineSegment