Struct Line
Represents a line in 2D space that is composed of 32-bit signed integer X and Y coordinates.
Namespace: X10D.Drawing
Assembly: X10D.dll
Syntax
public struct Line : IEquatable<Line>, IComparable<Line>, IComparable
Constructors
| Improve this Doc View SourceLine(Point, Point)
Initializes a new instance of the Line struct by taking the start and end points.
Declaration
public Line(Point start, Point end)
Parameters
Type | Name | Description |
---|---|---|
Point | start | The start point. |
Point | end | The end point. |
Fields
| Improve this Doc View SourceEmpty
The empty line. That is, a line whose start and end points are at (0, 0).
Declaration
public static readonly Line Empty
Field Value
Type | Description |
---|---|
Line |
One
The line whose start point is at (0, 0) and end point is at (1, 1).
Declaration
public static readonly Line One
Field Value
Type | Description |
---|---|
Line |
UnitX
The line whose start point is at (0, 0) and end point is at (1, 0).
Declaration
public static readonly Line UnitX
Field Value
Type | Description |
---|---|
Line |
UnitY
The line whose start point is at (0, 0) and end point is at (0, 1).
Declaration
public static readonly Line UnitY
Field Value
Type | Description |
---|---|
Line |
Properties
| Improve this Doc View SourceEnd
Gets the end point of the line.
Declaration
public Point End { get; }
Property Value
Type | Description |
---|---|
Point | The end point. |
Length
Gets the length of this line.
Declaration
public float Length { get; }
Property Value
Type | Description |
---|---|
System.Single | The length. |
LengthSquared
Gets the length of this line, squared.
Declaration
public float LengthSquared { get; }
Property Value
Type | Description |
---|---|
System.Single | The squared length. |
Start
Gets the start point of the line.
Declaration
public Point Start { get; }
Property Value
Type | Description |
---|---|
Point | The start point. |
Methods
| Improve this Doc View SourceCompareTo(Nullable<Object>)
Compares this instance to another object.
Declaration
public int CompareTo(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj | The object with with which to compare |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
System.Int32 | A signed number indicating the relative values of this instance and
|
Remarks
Comparison internally measures the LengthSquared property to avoid calls to obj
is not an instance of Line.
CompareTo(Line)
Compares this instance to another Line.
Declaration
public int CompareTo(Line other)
Parameters
Type | Name | Description |
---|---|---|
Line | other |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
System.Int32 | A signed number indicating the relative values of this instance and
|
Remarks
Comparison internally measures the LengthSquared property to avoid calls to
Equals(Nullable<Object>)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Line)
Returns a value indicating whether this instance and another instance are equal.
Declaration
public bool Equals(Line other)
Parameters
Type | Name | Description |
---|---|---|
Line | other | The instance with which to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if this instance and |
FromLine3D(Line3D)
Declaration
public static Line FromLine3D(in Line3D line)
Parameters
Type | Name | Description |
---|---|---|
Line3D | line | The line to convert. |
Returns
Type | Description |
---|---|
Line | The converted line. |
FromLineF(LineF)
Declaration
public static Line FromLineF(in LineF line)
Parameters
Type | Name | Description |
---|---|---|
LineF | line | The line to convert. |
Returns
Type | Description |
---|---|
Line | The converted line. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Operators
| Improve this Doc View SourceEquality(Line, Line)
Returns a value indicating whether two instances of Line are equal.
Declaration
public static bool operator ==(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Explicit(Line3D to Line)
Declaration
public static explicit operator Line(in Line3D line)
Parameters
Type | Name | Description |
---|---|---|
Line3D | line | The line to convert. |
Returns
Type | Description |
---|---|
Line | The converted line. |
Explicit(LineF to Line)
Declaration
public static explicit operator Line(in LineF line)
Parameters
Type | Name | Description |
---|---|---|
LineF | line | The line to convert. |
Returns
Type | Description |
---|---|
Line | The converted line. |
GreaterThan(Line, Line)
Returns a value indicating whether the length of one line is greater than that of another.
Declaration
public static bool operator>(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the Length of |
GreaterThanOrEqual(Line, Line)
Returns a value indicating whether the length of one line is greater than or equal to that of another.
Declaration
public static bool operator >=(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the Length of |
Inequality(Line, Line)
Returns a value indicating whether two instances of Line are not equal.
Declaration
public static bool operator !=(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
LessThan(Line, Line)
Returns a value indicating whether the length of one line is less than that of another.
Declaration
public static bool operator <(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the Length of |
LessThanOrEqual(Line, Line)
Returns a value indicating whether the length of one line is less than or equal to that of another.
Declaration
public static bool operator <=(in Line left, in Line right)
Parameters
Type | Name | Description |
---|---|---|
Line | left | The first instance. |
Line | right | The second instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the Length of |