From b8aa898b1f3182d028a67c39d8643b331c565053 Mon Sep 17 00:00:00 2001 From: jonas Date: Mon, 21 Jan 2019 19:10:15 +0100 Subject: started rotate() --- cWiremesh.cpp | 22 +++++++++++++++++++++- cWiremesh.h | 6 ++++++ main.cpp | 11 +++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/cWiremesh.cpp b/cWiremesh.cpp index 23c7667..91f92af 100644 --- a/cWiremesh.cpp +++ b/cWiremesh.cpp @@ -17,7 +17,7 @@ void cWiremesh::addVector(sCoord3d _origin, sCoord3d _vector, char _char, WORD _ void cWiremesh::rotate(sCoord3d _val) { - //Implement rotate + angle = angle + _val; } void cWiremesh::reset() @@ -80,3 +80,23 @@ void cWiremesh::scale(float _scalar) vectors[i].direction.z = (int)((float)vectors[i].direction.z * _scalar); } } + +sCoord3d applyRotation(sCoord3d _vector, sCoord3d _angle) +{ + sCoord3d ret = _vector; + + if(_angle.x) + { + + } + if(_angle.y) + { + + } + if(_angle.z) + { + + } + + return ret; +} diff --git a/cWiremesh.h b/cWiremesh.h index 37df740..0bdfbdb 100644 --- a/cWiremesh.h +++ b/cWiremesh.h @@ -7,6 +7,8 @@ #define _DEPTH 99 +#define PI 3.14159265 + struct sCoord3d { int x; @@ -71,7 +73,11 @@ private: sPos translate(sCoord3d _coord, sCoord3d _origin); + sCoord3d applyRotation(sCoord3d _vector, sCoord3d _angle); + sCoord3d position; + sCoord3d angle; + std::vector vectors; }; diff --git a/main.cpp b/main.cpp index 49670c4..531071e 100644 --- a/main.cpp +++ b/main.cpp @@ -35,8 +35,8 @@ int main() handler.moveObject(iver, {0,0}, _MOVE_ABSOLUTE); int x = 30; - int y = 20; - int z = 20; + int y = 30; + int z = 30; obj.addVector({0,0,z}, {x,0,0}, '+', _COL_RED); obj.addVector({0,0,z}, {0,y,0}, '+', _COL_RED); @@ -96,6 +96,12 @@ int main() case 's': position.z--; break; + case 'a': + obj.scale(1.2); + break; + case 'd': + obj.scale(0.8); + break; }; obj.setPosition(position); } @@ -108,6 +114,7 @@ int main() handler.write(); obj.write(&render); render.render(); + usleep(10*1000); } -- cgit v1.2.3