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 + b
givena
andb
ofV3d
type. - Substraction:
a - b
givena
andb
ofV3d
type. - Negation:
-a
givena
ofV3d
type. - Scalar multiplication:
a * n
givenn
of typeFloat
orInt
- Scalar division:
a / n
givenn
of 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
this
tothat
- 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)
true
if is instance ofV3d
and the coordinates are equal- hash
virtual override Int hash()
- isUnit
Bool isUnit()
Is the unit vector?
true
ifmagnitude
is 1.0f,false
otherwise.- 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
,y
andz
- toStr
virtual override Str toStr()
Show the vector as a
Str
(x,y,z)
- x
const Float x
x
coordinate- y
const Float y
y
coordinate- z
const Float z
z
coordinate- zero
const static V3d zero := V3d.<ctor>(0.0, 0.0, 0.0)
Vector with all components initialized to 0.0f