Added Doxygen documentation, removed using namespace std, some other minor changes.

This commit is contained in:
Paolo Cignoni 2007-07-09 22:41:22 +00:00
parent fa4061a630
commit 2eb3337caa
1 changed files with 312 additions and 69 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.3 2007/06/12 08:58:08 benedetti
Minor fix in DrawUglyCylinderMode()
Revision 1.2 2007/05/28 08:10:47 fiorin
Removed type cast warnings
@ -47,13 +50,23 @@ Utility functions for the trackmodes, first version
#include <wrap/gl/space.h>
#include <vector>
using namespace std;
namespace vcg {
/*!
This namespace contains some support functions used by TrackMode subclassess.
\warning Many of these functions shouldn't be here and are supposed to be moved to some appropriate place by the library administrator.
\warning The \e DrawUgly series of functions is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
*/
namespace trackutils {
/// Compute the plane perpedicular to view dir and passing through manip center
/*!
@brief Compute the plane perpedicular to view dir and passing through the manipulator center.
@param camera the camera of the manipulator.
@param center the center of the manipulator.
@return the plane perpedicular to view dir and passing through the manipulator center.
*/
Plane3f GetViewPlane (const View < float >&camera, const Point3f & center)
{
Point3f vp = camera.ViewPoint ();
@ -64,24 +77,36 @@ Plane3f GetViewPlane (const View < float >&camera, const Point3f & center)
return pl;
}
/*!
@brief Convert a line to a normalized ray.
@param l the line to be converted.
@return the normalized ray.
*/
Ray3f line2ray(const Line3f &l){
Ray3f r(l.Origin(),l.Direction());
r.Normalize();
return r;
}
// Given a point p in window coordinate it compute the point where the lie p
// over the plane paralell the viewplane and passing through the center of the trackball
/*!
@brief Project a window coordinate point on the plane perpedicular to view dir and passing through the manipulator center.
@param tb the manipulator.
@param p the window coordinate point.
@return p's projection on plane perpedicular to view dir and passing through the manipulator center.
*/
Point3f HitViewPlane (Trackball * tb, const Point3f & p)
{
// plane perpedicular to view direction and passing through manip center
Plane3f vp = GetViewPlane (tb->camera, tb->center);
Line3fN ln = tb->camera.ViewLineFromWindow (Point3f (p[0], p[1], 0));
Point3f PonVP;
/*bool res = */ IntersectionLinePlane < float >(vp, ln, PonVP);
IntersectionLinePlane < float >(vp, ln, PonVP);
return PonVP;
}
/*
dato un punto in coordinate di schermo e.g. in pixel stile opengl
calcola il punto di intersezione tra la viewline che passa per viewpoint e per hitplane e l'iperboloide.
@ -104,6 +129,19 @@ y = --- * (r^2 /2.0)
viewpoint.x
*/
// nota: non ho scritto io questa funzione,
// quindi la documentazione doxy potrebbe non essere accurata al 100%.
/*!
@brief Project a window coordinate point on the rotational hyperboloid relative to the manipulator.
@param center the center of the manipulator.
@param radius the radius of the manipulator.
@param viewpoint the view point.
@param vp the view plane.
@param hitplane the projection of the window coordinate point on the view plane.
@param hit the projection of hitplane on the rotational hyperboloid relative to the manipulator.
@return true if and only if hit is valid.
*/
bool HitHyper (Point3f center, float radius, Point3f viewpoint, Plane3f vp,
Point3f hitplane, Point3f & hit)
{
@ -149,7 +187,15 @@ bool HitHyper (Point3f center, float radius, Point3f viewpoint, Plane3f vp,
eq cono y=x+sqrt(2);
*/
// nota: non ho scritto io questa funzione,
// quindi la documentazione doxy potrebbe non essere accurata al 100%.
/*!
@brief Project a window coordinate point on the sphere relative to the manipulator.
@param tb the manipulator.
@param p the window coordinate point.
@return the projection of p on the sphere relative to the manipulator.
*/
Point3f HitSphere (Trackball * tb, const Point3f & p)
{
// const float Thr = tb->radius/math::Sqrt(2.0f);
@ -225,16 +271,25 @@ Point3f HitSphere (Trackball * tb, const Point3f & p)
// return hit;
}
/*
calculates the minimal distance between 2 lines.
P and Q are the lines, P_s and Q_t are set to be the closest points on these lines.
it's returned the distance from P_s and Q_t, and a boolean value which is true
if the lines are parallel enough.
if P and Q are parallel P_s and Q_t aren't set.
the formula is taken from pages 81-83 of
"Eric Lengyel - Mathematics for 3D Game Programming & Computer Graphics"
/*!
@brief Calculates the minimal distance between 2 lines.
P and Q are the lines, P_s and Q_t are set to be the closest points on these lines.
it's returned the distance from P_s and Q_t, and a boolean value which is true
if the lines are parallel enough.
if P and Q are parallel P_s and Q_t aren't set.
the formula is taken from pages 81-83 of
<em>"Eric Lengyel - Mathematics for 3D Game Programming & Computer Graphics"</em>
@param P the first line.
@param Q the second line.
@param P_s the point on P closest to Q.
@param Q_t the point on Q closest to P.
@return a std::pair made with the distance from P_s to Q_t and a boolean value, true if and only if P and Q are almost parallel.
*/
pair< float, bool > LineLineDistance(const Line3f & P,const Line3f & Q,Point3f & P_s, Point3f & Q_t){
std::pair< float, bool > LineLineDistance(const Line3f & P,const Line3f & Q,Point3f & P_s, Point3f & Q_t){
Point3f p0 = P.Origin (), Vp = P.Direction ();
Point3f q0 = Q.Origin (), Vq = Q.Direction ();
float VPVP = Vp * Vp;
@ -243,7 +298,7 @@ pair< float, bool > LineLineDistance(const Line3f & P,const Line3f & Q,Point3f &
const float det = ( VPVP * VQVQ ) - ( VPVQ * VPVQ );
const float EPSILON = 0.00001f;
if ( fabs(det) < EPSILON ) {
return make_pair(Distance(P,q0), true);
return std::make_pair(Distance(P,q0), true);
}
float b1= (q0 - p0) * Vp;
float b2= (p0 - q0) * Vq;
@ -251,18 +306,26 @@ pair< float, bool > LineLineDistance(const Line3f & P,const Line3f & Q,Point3f &
float t = ( (VPVQ * b1) + (VPVP * b2) ) / det;
P_s = p0 + (Vp * s);
Q_t = q0 + (Vq * t);
return make_pair(Distance(P_s,Q_t),false);
return std::make_pair(Distance(P_s,Q_t),false);
}
/*
calculates the minimal distance between a ray and a line
R is the ray and Q is the line, R_s and Q_t are set to be the closest points on
the ray and the line.
it's returned the distance from R_s and Q_t, and a boolean value which is true
if the ray and the line are parallel enough.
if R and Q are parallel R_s and Q_t aren't set.
/*!
@brief Calculates the minimal distance between a ray and a line.
R is the ray and Q is the line, R_s and Q_t are set to be the closest points on
the ray and the line.
it's returned the distance from R_s and Q_t, and a boolean value which is true
if the ray and the line are parallel enough.
if R and Q are parallel R_s and Q_t aren't set.
@param R the ray.
@param Q the line.
@param R_s the point on R closest to Q.
@param Q_t the point on Q closest to R.
@return a std::pair made with the distance from R_s to Q_t and a boolean value, true if and only if P and Q are almost parallel.
*/
pair< float, bool > RayLineDistance(const Ray3f & R,const Line3f & Q,Point3f & R_s, Point3f & Q_t){
std::pair< float, bool > RayLineDistance(const Ray3f & R,const Line3f & Q,Point3f & R_s, Point3f & Q_t){
Point3f r0 = R.Origin (), Vr = R.Direction ();
Point3f q0 = Q.Origin (), Vq = Q.Direction ();
float VRVR = Vr * Vr;
@ -271,7 +334,7 @@ pair< float, bool > RayLineDistance(const Ray3f & R,const Line3f & Q,Point3f & R
const float det = ( VRVR * VQVQ ) - ( VRVQ * VRVQ );
const float EPSILON = 0.00001f;
if ( ( det >= 0.0f ? det : -det) < EPSILON ) {
return make_pair(Distance(Q,r0), true);
return std::make_pair(Distance(Q,r0), true);
}
float b1= (q0 - r0) * Vr;
float b2= (r0 - q0) * Vq;
@ -284,30 +347,37 @@ pair< float, bool > RayLineDistance(const Ray3f & R,const Line3f & Q,Point3f & R
R_s = r0 + (Vr * s);
Q_t = q0 + (Vq * t);
}
return make_pair(Distance(R_s,Q_t),false);
return std::make_pair(Distance(R_s,Q_t),false);
}
/*
calculates the minimal distance between 2 segments
R e Q are the segments, R_s and Q_t are set to be the closest points on
the segments
it's returned the distance from R_s and Q_t, and a boolean value which is true
if the segments are parallel enough.
/*!
@brief Calculates the minimal distance between 2 segments.
R e Q are the segments, R_s and Q_t are set to be the closest points on
the segments.
it's returned the distance from R_s and Q_t, and a boolean value which is true
if the segments are parallel enough.
@param R the first segment.
@param Q the second segment.
@param R_s the point on R closest to Q.
@param Q_t the point on Q closest to R.
@return a std::pair made with the distance from R_s to Q_t and a boolean value, true if and only if P and Q are almost parallel.
*/
pair< float, bool > SegmentSegmentDistance(const Segment3f & R, const Segment3f & Q, Point3f & R_s, Point3f & Q_t)
std::pair< float, bool > SegmentSegmentDistance(const Segment3f & R, const Segment3f & Q, Point3f & R_s, Point3f & Q_t)
{
float R_len=Distance(R.P0(),R.P1());
float Q_len=Distance(Q.P0(),Q.P1());
const float EPSILON_LENGTH = max(R_len,Q_len)*0.0001f;
const float EPSILON_LENGTH = std::max(R_len,Q_len)*0.0001f;
if(R_len < EPSILON_LENGTH){
R_s=R.P0();
Q_t=ClosestPoint(Q,R_s);
return make_pair(Distance(R_s,Q_t),true);
return std::make_pair(Distance(R_s,Q_t),true);
}
if( Q_len < EPSILON_LENGTH){
Q_t=Q.P0();
R_s=ClosestPoint(R,Q_t);
return make_pair(Distance(R_s,Q_t),true);
return std::make_pair(Distance(R_s,Q_t),true);
}
Point3f r0 = R.P0(), Vr = (R.P1()-R.P0()).Normalize();
Point3f q0 = Q.P0(), Vq = (Q.P1()-Q.P0()).Normalize();
@ -342,7 +412,7 @@ pair< float, bool > SegmentSegmentDistance(const Segment3f & R, const Segment3f
}
}
}
return make_pair(Distance(R_s,Q_t),true);
return std::make_pair(Distance(R_s,Q_t),true);
}
float b1= (q0 - r0) * Vr;
float b2= (r0 - q0) * Vq;
@ -362,22 +432,42 @@ pair< float, bool > SegmentSegmentDistance(const Segment3f & R, const Segment3f
}else{
Q_t = q0 + (Vq * t);
}
return make_pair(Distance(R_s,Q_t),false);
return std::make_pair(Distance(R_s,Q_t),false);
}
/*!
@brief Compute the point on a line closest to the ray projection of a window coordinate point.
pair< Point3f,bool > HitNearestPointOnAxis (Trackball * tb,Line3f axis, Point3f point)
Given a window coordinate point, computes a ray starting from the manipulator
camera eye and passing through the point's projection on the viewplane, then uses RayLineDistance()
to get the closest point to ray on a given line.
@see RayLineDistance(const Ray3f & R,const Line3f & Q,Point3f & R_s, Point3f & Q_t)
@param tb the manipulator.
@param axis the axis.
@param point the window coordinate point.
@return a std::pair made with the point on axis closest to the ray projection of point and a boolean true if and only if the ray doesn't diverges respect to the axis.
*/
std::pair< Point3f,bool > HitNearestPointOnAxis (Trackball * tb,Line3f axis, Point3f point)
{
Ray3fN ray = line2ray(tb->camera.ViewLineFromWindow (point));
Point3f axis_p(0,0,0), ray_p(0,0,0);
pair< float, bool > resp=RayLineDistance(ray,axis,ray_p,axis_p);
std::pair< float, bool > resp=RayLineDistance(ray,axis,ray_p,axis_p);
if(resp.second || (ray_p == ray.Origin())){
return make_pair(Point3f(0,0,0),false);
return std::make_pair(Point3f(0,0,0),false);
}
return make_pair(axis_p,true);
return std::make_pair(axis_p,true);
}
/*!
@brief Project a line into a plane.
Given a line and a plane, returns the line projection on the plane.
The line returned is \e not normalized.
@param ln the line.
@param pl the plane.
@return the (non normalized) line projected.
*/
Line3f ProjectLineOnPlane(const Line3f & ln, const Plane3f & pl)
{
Point3f l0=ln.Origin();
@ -389,6 +479,15 @@ Line3f ProjectLineOnPlane(const Line3f & ln, const Plane3f & pl)
return res;
}
/*!
@brief Computes a signed line-point distance.
Given a line, a point and a positivity direction, computes the signed distance between the line and the point.
@param line the line.
@param pt the point.
@param positive_dir the positivity direction.
@return the signed distance.
*/
float signedDistance(Line3f line,Point3f pt,Point3f positive_dir)
{
return Distance(line,pt) * ((((pt-ClosestPoint(line,pt)) * positive_dir) >= 0.0f )? 1.0f: -1.0f);
@ -400,7 +499,14 @@ float getDeltaY(Trackball * tb, Point3f new_point)
return (new_point[1] - tb->last_point[1]) / ScreenHeight;
}
/// intersection between RAY and plane
/*!
@brief Computes the intersection between a ray and a plane.
@param pl the plane.
@param ray the ray.
@param po the intersection point.
@return true if and only if there is intersection (po is valid).
*/
template<class T>
inline bool IntersectionRayPlane( const Plane3<T> & pl, const Ray3<T> & ray, Point3<T> &po){
const T epsilon = T(1e-8);
@ -415,19 +521,46 @@ template<class T>
return true;
}
pair< Point3f, bool > HitPlane (Trackball * tb, Point3f point, Plane3f plane)
/*!
@brief Project a window coordinate point on a plane.
Given a window coordinate point, computes a ray starting from the manipulator
camera eye and passing through the point's projection on the viewplane, then uses IntersectionRayPlane()
to get the ray intersection with a given plane.
@see IntersectionRayPlane( const Plane3<T> & pl, const Ray3<T> & ray, Point3<T> &po)
@param tb the manipulator.
@param point the window coordinate point.
@param plane the plane.
@return a std::pair made with p's projection on the.plane and a boolean true if and only if the ray doesn't diverges respect to the plane.
*/
std::pair< Point3f, bool > HitPlane (Trackball * tb, Point3f point, Plane3f plane)
{
Ray3fN ray = line2ray(tb->camera.ViewLineFromWindow (point));
Point3f p(0,0,0);
bool res = IntersectionRayPlane < float >(plane, ray, p);
return make_pair(p,res);
return std::make_pair(p,res);
}
// drawing section
// nota: non ho scritto io questa classe,
// quindi la documentazione doxy potrebbe non essere accurata al 100%.
/*!
@brief Drawing hints for manipulators
This class is an holder for drawing-related variables.
It's mainly used for SphereMode and InactiveMode drawings.
*/
class DrawingHint {
public:
/*!
@brief Drawing hints constructor
assign the drawing-related variables.
*/
DrawingHint () {
CircleStep = 64;
HideStill = false;
@ -436,15 +569,28 @@ public:
LineWidthMoving = 1.5f;
color = Color4b::LightBlue;
}
/// The circles resolution.
int CircleStep;
bool HideStill, DrawTrack;
/// currently not in use.
bool HideStill;
/// currently not in use.
bool DrawTrack;
/// circle color
Color4b color;
/// circle line width when inactive.
float LineWidthStill;
/// circle line width when active.
float LineWidthMoving;
};
/// the drawing hint used by the manipulators
DrawingHint DH;
// nota: non ho scritto io questa funzione,
// quindi la documentazione doxy potrebbe non essere accurata al 100%.
/*!
@brief Draw 2 squares, used by DrawCircle().
*/
void DrawPlaneHandle ()
{
float r = 1.0;
@ -466,6 +612,11 @@ void DrawPlaneHandle ()
glEnd ();
}
// nota: non ho scritto io questa funzione,
// quindi la documentazione doxy potrebbe non essere accurata al 100%.
/*!
@brief Draw a circle with 2 squares, used by DrawSphereIcon().
*/
void DrawCircle ()
{
int nside = DH.CircleStep;
@ -479,6 +630,13 @@ void DrawCircle ()
DrawPlaneHandle ();
}
// nota: non ho scritto io questa funzione.
/*!
@brief Draw a spherical manipulator icon.
@param tb the manipulator.
@param active boolean to be set to true if the icon is active.
*/
void DrawSphereIcon (Trackball * tb,bool active)
{
glPushMatrix ();
@ -524,7 +682,13 @@ void DrawSphereIcon (Trackball * tb,bool active)
// Disclaimer: the following code is of VERY POOR quality
// feel free to delete and rewrite everything
void prepara_attrib()
/*!
@brief Support function for the \e DrawUgly series of functions
Prepare the OpenGL attributes.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
*/
void prepare_attrib()
{
float amb[4] = { .3f, .3f, .3f, 1.0f };
float col[4] = { .5f, .5f, .8f, 1.0f };
@ -537,20 +701,28 @@ void prepara_attrib()
glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, col);
}
void DrawUglyLetter(Trackball * tb,vector<Point3f> ugly_letter)
/*!
@brief Support function for the \e DrawUgly series of functions.
Draw a coordinate vector, usually a letter, near the manipulator icon in a user readable oriantation.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param ugly_letter the coordinate vector.
*/
void DrawUglyLetter(Trackball * tb,std::vector<Point3f> ugly_letter)
{
Point3f center=tb->camera.Project(tb->center);
float offset=0;
offset=max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(1,0,0) * tb->radius))));
offset=max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(0,1,0) * tb->radius))));
offset=max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(0,0,1) * tb->radius))));
offset=std::max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(1,0,0) * tb->radius))));
offset=std::max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(0,1,0) * tb->radius))));
offset=std::max(offset,Distance(center,tb->camera.Project(tb->center+(Point3f(0,0,1) * tb->radius))));
glPushMatrix();
glPushAttrib (GL_ALL_ATTRIB_BITS);
// go to world coords
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
glColor3f(1,1,1);
glLineWidth(4.0);
@ -565,9 +737,16 @@ void DrawUglyLetter(Trackball * tb,vector<Point3f> ugly_letter)
}
/*!
@brief PanMode drawing function, member of the \e DrawUgly series.
Draw a PanMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
*/
void DrawUglyPanMode(Trackball * tb)
{
vector<Point3f> ugly_p;
std::vector<Point3f> ugly_p;
ugly_p.push_back(Point3f(-1,-1,0));
ugly_p.push_back(Point3f(-1,1,0));
ugly_p.push_back(Point3f(1,1,0));
@ -577,9 +756,16 @@ void DrawUglyPanMode(Trackball * tb)
DrawUglyLetter(tb,ugly_p);
}
/*!
@brief ZMode drawing function, member of the \e DrawUgly series.
Draw a ZMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
*/
void DrawUglyZMode(Trackball * tb)
{
vector<Point3f> ugly_z;
std::vector<Point3f> ugly_z;
ugly_z.push_back(Point3f(-1,1,0));
ugly_z.push_back(Point3f(1,1,0));
ugly_z.push_back(Point3f(-1,-1,0));
@ -587,9 +773,16 @@ void DrawUglyZMode(Trackball * tb)
DrawUglyLetter(tb,ugly_z);
}
/*!
@brief ScaleMode drawing function, member of the \e DrawUgly series.
Draw a ScaleMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
*/
void DrawUglyScaleMode(Trackball * tb)
{
vector<Point3f> ugly_s;
std::vector<Point3f> ugly_s;
ugly_s.push_back(Point3f(1,1,0));
ugly_s.push_back(Point3f(-1,1,0));
ugly_s.push_back(Point3f(-1,0,0));
@ -599,6 +792,14 @@ void DrawUglyScaleMode(Trackball * tb)
DrawUglyLetter(tb,ugly_s);
}
/*!
@brief AxisMode drawing function, member of the \e DrawUgly series.
Draw an AxisMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param axis AxisMode's axis.
*/
void DrawUglyAxisMode(Trackball * tb,Line3f axis)
{
glPushMatrix();
@ -607,7 +808,7 @@ void DrawUglyAxisMode(Trackball * tb,Line3f axis)
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
glColor3f(0.9f, 0.9f, 0.2f);
glLineWidth(2.0);
glBegin(GL_LINES);
@ -623,6 +824,14 @@ void DrawUglyAxisMode(Trackball * tb,Line3f axis)
glPopMatrix();
}
/*!
@brief PlaneMode drawing function, member of the \e DrawUgly series.
Draw a PlaneMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param plane PlaneMode's plane.
*/
void DrawUglyPlaneMode(Trackball * tb,Plane3f plane)
{
glPushMatrix();
@ -631,7 +840,7 @@ void DrawUglyPlaneMode(Trackball * tb,Plane3f plane)
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
Point3f p0,d1,d2,norm;
norm=plane.Direction();
p0=plane.Projection(Point3f(0,0,0));
@ -671,6 +880,14 @@ void DrawUglyPlaneMode(Trackball * tb,Plane3f plane)
glPopMatrix();
}
/*!
@brief CylinderMode drawing function, member of the \e DrawUgly series.
Draw a CylinderMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param axis CylinderMode's axis.
*/
void DrawUglyCylinderMode(Trackball * tb,Line3f axis)
{
glPushMatrix();
@ -679,7 +896,7 @@ void DrawUglyCylinderMode(Trackball * tb,Line3f axis)
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
Plane3f plane;
plane.Init(axis.Origin(),axis.Direction());
Point3f p0,d1,d2,norm;
@ -723,7 +940,20 @@ void DrawUglyCylinderMode(Trackball * tb,Line3f axis)
glPopMatrix();
}
void DrawUglyPathMode(Trackball * tb,const vector < Point3f > &points,
/*!
@brief PathMode drawing function, member of the \e DrawUgly series.
Draw a PathMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param points PathMode's points.
@param current_point PathMode's current point.
@param prev_point PathMode's prev point.
@param next_point PathMode's next point.
@param old_hitpoint PathMode's old hitpoint.
@param wrap PathMode's wrap.
*/
void DrawUglyPathMode(Trackball * tb,const std::vector < Point3f > &points,
Point3f current_point,Point3f prev_point,
Point3f next_point,Point3f old_hitpoint,bool wrap)
{
@ -733,14 +963,14 @@ void DrawUglyPathMode(Trackball * tb,const vector < Point3f > &points,
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
glColor3f(0.9f, 0.9f, 0.2f);
glLineWidth(2.0);
if(wrap)
glBegin(GL_LINE_LOOP);
else
glBegin(GL_LINE_STRIP);
for (vector < Point3f >::const_iterator i = points.begin (); i != points.end (); ++i){
for (std::vector < Point3f >::const_iterator i = points.begin (); i != points.end (); ++i){
glVertex(*i);
}
glEnd();
@ -764,9 +994,22 @@ void DrawUglyPathMode(Trackball * tb,const vector < Point3f > &points,
glPopMatrix();
}
void DrawUglyAreaMode(Trackball * tb,const vector < Point3f > &points,
/*!
@brief AreaMode drawing function, member of the \e DrawUgly series.
Draw an AreaMode manipulator in an ugly way.
\warning this method is part of the \e DrawUgly series of functions, which is a \b TEMPORARY solution, used while waiting for the \e DrawBeautiful series...
@param tb the manipulator.
@param points AreaMode's points.
@param status AreaMode's status.
@param old_status AreaMode's old status.
@param plane AreaMode's plane.
@param path AreaMode's path.
@param rubberband_handle AreaMode's rubberband handle.
*/
void DrawUglyAreaMode(Trackball * tb,const std::vector < Point3f > &points,
Point3f status,Point3f old_status,Plane3f plane,
const vector < Point3f > &path,Point3f rubberband_handle)
const std::vector < Point3f > &path,Point3f rubberband_handle)
{
glPushMatrix();
glPushAttrib (GL_ALL_ATTRIB_BITS);
@ -774,18 +1017,18 @@ void DrawUglyAreaMode(Trackball * tb,const vector < Point3f > &points,
glTranslate (tb->center);
glMultMatrix (tb->track.InverseMatrix ());
glTranslate (-tb->center);
prepara_attrib();
prepare_attrib();
glColor3f(0.9f, 0.9f, 0.2f);
glLineWidth(2.0);
glBegin(GL_LINE_LOOP);
for (vector < Point3f >::const_iterator i = points.begin (); i != points.end (); ++i){
for (std::vector < Point3f >::const_iterator i = points.begin (); i != points.end (); ++i){
glVertex(*i);
}
glEnd();
glColor3f(0.0f, 0.9f, 0.2f);
glLineWidth(1.2f);
glBegin(GL_LINE_STRIP);
for (vector < Point3f >::const_iterator i = path.begin (); i != path.end (); ++i){
for (std::vector < Point3f >::const_iterator i = path.begin (); i != path.end (); ++i){
glVertex(*i);
}
glEnd();