H3D::Sphere Class Reference
[X3D node classes.]

The Sphere node specifies a sphere centred at (0, 0, 0) in the local coordinate system. More...

#include <H3D/Sphere.h>

Inheritance diagram for H3D::Sphere:

Inheritance graph

List of all members.

Classes

class  SFBound
 SFBound is specialized update itself from the radius field of the Sphere node. More...

Public Member Functions

 Sphere (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFFloat > _radius=0, Inst< SFBool > _solid=0)
 Constructor.
virtual int nrTriangles ()
 The number of triangles renderered in this geometry.
virtual void render ()
 Renders the Sphere with OpenGL.
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. Adds a HapticSphere if haptics is enabled.
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the sphere.
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on the sphere to point p.
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and this sphere.

Public Attributes

auto_ptr< SFFloatradius
 The radius of the Sphere in metres.
auto_ptr< SFBoolsolid
 Specifies if both sides of the Sphere should be rendered or only the outside.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.


Detailed Description

The Sphere node specifies a sphere centred at (0, 0, 0) in the local coordinate system.

The radius field specifies the radius of the sphere and shall be greater than zero. Figure 13.8 depicts the fields of the Sphere node.

When a texture is applied to a sphere, the texture covers the entire surface, wrapping counterclockwise from the back of the sphere (i.e., longitudinal arc intersecting the -Z-axis) when viewed from the top of the sphere. The texture has a seam at the back where the X=0 plane intersects the sphere and Z values are negative.

The solid field determines whether the sphere is visible when viewed from the inside. If solid is false both sides of the sphere will be rendered.

Internal routes:
Sphere.dot

Member Function Documentation

void Sphere::closestPoint ( const Vec3f &  p,
NodeIntersectResult &  result 
) [virtual]

Find closest point on the sphere to point p.

Parameters:
p The point to find the closest point to.
result A struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::X3DGeometryNode.

References IntersectionInfo::normal, IntersectionInfo::point, radius, and IntersectionInfo::tex_coord.

bool Sphere::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult &  result 
) [virtual]

Detect intersection between a line segment and the sphere.

Parameters:
from The start of the line segment.
to The end of the line segment.
result Contains info about the closest intersection for every object that intersects the line.
Returns:
true if intersected, false otherwise.

Reimplemented from H3D::X3DGeometryNode.

References radius.

bool Sphere::movingSphereIntersect ( H3DFloat  radius,
const Vec3f &  from,
const Vec3f &  to,
NodeIntersectResult &  result 
) [virtual]

Detect collision between a moving sphere and this sphere.

Parameters:
radius The radius of the sphere
from The start position of the sphere
to The end position of the sphere.
result A struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns:
true if intersected, false otherwise.

Reimplemented from H3D::X3DGeometryNode.

References radius.


Member Data Documentation

The radius of the Sphere in metres.

Access type: inputOutput
Default value: 1
Valid range: >0

Sphere_radius.dot

Referenced by closestPoint(), lineIntersect(), movingSphereIntersect(), render(), Sphere(), and traverseSG().

Specifies if both sides of the Sphere should be rendered or only the outside.

Both are rendered if false, outside only it true.

Access type: inputOutput
Default value: TRUE

Sphere_solid.dot

Referenced by Sphere(), and traverseSG().


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

Generated on Fri Nov 7 10:31:01 2008 for H3D API by  doxygen 1.5.7