Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SbSphere Class Reference

The SbSphere class is a representation of a sphere. More...

#include <Inventor/SbSphere.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 SbVec3fgetCenter (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() [1/2]

SbSphere::SbSphere ( void  )

The default constructor does nothing. The center point and the radius will be uninitialized.

◆ SbSphere() [2/2]

SbSphere::SbSphere ( const SbVec3f centerarg,
const float  radiusarg 
)

Construct an SbSphere instance with the given center point and radius.

Member Function Documentation

◆ setValue()

void SbSphere::setValue ( const SbVec3f centerarg,
const float  radiusarg 
)

Set the sphere's center point and radius.

See also
getCenter(), getRadius().

◆ setCenter()

void SbSphere::setCenter ( const SbVec3f centerarg)

Set the sphere's center point.

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

◆ setRadius()

void SbSphere::setRadius ( const float  radiusarg)

Set the sphere's radius.

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

◆ getCenter()

const SbVec3f & SbSphere::getCenter ( void  ) const

Returns an SbVec3f with the sphere's center point.

See also
setCenter(), getRadius().

◆ getRadius()

float SbSphere::getRadius ( void  ) const

Returns the sphere's radius.

See also
setRadius(), getCenter().

◆ circumscribe()

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.

◆ intersect() [1/2]

SbBool SbSphere::intersect ( const SbLine l,
SbVec3f intersection 
) const

Finds the intersection enter point for the given line l on the sphere.

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

◆ intersect() [2/2]

SbBool SbSphere::intersect ( const SbLine l,
SbVec3f enter,
SbVec3f exit 
) const

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

◆ pointInside()

SbBool SbSphere::pointInside ( const SbVec3f p) const

Returns TRUE of the given point p lies within the sphere.

◆ print()

void SbSphere::print ( FILE *  fp) const

Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile.


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