Physsim::Sphere Class Reference

Represents a sphere primitive for inertia properties, collision detection, and visualization. More...

#include <Sphere.h>

Inheritance diagram for Physsim::Sphere:

Physsim::Primitive Physsim::Base List of all members.

Public Member Functions

 Sphere ()
 Creates a sphere with radius 1.0 and recursion level level of 3.
 Sphere (Real radius)
 Creates a sphere with the specified radius and recursion level level of 3.
 Sphere (const Matrix4 &T)
 Creates a sphere with radius 1.0 and recursion level level of 3 at the given transform.
 Sphere (Real radius, unsigned recursion_level)
 Sphere (Real radius, const Matrix4 &T)
 Creates a sphere with the specified radius and transform.
 Sphere (Real radius, unsigned recursion_level, const Matrix4 &T)
 Creates a sphere with the specified radius, transform, and recursion level.
virtual Real calc_mass ()
 Gets the mass for this sphere (computing it if necessary).
virtual Matrix3 calc_inertia ()
 Gets the inertia matrix for this sphere, with the current transform applied.
void set_radius (Real radius)
 Sets the radius for this sphere (forces redetermination of the mesh).
void set_recursion_level (unsigned level)
 Sets the recursion level for this sphere's mesh.
virtual void load_from_xml (XMLTreeConstPtr node, std::map< std::string, BasePtr > &id_map)
 Implements Base::load_from_xml() for serialization.
virtual void save_to_xml (XMLTreePtr node, std::list< BaseConstPtr > &shared_objects) const
 Implements Base::save_to_xml() for serialization.
virtual SoNode * create_visualization ()
 Creates the visualization for this primitive.
Real get_radius () const
 Gets the radius for this sphere.
unsigned get_recursion_level () const
 Gets the recursion level for the sphere for visualization / collision checking.
virtual Vector3 calc_com ()
 Calculates the center-of-mass for this cylinder.

Detailed Description

Represents a sphere primitive for inertia properties, collision detection, and visualization.


Constructor & Destructor Documentation

Sphere::Sphere ( Real  radius,
const Matrix4 T 
)

Creates a sphere with the specified radius and transform.

The recursion level level is set to 3.


Member Function Documentation

void Sphere::set_recursion_level ( unsigned  max_recursion  ) 

Sets the recursion level for this sphere's mesh.

Note:
forces redetermination of the mesh

unsigned Physsim::Sphere::get_recursion_level (  )  const [inline]

Gets the recursion level for the sphere for visualization / collision checking.

Higher recursion levels result in better approximations to a true sphere, but increase the number of triangles used in the resulting mesh by a factor of four for each level increase.


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:23 2007 for Physsim by  doxygen 1.5.1