Public Member Functions | Private Member Functions | Private Attributes
vcg::AreaMode Class Reference

The area constrained manipulator. More...

#include <trackmode.h>

Inheritance diagram for vcg::AreaMode:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void Apply (Trackball *trackball, Point3f new_point)
 Apply a translation, function of the user mouse drag action.
 AreaMode (const std::vector< Point3f > &pts)
 The constructor.
void Draw (Trackball *trackball)
 Render this manipulator.
bool isSticky ()
 The (non) avaibility to manipulator changes inside an action.
const char * Name ()
 Return this manipulator's name.
void Reset ()
 The reset function.
void SetAction ()
 The begin action function.
Point3f SetStartNear (Point3f p)
 Try to set the inital point.
void Undo ()
 The undo function.

Private Member Functions

void Init (const std::vector< Point3f > &pts)
 The data initializer.
bool Inside (Point3f point)
 Point in Polygon test.
Point3f Move (Point3f start, Point3f end)
 Try to move the object inside the polygon.

Private Attributes

bool begin_action
 True in time inteval between a call to SetAction () and a call to Apply()
Point3f delta_mouse
 The screen space differenve between the object and the cursor during an action.
int first_coord_kept
 One of the two dimensions used during the point in polygon test.
Point3f initial_status
 The initial status.
float min_side_length
 The length of the shortest border.
Point3f old_status
 The old status.
std::vector< Point3fpath
 Current action's object trace.
Plane3f plane
 The polygon plane.
std::vector< Point3fpoints
 The vertexes vector.
Point3f rubberband_handle
 The rubberband handle (current destination in Move())
int second_coord_kept
 One of the two dimensions used during the point in polygon test.
Point3f status
 The current status.
bool undo_begin_action
 begin_action after an Undo() call.
Point3f undo_delta_mouse
 delta_mouse after an Undo() call.
Point3f undo_old_status
 old_status after an Undo() call.
size_t undo_path_index
 path endpoint after an Undo() call.
Point3f undo_rubberband_handle
 rubberband_handle after an Undo() call.
Point3f undo_status
 status after an Undo() call.

Detailed Description

The area constrained manipulator.

This manipulator moves the object inside a poligonal area.

The user can drag the object inside a planar area, defined by a polygon. The polygon can be non convex, and is specified with a vector of vertexes.

If the object's trajectory intersects some poligon side, it tries to slide around it, in a "rubber band flavoured" way.

The object is assumed to initially be on the same position of the first vertex.

This is a stateful manipulator, result of the Apply function is determined by the objects's position inside the area and by the mouse coordinates.

Definition at line 861 of file trackmode.h.


Constructor & Destructor Documentation

vcg::AreaMode::AreaMode ( const std::vector< Point3f > &  pts) [inline]

The constructor.

From the given vector, is calculated the plane of the polygon, then every point in the vector is projected on this plane.

The vector passed to build the polygon is copied locally.

Warning:
The vector is assumed to be formed of non collinear points.
The polygon is not assumed to have 0-length sides, so please do not add a copy of the first point on the end of the vector.
Parameters:
ptsthe vertexes vector.

Definition at line 876 of file trackmode.h.


Member Function Documentation

void AreaMode::Apply ( Trackball trackball,
Point3f  new_point 
) [virtual]

Apply a translation, function of the user mouse drag action.

The manipulated object is moved inside the poligon. This function implements an algorithm that makes the object try to slide around the polygon borders.

Parameters:
trackballthe manipulator manager.
new_pointthe new mouse pointer coordinate.

Reimplemented from vcg::TrackMode.

Definition at line 520 of file trackmode.cpp.

void AreaMode::Draw ( Trackball trackball) [virtual]

Render this manipulator.

Parameters:
trackballthe manipulator manager.

Reimplemented from vcg::TrackMode.

Definition at line 680 of file trackmode.cpp.

void AreaMode::Init ( const std::vector< Point3f > &  pts) [private]

The data initializer.

Initialize the internal state and checks params validity.

Parameters:
ptsThe polygon vertexes.

Definition at line 466 of file trackmode.cpp.

bool AreaMode::Inside ( Point3f  point) [private]

Point in Polygon test.

Checks if a given point relies inside the poligon area, using the ray tracing algorithm, linear in the number of vertexes.

Parameters:
pointThe point to test.
Returns:
true if the point is inside the polygon, false otherwise.

Definition at line 619 of file trackmode.cpp.

bool AreaMode::isSticky ( ) [virtual]

The (non) avaibility to manipulator changes inside an action.

This manipulator has an internal state and does not allow a switch in the middle of a function.

Returns:
The costant boolean true.

Reimplemented from vcg::TrackMode.

Definition at line 666 of file trackmode.cpp.

Point3f AreaMode::Move ( Point3f  start,
Point3f  end 
) [private]

Try to move the object inside the polygon.

Given a point inside the area and a destination in the poligon plane, try to move the point toward the destination, sliding on any evenual border of the polygon. The object can be imagined tied with a rubber attached to destination, so it won't go back from it to slide around a border.

The algorithm is quadratic in the number of vertexes (worst case, really really unlikely).

Parameters:
startthe starting point assumed inside.
endthe destination assumed in the plane.
Returns:
the final move vector.

Definition at line 555 of file trackmode.cpp.

const char* vcg::AreaMode::Name ( ) [inline, virtual]

Return this manipulator's name.

Returns:
the constant string "AreaMode"

Reimplemented from vcg::TrackMode.

Definition at line 886 of file trackmode.h.

void AreaMode::Reset ( ) [virtual]

The reset function.

This function reset the object position to the initial point.

Reimplemented from vcg::TrackMode.

Definition at line 514 of file trackmode.cpp.

void AreaMode::SetAction ( ) [virtual]

The begin action function.

This function is to be called at the begin of an user action.

Reimplemented from vcg::TrackMode.

Definition at line 545 of file trackmode.cpp.

Try to set the inital point.

This function try to set the starting point in the point passed as parameter, if the point passed does not reside in the area, the start is put in the closest point on it.

Parameters:
pthe point wished for the start.
Returns:
the starting point in the area.

Definition at line 640 of file trackmode.cpp.

void AreaMode::Undo ( ) [virtual]

The undo function.

This function recreates the state present before the last Apply() call.

Reimplemented from vcg::TrackMode.

Definition at line 670 of file trackmode.cpp.


Member Data Documentation

True in time inteval between a call to SetAction () and a call to Apply()

Definition at line 985 of file trackmode.h.

The screen space differenve between the object and the cursor during an action.

Definition at line 995 of file trackmode.h.

One of the two dimensions used during the point in polygon test.

Definition at line 987 of file trackmode.h.

The initial status.

Definition at line 999 of file trackmode.h.

The length of the shortest border.

Definition at line 991 of file trackmode.h.

The old status.

Definition at line 997 of file trackmode.h.

std::vector< Point3f > vcg::AreaMode::path [private]

Current action's object trace.

Definition at line 1005 of file trackmode.h.

The polygon plane.

Definition at line 1001 of file trackmode.h.

std::vector< Point3f > vcg::AreaMode::points [private]

The vertexes vector.

Definition at line 983 of file trackmode.h.

The rubberband handle (current destination in Move())

Definition at line 1003 of file trackmode.h.

One of the two dimensions used during the point in polygon test.

Definition at line 989 of file trackmode.h.

The current status.

Definition at line 993 of file trackmode.h.

begin_action after an Undo() call.

Definition at line 1007 of file trackmode.h.

delta_mouse after an Undo() call.

Definition at line 1011 of file trackmode.h.

old_status after an Undo() call.

Definition at line 1013 of file trackmode.h.

path endpoint after an Undo() call.

Definition at line 1017 of file trackmode.h.

rubberband_handle after an Undo() call.

Definition at line 1015 of file trackmode.h.

status after an Undo() call.

Definition at line 1009 of file trackmode.h.


The documentation for this class was generated from the following files:


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:41:10