Header menu logo Euclid

UnitVc Type

UnitVc is an immutable 2D unit-vector. it is guaranteed to be unitized. Never use the struct default constructor UnitVc()! It will create an invalid zero length vector. Use UnitVc.create or UnitVc.createUnchecked instead.

3D unit-vectors are called 'UnitVec'

Record fields

Record Field Description

X

Full Usage: X

Field type: float

Gets the X part of this 2D unit-vector.

Field type: float

Y

Full Usage: Y

Field type: float

Gets the X part of this 2D unit-vector.

Field type: float

Instance members

Instance member Description

this.AsString

Full Usage: this.AsString

Returns: string

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

Returns: string

Static members

Static member Description

a *** b

Full Usage: a *** b

Parameters:
Returns: float
Modifiers: inline

Dot product, or scalar product of a 2D vector with a 2D unit-vector. Returns a float. This float is the projected length of the 2D vector on the direction of the unit-vector.

a : Vc
b : UnitVc
Returns: float

a *** b

Full Usage: a *** b

Parameters:
Returns: float
Modifiers: inline

Dot product, or scalar product of a 2D unit-vector with a 2D vector. Returns a float. This float is the projected length of the 2D vector on the direction of the unit-vector.

a : UnitVc
b : Vc
Returns: float

a *** b

Full Usage: a *** b

Parameters:
Returns: float
Modifiers: inline

Dot product, or scalar product of two 2D unit-vectors. Returns a float. This float is the Cosine of the angle between the two 2D vectors.

a : UnitVc
b : UnitVc
Returns: float

f * a

Full Usage: f * a

Parameters:
Returns: Vc
Modifiers: inline

Multiplies a scalar with a 2D unit-vector, also called scaling a vector. Returns a new (non-unitized) 2D vector.

f : float
a : UnitVc
Returns: Vc

a * f

Full Usage: a * f

Parameters:
Returns: Vc
Modifiers: inline

Multiplies a 2D unit-vector with a scalar, also called scaling a vector. Returns a new (non-unitized) 2D vector.

a : UnitVc
f : float
Returns: Vc

a + b

Full Usage: a + b

Parameters:
Returns: Vc
Modifiers: inline

Add a 2D vectors and a 2D unit-vector together. Returns a new (non-unitized) 2D vector.

a : UnitVc
b : Vc
Returns: Vc

a + b

Full Usage: a + b

Parameters:
Returns: Vc
Modifiers: inline

Add a 2D unit-vectors and a 2D vector together. Returns a new (non-unitized) 2D vector.

a : Vc
b : UnitVc
Returns: Vc

a + b

Full Usage: a + b

Parameters:
Returns: Vc
Modifiers: inline

Add two 2D unit-vectors together. Returns a new (non-unitized) 2D vector.

a : UnitVc
b : UnitVc
Returns: Vc

a - b

Full Usage: a - b

Parameters:
Returns: Vc
Modifiers: inline

Subtract a 2D vectors from a 2D unit-vector". Returns a new (non-unitized) 2D vector.

a : UnitVc
b : Vc
Returns: Vc

a - b

Full Usage: a - b

Parameters:
Returns: Vc
Modifiers: inline

Subtract a 2D unit-vectors from a 2D vector". Returns a new (non-unitized) 2D vector.

a : Vc
b : UnitVc
Returns: Vc

a - b

Full Usage: a - b

Parameters:
Returns: Vc
Modifiers: inline

Subtract one 2D unit-vectors from another. Returns a new (non-unitized) 2D vector.

a : UnitVc
b : UnitVc
Returns: Vc

v / f

Full Usage: v / f

Parameters:
Returns: Vc
Modifiers: inline

Divides a 2D unit-vector by a scalar, also be called dividing/scaling a vector. Returns a new (non-unitized) 2D vector.

v : UnitVc
f : float
Returns: Vc

~-v

Full Usage: ~-v

Parameters:
Returns: UnitVc
Modifiers: inline

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

v : UnitVc
Returns: UnitVc

UnitVc.create (x, y)

Full Usage: UnitVc.create (x, y)

Parameters:
    x : float
    y : float

Returns: UnitVc
Modifiers: inline

Create 2D unit-vector. Does the unitizing too.

x : float
y : float
Returns: UnitVc

UnitVc.createUnchecked v

Full Usage: UnitVc.createUnchecked v

Parameters:
Returns: UnitVc
Modifiers: inline

For use as a faster constructor. Requires correct input of unitized values.

v : Vc
Returns: UnitVc

UnitVc.createUnchecked (x, y)

Full Usage: UnitVc.createUnchecked (x, y)

Parameters:
    x : float
    y : float

Returns: UnitVc
Modifiers: inline

For use as a faster constructor. Requires correct input of unitized values.

x : float
y : float
Returns: UnitVc

UnitVc.cross (a, b)

Full Usage: UnitVc.cross (a, b)

Parameters:
Returns: float
Modifiers: inline

The 2D Cross Product. It is also known as the Determinant, Wedge Product or Outer Product. In 2D it is just a scalar equal to the signed square area of the parallelogram spanned by the input vectors. If the rotation from 'a' to 'b' is Counter-Clockwise the result is positive. For unit-vectors this is the same as the sine of the angle between the two vectors. (while the dot product is the cosine)

a : UnitVc
b : UnitVc
Returns: float

UnitVc.dot (a, b)

Full Usage: UnitVc.dot (a, b)

Parameters:
Returns: float
Modifiers: inline

Dot product, or scalar product of two 2D unit-vectors. Returns a float. This float is the Cosine of the angle between the two 2D vectors.

a : UnitVc
b : UnitVc
Returns: float

Type something to start searching.