const classfes2vector3d::V3d
sys::Obj fes2vector3d::V3d
V3d represents a three dimension vector with Float coordinates x, y and z.
V3d has the following operators overloaded:
- Addition:
a + bgivenaandbofV3dtype. - Substraction:
a - bgivenaandbofV3dtype. - Negation:
-agivenaofV3dtype. - Scalar multiplication:
a * ngivennof typeFloatorInt - Scalar division:
a / ngivennof typeFloat
References
- abs
Float abs()Absolute value, alias for
magnitude- compare
virtual override Int compare(Obj that)Comparison of vectors is based in their magnitudes
- cross
Cross product
- distance
Distance of
thistothat- divFloat
@Operator
This divFloat(Float n)Division by a scalar. Shortcut is
this / 3.0f- dot
Dot product
- equals
virtual override Bool equals(Obj? that)trueif is instance ofV3dand the coordinates are equal- hash
virtual override Int hash()- isUnit
Bool isUnit()Is the unit vector?
trueifmagnitudeis 1.0f,falseotherwise.- magnitude
Float magnitude()Length of the vector obtained from Pythagoras's theorem.
- make
new make(Float x, Float y, Float z)Make a new vector
- minus
@Operator
This minus(V3d that)Substract that from
this. Shortcut isthis - that- multFloat
@Operator
This multFloat(Float n)Multiplication by a scalar. Shortcut is
this * 3.0f- multInt
Multiplication by a scalar. Equivalent to
multFloat(n.toFloat). Shortcut isthis * 3- negate
Negation. Shortcut is
-a- plus
Add a vector to
this. Shortcut isthis + that- size
Float size()Size, alias for
magnitude- squared
Float squared()Sum of the squared components
x,yandz- toStr
virtual override Str toStr()Show the vector as a
Str(x,y,z)- x
const Float xxcoordinate- y
const Float yycoordinate- z
const Float zzcoordinate- zero
const static V3d zero := V3d.<ctor>(0.0, 0.0, 0.0)Vector with all components initialized to 0.0f