Base class for coordinate projection classes. More...
#include <Inventor/projection/SbProjection.h>
Public Member Functions | |
SbProjection () | |
SbProjection (SoProjection *node) | |
SbProjection (const SbProjection &proj) | |
virtual | ~SbProjection () |
virtual void | init () |
virtual void | exit () |
virtual void | inverse (SbVec3f &point) |
virtual bool | getProjectedBoundingBox (SbBox3f &bbox) |
void | project (SbVec3f &point) |
void | project (int numPoints, float *points) |
void | project (int32_t numCoords, const SbVec3f *coords, SbVec3f *projectedCoords) |
SoProjection * | getProjectionNode () const |
virtual void | setParameter (int parameterId, const SbString ¶meterString) |
virtual void | setParameter (int parameterId, const float ¶meterFloat) |
void | setNumStringParameters (int numParameters) |
void | setNumFloatParameters (int numParameters) |
int | getNumStringParameters () const |
int | getNumFloatParameters () const |
SbBool | getParameter (int pos, SbString ¶meter) const |
SbBool | getParameter (int pos, float ¶meter) const |
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
SbProjection::SbProjection | ( | ) |
Constructor.
SbProjection::SbProjection | ( | SoProjection * | node | ) |
Constructor.
SbProjection::SbProjection | ( | const SbProjection & | proj | ) |
Copy constructor.
virtual SbProjection::~SbProjection | ( | ) | [virtual] |
Destructor.
virtual void SbProjection::exit | ( | ) | [inline, virtual] |
Exit method.
Reimplemented in SbProj4Projection.
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.
bool SbProjection::getProjectedBoundingBox | ( | SbBox3f & | bbox | ) | [inline, virtual] |
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.
SoProjection* SbProjection::getProjectionNode | ( | ) | const [inline] |
Return associated projection node.
virtual void SbProjection::init | ( | ) | [inline, virtual] |
Initialisation method.
Reimplemented in SbProj4Projection.
void SbProjection::inverse | ( | SbVec3f & | point | ) | [inline, virtual] |
Apply the inverse coordinate to one point.
Modifies the given object.
Reimplemented in SbCylindricalProjection, SbProj4Projection, and SbSphericalProjection.
Apply the complete computation to a set of coordinates.
void SbProjection::project | ( | int | numPoints, | |
float * | points | |||
) |
Apply the complete computation to a set of points.
Modifies the given objects.
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 void SbProjection::setParameter | ( | int | parameterId, | |
const float & | parameterFloat | |||
) | [virtual] |
Set float parameter.
virtual void SbProjection::setParameter | ( | int | parameterId, | |
const SbString & | parameterString | |||
) | [virtual] |
Set string parameter.