Struct VectorPoint
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
Fields
Zero
public static readonly VectorPoint Zero
Field Value
Properties
X
public int X { get; }
Property Value
Y
public int Y { get; }
Property Value
Methods
Div(VectorPoint)
Integer divides a point by another point component by component.
public VectorPoint Div(VectorPoint other)
Parameters
other
VectorPoint
Returns
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
Equals(VectorPoint)
public bool Equals(VectorPoint other)
Parameters
other
VectorPoint
Returns
Equals(object)
public override bool Equals(object other)
Parameters
other
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
Magnitude()
public int Magnitude()
Returns
Mod(VectorPoint)
Integer divides a point component by component and returns the remainder.
public VectorPoint Mod(VectorPoint other)
Parameters
other
VectorPoint
Returns
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
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
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
Examples
(-5, 5) Mul (2, 2) == (-10, 10)
Negate()
Returns a new point with the vector component negated.
public VectorPoint Negate()
Returns
PerpDot(VectorPoint)
[Version(1, 7, 0)]
public int PerpDot(VectorPoint other)
Parameters
other
VectorPoint
Returns
ScaleDown(int)
Scales this vector by the given amount.
public VectorPoint ScaleDown(int r)
Parameters
r
int
Returns
Examples
v.ScaleUp(1)
v.ScaleUp(n) == v.ScaleUp(n - 1).Translate(v)
ScaleUp(int)
public VectorPoint ScaleUp(int r)
Parameters
r
int
Returns
Subtract(VectorPoint)
Translates this point by the negation of the given vector.
public VectorPoint Subtract(VectorPoint other)
Parameters
other
VectorPoint
Returns
ToString()
public override string ToString()
Returns
Translate(VectorPoint)
Translate this point by the given vector.
public VectorPoint Translate(VectorPoint translation)
Parameters
translation
VectorPoint
Returns
Operators
operator +(VectorPoint, VectorPoint)
public static VectorPoint operator +(VectorPoint point1, VectorPoint point2)
Parameters
point1
VectorPointpoint2
VectorPoint
Returns
operator /(VectorPoint, int)
public static VectorPoint operator /(VectorPoint point, int n)
Parameters
point
VectorPointn
int
Returns
operator ==(VectorPoint, VectorPoint)
public static bool operator ==(VectorPoint point1, VectorPoint point2)
Parameters
point1
VectorPointpoint2
VectorPoint
Returns
operator !=(VectorPoint, VectorPoint)
public static bool operator !=(VectorPoint point1, VectorPoint point2)
Parameters
point1
VectorPointpoint2
VectorPoint
Returns
operator *(VectorPoint, int)
public static VectorPoint operator *(VectorPoint point, int n)
Parameters
point
VectorPointn
int
Returns
operator -(VectorPoint, VectorPoint)
public static VectorPoint operator -(VectorPoint point1, VectorPoint point2)
Parameters
point1
VectorPointpoint2
VectorPoint
Returns
operator -(VectorPoint)
public static VectorPoint operator -(VectorPoint point)
Parameters
point
VectorPoint
Returns
operator +(VectorPoint)
public static VectorPoint operator +(VectorPoint point)
Parameters
point
VectorPoint