TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct Vec2I in Tinman.Core.Math.Vectors

A two-dimensional vector with 32-bit integer precision.

struct Vec2I implements IEquatable<Vec2I>

Remarks

/     \
|  X  |
|  Y  |
\     /

Serialization

Serializer

The serialization helper object for values of Vec2I.

public static readonly field Serializer
type ITypeSerializerEx<Vec2I>

Public / Constants

Zero

The zero vector.

public static readonly field Zero
type Vec2I

Public / Attributes

Length

Returns the length of this vector.

public property Length { get }
type float64
value [>=0] The vector length.

LengthSqr

Returns the squared length of this vector.

public property LengthSqr { get }
type float64
value [>=0] The squared vector length.

X

X-coordinate of vector.

public readonly field X
type int32

Y

Y-coordinate of vector.

public readonly field Y
type int32

Public / Constructors

Vec2I

Creates a new instance of Vec2I.

public constructor Vec2I (int32 x, int32 y)
params x X-coordinate of vector.
  y Y-coordinate of vector.

Public / Methods

Add

Adds this vector and the given one.

[Pure]
public method Add (Vec2I v)
type Vec2I
params v The vector.
returns The resulting vector.

Adds this vector and the given one.

[Pure]
public method Add (int32 x, int32 y)
type Vec2I
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Choose

Chooses a component of this vector.

[Pure]
public method Choose (int32 idx, int32 v = 0)
type int32
params idx The zero-based component index.
  v The value to return if idx is out of range. Defaults to 0.
returns The resulting vector.

Cross

Computes the cross product between this vector and the given one: this x other.

[Pure]
public method Cross (int32 z)
type Vec2I
params z Z-component of vector (X- and Y-components are zero).
returns The cross product vector.

Computes the cross product between this vector and the given one: this x other.

[Pure]
public method Cross (Vec2I v)
type int32
params v The other vector.
returns The Z-component of the cross product vector (X- and Y-components are zero).

Computes the cross product between this vector and the given one: this x other.

[Pure]
public method Cross (int32 x, int32 y)
type int32
params x X-component of vector.
  y Y-component of vector.
returns The Z-component of the cross product vector (X- and Y-components are zero).

Dot

Computes the dot product between this vector and the given one.

[Pure]
public method Dot (Vec2I v)
type int32
params v The vector.
returns The resulting vector.

Computes the dot product between this vector and the given one.

[Pure]
public method Dot (int32 x, int32 y)
type int32
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Equals

Checks if this vector and the given one are equal.

[Pure]
public method Equals (Vec2I v)
type bool
params v The vector.
returns true if both vectors are equal, false if they are not.

Checks if this vector and the given one are equal.

[Pure]
public method Equals (int32 x, int32 y)
type bool
params x X-component of vector.
  y Y-component of vector.
returns true if both vectors are equal, false if they are not.

GetHashCode

[Pure]
public override method GetHashCode ()
type int32

Max

Computes the component-wise maximum of this vector and the given one.

[Pure]
public method Max (Vec2I v)
type Vec2I
params v The vector.
returns The resulting vector.

Computes the component-wise maximum of this vector and the given one.

[Pure]
public method Max (int32 x, int32 y)
type Vec2I
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Min

Computes the component-wise minimum of this vector and the given one.

[Pure]
public method Min (Vec2I v)
type Vec2I
params v The vector.
returns The resulting vector.

Computes the component-wise minimum of this vector and the given one.

[Pure]
public method Min (int32 x, int32 y)
type Vec2I
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Mul

Multiplies this vector with the given one.

[Pure]
public method Mul (Vec2I v)
type Vec2I
params v The vector.
returns The resulting vector.

Multiplies this vector with the given scalar value.

[Pure]
public method Mul (int32 v)
type Vec2I
params v The scalar value.
returns The resulting vector.

Multiplies this vector with the given one.

[Pure]
public method Mul (int32 x, int32 y)
type Vec2I
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

Neg

Negates this vector.

[Pure]
public method Neg ()
type Vec2I
returns The resulting vector.

ShiftLeft

Performs a left bit shift on each component of this vector.

[Pure]
public method ShiftLeft (int32 v)
type Vec2I
params v The shift amount.
returns The resulting vector.

ShiftRight

Performs a right bit shift on each component of this vector.

[Pure]
public method ShiftRight (int32 v)
type Vec2I
params v The shift amount.
returns The resulting vector.

Sub

Subtracts the given vector from this one.

[Pure]
public method Sub (Vec2I v)
type Vec2I
params v The vector.
returns The resulting vector.

Subtracts the given vector from this one.

[Pure]
public method Sub (int32 x, int32 y)
type Vec2I
params x X-component of vector.
  y Y-component of vector.
returns The resulting vector.

ToString

Returns a formatted string representation of this vector.

[Pure]
public override method ToString ()
type string
returns [not-null] The formatted string value.