X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fturtle.cpp;h=5ef84a5afb0e91efc8591401406399ab579a19d8;hb=68a7b857d7778c1a7b33d916d062de317fdd5069;hp=69421c86433bb861191a8d82b313d69fc35462ca;hpb=526db67540bf69a4c09ed0d0f4d62bad0a37ee70;p=lsystem3d.git diff --git a/src/turtle.cpp b/src/turtle.cpp index 69421c8..5ef84a5 100644 --- a/src/turtle.cpp +++ b/src/turtle.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 @@ -58,6 +58,31 @@ Turtle::~Turtle() +/** + * Reset to default state + */ +void Turtle::reset() +{ + // put turtle at (0,0,0), head upwards, back towards camera + + _position.setXYZ(0.0, 0.0, 0.0); + + _heading.setXYZ(0.0, 1.0, 0.0); + _left.setXYZ(1.0, 0.0, 0.0); + _up.setXYZ(0.0, 0.0, 1.0); + + + // empty the stacks + _positionStack = stack(); + _headingStack = stack(); + _leftStack = stack(); + _upStack = stack(); + _diameterStack = stack(); + _colorIndexStack = stack(); +} + + + /** * Turn left */ @@ -238,31 +263,6 @@ void Turtle::pop() -/** - * Reset to default state - */ -void Turtle::reset() -{ - // put turtle at (0,0,0), head upwards, back towards camera - - _position.setXYZ(0.0, 0.0, 0.0); - - _heading.setXYZ(0.0, 1.0, 0.0); - _left.setXYZ(1.0, 0.0, 0.0); - _up.setXYZ(0.0, 0.0, 1.0); - - - // empty the stacks - _positionStack = stack(); - _headingStack = stack(); - _leftStack = stack(); - _upStack = stack(); - _diameterStack = stack(); - _colorIndexStack = stack(); -} - - - /** * Set turn/pitch/roll angle * @param angle the angle, in radians