const classfes2vector3d::V3d

sys::Obj
  fes2vector3d::V3d

@Serializable
@Js

V3d represents a three dimension vector with Float coordinates x, y and z.

V3d has the following operators overloaded:

  • Addition: a + b given a and b of V3d type.
  • Substraction: a - b given a and b of V3d type.
  • Negation: -a given a of V3d type.
  • Scalar multiplication: a * n given n of type Float or Int
  • Scalar division: a / n given n of type Float

References

abs

Source

Float abs()

Absolute value, alias for magnitude

compare

Source

virtual override Int compare(Obj that)

Comparison of vectors is based in their magnitudes

cross

Source

V3d cross(V3d that)

Cross product

distance

Source

Float distance(V3d that)

Distance of this to that

divFloat

Source

@Operator
This divFloat(Float n)

Division by a scalar. Shortcut is this / 3.0f

dot

Source

Float dot(V3d that)

Dot product

equals

Source

virtual override Bool equals(Obj? that)

true if is instance of V3d and the coordinates are equal

hash

Source

virtual override Int hash()

isUnit

Source

Bool isUnit()

Is the unit vector? true if magnitude is 1.0f, false otherwise.

magnitude

Source

Float magnitude()

Length of the vector obtained from Pythagoras's theorem.

make

Source

new make(Float x, Float y, Float z)

Make a new vector

minus

Source

@Operator
This minus(V3d that)

Substract that from this. Shortcut is this - that

multFloat

Source

@Operator
This multFloat(Float n)

Multiplication by a scalar. Shortcut is this * 3.0f

multInt

Source

@Operator
This multInt(Int n)

Multiplication by a scalar. Equivalent to multFloat(n.toFloat). Shortcut is this * 3

negate

Source

@Operator
This negate()

Negation. Shortcut is -a

plus

Source

@Operator
This plus(V3d that)

Add a vector to this. Shortcut is this + that

size

Source

Float size()

Size, alias for magnitude

squared

Source

Float squared()

Sum of the squared components x, y and z

toStr

Source

virtual override Str toStr()

Show the vector as a Str (x,y,z)

x

Source

const Float x

x coordinate

y

Source

const Float y

y coordinate

z

Source

const Float z

z coordinate

zero

Source

const static V3d zero := V3d.<ctor>(0.0, 0.0, 0.0)

Vector with all components initialized to 0.0f