OpenSceneGraph  3.0.1
Public Types | Public Member Functions | Friends
osgSim::SphereSegment Class Reference

A SphereSegment is a Geode to represent an portion of a sphere (potentially the whole sphere). More...

Inheritance diagram for osgSim::SphereSegment:
Inheritance graph
[legend]

List of all members.

Public Types

enum  DrawMask {
  SURFACE = 0x00000001, SPOKES = 0x00000002, EDGELINE = 0x00000008, SIDES = 0x00000010,
  ALL = 0x7fffffff
}
 DrawMask represents a bit field, the values of which may be OR'ed together to specify which parts of the sphere segment should be drawn. More...
typedef std::vector
< osg::ref_ptr< osg::Vec3Array > > 
LineList
 A list of vertex arrays representing a list of lines.

Public Member Functions

 SphereSegment ()
 Default constructor.
 SphereSegment (const osg::Vec3 &centre, float radius, float azMin, float azMax, float elevMin, float elevMax, int density)
 Construct by angle ranges.
 SphereSegment (const osg::Vec3 &centre, float radius, const osg::Vec3 &vec, float azRange, float elevRange, int density)
 Construct by vector.
 SphereSegment (const SphereSegment &rhs, const osg::CopyOp &co)
 Copy constructor.
void setCentre (const osg::Vec3 &c)
 Set the centre point of the SphereSegment.
const osg::Vec3getCentre () const
 Get the centre point of the SphereSegment.
void setRadius (float r)
 Set the radius of the SphereSegment.
float getRadius () const
 Get the radius of the SphereSegment.
void setArea (const osg::Vec3 &vec, float azRange, float elevRange)
 Set the area of the sphere segment.
void getArea (osg::Vec3 &vec, float &azRange, float &elevRange) const
 Get the area of the sphere segment.
void setArea (float azMin, float azMax, float elevMin, float elevMax)
 Set the area of the sphere segment.
void getArea (float &azMin, float &azMax, float &elevMin, float &elevMax) const
 Get the area of the sphere segment.
void setDensity (int d)
 Set the density of the sphere segment.
int getDensity () const
 Get the density of the sphere segment.
void setDrawMask (int dm)
 Specify the DrawMask.
int getDrawMask () const
 Get the DrawMask.
void setSurfaceColor (const osg::Vec4 &c)
 Set the color of the surface.
const osg::Vec4getSurfaceColor () const
 Get the color of the surface.
void setSpokeColor (const osg::Vec4 &c)
 Set the color of the spokes.
const osg::Vec4getSpokeColor () const
 Get the color of the spokes.
void setEdgeLineColor (const osg::Vec4 &c)
 Set the color of the edge line.
const osg::Vec4getEdgeLineColor () const
 Get the color of the edge line.
void setSideColor (const osg::Vec4 &c)
 Set the color of the planes.
const osg::Vec4getSideColor () const
 Get the color of the planes.
void setAllColors (const osg::Vec4 &c)
 Set color of all components.
 META_Node (osgSim, SphereSegment)
LineList computeIntersection (const osg::Matrixd &matrix, osg::Node *subgraph)
 Compute the interesection lines between subgraph and this sphere segment.
LineList computeIntersection (const osg::Matrixd &matrix, osg::Drawable *drawable)
 Compute the interesection lines between specified drawable and this sphere segment.
osg::NodecomputeIntersectionSubgraph (const osg::Matrixd &matrix, osg::Node *subgraph)
 Compute the interesection lines between subgraph and this sphere segment.
osg::NodecomputeIntersectionSubgraph (const osg::Matrixd &matrix, osg::Drawable *drawable)
 Compute the interesection lines between specified drawable and this sphere segment.

Friends

class Surface
class EdgeLine
class Side
class Spoke

Detailed Description

A SphereSegment is a Geode to represent an portion of a sphere (potentially the whole sphere).

The sphere is aligned such that the line through the sphere's poles is parallel to the z axis. The sphere segment may be rendered various components switched on or off:

- The specified area of the sphere surface.

- An edge line around the boundary of the specified area
  of the sphere surface.

- Four <i>spokes</i>, where a spoke is the line from
  the sphere's centre to a corner of the rendered area.

- Four planar areas, where the planar areas are formed
  between the spokes.

Caveats:

- It's worth noting that the line through the sphere's poles is
  parallel to the z axis. This has implications when specifying the
  area to be rendered, and specifying areas where the centre of
  the rendered area <i>is</i> the Z axis may lead to unexpected
  geometry.

- It's possible to render the whole sphere by specifying elevation
  and azimuth ranges round the full 360 degrees. When doing
  so you may consider switching the planes, spokes, and edge lines
  off, to avoid rendering artefacts, e.g. the upper and lower
  planes will be coincident.

Member Typedef Documentation

A list of vertex arrays representing a list of lines.


Member Enumeration Documentation

DrawMask represents a bit field, the values of which may be OR'ed together to specify which parts of the sphere segment should be drawn.

E.g.

Enumerator:
SURFACE 

Draw the specified area on the sphere's surface.

SPOKES 

Draw the spokes from the sphere's centre to the surface's corners.

EDGELINE 

Draw the line round the edge of the area on the sphere's surface.

SIDES 

Draw the planes from the sphere's centre to the edge of the sphere's surface.

ALL 

Draw every part of the sphere segment.


Constructor & Destructor Documentation

Default constructor.

osgSim::SphereSegment::SphereSegment ( const osg::Vec3 centre,
float  radius,
float  azMin,
float  azMax,
float  elevMin,
float  elevMax,
int  density 
) [inline]

Construct by angle ranges.

Note that the azimuth 'zero' is the Y axis; specifying an azimuth range from azMin -osg::PI/2.0f to azMax osg::PI/2.0f will cover the 'top half' of the circle in the XY plane. The elev angles are 'out' of the 'zero' XY plane with +ve angles above the plane, and -ve angles below.

Parameters:
centresphere centre
radiusradius of sphere
azMinazimuth minimum
azMaxazimuth maximum
elevMinelevation minimum
elevMaxelevation maximum
densitynumber of units to divide the azimuth and elevation ranges into
osgSim::SphereSegment::SphereSegment ( const osg::Vec3 centre,
float  radius,
const osg::Vec3 vec,
float  azRange,
float  elevRange,
int  density 
)

Construct by vector.

Parameters:
centresphere centre
radiusradius of sphere
vecvector pointing from sphere centre to centre point of rendered area on sphere surface
azRangeazimuth range in radians (with centre along vec)
elevRangeelevation range in radians (with centre along vec)
densitynumber of units to divide the azimuth and elevation ranges into
osgSim::SphereSegment::SphereSegment ( const SphereSegment rhs,
const osg::CopyOp co 
) [inline]

Copy constructor.


Member Function Documentation

Compute the interesection lines between subgraph and this sphere segment.

The matrix is the transform that takes the subgraph into the same coordiante frame as the sphere segment. The resulting intersections are in the coordinate frame of the sphere segment.

Compute the interesection lines between specified drawable and this sphere segment.

The matrix is the transform that takes the subgraph into the same coordiante frame as the sphere segment. The resulting intersections are in the coordinate frame of the sphere segment.

Compute the interesection lines between subgraph and this sphere segment.

The matrix is the transform that takes the subgraph into the same coordiante frame as the sphere segment. The resulting intersections are in the coordinate frame of the sphere segment.

Compute the interesection lines between specified drawable and this sphere segment.

The matrix is the transform that takes the subgraph into the same coordiante frame as the sphere segment. The resulting intersections are in the coordinate frame of the sphere segment.

void osgSim::SphereSegment::getArea ( osg::Vec3 vec,
float &  azRange,
float &  elevRange 
) const

Get the area of the sphere segment.

Parameters:
vecvector pointing from sphere centre to centre point of rendered area on sphere surface (normalized)
azRangeazimuth range in radians (with centre along vec)
elevRangeelevation range in radians (with centre along vec)
void osgSim::SphereSegment::getArea ( float &  azMin,
float &  azMax,
float &  elevMin,
float &  elevMax 
) const

Get the area of the sphere segment.

Parameters:
azMinazimuth minimum
azMaxazimuth maximum
elevMinelevation minimum
elevMaxelevation maximum

Get the centre point of the SphereSegment.

Get the density of the sphere segment.

int osgSim::SphereSegment::getDrawMask ( ) const [inline]

Get the DrawMask.

Get the color of the edge line.

Get the radius of the SphereSegment.

Get the color of the planes.

Get the color of the spokes.

Get the color of the surface.

Set color of all components.

void osgSim::SphereSegment::setArea ( const osg::Vec3 vec,
float  azRange,
float  elevRange 
)

Set the area of the sphere segment.

Parameters:
vecvector pointing from sphere centre to centre point of rendered area on sphere surface
azRangeazimuth range in radians (with centre along vec)
elevRangeelevation range in radians (with centre along vec)
void osgSim::SphereSegment::setArea ( float  azMin,
float  azMax,
float  elevMin,
float  elevMax 
)

Set the area of the sphere segment.

Parameters:
azMinazimuth minimum
azMaxazimuth maximum
elevMinelevation minimum
elevMaxelevation maximum

Set the centre point of the SphereSegment.

Set the density of the sphere segment.

Specify the DrawMask.

Parameters:
dmBitmask specifying which parts of the sphere segment should be drawn.
See also:
DrawMask

Set the color of the edge line.

Set the radius of the SphereSegment.

Set the color of the planes.

Set the color of the spokes.

Set the color of the surface.


Friends And Related Function Documentation

friend class EdgeLine [friend]
friend class Side [friend]
friend class Spoke [friend]
friend class Surface [friend]

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

osg logo
Generated at Sun May 6 2012 20:07:53 for the OpenSceneGraph by doxygen 1.8.0.