#include <clip.h>
Clip a scene with a plane. For instance, when visualizing a volume, clipping will reveal what is inside the volume
Use and manipulate a clip plane with:
Clip plane; plane.enable(); // ... draw ... // plane.display(); // optionnaly draw the plane plane.disable(); plane.rotateWithScreen(delta_mouse_x, delta_mouse_y); plane.slide(delta_mouse_y);
Note, there is currently a maximum of 6 available clip planes If using more clip planes, an Error will be thrown
Public Member Functions | |
Clip () | |
~Clip () | |
void | enable () |
void | disable () |
void | slide (float d) |
void | rotateWithWorld (float dx, float dy) |
void | rotateWithScreen (float dx, float dy) |
void | display (bool use_cross_section=true) const |
void | init () |
void | getPlaneMatrix (float m[]) const |
void | setPlaneMatrix (const float m[]) |
Classes | |
struct | PlaneManager |
transpose matrix |
Tools::Clip::Clip | ( | ) |
Tools::Clip::~Clip | ( | ) |
void Tools::Clip::enable | ( | ) |
enable clip plane when using this method while drawing every object drawn next will be clipped
void Tools::Clip::disable | ( | ) |
disable clip plane use this method after enable() while drawing
void Tools::Clip::slide | ( | float | d | ) |
slide plane
void Tools::Clip::rotateWithWorld | ( | float | dx, | |
float | dy | |||
) |
rotate the plane from its current orientation
dx | a rotation around the plane Y world axis | |
dy | a rotation around the plane X world axis |
void Tools::Clip::rotateWithScreen | ( | float | dx, | |
float | dy | |||
) |
rotate plane with mouse movement this method requires the currnet modelview matrix, it is assumed to be the same as when "enable()" was called
dx | a rotation around the screen Y axis (horizontal movement) | |
dy | a rotation around the screen X axis (vertical movement) |
void Tools::Clip::display | ( | bool | use_cross_section = true |
) | const |
display a plane close to the origin
use_cross_section | draw a cross section of a unit centered cube |
void Tools::Clip::init | ( | ) |
Use identity matrix for the clip plane, that is a plane normal to the Z axis
void Tools::Clip::getPlaneMatrix | ( | float | m[] | ) | const |
Get plane matrix
m | (out) plane matrix (4x4 rotation and translation) |
void Tools::Clip::setPlaneMatrix | ( | const float | m[] | ) |
Set modelview matrix