Struct OrthogonalLine
Structure representing an orthogonal line in a integer grid.
Assembly: cs.temp.dll.dll
Syntax
public struct OrthogonalLine : IEquatable<OrthogonalLine>
Constructors
OrthogonalLine(Vector3Int, Vector3Int)
Construct an orthogonal line from given endpoints.
Declaration
public OrthogonalLine(Vector3Int from, Vector3Int to)
Parameters
Type |
Name |
Description |
Vector3Int |
from |
|
Vector3Int |
to |
|
Properties
Direction
Declaration
public Vector3Int Direction { get; }
Property Value
Type |
Description |
Vector3Int |
|
From
Declaration
public Vector3Int From { get; }
Property Value
Type |
Description |
Vector3Int |
|
Length
Returns number of points on the line.
If From equals To, the Length is 1 (point).
Declaration
public int Length { get; }
Property Value
Type |
Description |
System.Int32 |
|
To
Declaration
public Vector3Int To { get; }
Property Value
Type |
Description |
Vector3Int |
|
Methods
Contains(Vector3Int)
Checks if the orthogonal line contains a given point.
Declaration
public int Contains(Vector3Int point)
Parameters
Type |
Name |
Description |
Vector3Int |
point |
|
Returns
Type |
Description |
System.Int32 |
Index of a given point on the line or -1.
|
Equals(OrthogonalLine)
Declaration
public bool Equals(OrthogonalLine other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
GetNthPoint(Int32)
Gets nth point on the line. (Counted from From)
Declaration
public Vector3Int GetNthPoint(int n)
Parameters
Type |
Name |
Description |
System.Int32 |
n |
|
Returns
Type |
Description |
Vector3Int |
|
GetPoints()
Gets all points of the line. Both "From" and "To" are inclusive.
The direction is from "From" to "To";
Declaration
public List<Vector3Int> GetPoints()
Returns
Type |
Description |
System.Collections.Generic.List<Vector3Int> |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()
Operators
Addition(OrthogonalLine, Vector3Int)
Adds given IntVector2 to both endpoints of a given orthogonal line.
Declaration
public static OrthogonalLine operator +(OrthogonalLine line, Vector3Int point)
Parameters
Returns
Addition(Vector3Int, OrthogonalLine)
Adds given IntVector2 to both endpoints of a given orthogonal line.
Declaration
public static OrthogonalLine operator +(Vector3Int point, OrthogonalLine line)
Parameters
Returns
Implements
IEquatable<>