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. AnSoProjectionnode applies a coordinate projection to geometry nodes. A valid instance of aSbProjectionclass is needed by anSoProjectionnode 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
SoProjectionnode (if any). The parameters for a projection should be stored in theSoProjectionnode, as it is the only entry in the scene graph. TheSoProjection.floatParametersfield stores the float values that are synchronized with the float parameters of the projection class. TheSoProjection.parametersfield 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 associatedSoProjectionnode is modified. Theexit()method is called at theSbProjectioninstance destruction.If using the VolumeViz extension, defining the
getProjectedBoundingBox()method will improve the rendering speed (seegetProjectedBoundingBoxcomments).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 voidexit()Exit method.floatgetFloatParameter(int pos)Get float parameter at position pos.intgetNumFloatParameters()Get number of used float parameters.intgetNumStringParameters()Get number of used string parameters.SbBox3fgetProjectedBoundingBox()Return projected bounding box if available.SoProjectiongetProjectionNode()Return associated projection node.java.lang.StringgetStringParameter(int pos)Get string parameter at position pos.voidinit()Initialisation method.SbVec3finverse()Apply the inverse coordinate to one point.SbVec3fproject()Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.voidsetNumFloatParameters(int numParameters)Set number of float parameters to use.voidsetNumStringParameters(int numParameters)Set number of string parameters to use.voidsetParameter(int parameterId, float parameterFloat)Set float parameter.voidsetParameter(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.
-
-