Coin: SbPlaneProjector Class Reference

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SbPlaneProjector Class Reference
Projector Classes

The SbPlaneProjector class projects 2D points to 3D points in a plane. More...

`#include <Inventor/projectors/SbPlaneProjector.h>`

Inheritance diagram for SbPlaneProjector:

## Public Member Functions
| SbPlaneProjector (const SbBool orient=FALSE)
| SbPlaneProjector (const SbPlane &plane, const SbBool orient=FALSE)
virtual SbProjector * | copy (void) const
virtual SbVec3f | project (const SbVec2f &point)
virtual SbBool | tryProject (const SbVec2f &point, const float epsilon, SbVec3f &result)
void | setPlane (const SbPlane &plane)
const SbPlane & | getPlane (void) const
void | setOrientToEye (const SbBool orienttoeye)
SbBool | isOrientToEye (void) const
virtual SbVec3f | getVector (const SbVec2f &viewpos1, const SbVec2f &viewpos2)
virtual SbVec3f | getVector (const SbVec2f &viewpos)
void | setStartPosition (const SbVec2f &viewpos)
void | setStartPosition (const SbVec3f &point)
Public Member Functions inherited from SbProjector
virtual void | setViewVolume (const SbViewVolume &vol)
const SbViewVolume & | getViewVolume (void) const
virtual void | setWorkingSpace (const SbMatrix &space)
const SbMatrix & | getWorkingSpace (void) const

## Protected Member Functions
void | setupPlane (void)
Protected Member Functions inherited from SbProjector
| SbProjector (void)
virtual | ~SbProjector ()
SbLine | getWorkingLine (const SbVec2f &point) const
float | findVanishingDistance (void) const
SbBool | verifyProjection (const SbVec3f &projpt) const

## Protected Attributes
SbPlane | plane
SbPlane | nonOrientPlane
SbBool | orientToEye
SbBool | needSetup
SbVec3f | lastPoint
Protected Attributes inherited from SbProjector
SbViewVolume | viewVol
SbMatrix | worldToWorking
SbMatrix | workingToWorld

## Detailed Description

The SbPlaneProjector class projects 2D points to 3D points in a plane.

The 3D projection of the 2D coordinates is for this projector class constrained to lie inside a predefined 3D plane.

See also
  SbLineProjector

## Constructor & Destructor Documentation

## ◆ SbPlaneProjector() [1/2]

SbPlaneProjector::SbPlaneProjector | ( | const SbBool | orient = FALSE | ) |

Constructor. Sets up a projection plane parallel with the XY-plane in world coordinates.

## ◆ SbPlaneProjector() [2/2]

SbPlaneProjector::SbPlaneProjector | ( | const SbPlane & | plane,
|  | const SbBool | orient = FALSE )

Constructor taking an explicit projection plane definition.

## Member Function Documentation

## ◆ copy()

SbProjector * SbPlaneProjector::copy | ( | void |  | ) | const
| virtual

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 are 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.

Implements SbProjector.

## ◆ project()

SbVec3f SbPlaneProjector::project | ( | const SbVec2f & | point | ) |
| virtual

Projects 2D point into a 3D point within the current projection plane.

Implements SbProjector.

## ◆ tryProject()

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

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 from SbProjector.

## ◆ setPlane()

void SbPlaneProjector::setPlane | ( | const SbPlane & | planeref | ) |

Set a new projection plane.

## ◆ getPlane()

const SbPlane & SbPlaneProjector::getPlane | ( | void |  | ) | const

Returns the current projection plane.

## ◆ setOrientToEye()

void SbPlaneProjector::setOrientToEye | ( | const SbBool | orienttoeye | ) |

Sets whether or not the plane should always be oriented towards the "eye" of the viewer.

## ◆ isOrientToEye()

SbBool SbPlaneProjector::isOrientToEye | ( | void |  | ) | const

Returns the state of the plane orientation flag.

## ◆ getVector() [1/2]

SbVec3f SbPlaneProjector::getVector | ( | const SbVec2f & | viewpos1,
|  | const SbVec2f & | viewpos2 )
| virtual

Returns a vector between the projected 3D points of viewpos1 and viewpos2.

## ◆ getVector() [2/2]

SbVec3f SbPlaneProjector::getVector | ( | const SbVec2f & | viewpos | ) |
| virtual

Returns a vector between the last projected point and the projected 3D point of viewpos.

## ◆ setStartPosition() [1/2]

void SbPlaneProjector::setStartPosition | ( | const SbVec2f & | viewpos | ) |

Explicitly set position of initial projection, so we get correct values for later calls to getVector() etc.

## ◆ setStartPosition() [2/2]

void SbPlaneProjector::setStartPosition | ( | const SbVec3f & | point | ) |

Explicitly set position of initial projection, so we get correct values for later calls to getVector() etc.

## ◆ setupPlane()

void SbPlaneProjector::setupPlane | ( | void |  | ) |
| protected

Should be called whenever SbPlaneProjector::needSetup is `TRUE`. Will recalculate projection plane.

## Member Data Documentation

## ◆ plane

SbPlane SbPlaneProjector::plane
| protected

The projection plane.

## ◆ nonOrientPlane

SbPlane SbPlaneProjector::nonOrientPlane
| protected

The "original" plane which was set (as opposed to the recalculated projection plane according to the SbPlaneProjector::orientToEye setting).

## ◆ orientToEye

SbBool SbPlaneProjector::orientToEye
| protected

Which direction the plane is oriented.

## ◆ needSetup

SbBool SbPlaneProjector::needSetup
| protected

Set to `TRUE` whenever the plane needs to be recalculated according to the setting of the SbPlaneProjector::orientToEye flag.

## ◆ lastPoint

SbVec3f SbPlaneProjector::lastPoint
| protected

Stores the previously projected 3D point.

The documentation for this class was generated from the following files:

- SbPlaneProjector.h
- SbPlaneProjector.cpp