Class SoProjection
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SoGeoProjection
,SoTransformProjection
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
- Shapes
The following shapes are not supported bySoProjection
:- Text nodes (
SoAnnoText3
,SoAsciiText
,SoText2
,SoText3
) SoCylinder
,SoCube
,SoCone
- All classes inheriting from
SoAlgebraicShape
SoImage
- NURBS shapes
- All VolumeViz shapes except
SoVolumeRender
with some limitations (seeSoVolumeRender
doc for details)- Volume geometry nodes (e.g.
SoVolumeIndexedFaceSet
)
- Text nodes (
- Transform nodes
The projection mechanism is not compatible with transform and manipulator nodes. Using nodes derived fromSoTransformation
, for exampleSoTransform
orSoTabBoxManip
will give unexpected results. To apply a transformation matrix to projected shapes, set thematrix
field to the expected value. Shape vertices will be multiplied by the matrix before being projected. - Draggers
Because draggers are composed withSoTransformation
nodes, they can't be projected using anSoProjection
node. - Memory
Because shape coordinates must be duplicated, memory consumption will increase when using projections. - Picking
Projection is not applied when doing picking (SoRayPickAction
). Results may be incorrect.
File format/default:
Projection {
parameters | "" |
matrix | identity |
isOn | true |
floatParameters | 1 |
projTypeId | 0 |
Action behavior:
Sets: SoCoordinateElement
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SoMFFloat
Float parameters stored for projections.final SoSFBool
If set to false, projection is inactive.final SoSFMatrix
Matrix that can be applied before projecting a point.final SoMFString
String parameters stored for projections.final SoMFString
String parameters stored for projections.final SoSFInt32
Current projection id.Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProjection
(SbProjection projection, int id) Add a projection with the given name and id to the list.static SbVec3f[]
checkProjection
(SoState state, SoNode node, SbVec3f[] coords) Apply projection to given coordinates.Return current projection.void
setProjection
(SbProjection projection) Set the current projection.Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
isOn
If set to false, projection is inactive. Default is true. -
matrix
Matrix that can be applied before projecting a point. Set to Identity by default -
projTypeId
Current projection id. Default is zero. -
floatParameters
Float parameters stored for projections. -
parameters
String parameters stored for projections. -
parametersIn
String parameters stored for projections.
-
-
Constructor Details
-
SoProjection
public SoProjection()Constructor.
-
-
Method Details
-
checkProjection
Apply projection to given coordinates. Store projected coordinates in currentSoCoordinate3
element. -
addProjection
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
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
Return current projection.
-