Class SbProjection
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.projection.SbProjection
-
- Direct Known Subclasses:
SbCylindricalProjection
,SbProj4Projection
,SbSphericalProjection
,SbTransformProjection
public class SbProjection extends Inventor
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. AnSoProjection
node applies a coordinate projection to geometry nodes. A valid instance of aSbProjection
class is needed by anSoProjection
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 theproject()
method, which internally computes the result and calls apply(). You can also define theinverse()
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()
orgetParameter()
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 theSoProjection
node, as it is the only entry in the scene graph. TheSoProjection.floatParameters
field stores the float values that are synchronized with the float parameters of the projection class. TheSoProjection.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 associatedSoProjection
node is modified. Theexit()
method is called at theSbProjection
instance destruction.If using the VolumeViz extension, defining the
getProjectedBoundingBox()
method will improve the rendering speed (seegetProjectedBoundingBox
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
Constructors Constructor Description SbProjection()
Constructor.SbProjection(SoProjection node)
Constructor.SbProjection(SbProjection proj)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exit()
Exit method.float
getFloatParameter(int pos)
Get float parameter at position pos.int
getNumFloatParameters()
Get number of used float parameters.int
getNumStringParameters()
Get number of used string parameters.SbBox3f
getProjectedBoundingBox()
Return projected bounding box if available.SoProjection
getProjectionNode()
Return associated projection node.java.lang.String
getStringParameter(int pos)
Get string parameter at position pos.void
init()
Initialisation method.SbVec3f
inverse()
Apply the inverse coordinate to one point.SbVec3f
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, java.lang.String parameterString)
Set string parameter.-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SbProjection
public SbProjection()
Constructor.
-
SbProjection
public SbProjection(SoProjection node)
Constructor.
-
SbProjection
public SbProjection(SbProjection proj)
Copy constructor.
-
-
Method Detail
-
inverse
public SbVec3f 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
public SbBox3f 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
public SoProjection getProjectionNode()
Return associated projection node.
-
setParameter
public void setParameter(int parameterId, java.lang.String parameterString)
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
public SbVec3f 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
public java.lang.String getStringParameter(int pos)
Get string parameter at position pos.
-
getNumFloatParameters
public int getNumFloatParameters()
Get number of used float parameters.
-
-