X-Git-Url: https://git.piment-noir.org/?p=lsystem3d.git;a=blobdiff_plain;f=src%2Fvector.cpp;fp=src%2Fvector.cpp;h=06ce40c6c5d4e741f749ea8490975f0022f40d49;hp=639d0b2083aace27c535a1e9903f10113a4bf6d0;hb=68a7b857d7778c1a7b33d916d062de317fdd5069;hpb=b983918b252749f97e0fe2a85dd86bb3306921cc diff --git a/src/vector.cpp b/src/vector.cpp index 639d0b2..06ce40c 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -47,6 +47,23 @@ Vector::~Vector() +/** + * Normalize vector + */ +void Vector::normalize() +{ + double length = sqrt(_x * _x + _y * _y + _z * _z); + + if (length != 0) + { + _x /= length; + _y /= length; + _z /= length; + } +} + + + /** * Rotate around another vector * @param angle rotation angle @@ -82,23 +99,6 @@ void Vector::rotate(double angle, Vector vector) -/** - * Normalize vector - */ -void Vector::normalize() -{ - double length = sqrt(_x * _x + _y * _y + _z * _z); - - if (length != 0) - { - _x /= length; - _y /= length; - _z /= length; - } -} - - - /** * Get scalar product of two vectors * @param vector arbitrary vector