Class SoProjection

  • All Implemented Interfaces:
    SafeDisposable
    Direct Known Subclasses:
    SoGeoProjection, SoTransformProjection

    public class SoProjection
    extends SoNode
    Coordinate projection node. This property node defines a coordinate projection that will be applied to all subsequent shapes in the scene graph. Coordinate transform nodes like SoTransform can only apply transforms that can be expressed as a matrix. A coordinate projection can be any algorithm that takes a coordinate and returns a different coordinate. This is particularly useful for geospatial coordinate systems (see SoGeoProjection), but is also useful for using spherical, cylindrical and other coordinate systems directly.

    This node works together with projection classes derived from the SbProjection class. The projection classes implement the projection computations applied to 3D points. Applications can create new subclasses of SbProjection.

    To use a specific projection, call setProjection() with an instance of the SbProjection class. Each instance of SoProjection can also store a list of projections, each one associated with a unique id. This is convenient for switching between different geospatial projections. Changing the projTypeId value activates the projection registered with the corresponding id.

    The default projection is spherical coordinates (SbSphericalProjection).

    The projection classes will use the string parameters and float parameters in the fields parameters and floatParameters respectively. See the projection class documentation for relevant parameters.

    Normal vectors

    • If no normal vectors are given for the geometry (and normal vectors are needed), Open Inventor will automatically compute normal vectors using the projected vertices, i.e. the coordinates after projection has been applied. This is usually the desired result.
    • If normal vectors are specified for the geometry, they are not projected. Therefore normal vectors must be specified in post-projection (world) coordinates.

    LIMITATIONS

    File format/default:

    Projection {

      parameters ""
      matrix identity
      isOn true
      floatParameters 1
      projTypeId 0
    }

    Action behavior:

    Sets: SoCoordinateElement

    See Also:
    SbProjection, SbSphericalProjection, SoGeoProjection
    • Field Detail

      • isOn

        public final SoSFBool isOn
        If set to false, projection is inactive. Default is true.
      • matrix

        public final SoSFMatrix matrix
        Matrix that can be applied before projecting a point. Set to Identity by default
      • projTypeId

        public final SoSFInt32 projTypeId
        Current projection id. Default is zero.
      • floatParameters

        public final SoMFFloat floatParameters
        Float parameters stored for projections.
      • parameters

        public final SoMFString parameters
        String parameters stored for projections.
      • parametersIn

        public final SoMFString parametersIn
        String parameters stored for projections.
    • Constructor Detail

      • SoProjection

        public SoProjection()
        Constructor.
    • Method Detail

      • checkProjection

        public static SbVec3f[] checkProjection​(SoState state,
                                                SoNode node,
                                                SbVec3f[] coords)
        Apply projection to given coordinates. Store projected coordinates in current SoCoordinate3 element.
      • addProjection

        public java.lang.String addProjection​(SbProjection projection,
                                              int id)
        Add a projection with the given name and id to the list. The projection name is just for convenience. The projection id value should be greater than zero because the default spherical projection already uses this id. If multiple projections are assigned the same id, the first one added to the list will be used.
      • setProjection

        public void setProjection​(SbProjection projection)
        Set the current projection. The specified projection is used regardless of whether it is in the list. In this case the value of the projTypeId field is not used.
      • getProjection

        public SbProjection getProjection()
        Return current projection.