SbPlane.3coin2

Langue: en

Version: 382052 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

SbPlane -

The SbPlane class represents a plane in 3D space.

SbPlane is used by many other classes in Coin. It provides a way of representing a plane, specified by a plane normal vector and a distance from the origin of the coordinate system.

SYNOPSIS


#include <Inventor/SbLinear.h>

Public Member Functions


SbPlane (void)

SbPlane (const SbVec3f &normal, const float D)

SbPlane (const SbVec3f &p0, const SbVec3f &p1, const SbVec3f &p2)

SbPlane (const SbVec3f &normal, const SbVec3f &point)

void offset (const float d)

SbBool intersect (const SbLine &l, SbVec3f &intersection) const

void transform (const SbMatrix &matrix)

SbBool isInHalfSpace (const SbVec3f &point) const

float getDistance (const SbVec3f &point) const

const SbVec3f & getNormal (void) const

float getDistanceFromOrigin (void) const

void print (FILE *file) const

SbBool intersect (const SbPlane &pl, SbLine &line)

Friends


int operator== (const SbPlane &p1, const SbPlane &p2)

int operator!= (const SbPlane &p1, const SbPlane &p2)

Detailed Description

The SbPlane class represents a plane in 3D space.

SbPlane is used by many other classes in Coin. It provides a way of representing a plane, specified by a plane normal vector and a distance from the origin of the coordinate system.

Constructor & Destructor Documentation

SbPlane::SbPlane (void)An SbPlane instantiated with the default constructor will be uninitialized.

SbPlane::SbPlane (const SbVec3f & normalref, const float D)Construct an SbPlane instance with a normal pointing in the given direction and the given shortest distance from the origin of the coordinate system to a point in the plane.

normal must not be a null vector.

References SbVec3f::normalize(), SoDebugError::postWarning(), and SbVec3f::sqrLength().

SbPlane::SbPlane (const SbVec3f & p0, const SbVec3f & p1, const SbVec3f & p2)Construct an SbPlane with three points laying in the plane. Make sure p0, p1 and p2 are actually three distinct points, not on a line, when using this constructor.

References SbVec3f::dot(), SbVec3f::normalize(), SoDebugError::postWarning(), and SbVec3f::sqrLength().

SbPlane::SbPlane (const SbVec3f & normalref, const SbVec3f & point)Construct an SbPlane from a normal and a point laying in the plane.

normal must not be a null vector.

References SbVec3f::dot(), SbVec3f::normalize(), SoDebugError::postWarning(), and SbVec3f::sqrLength().

Member Function Documentation

void SbPlane::offset (const float d)Add the given offset d to the plane distance from the origin.

SbBool SbPlane::intersect (const SbLine & l, SbVec3f & intersection) constFind the point on given line l intersecting the plane and return it in intersection. If the line is parallel to the plane, we return FALSE, otherwise TRUE.

Do not pass an invalid line for the l parameter (i.e. with a null direction vector).

References SbVec3f::dot(), SbLine::getDirection(), SbLine::getPosition(), SoDebugError::postWarning(), and SbVec3f::sqrLength().

Referenced by SoRotateDiscDragger::drag(), SbSphereSheetProjector::project(), SbSphereSectionProjector::project(), SbSpherePlaneProjector::project(), SbPlaneProjector::project(), SbLineProjector::project(), SbCylinderSheetProjector::project(), SbCylinderSectionProjector::project(), and SbCylinderPlaneProjector::project().

void SbPlane::transform (const SbMatrix & matrix)Transform the plane by matrix.

See also:

offset()

References SbVec3f::dot(), SbMatrix::inverse(), SbMatrix::multDirMatrix(), SbMatrix::multVecMatrix(), SbVec3f::normalize(), SoDebugError::postWarning(), and SbMatrix::transpose().

Referenced by SoClipPlane::GLRender(), SbPlaneProjector::project(), and SoClipPlaneManip::valueChangedCB().

SbBool SbPlane::isInHalfSpace (const SbVec3f & point) constCheck if the given point lies in the halfspace of the plane which the plane normal vector is pointing.

References getDistance().

Referenced by SbCylinderSectionProjector::isWithinTolerance(), SbViewVolume::outsideTest(), and SbProjector::verifyProjection().

float SbPlane::getDistance (const SbVec3f & point) constReturn the distance from point to plane. Positive distance means the point is in the plane's half space.

This method is an extension specific to Coin versus the original SGI Inventor API.

References SbVec3f::dot().

Referenced by SbClip::clip(), SoClipPlaneManip::fieldSensorCB(), isInHalfSpace(), and SbPlaneProjector::project().

const SbVec3f & SbPlane::getNormal (void) constReturn the plane's normal vector, which indicates which direction the plane is oriented.

See also:

getDistanceFromOrigin().

Referenced by SbClip::clip(), SoClipPlaneManip::fieldSensorCB(), print(), SbPlaneProjector::project(), SbVec3f::SbVec3f(), SbPlaneProjector::setupPlane(), and SoClipPlaneManip::valueChangedCB().

float SbPlane::getDistanceFromOrigin (void) constReturn distance from origin of coordinate system to the point in the plane which is closest to the origin.

See also:

getNormal().

Referenced by print(), SbVec3f::SbVec3f(), and SbPlaneProjector::setupPlane().

void SbPlane::print (FILE * fp) constDump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized build.

References getDistanceFromOrigin(), getNormal(), and SbVec3f::print().

SbBool SbPlane::intersect (const SbPlane & pl, SbLine & line)Intersect this plane with pl, and return the resulting line in line. Returns TRUE if an intersection line can be found, and FALSE if the planes are parallel.

Please note that the resulting SbLine must be considered as a line intersecting the SbLine's origin, extending infinitely in both directions.

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since:

Coin 2.0

References SbVec3f::cross().

Author

Generated automatically by Doxygen for Coin from the source code.