This namespace contains some support functions used by TrackMode subclassess. More...
Classes | |
class | DrawingHint |
Drawing hints for manipulators. More... | |
Functions | |
void | DrawCircle () |
Draw a circle with 2 squares, used by DrawSphereIcon(). | |
void | DrawPlaneHandle () |
Draw 2 squares, used by DrawCircle(). | |
void | DrawSphereIcon (Trackball *tb, bool active) |
Draw a spherical manipulator icon. | |
void | DrawUglyAreaMode (Trackball *tb, const std::vector< Point3f > &points, Point3f status, Point3f old_status, Plane3f plane, const std::vector< Point3f > &path, Point3f rubberband_handle) |
AreaMode drawing function, member of the DrawUgly series. | |
void | DrawUglyAxisMode (Trackball *tb, Line3f axis) |
AxisMode drawing function, member of the DrawUgly series. | |
void | DrawUglyCylinderMode (Trackball *tb, Line3f axis) |
CylinderMode drawing function, member of the DrawUgly series. | |
void | DrawUglyLetter (Trackball *tb, std::vector< Point3f > ugly_letter) |
Support function for the DrawUgly series of functions. | |
void | DrawUglyPanMode (Trackball *tb) |
PanMode drawing function, member of the DrawUgly series. | |
void | DrawUglyPathMode (Trackball *tb, const std::vector< Point3f > &points, Point3f current_point, Point3f prev_point, Point3f next_point, Point3f old_hitpoint, bool wrap) |
PathMode drawing function, member of the DrawUgly series. | |
void | DrawUglyPlaneMode (Trackball *tb, Plane3f plane) |
PlaneMode drawing function, member of the DrawUgly series. | |
void | DrawUglyScaleMode (Trackball *tb) |
ScaleMode drawing function, member of the DrawUgly series. | |
void | DrawUglyZMode (Trackball *tb) |
ZMode drawing function, member of the DrawUgly series. | |
float | getDeltaY (Trackball *tb, Point3f new_point) |
Computes the verical component of an user mouse drag. | |
Plane3f | GetViewPlane (const View< float > &camera, const Point3f ¢er) |
Compute the plane perpedicular to view dir and passing through the manipulator center. | |
bool | HitHyper (Point3f center, float radius, Point3f viewpoint, Plane3f vp, Point3f hitplane, Point3f &hit) |
Project a window coordinate point on the rotational hyperboloid relative to the manipulator. | |
std::pair< Point3f, bool > | HitNearestPointOnAxis (Trackball *tb, Line3f axis, Point3f point) |
Compute the point on a line closest to the ray projection of a window coordinate point. | |
std::pair< Point3f, bool > | HitPlane (Trackball *tb, Point3f point, Plane3f plane) |
Project a window coordinate point on a plane. | |
Point3f | HitSphere (Trackball *tb, const Point3f &p) |
Project a window coordinate point on the sphere relative to the manipulator. | |
Point3f | HitViewPlane (Trackball *tb, const Point3f &p) |
Project a window coordinate point on the plane perpedicular to view dir and passing through the manipulator center. | |
template<class T > | |
bool | IntersectionRayPlane (const Plane3< T > &pl, const Ray3< T > &ray, Point3< T > &po) |
Computes the intersection between a ray and a plane. | |
Ray3f | line2ray (const Line3f &l) |
Convert a line to a normalized ray. | |
std::pair< float, bool > | LineLineDistance (const Line3f &P, const Line3f &Q, Point3f &P_s, Point3f &Q_t) |
Calculates the minimal distance between 2 lines. | |
void | prepare_attrib () |
Support function for the DrawUgly series of functions. | |
Line3f | ProjectLineOnPlane (const Line3f &ln, const Plane3f &pl) |
Project a line into a plane. | |
std::pair< float, bool > | RayLineDistance (const Ray3f &R, const Line3f &Q, Point3f &R_s, Point3f &Q_t) |
Calculates the minimal distance between a ray and a line. | |
std::pair< float, bool > | SegmentSegmentDistance (const Segment3f &R, const Segment3f &Q, Point3f &R_s, Point3f &Q_t) |
Calculates the minimal distance between 2 segments. | |
float | signedDistance (Line3f line, Point3f pt, Point3f positive_dir) |
Computes a signed line-point distance. | |
Variables | |
DrawingHint | DH |
the drawing hint used by the manipulators |
This namespace contains some support functions used by TrackMode subclassess.
void vcg::trackutils::DrawCircle | ( | ) |
Draw a circle with 2 squares, used by DrawSphereIcon().
Definition at line 666 of file trackutils.h.
void vcg::trackutils::DrawPlaneHandle | ( | ) |
Draw 2 squares, used by DrawCircle().
Definition at line 640 of file trackutils.h.
void vcg::trackutils::DrawSphereIcon | ( | Trackball * | tb, | |
bool | active | |||
) |
Draw a spherical manipulator icon.
tb | the manipulator. | |
active | boolean to be set to true if the icon is active. |
Definition at line 685 of file trackutils.h.
void vcg::trackutils::DrawUglyAreaMode | ( | Trackball * | tb, | |
const std::vector< Point3f > & | points, | |||
Point3f | status, | |||
Point3f | old_status, | |||
Plane3f | plane, | |||
const std::vector< Point3f > & | path, | |||
Point3f | rubberband_handle | |||
) |
AreaMode drawing function, member of the DrawUgly series.
Draw an AreaMode manipulator in an ugly way.
tb | the manipulator. | |
points | AreaMode's points. | |
status | AreaMode's status. | |
old_status | AreaMode's old status. | |
plane | AreaMode's plane. | |
path | AreaMode's path. | |
rubberband_handle | AreaMode's rubberband handle. |
Definition at line 1049 of file trackutils.h.
void vcg::trackutils::DrawUglyAxisMode | ( | Trackball * | tb, | |
Line3f | axis | |||
) |
AxisMode drawing function, member of the DrawUgly series.
Draw an AxisMode manipulator in an ugly way.
tb | the manipulator. | |
axis | AxisMode's axis. |
Definition at line 842 of file trackutils.h.
void vcg::trackutils::DrawUglyCylinderMode | ( | Trackball * | tb, | |
Line3f | axis | |||
) |
CylinderMode drawing function, member of the DrawUgly series.
Draw a CylinderMode manipulator in an ugly way.
tb | the manipulator. | |
axis | CylinderMode's axis. |
Definition at line 930 of file trackutils.h.
void vcg::trackutils::DrawUglyLetter | ( | Trackball * | tb, | |
std::vector< Point3f > | ugly_letter | |||
) |
Support function for the DrawUgly series of functions.
Draw a coordinate vector, usually a letter, near the manipulator icon in a user readable oriantation.
tb | the manipulator. | |
ugly_letter | the coordinate vector. |
Definition at line 751 of file trackutils.h.
void vcg::trackutils::DrawUglyPanMode | ( | Trackball * | tb | ) |
PanMode drawing function, member of the DrawUgly series.
Draw a PanMode manipulator in an ugly way.
tb | the manipulator. |
Definition at line 786 of file trackutils.h.
void vcg::trackutils::DrawUglyPathMode | ( | Trackball * | tb, | |
const std::vector< Point3f > & | points, | |||
Point3f | current_point, | |||
Point3f | prev_point, | |||
Point3f | next_point, | |||
Point3f | old_hitpoint, | |||
bool | wrap | |||
) |
PathMode drawing function, member of the DrawUgly series.
Draw a PathMode manipulator in an ugly way.
tb | the manipulator. | |
points | PathMode's points. | |
current_point | PathMode's current point. | |
prev_point | PathMode's prev point. | |
next_point | PathMode's next point. | |
old_hitpoint | PathMode's old hitpoint. | |
wrap | PathMode's wrap. |
Definition at line 995 of file trackutils.h.
void vcg::trackutils::DrawUglyPlaneMode | ( | Trackball * | tb, | |
Plane3f | plane | |||
) |
PlaneMode drawing function, member of the DrawUgly series.
Draw a PlaneMode manipulator in an ugly way.
tb | the manipulator. | |
plane | PlaneMode's plane. |
Definition at line 874 of file trackutils.h.
void vcg::trackutils::DrawUglyScaleMode | ( | Trackball * | tb | ) |
ScaleMode drawing function, member of the DrawUgly series.
Draw a ScaleMode manipulator in an ugly way.
tb | the manipulator. |
Definition at line 822 of file trackutils.h.
void vcg::trackutils::DrawUglyZMode | ( | Trackball * | tb | ) |
ZMode drawing function, member of the DrawUgly series.
Draw a ZMode manipulator in an ugly way.
tb | the manipulator. |
Definition at line 805 of file trackutils.h.
float vcg::trackutils::getDeltaY | ( | Trackball * | tb, | |
Point3f | new_point | |||
) |
Computes the verical component of an user mouse drag.
tb | the manipulator. | |
new_point | the new mouse pointer coordinate. |
Definition at line 542 of file trackutils.h.
Plane3f vcg::trackutils::GetViewPlane | ( | const View< float > & | camera, | |
const Point3f & | center | |||
) |
Compute the plane perpedicular to view dir and passing through the manipulator center.
camera | the camera of the manipulator. | |
center | the center of the manipulator. |
Definition at line 101 of file trackutils.h.
bool vcg::trackutils::HitHyper | ( | Point3f | center, | |
float | radius, | |||
Point3f | viewpoint, | |||
Plane3f | vp, | |||
Point3f | hitplane, | |||
Point3f & | hit | |||
) |
Project a window coordinate point on the rotational hyperboloid relative to the manipulator.
The original documentation (in italian) follows:
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. l'iperboloide si assume essere quello di rotazione attorno alla retta viewpoint-center e di raggio rad si assume come sistema di riferimento quello con l'origine su center ecome x la retta center-viewpoint
eq linea hitplane.y y = - ----------- * x + hitplane.y viewpoint.x
eq hiperboloide di raggio r (e.g. che passa per (r/sqrt2,r/sqrt2)
1 y = --- * (r^2 /2.0) x
hitplane.y ----------- * x^2 - hitplane.y *x + (r^2/2.0) == 0 viewpoint.x
center | the center of the manipulator. | |
radius | the radius of the manipulator. | |
viewpoint | the view point. | |
vp | the view plane. | |
hitplane | the projection of the window coordinate point on the view plane. | |
hit | the projection of hitplane on the rotational hyperboloid relative to the manipulator. |
Definition at line 179 of file trackutils.h.
std::pair< Point3f,bool > vcg::trackutils::HitNearestPointOnAxis | ( | Trackball * | tb, | |
Line3f | axis, | |||
Point3f | point | |||
) |
Compute the point on a line closest to the ray projection of a window coordinate 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.
tb | the manipulator. | |
axis | the axis. | |
point | the window coordinate point. |
Definition at line 489 of file trackutils.h.
std::pair< Point3f, bool > vcg::trackutils::HitPlane | ( | Trackball * | tb, | |
Point3f | point, | |||
Plane3f | plane | |||
) |
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.
tb | the manipulator. | |
point | the window coordinate point. | |
plane | the plane. |
Definition at line 583 of file trackutils.h.
Point3f vcg::trackutils::HitSphere | ( | Trackball * | tb, | |
const Point3f & | p | |||
) |
Project a window coordinate point on the sphere relative to the manipulator.
The original documentation (in italian) follows:
dato un punto in coordinate di schermo e.g. in pixel stile opengl restituisce un punto in coordinate di mondo sulla superficie della trackball. La superficie della trackball e' data da una sfera + una porzione di iperboloide di rotazione. Assumiamo la sfera di raggio unitario e centrata sull'origine e di guardare lungo la y negativa.
X 0 sqrt(1/2) 1 eq sfera: y=sqrt(1-x*x); 1 sqrt(1/2) 0 eq iperboloide : y=1/2*x; inf sqrt(1/2) 1/2 eq cono y=x+sqrt(2);
tb | the manipulator. | |
p | the window coordinate point. |
Definition at line 235 of file trackutils.h.
Point3f vcg::trackutils::HitViewPlane | ( | Trackball * | tb, | |
const Point3f & | p | |||
) |
Project a window coordinate point on the plane perpedicular to view dir and passing through the manipulator center.
tb | the manipulator. | |
p | the window coordinate point. |
Definition at line 131 of file trackutils.h.
bool vcg::trackutils::IntersectionRayPlane | ( | const Plane3< T > & | pl, | |
const Ray3< T > & | ray, | |||
Point3< T > & | po | |||
) | [inline] |
Computes the intersection between a ray and a plane.
pl | the plane. | |
ray | the ray. | |
po | the intersection point. |
Definition at line 557 of file trackutils.h.
Ray3f vcg::trackutils::line2ray | ( | const Line3f & | l | ) |
Convert a line to a normalized ray.
l | the line to be converted. |
Definition at line 117 of file trackutils.h.
std::pair< float, bool > vcg::trackutils::LineLineDistance | ( | const Line3f & | P, | |
const Line3f & | Q, | |||
Point3f & | P_s, | |||
Point3f & | Q_t | |||
) |
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"
P | the first line. | |
Q | the second line. | |
P_s | the point on P closest to Q. | |
Q_t | the point on Q closest to P. |
Definition at line 331 of file trackutils.h.
void vcg::trackutils::prepare_attrib | ( | ) |
Support function for the DrawUgly series of functions.
Prepare the OpenGL attributes.
Definition at line 730 of file trackutils.h.
Line3f vcg::trackutils::ProjectLineOnPlane | ( | const Line3f & | ln, | |
const Plane3f & | pl | |||
) |
Project a line into a plane.
Given a line and a plane, returns the line projection on the plane.
The line returned is not normalized.
ln | the line. | |
pl | the plane. |
Definition at line 510 of file trackutils.h.
std::pair< float, bool > vcg::trackutils::RayLineDistance | ( | const Ray3f & | R, | |
const Line3f & | Q, | |||
Point3f & | R_s, | |||
Point3f & | Q_t | |||
) |
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.
R | the ray. | |
Q | the line. | |
R_s | the point on R closest to Q. | |
Q_t | the point on Q closest to R. |
Definition at line 367 of file trackutils.h.
std::pair< float, bool > vcg::trackutils::SegmentSegmentDistance | ( | const Segment3f & | R, | |
const Segment3f & | Q, | |||
Point3f & | R_s, | |||
Point3f & | Q_t | |||
) |
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.
R | the first segment. | |
Q | the second segment. | |
R_s | the point on R closest to Q. | |
Q_t | the point on Q closest to R. |
Definition at line 406 of file trackutils.h.
float vcg::trackutils::signedDistance | ( | Line3f | line, | |
Point3f | pt, | |||
Point3f | positive_dir | |||
) |
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.
line | the line. | |
pt | the point. | |
positive_dir | the positivity direction. |
Definition at line 530 of file trackutils.h.
the drawing hint used by the manipulators
Definition at line 633 of file trackutils.h.