SYNOPSIS

#include <Inventor/projectors/SbProjector.h>

Inherited by SbCylinderProjector, SbLineProjector, SbPlaneProjector, and SbSphereProjector.

Public Member Functions

virtual SbVec3f project (const SbVec2f &point)=0

virtual void setViewVolume (const SbViewVolume &vol)

const SbViewVolume & getViewVolume (void) const

virtual void setWorkingSpace (const SbMatrix &space)

const SbMatrix & getWorkingSpace (void) const

virtual SbProjector * copy (void) const =0

virtual SbBool tryProject (const SbVec2f &point, const float epsilon, SbVec3f &result)

Protected Member Functions

SbProjector (void)

virtual ~SbProjector ()

SbLine getWorkingLine (const SbVec2f &point) const

float findVanishingDistance (void) const

SbBool verifyProjection (const SbVec3f &projpt) const

Protected Attributes

SbViewVolume viewVol

SbMatrix worldToWorking

SbMatrix workingToWorld

Detailed Description

The SbProjector class is the abstract base projector class.

Projectors are used in the Coin library for mapping 2D coordinates (typically from the position of the mouse cursor in the rendering window) to 3D 'world' coordinates.

Mapping 2D coordinates to 3D coordinates is something which is done extensively in the dragger classes, to provide the user with a convenient and natural way of interacting with the 3D geometry of scenes.

For a usage example, see the class documentation for SbSphereSheetProjector.

The application programmer should normally not need to care about the projector classes, unless there are special needs in the application.

See also:

SoDragger

Constructor & Destructor Documentation

SbProjector::SbProjector (void)\fC [protected]\fP

The constructor initializes the workingspace matrix to an identity matrix.

SbProjector::~SbProjector ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

Destructor is protected, as this is an abstract class.

Member Function Documentation

\fBSbVec3f\fP SbProjector::project (const \fBSbVec2f\fP &point)\fC [pure virtual]\fP

Project the 2D point from normalized viewport coordinates to a 3D point. The mapping will be done in accordance with the type of the projector.

Implemented in SbCylinderSectionProjector, SbSphereSectionProjector, SbCylinderPlaneProjector, SbCylinderSheetProjector, SbSpherePlaneProjector, SbLineProjector, SbPlaneProjector, SbSphereSheetProjector, and SbCylinderProjector.

void SbProjector::setViewVolume (const \fBSbViewVolume\fP &vol)\fC [virtual]\fP

Set the viewing volume the projections will take place in.

See also:

getViewVolume()

const \fBSbViewVolume\fP & SbProjector::getViewVolume (void) const

Return the current viewing volume used by the projections.

See also:

setViewVolume()

void SbProjector::setWorkingSpace (const \fBSbMatrix\fP &space)\fC [virtual]\fP

Sets the matrix used for converting from the projector's coordinate system to the world coordinate system.

Reimplemented in SbSphereProjector, and SbCylinderProjector.

const \fBSbMatrix\fP & SbProjector::getWorkingSpace (void) const

Returns projector-to-world matrix.

See also:

setWorkingSpace()

\fBSbProjector\fP * SbProjector::copy (void) const\fC [pure virtual]\fP

Construct and return a copy of this projector. The caller is responsible for destructing the new instance.

Note that if the Coin library has been built as a DLL under Microsoft Windows and you use this method from application code, you must make sure that both the Coin DLL and the application executable is using the same instance of a C Run-Time (CRT) library. Otherwise, you will get memory heap corruption upon deallocating the returned instances, eventually leading to mysterious crashes.

Implemented in SbCylinderSectionProjector, SbSphereSectionProjector, SbCylinderPlaneProjector, SbCylinderSheetProjector, SbSpherePlaneProjector, SbLineProjector, SbPlaneProjector, and SbSphereSheetProjector.

SbBool SbProjector::tryProject (const \fBSbVec2f\fP &point, const floatepsilon, \fBSbVec3f\fP &result)\fC [virtual]\fP

Try projecting the 2D point from normalized viewport coordinates to a 3D point. The mapping will be done in accordance with the type of the projector.

If the projection can't be done safely (for instance when the projection plane or line is parallel to the view volume projection), this function should return FALSE.

Default implementation will call project() and always return TRUE, but subclasses can override this behavior to support safe projections.

Since:

Coin 3.0

Reimplemented in SbLineProjector, and SbPlaneProjector.

\fBSbLine\fP SbProjector::getWorkingLine (const \fBSbVec2f\fP &point) const\fC [protected]\fP

From the 2D point in normalized screenspace coordinates, calculate the line passing through the scene.

Typically used for tracking intersection points for the mouse cursor.

float SbProjector::findVanishingDistance (void) const\fC [protected]\fP

Finds the unit cube vanishing distance for the current projector view volume. The view volume must be a perspective view volume.

This method was not part of the Inventor v2.1 API, and is an extension specific to Coin.

Since:

Coin 1.1

SbBool SbProjector::verifyProjection (const \fBSbVec3f\fP &projpt) const\fC [protected]\fP

Verifies that projpt is a valid projection for the current view volume. For perspective view volumes, it does this by checking that the projection point is in front of the eye plane. For orthographic projections, this method always returns TRUE.

This method was not part of the Inventor v2.1 API, and is an extension specific to Coin.

Since:

Coin 1.1

Member Data Documentation

SbProjector::viewVol\fC [protected]\fP

The viewVol definition.

SbProjector::worldToWorking\fC [protected]\fP

The matrix which converts from world coordinates to coordinates in the projector's local coordinate system.

SbProjector::workingToWorld\fC [protected]\fP

The matrix which converts from coordinates in the projector's local coordinate system to world coordinates.

Author

Generated automatically by Doxygen for Coin from the source code.