Class SbProjection
- Direct Known Subclasses:
SbCylindricalProjection
,SbProj4Projection
,SbSphericalProjection
,SbTransformProjection
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SbProjection
(SoProjection node) Constructor.SbProjection
(SbProjection proj) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
exit()
Exit method.float
getFloatParameter
(int pos) Get float parameter at position pos.int
Get number of used float parameters.int
Get number of used string parameters.Return projected bounding box if available.Return associated projection node.getStringParameter
(int pos) Get string parameter at position pos.void
init()
Initialisation method.inverse()
Apply the inverse coordinate to one point.project()
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.void
setNumFloatParameters
(int numParameters) Set number of float parameters to use.void
setNumStringParameters
(int numParameters) Set number of string parameters to use.void
setParameter
(int parameterId, float parameterFloat) Set float parameter.void
setParameter
(int parameterId, String parameterString) Set string parameter.Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SbProjection
public SbProjection()Constructor. -
SbProjection
Constructor. -
SbProjection
Copy constructor.
-
-
Method Details
-
inverse
Apply the inverse coordinate to one point. Modifies the given object. -
exit
public void exit()Exit method. -
init
public void init()Initialisation method. -
getProjectedBoundingBox
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.
-
setNumFloatParameters
public void setNumFloatParameters(int numParameters) Set number of float parameters to use. -
getProjectionNode
Return associated projection node. -
setParameter
Set string parameter. -
setParameter
public void setParameter(int parameterId, float parameterFloat) Set float parameter. -
setNumStringParameters
public void setNumStringParameters(int numParameters) Set number of string parameters to use. -
getNumStringParameters
public int getNumStringParameters()Get number of used string parameters. -
project
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point. Modifies the given object. -
getFloatParameter
public float getFloatParameter(int pos) Get float parameter at position pos. -
getStringParameter
Get string parameter at position pos. -
getNumFloatParameters
public int getNumFloatParameters()Get number of used float parameters.
-