SbSphere.3coin2

Langue: en

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

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

SbSphere -

The SbSphere class is a representation of a sphere.

This class is used within many other classes in Coin. It contains the data neccessary to represent a sphere (a 3D point and a radius).

SYNOPSIS


#include <Inventor/SbLinear.h>

Public Member Functions


SbSphere (void)

SbSphere (const SbVec3f &center, const float radius)

void setValue (const SbVec3f &center, const float radius)

void setCenter (const SbVec3f &center)

void setRadius (const float radius)

const SbVec3f & getCenter (void) const

float getRadius (void) const

void circumscribe (const SbBox3f &box)

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

SbBool intersect (const SbLine &l, SbVec3f &enter, SbVec3f &exit) const

SbBool pointInside (const SbVec3f &p) const

void print (FILE *file) const

Detailed Description

The SbSphere class is a representation of a sphere.

This class is used within many other classes in Coin. It contains the data neccessary to represent a sphere (a 3D point and a radius).

See also:

SbCylinder

Constructor & Destructor Documentation

SbSphere::SbSphere (void)The default constructor does nothing. The center point and the radius will be uninitialized.

SbSphere::SbSphere (const SbVec3f & centerarg, const float radiusarg)Construct an SbSphere instance with the given center point and radius.

References SoDebugError::postWarning(), and setValue().

Member Function Documentation

void SbSphere::setValue (const SbVec3f & centerarg, const float radiusarg)Set the sphere's center point and radius.

See also:

getCenter(), getRadius().

References SoDebugError::postWarning(), setCenter(), and setRadius().

Referenced by SbSphere().

void SbSphere::setCenter (const SbVec3f & centerarg)Set the sphere's center point.

See also:

setValue(), setRadius() and getCenter().

Referenced by circumscribe(), and setValue().

void SbSphere::setRadius (const float radiusarg)Set the sphere's radius.

See also:

setValue(), setCenter() and getRadius().

References SoDebugError::postWarning().

Referenced by circumscribe(), SbBSPTree::findClosest(), and setValue().

const SbVec3f & SbSphere::getCenter (void) constReturns an SbVec3f with the sphere's center point.

See also:

setCenter(), getRadius().

Referenced by SbBSPTree::findClosest(), SbSphereSectionProjector::getRotation(), SbSpherePlaneProjector::getRotation(), intersect(), SbSphereProjector::isPointInFront(), print(), SbSphereSectionProjector::project(), SbSphereSheetProjector::setupPlane(), and SbSphereSectionProjector::setupTolerance().

float SbSphere::getRadius (void) constReturns the sphere's radius.

See also:

setRadius(), getCenter().

Referenced by SbSpherePlaneProjector::getRotation(), intersect(), print(), SbSphereSheetProjector::project(), SbSphereSectionProjector::setupTolerance(), SoPerspectiveCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoFrustumCamera::viewBoundingBox().

void SbSphere::circumscribe (const SbBox3f & box)Make the sphere exactly contain box, i.e. the sphere center point will be the same as that of the box, and the radius will be the distance from the box center point to any of the corners.

References SbBox3f::getCenter(), SbBox3f::getSize(), SbBox3f::isEmpty(), SoDebugError::postWarning(), setCenter(), and setRadius().

Referenced by SoPerspectiveCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoFrustumCamera::viewBoundingBox().

SbBool SbSphere::intersect (const SbLine & l, SbVec3f & intersection) constFinds the intersection enter point for the given line l on the sphere.

If the line does not intersect the sphere, FALSE is returned.

Referenced by SbSphereProjector::intersectSphereFront(), and SbSphereSectionProjector::project().

SbBool SbSphere::intersect (const SbLine & l, SbVec3f & enter, SbVec3f & exit) constFind the intersection points of the ray l on the sphere and return these in enter and exit. If the ray just 'grazes' the sphere, the enter and exit points have equal values.

If the ray does not intersect the sphere, FALSE is returned, otherwise we will return TRUE.

References SbVec3f::dot(), getCenter(), SbLine::getDirection(), SbLine::getPosition(), getRadius(), SbVec3f::length(), SbVec3f::normalize(), and SoDebugError::postWarning().

SbBool SbSphere::pointInside (const SbVec3f & p) constReturns TRUE of the given point p lies within the sphere.

void SbSphere::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 compile.

References getCenter(), getRadius(), and SbVec3f::print().

Author

Generated automatically by Doxygen for Coin from the source code.