fixed memory increase bug
1 parent d395fe9 commit 9768b73896d8ea75e69324573e74e51ac890e999
@glproj03 glproj03 authored on 18 Jan 2006
Showing 1 changed file
View
9
sources/poly.cpp
* 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();
}