Table of Contents

Struct VectorPoint

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

A VectorPoint behaves like a vector, except that it's coordinates are integers.

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

Constructors

VectorPoint(int, int)

public VectorPoint(int x, int y)

Parameters

x int
y int

Fields

Zero

public static readonly VectorPoint Zero

Field Value

VectorPoint

Properties

X

public int X { get; }

Property Value

int

Y

public int Y { get; }

Property Value

int

Methods

Div(VectorPoint)

Integer divides a point by another point component by component.

public VectorPoint Div(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

Examples

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

Remarks

Remainders are always positive.

Dot(VectorPoint)

[Version(1, 7, 0)]
public int Dot(VectorPoint other)

Parameters

other VectorPoint

Returns

int

Equals(VectorPoint)

public bool Equals(VectorPoint other)

Parameters

other VectorPoint

Returns

bool

Equals(object)

public override bool Equals(object other)

Parameters

other object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Magnitude()

public int Magnitude()

Returns

int

Mod(VectorPoint)

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

public VectorPoint Mod(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

Examples

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

Remarks

Remainders are always positive.

MoveBackBy(VectorPoint)

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

public VectorPoint MoveBackBy(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

Remarks

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

MoveBy(VectorPoint)

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

public VectorPoint MoveBy(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

Remarks

This operation is the same as

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

Mul(VectorPoint)

Multiplies two points component by component.

public VectorPoint Mul(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

Examples

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

Negate()

Returns a new point with the vector component negated.

public VectorPoint Negate()

Returns

VectorPoint

PerpDot(VectorPoint)

[Version(1, 7, 0)]
public int PerpDot(VectorPoint other)

Parameters

other VectorPoint

Returns

int

ScaleDown(int)

Scales this vector by the given amount.

public VectorPoint ScaleDown(int r)

Parameters

r int

Returns

VectorPoint

Examples

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

ScaleUp(int)

public VectorPoint ScaleUp(int r)

Parameters

r int

Returns

VectorPoint

Subtract(VectorPoint)

Translates this point by the negation of the given vector.

public VectorPoint Subtract(VectorPoint other)

Parameters

other VectorPoint

Returns

VectorPoint

ToString()

public override string ToString()

Returns

string

Translate(VectorPoint)

Translate this point by the given vector.

public VectorPoint Translate(VectorPoint translation)

Parameters

translation VectorPoint

Returns

VectorPoint

Operators

operator +(VectorPoint, VectorPoint)

public static VectorPoint operator +(VectorPoint point1, VectorPoint point2)

Parameters

point1 VectorPoint
point2 VectorPoint

Returns

VectorPoint

operator /(VectorPoint, int)

public static VectorPoint operator /(VectorPoint point, int n)

Parameters

point VectorPoint
n int

Returns

VectorPoint

operator ==(VectorPoint, VectorPoint)

public static bool operator ==(VectorPoint point1, VectorPoint point2)

Parameters

point1 VectorPoint
point2 VectorPoint

Returns

bool

operator !=(VectorPoint, VectorPoint)

public static bool operator !=(VectorPoint point1, VectorPoint point2)

Parameters

point1 VectorPoint
point2 VectorPoint

Returns

bool

operator *(VectorPoint, int)

public static VectorPoint operator *(VectorPoint point, int n)

Parameters

point VectorPoint
n int

Returns

VectorPoint

operator -(VectorPoint, VectorPoint)

public static VectorPoint operator -(VectorPoint point1, VectorPoint point2)

Parameters

point1 VectorPoint
point2 VectorPoint

Returns

VectorPoint

operator -(VectorPoint)

public static VectorPoint operator -(VectorPoint point)

Parameters

point VectorPoint

Returns

VectorPoint

operator +(VectorPoint)

public static VectorPoint operator +(VectorPoint point)

Parameters

point VectorPoint

Returns

VectorPoint