Base class for coordinate projection classes. More...
#include <Inventor/projection/SbProjection.h>
Public Member Functions | |
SbProjection () | |
Constructor. | |
SbProjection (SoProjection *node) | |
Constructor. | |
SbProjection (const SbProjection &proj) | |
Copy constructor. | |
virtual | ~SbProjection () |
Destructor. | |
virtual void | init () |
Initialisation method. | |
virtual void | exit () |
Exit method. | |
virtual void | inverse (SbVec3f &point) |
Apply the inverse coordinate to one point. | |
virtual bool | getProjectedBoundingBox (SbBox3f &bbox) |
Return projected bounding box if available. | |
void | project (SbVec3f &point) |
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point. | |
void | project (int numPoints, float *points) |
Apply the complete computation to a set of points. | |
void | project (int32_t numCoords, const SbVec3f *coords, SbVec3f *projectedCoords) |
Apply the complete computation to a set of coordinates. | |
SoProjection * | getProjectionNode () const |
Return associated projection node. | |
virtual void | setParameter (int parameterId, const SbString ¶meterString) |
Set string parameter. | |
virtual void | setParameter (int parameterId, const float ¶meterFloat) |
Set float parameter. | |
void | setNumStringParameters (int numParameters) |
Set number of string parameters to use. | |
void | setNumFloatParameters (int numParameters) |
Set number of float parameters to use. | |
int | getNumStringParameters () const |
Get number of used string parameters. | |
int | getNumFloatParameters () const |
Get number of used float parameters. | |
SbBool | getParameter (int pos, SbString ¶meter) const |
Get string parameter at position pos. | |
SbBool | getParameter (int pos, float ¶meter) const |
Get float parameter at position pos. | |
Base class for coordinate projection classes.
This is the base class for classes that define a coordinate projection. The projection of a point P consists of computing a point P' and replacing internally the coordinates of P with the coordinates of P'. Projections can modify points in complex ways that are not possible with a transformation matrix. For example, projections allow the use of spherical coordinates, geospatial coordinates and others. An SoProjection node applies a coordinate projection to geometry nodes. A valid instance of a SbProjection class is needed by an SoProjection node put in a scene graph.
To create a new projection class, implement a class inheriting from SbProjection. The only mandatory method to define a projection is the apply() method. To obtain the result of a projected point, call the project() method, which internally computes the result and calls apply(). You can also define the inverse() method, which is only used for applications that must compute the inverse of a projected point.
The applyPreProjection() method can be defined and will be called just before a point is projected. The applyPostProjection() method can be defined and will be called just after a point has been projected.
A projection class stores a list of string parameters and a list of float parameters. You can set or inquire a parameter using setParameter() or getParameter()
The projection routine can get parameter values from the fields of the associated SoProjection node (if any). The parameters for a projection should be stored in the SoProjection node, as it is the only entry in the scene graph. The SoProjection::floatParameters field stores the float values that are synchronized with the float parameters of the projection class. The SoProjection::parameters field stores the string values that are synchronized with the string parameters of the projection class.
The init() method is called each time a parameter of the associated SoProjection node is modified. The exit() method is called at the SbProjection instance destruction.
If using the VolumeViz extension, defining the getProjectedBoundingBox() method will improve the rendering speed (see getProjectedBoundingBox comments).
SbProj4Projection, SbSphericalProjection, SoProjection, SoGeoProjection, SbProjectionCoordinates
Definition at line 96 of file SbProjection.h.
SbProjection::SbProjection | ( | ) |
Constructor.
SbProjection::SbProjection | ( | SoProjection * | node | ) |
Constructor.
SbProjection::SbProjection | ( | const SbProjection & | proj | ) |
Copy constructor.
|
virtual |
Destructor.
|
inlinevirtual |
int SbProjection::getNumFloatParameters | ( | ) | const |
Get number of used float parameters.
int SbProjection::getNumStringParameters | ( | ) | const |
Get number of used string parameters.
SbBool SbProjection::getParameter | ( | int | pos, |
float & | parameter | ||
) | const |
Get float parameter at position pos.
Get string parameter at position pos.
|
inlinevirtual |
Return projected bounding box if available.
Note: Projecting a bounding box is most of the time not equivalent to the result of a bounding box that contains all projected point.
It depends on the projection, and it is why by default it returns false, and should be redefined by the specific inherited projection class if it make sense.
Reimplemented in SbCylindricalProjection, SbSphericalProjection, and SbTransformProjection.
Definition at line 302 of file SbProjection.h.
|
inline |
Return associated projection node.
Definition at line 170 of file SbProjection.h.
|
inlinevirtual |
Initialisation method.
Reimplemented in SbProj4Projection.
Definition at line 124 of file SbProjection.h.
|
inlinevirtual |
Apply the inverse coordinate to one point.
Modifies the given object.
Reimplemented in SbCylindricalProjection, SbProj4Projection, and SbSphericalProjection.
Definition at line 293 of file SbProjection.h.
void SbProjection::project | ( | int | numPoints, |
float * | points | ||
) |
Apply the complete computation to a set of points.
Modifies the given objects.
Apply the complete computation to a set of coordinates.
void SbProjection::project | ( | SbVec3f & | point | ) |
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.
Modifies the given object.
void SbProjection::setNumFloatParameters | ( | int | numParameters | ) |
Set number of float parameters to use.
void SbProjection::setNumStringParameters | ( | int | numParameters | ) |
Set number of string parameters to use.
|
virtual |
Set float parameter.
|
virtual |
Set string parameter.