Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SbProjection Class Reference

Base class for coordinate projection classes. More...

#include <Inventor/projection/SbProjection.h>

+ Inheritance diagram for SbProjection:

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.
 
SoProjectiongetProjectionNode () const
 Return associated projection node.
 
virtual void setParameter (int parameterId, const SbString &parameterString)
 Set string parameter.
 
virtual void setParameter (int parameterId, const float &parameterFloat)
 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 &parameter) const
 Get string parameter at position pos.
 
SbBool getParameter (int pos, float &parameter) const
 Get float parameter at position pos.
 

Detailed Description

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).

SEE ALSO

SbProj4Projection, SbSphericalProjection, SoProjection, SoGeoProjection, SbProjectionCoordinates

Definition at line 96 of file SbProjection.h.

Constructor & Destructor Documentation

◆ SbProjection() [1/3]

SbProjection::SbProjection ( )

Constructor.

◆ SbProjection() [2/3]

SbProjection::SbProjection ( SoProjection node)

Constructor.

◆ SbProjection() [3/3]

SbProjection::SbProjection ( const SbProjection proj)

Copy constructor.

◆ ~SbProjection()

virtual SbProjection::~SbProjection ( )
virtual

Destructor.

Member Function Documentation

◆ exit()

virtual void SbProjection::exit ( )
inlinevirtual

Exit method.

Reimplemented in SbProj4Projection.

Definition at line 129 of file SbProjection.h.

◆ getNumFloatParameters()

int SbProjection::getNumFloatParameters ( ) const

Get number of used float parameters.

◆ getNumStringParameters()

int SbProjection::getNumStringParameters ( ) const

Get number of used string parameters.

◆ getParameter() [1/2]

SbBool SbProjection::getParameter ( int  pos,
float &  parameter 
) const

Get float parameter at position pos.

◆ getParameter() [2/2]

SbBool SbProjection::getParameter ( int  pos,
SbString parameter 
) const

Get string parameter at position pos.

◆ getProjectedBoundingBox()

bool SbProjection::getProjectedBoundingBox ( SbBox3f bbox)
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.

◆ getProjectionNode()

SoProjection * SbProjection::getProjectionNode ( ) const
inline

Return associated projection node.

Definition at line 170 of file SbProjection.h.

◆ init()

virtual void SbProjection::init ( )
inlinevirtual

Initialisation method.

Reimplemented in SbProj4Projection.

Definition at line 124 of file SbProjection.h.

◆ inverse()

void SbProjection::inverse ( SbVec3f point)
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.

◆ project() [1/3]

void SbProjection::project ( int  numPoints,
float *  points 
)

Apply the complete computation to a set of points.

Modifies the given objects.

◆ project() [2/3]

void SbProjection::project ( int32_t  numCoords,
const SbVec3f coords,
SbVec3f projectedCoords 
)

Apply the complete computation to a set of coordinates.

◆ project() [3/3]

void SbProjection::project ( SbVec3f point)

Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.

Modifies the given object.

◆ setNumFloatParameters()

void SbProjection::setNumFloatParameters ( int  numParameters)

Set number of float parameters to use.

◆ setNumStringParameters()

void SbProjection::setNumStringParameters ( int  numParameters)

Set number of string parameters to use.

◆ setParameter() [1/2]

virtual void SbProjection::setParameter ( int  parameterId,
const float &  parameterFloat 
)
virtual

Set float parameter.

◆ setParameter() [2/2]

virtual void SbProjection::setParameter ( int  parameterId,
const SbString parameterString 
)
virtual

Set string parameter.


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