Structure describes point in space. This structure is defined in #include <mgl2/type.h>
mglPoint
: mreal
x, y, z, c ¶Point coordinates {x,y,z} and one extra value c used for amplitude, transparency and so on. By default all values are zero.
mglPoint
:
mglPoint (mreal
X=0
, mreal
Y=0
, mreal
Z=0
, mreal
C=0
)
¶Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1].
mglPoint
: bool
IsNAN ()
¶Returns true
if point contain NAN values.
mglPoint
: mreal
norm ()
¶Returns the norm \sqrt{x^2+y^2+z^2} of vector.
mglPoint
: void
Normalize ()
¶Normalizes vector to be unit vector.
mglPoint
: mreal
val (int
i)
¶Returns point component: x for i=0, y for i=1, z for i=2, c for i=3.
mglPoint
operator+ (const mglPoint &
a, const mglPoint &
b)
¶Point of summation (summation of vectors).
mglPoint
operator- (const mglPoint &
a, const mglPoint &
b)
¶Point of difference (difference of vectors).
mglPoint
operator* (mreal
a, const mglPoint &
b)
¶mglPoint
operator* (const mglPoint &
a, mreal
b)
¶Multiplies (scale) points by number.
mglPoint
operator/ (const mglPoint &
a, mreal
b)
¶Multiplies (scale) points by number 1/b.
mreal
operator* (const mglPoint &
a, const mglPoint &
b)
¶Scalar product of vectors.
mglPoint
operator/ (const mglPoint &
a, const mglPoint &
b)
¶Return vector of element-by-element product.
mglPoint
operator^ (const mglPoint &
a, const mglPoint &
b)
¶Cross-product of vectors.
mglPoint
operator& (const mglPoint &
a, const mglPoint &
b)
¶The part of a which is perpendicular to vector b.
mglPoint
operator| (const mglPoint &
a, const mglPoint &
b)
¶The part of a which is parallel to vector b.
mglPoint
operator! (const mglPoint &
a)
¶Return vector perpendicular to vector a.
mreal
mgl_norm (const mglPoint &
a)
¶Return the norm sqrt(|a|^2) of vector a.
bool
operator== (const mglPoint &
a, const mglPoint &
b)
¶Return true if points are the same.
bool
operator!= (const mglPoint &
a, const mglPoint &
b)
¶Return true if points are different.