X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fvector.cpp;h=06ce40c6c5d4e741f749ea8490975f0022f40d49;hb=a4205fb0191cc9a6a9090e0f6276248724e4f940;hp=3f68193c792231132f36c598280dee015537e8cf;hpb=526db67540bf69a4c09ed0d0f4d62bad0a37ee70;p=lsystem3d.git diff --git a/src/vector.cpp b/src/vector.cpp index 3f68193..06ce40c 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2006 Erik Dahlberg // -// This file is part of LSystem3d. +// This file is part of LSystem3D. // // LSystem3D is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -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