Table of Contents

Struct LinePoint

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

Represents 1D grid points. These are auto-convertible to integers, making it possible to write, for example, grid[6] instead of grid[new LinePoint(6)].

[Version(1, 8, 0)]
public struct LinePoint : IGridPoint<LinePoint>, IEquatable<LinePoint>, IGridPoint, IVectorPoint<LinePoint>, ISplicedVectorPoint<LinePoint, LinePoint>
Implements
Inherited Members
Extension Methods

Constructors

LinePoint(int)

public LinePoint(int n)

Parameters

n int

Fields

Left

Add this to another LinePoint to get the point to the left (negative side) of the other point.

public static readonly LinePoint Left

Field Value

LinePoint

Right

Add this to another LinePoint to get the point to the right (positive side) of the other point.

public static readonly LinePoint Right

Field Value

LinePoint

Zero

public static readonly LinePoint Zero

Field Value

LinePoint

Properties

SpliceCount

For spliced grids, this is the number of slices for all points.

For Uniform grids, this is always 1.

public int SpliceCount { get; }

Property Value

int

SpliceIndex

For spliced grids, this is the index of the splice.

For Uniform grids, this is always 0.

public int SpliceIndex { get; }

Property Value

int

X

public int X { get; }

Property Value

int

Y

public int Y { get; }

Property Value

int

Methods

DistanceFrom(LinePoint)

The lattice distance between two points.

Two points should have a distance of 1 if and only if they are neighbors.

public int DistanceFrom(LinePoint other)

Parameters

other LinePoint

Returns

int

Div(LinePoint)

Integer divides a point by another point component by component.

public LinePoint Div(LinePoint other)

Parameters

other LinePoint

Returns

LinePoint

Examples

(-5, 5) Div(2, 2) == (-3, 2)

Remarks

Remainders are always positive.

Equals(LinePoint)

public bool Equals(LinePoint other)

Parameters

other LinePoint

Returns

bool

GetColor(int)

public int GetColor(int colorCount)

Parameters

colorCount int

Returns

int

Magnitude()

public int Magnitude()

Returns

int

Mod(LinePoint)

Integer divides a point component by component and returns the remainder.

public LinePoint Mod(LinePoint other)

Parameters

other LinePoint

Returns

LinePoint

Examples

(-5, 5) Mod (2, 2) == (1, 1)

Remarks

Remainders are always positive.

MoveBackBy(LinePoint)

If a spliced vectors u and v has base vector B and index I

public LinePoint MoveBackBy(LinePoint splicedVector)

Parameters

splicedVector LinePoint

Returns

LinePoint

Remarks

new SplicedVector(u.B.Subtract(v.B), (SpliceCount + u.I - v.I) % SpliceCount))

MoveBy(LinePoint)

If a spliced vectors u and v has base vector B and index I,

public LinePoint MoveBy(LinePoint splicedVector)

Parameters

splicedVector LinePoint

Returns

LinePoint

Remarks

This operation is the same as

new SplicedVector(u.B.Translate(v.B), (u.I + v.I) % SpliceCount))

Mul(LinePoint)

Multiplies two points component by component.

public LinePoint Mul(LinePoint other)

Parameters

other LinePoint

Returns

LinePoint

Examples

(-5, 5) Mul (2, 2) == (-10, 10)

Negate()

Returns a new point with the vector component negated.

public LinePoint Negate()

Returns

LinePoint

ScaleDown(int)

Scales this vector by the given amount.

public LinePoint ScaleDown(int r)

Parameters

r int

Returns

LinePoint

Examples

v.ScaleUp(1)
v.ScaleUp(n) ==  v.ScaleUp(n - 1).Translate(v)

ScaleUp(int)

public LinePoint ScaleUp(int r)

Parameters

r int

Returns

LinePoint

Subtract(LinePoint)

Translates this point by the negation of the given vector.

public LinePoint Subtract(LinePoint vector)

Parameters

vector LinePoint

Returns

LinePoint

ToString()

public override string ToString()

Returns

string

Translate(LinePoint)

Translate this point by the given vector.

public LinePoint Translate(LinePoint vector)

Parameters

vector LinePoint

Returns

LinePoint

Operators

implicit operator int(LinePoint)

public static implicit operator int(LinePoint point)

Parameters

point LinePoint

Returns

int

implicit operator LinePoint(int)

public static implicit operator LinePoint(int n)

Parameters

n int

Returns

LinePoint