Header menu logo Euclid

Vc Type

Vc is an immutable 2D vector with any length. Made up from 2 floats: X and Y.

2D unit-vectors with length 1.0 are called 'UnitVc'. 3D vectors are called 'Vec'.

Record fields

Record Field Description

X

Full Usage: X

Field type: float

Gets the X part of this 2D vector.

Field type: float

Y

Full Usage: Y

Field type: float

Gets the X part of this 2D vector.

Field type: float

Constructors

Constructor Description

Vc(x, y)

Full Usage: Vc(x, y)

Parameters:
    x : float
    y : float

Returns: Vc

Create a new 2D vector with any length. Made up from 2 floats: X and Y.

x : float
y : float
Returns: Vc

Instance members

Instance member Description

this.AsString

Full Usage: this.AsString

Returns: string

Format 2D vector into string with nice floating point number formatting of X and Y But without full type name or length as in v.ToString()

Returns: string

this.Length

Full Usage: this.Length

Returns: float
Modifiers: inline

Returns the length of the 2D vector.

Returns: float

this.LengthSq

Full Usage: this.LengthSq

Returns: float
Modifiers: inline

Returns the squared length of the 2D vector. The square length is faster to calculate and often good enough for use cases such as sorting vectors by length.

Returns: float

Static members

Static member Description

v *** b

Full Usage: v *** b

Parameters:
Returns: float
Modifiers: inline

Dot product, or scalar product of two 2D vectors. Returns a float.

v : Vc
b : Vc
Returns: float

f * v

Full Usage: f * v

Parameters:
    f : float
    v : Vc

Returns: Vc
Modifiers: inline

Multiplies a scalar with a 2D vector, also called scaling a vector. Returns a new 2D vector.

f : float
v : Vc
Returns: Vc

v * f

Full Usage: v * f

Parameters:
    v : Vc
    f : float

Returns: Vc
Modifiers: inline

Multiplies a 2D vector with a scalar, also called scaling a vector. Returns a new 2D vector.

v : Vc
f : float
Returns: Vc

a + b

Full Usage: a + b

Parameters:
Returns: Vc
Modifiers: inline

Add two 2D vectors together. Returns a new 2D vector.

a : Vc
b : Vc
Returns: Vc

a - b

Full Usage: a - b

Parameters:
Returns: Vc
Modifiers: inline

Subtract one 2D vectors from another. Returns a new 2D vector.

a : Vc
b : Vc
Returns: Vc

v / f

Full Usage: v / f

Parameters:
    v : Vc
    f : float

Returns: Vc
Modifiers: inline

Divides a 2D vector by a scalar, also be called dividing/scaling a vector. Returns a new 2D vector.

v : Vc
f : float
Returns: Vc

~-v

Full Usage: ~-v

Parameters:
Returns: Vc
Modifiers: inline

Negate or inverse a 2D vectors. Returns a new 2D vector.

v : Vc
Returns: Vc

Vc.DivideByInt(v, i)

Full Usage: Vc.DivideByInt(v, i)

Parameters:
    v : Vc
    i : int

Returns: Vc

Divides the vector by an integer. (This member is needed by Array.average and similar functions)

v : Vc
i : int
Returns: Vc

Vc.Zero

Full Usage: Vc.Zero

Returns: Vc
Modifiers: inline

Returns a zero length vector: Vec(0, 0)

Returns: Vc

Type something to start searching.