added Polarmode prototype (doesn't work yet)

This commit is contained in:
Paolo Cignoni 2008-10-28 15:55:40 +00:00
parent 6e0b8fe1aa
commit c0c76bc5b8
2 changed files with 36 additions and 0 deletions

View File

@ -772,3 +772,25 @@ void AreaMode::Draw(Trackball * tb)
DrawSphereIcon(tb,true );
DrawUglyAreaMode(tb,points,status,old_status,plane,path,rubberband_handle);
}
// Polar mode implementation.
void PolarMode::Apply (Trackball * tb, Point3f new_point)
{
Point3f hitOld = HitViewPlane (tb, tb->last_point);
Point3f hitNew = HitViewPlane (tb, new_point);
float dx = (hitNew.X() - hitOld.X());
float dy = (hitNew.Y() - hitOld.Y());
const float PI2=6.283185307179586232f;
float anglex = dx/(tb->radius * PI2);
float angley = -dy/(tb->radius * PI2);
tb->track.rot = Quaternionf (anglex,Point3f(0,1,0)) * Quaternionf (angley,Point3f(1,0,0)) * tb->last_track.rot ;
}
void PolarMode::Draw(Trackball * tb){
DrawSphereIcon(tb,true );
}

View File

@ -1015,6 +1015,20 @@ private:
};
// Polar mode.
class PolarMode:public TrackMode {
public:
void Apply (Trackball * trackball, Point3f new_point);
const char *Name () {
return "PolarMode";
};
void Draw (Trackball * trackball);
};
}//namespace
#endif