v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3NodeSphericalBoundingVolume Class Reference

#import <CC3BoundingVolumes.h>

Inheritance diagram for CC3NodeSphericalBoundingVolume:
Inheritance graph
[legend]

Instance Methods

(BOOL) - doesIntersect:
 
(BOOL) - doesIntersectConvexHullOf:planes:from:
 
(BOOL) - doesIntersectLocation:
 
(BOOL) - doesIntersectRay:
 
(BOOL) - doesIntersectSphere:from:
 
(id) - initFromSphere:
 
(BOOL) - isInFrontOfPlane:
 
- Instance Methods inherited from CC3NodeBoundingVolume
(CCColorRef- displayNodeColor
 
(CCOpacity- displayNodeOpacity
 
(BOOL) - doesIntersectFrustum:
 
(CC3Vector- locationOfRayIntesection:
 
(void) - markTransformDirty
 
(void) - scaleBy:
 
- Instance Methods inherited from CC3BoundingVolume
(BOOL) - doesIntersectConvexHullOf:planes:
 
(BOOL) - doesIntersectSphere:
 
(NSString *) - fullDescription
 
(CC3Vector- globalLocationOfGlobalRayIntesection:
 
(void) - markDirty
 
(void) - populateFrom:
 

Class Methods

(id) + boundingVolumeFromSphere:
 

Properties

GLfloat globalRadius
 
CC3Sphere globalSphere
 
GLfloat radius
 
CC3Sphere sphere
 
- Properties inherited from CC3NodeBoundingVolume
CC3Vector centerOfGeometry
 
CC3Vector globalCenterOfGeometry
 
BOOL isTransformDirty
 
CC3Nodenode
 
BOOL shouldBuildFromMesh
 
BOOL shouldDraw
 
BOOL shouldMaximize
 
- Properties inherited from CC3BoundingVolume
BOOL isDirty
 
GLuint planeCount
 
CC3Planeplanes
 
BOOL shouldIgnoreRayIntersection
 
BOOL shouldLogIntersectionMisses
 
BOOL shouldLogIntersections
 
GLuint vertexCount
 
CC3Vectorvertices
 

Detailed Description

A bounding volume that forms a sphere around a single point.

When applied to a node, the center of the sphere is the node's center of geometry, and this class indicates that the node intersects another bounding volume if any part of the sphere intersects that bounding volume.

The radius of the sphere must cover the node, and is scaled automatically to match the globalScale of the node. For meshes, the center of geometry and local radius are calculated from the vertex locations. For other nodes, the center of gravity and radius can be set directly within the bounding volume via their respective properties.

Method Documentation

+ (id) boundingVolumeFromSphere: (CC3Sphere sphere

Allocates and initializes an autoreleased instance from the specified sphere, and sets the shouldBuildFromMesh property to NO.

The sphere dimensions are specified in the coordinate system of the node. The resulting bounding volume is fixed to the sizes provided, and will not take into consideration the vertices of the mesh. It will, however, transform along with the node, as the node is transformed.

- (BOOL) doesIntersect: (CC3BoundingVolume *)  aBoundingVolume

Returns whether this bounding volume intersects the specfied other bounding volume.

This implementation tests whether the globalSphere of this bounding volume intersects the other bounding volume, by double-dispatching to the doesIntersectSphere:from: method of the other bounding volume, passing this bounding volume's globalSphere as the sphere to test, and passing this bounding volume as the otherBoundingVolume argument to that method.

Implements CC3BoundingVolume.

- (BOOL) doesIntersectConvexHullOf: (GLuint)  numOtherPlanes
planes: (CC3Plane *)  otherPlanes
from: (CC3BoundingVolume *)  otherBoundingVolume 

Returns whether a convex hull composed of the specified global planes intersects this bounding volume.

The planes may be the face planes of a mesh, or they may be the sides of an oriented bounding box (OBB), or frustum, etc.

Returns whether the globalSphere of this bounding volume intersects the convex hull defined by the specified planes. To be so, the globalCenterOfGeometry of this bounding volume must be no farther away than the globalRadius from the front face of every one of the specified planes.

This implementation ignores the otherBoundingVolume argument.

Implements CC3BoundingVolume.

- (BOOL) doesIntersectLocation: (CC3Vector aLocation

Returns whether the specified global location intersects (is inside) this bounding volume.

Returns whether the specified location is contained within the globalSphere of this bounding volume.

Implements CC3BoundingVolume.

- (BOOL) doesIntersectRay: (CC3Ray aRay

Returns whether the specified global-coordinate ray intersects this bounding volume.

Returns whether the specified ray intersects the globalSphere of this bounding volume.

The operation of this method is affected by the shouldIgnoreRayIntersection property. If that property is set to YES, this method will always return NO. See the notes of the shouldIgnoreRayIntersection property for more info.

Implements CC3BoundingVolume.

- (BOOL) doesIntersectSphere: (CC3Sphere aSphere
from: (CC3BoundingVolume *)  otherBoundingVolume 

Returns whether the specified global-coordinate sphere intersects this bounding volume.

Returns whether the specified sphere intersects the globalSphere of this bounding volume.

This implementation ignores the otherBoundingVolume argument.

Implements CC3BoundingVolume.

- (id) initFromSphere: (CC3Sphere sphere

Initializes this instance from the specified sphere, and sets the shouldBuildFromMesh property to NO.

The sphere dimensions are specified in the coordinate system of the node. The resulting bounding volume is fixed to the sizes provided, and will not take into consideration the vertices of the mesh. It will, however, transform along with the node, as the node is transformed.

- (BOOL) isInFrontOfPlane: (CC3Plane aPlane

Returns whether this bounding volume lies completely outside the specified normalized global coordinate plane.

This method returns YES if the bounding volume lies completely on the side of the plane from which the plane normal points. It returns NO if this bounding volume intersects the plane or lies completely on the opposite side of the plane.

Returns whether the globalCenterOfGeometry of this bounding volume is farther away than the globalRadius from the side of the plane from which the normal points.

Implements CC3BoundingVolume.

Property Documentation

- (GLfloat) globalRadius
readnonatomicassign

The radius that encompasses the extent of the node in the global coordinate system, as measured from the global center of geometry of this instance.

- (CC3Sphere) globalSphere
readnonatomicassign

Returns a sphere constructed from the globalCenterOfGeometry and the globalRadius properties.

- (GLfloat) radius
readwritenonatomicassign

The radius that encompasses the extent of the node in the node's local coordinate system, as measured from the center of geometry of this instance.

For mesh nodes, the value of this property is automatically calculated from the vertex locations, via specialized subclasses of CC3NodeBoundingVolume used for meshes. For other nodes, this property can be set directly, if needed.

You can also set this property directly for mesh nodes as well. Doing so will override the value that was calculated automatically. This can be useful when the vertices will be changing frequently, and therefore the bounding volume will need to be recalculated frequently. By setting this property to a value that suits all possible vertex configurations, you can avoid expensive recalculations of the bounding volume as the vertices change.

Setting the value of this property sets the shouldBuildFromMesh property to NO, so that the radius will not be overridden if the vertices of the mesh change.

The initial value of this property is zero.

- (CC3Sphere) sphere
readnonatomicassign

Returns a sphere constructed from the centerOfGeometry and the radius properties.


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