| |
---|
| | * set the position where the (rotation-)center of |
---|
| | * the polygon is located |
---|
| | */ |
---|
| | void Poly::setCenter(Vec c) { |
---|
| | position = c.clone(); |
---|
| | position = c.clone(); |
---|
| | } |
---|
| | |
---|
| | /* |
---|
| | * initial rotation relative to rotation center |
---|
| |
---|
| | * polygon to an absolute position) |
---|
| | */ |
---|
| | void Poly::setPosition(Vec newcenter) { |
---|
| | Vec diff = newcenter - (*position); |
---|
| | delete position; |
---|
| | position = newcenter.clone(); |
---|
| | |
---|
| | for ( std::vector<Vec*>::size_type i = 0; i < initpoints.size(); i++ ) { |
---|
| | initpoints.at(i)->add(diff); |
---|
| |
---|
| | //Vec v2 = *((Vec*)initpoints->get(1)) - *((Vec*)initpoints->get(0)); |
---|
| | //glNormal3fv( v1.cross(v2)+ *(Vec*)((*initpoints)[0]).c ); |
---|
| | //glNormal3fv( v1.cross(v2) + ((Vec*)initpoints->get(0))->c ); |
---|
| | |
---|
| | Vec* mv; |
---|
| | Vec mv; |
---|
| | |
---|
| | for ( std::vector<Vec*>::size_type i = 0; i < initpoints.size(); i++ ) { |
---|
| | color->drawColor(); |
---|
| | Vec out = *(initpoints.at(i)) - *position; |
---|
| | out = rotate_x(out); |
---|
| | out = rotate_y(out); |
---|
| | out = rotate_z(out); |
---|
| | mv = (*position + out).clone(); |
---|
| | glVertex3fv(mv->c); |
---|
| | mv = *position + out; |
---|
| | glVertex3fv(mv.c); |
---|
| | } |
---|
| | glEnd(); |
---|
| | } |
---|
| | |
---|
| |
---|
| | |