Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline double magnitudeSquared () const
- {
- return X * X + Y * Y + Z * Z;
- }
- inline double magnitude () const
- {
- return sqrt(magnitudeSquared());
- }
- inline void normalize (double mag = 1.0)
- {
- const double by = mag / magnitude();
- X *= by;
- Y *= by;
- Z *= by;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement