Sphere-section projector. More...
#include <Inventor/projectors/SbSphereSectionProjector.h>
Public Member Functions | |
SbSphereSectionProjector (float edgeTol=0.9f, SbBool orientToEye=TRUE) | |
SbSphereSectionProjector (const SbSphere &sph, float edgeTol=0.9f, SbBool orientToEye=TRUE) | |
~SbSphereSectionProjector () | |
virtual SbProjector * | copy () const |
virtual SbVec3f | project (const SbVec2f &point) |
virtual SbVec3f | intersect (const SbLine &line) |
virtual SbRotation | getRotation (const SbVec3f &point1, const SbVec3f &point2) |
void | setTolerance (float edgeTol) |
float | getTolerance () const |
void | setRadialFactor (float rad=0.0) |
float | getRadialFactor () const |
SbBool | isWithinTolerance (const SbVec3f &point) |
Sphere-section projector.
SbSphereSectionProjector projects a window space point (usually based on the mouse location) onto the section of a sphere that has been sliced by a plane. Two projected points can produce a rotation about the sphere's center. The tolerance slice can be specified as a fraction of the radius of the sphere. The projection point will not extend beyond the sliced portion of the sphere.
Incremental changes (delta rotation) can be computed during interactive sessions. Sphere projectors are typically used to write interactive 3D manipulators and viewers.
SbCylinderProjector, SbCylinderSectionProjector, SbCylinderPlaneProjector, SbCylinderSheetProjector, SbLineProjector, SbPlaneProjector, SbSpherePlaneProjector, SbSphereSheetProjector
SbSphereSectionProjector::SbSphereSectionProjector | ( | float | edgeTol = 0.9f , |
|
SbBool | orientToEye = TRUE | |||
) |
Constructor that uses a default sphere centered at the origin with radius 1.0.
The position of the plane which slices the sphere into a section is specified as a fraction of the sphere radius with the parameter edgeTol. A tolerance value of 1.0 positions the plane down the center of the sphere. A tolerance value of 0.5 defines the longitudinal plane halfway between the center and the outside edge of the sphere. The default value is 0.9, so that almost half the sphere is in front of the plane. The orientToEye parameter determines whether the plane is perpendicular to the eye, or perpendicular to the sphere's Z axis. Setting that parameter to TRUE (the default) specifies that the plane be perpendicular to the eye, which is most often the desired behavior.
The default view volume is undefined, and the working space is identity.
SbSphereSectionProjector::SbSphereSectionProjector | ( | const SbSphere & | sph, | |
float | edgeTol = 0.9f , |
|||
SbBool | orientToEye = TRUE | |||
) |
Constructor that uses a supplied sphere.
The position of the plane which slices the sphere into a section is specified as a fraction of the sphere radius with the parameter edgeTol. A tolerance value of 1.0 positions the plane down the center of the sphere. A tolerance value of 0.5 defines the longitudinal plane halfway between the center and the outside edge of the sphere. The default value is 0.9, so that almost half the sphere is in front of the plane. The orientToEye parameter determines whether the plane is perpendicular to the eye, or perpendicular to the sphere's Z axis. Setting that parameter to TRUE (the default) specifies that the plane be perpendicular to the eye, which is most often the desired behavior.
The default view volume is undefined, and the working space is identity.
SbSphereSectionProjector::~SbSphereSectionProjector | ( | ) | [inline] |
Destructor.
virtual SbProjector* SbSphereSectionProjector::copy | ( | ) | const [virtual] |
Returns an instance that is a copy of this instance.
The caller is responsible for deleting the copy when done.
Implements SbProjector.
Reimplemented in SbSpherePlaneProjector.
float SbSphereSectionProjector::getRadialFactor | ( | ) | const [inline] |
Gets the radial rotation factor.
virtual SbRotation SbSphereSectionProjector::getRotation | ( | const SbVec3f & | point1, | |
const SbVec3f & | point2 | |||
) | [virtual] |
Computes a rotation based on two points on this projector.
Implements SbSphereProjector.
Reimplemented in SbSpherePlaneProjector.
float SbSphereSectionProjector::getTolerance | ( | ) | const [inline] |
Gets the edge tolerance as a fraction of the radius of the sphere.
Applies the projector using the given line in world coordinates, returning the point in three dimensions that it projects to.
New for v3.0.
Implements SbSphereProjector.
Reimplemented in SbSpherePlaneProjector.
Finds whether this point on the sphere or tolerance plane is within tolerance.
Applies the projector using the given point, returning the point in three dimensions that it projects to.
The point should be normalized from 0-1, with (0,0) at the lower-left.
Implements SbSphereProjector.
Reimplemented in SbSpherePlaneProjector.
void SbSphereSectionProjector::setRadialFactor | ( | float | rad = 0.0 |
) | [inline] |
Sets the radial rotation factor.
When the mouse is dragged off the edge of the sphere, the mouse motion can be classified as either tangential (moving in a circle around the sphere) or radial (moving toward or away from the center). The tangential motion will always map to a rotation around the center, (like the hands of a clock). The radial motion, by default, has no effect. But if you set the radialFactor to be > 0.0, this motion will make the sphere rotate as if the mouse is pulling the top of the sphere out toward the mouse. If radialFactor = 1.0, then pulling has a `normal' feel (that is, the mouse motion causes the same amount of rotation as if you had rotated by hitting the actual surface of the sphere). Default is 0.0
void SbSphereSectionProjector::setTolerance | ( | float | edgeTol | ) |
Sets the edge tolerance as a fraction of the radius of the sphere.
If this is 1.0, the projector is a hemisphere. If this is 0.1, the projector is a slice of the sphere with radius 0.1*radius. Default is 0.9.