Cylinder Class Reference

#include <Cylinder.h>

Inheritance diagram for Cylinder:

Geometry ESGObject List of all members.

Public Member Functions

 Cylinder ()
 Cylinder (const Vector3 &point1, const Vector3 &normal1, const Vector3 &point2, const Vector3 &normal2, double radius)
virtual ~Cylinder ()
virtual void rayIntersection (PointEnv *pPE, int mask, const Vector3 &origin, const Vector3 &direction, float maxD=MAXFLOAT)
virtual bool mapToUV (const Vector3 &v, Vector2 &uv)
virtual void randomSample (int mask, PointEnv &pe, double *pdf)
virtual bool randomDirection (const Vector3 &pov, Vector3 &dir, double *pdf)
virtual Interval extent (const Vector3 &direction) const
virtual Vector3 centroid (void) const
virtual double radius (const Vector3 &centroid) const
virtual double radius (void) const
virtual Geometryclone (const Matrix4 *pTrMat) const
virtual bool separation (Geometry &geom, Vector3 *pDir)
virtual double distance (const Geometry &geom, Vector3 *pDir)
virtual void dump (const char *intent, const char *tab)
double getRadius () const
void setRadius (double radius)
void setFirstCap (const Vector3 &center, const Vector3 &normal)
void setSecondCap (const Vector3 &center, const Vector3 &normal)
void insideOut (bool b)
Interval extent (float x, float y, float z) const
Geometryclone (void) const
Meshmesh (int density=0) const
virtual void __debug ()

Static Public Attributes

static const float EPS = 1e-03
 epsilon variation (tolerance) of zero

Protected Member Functions

virtual Mesh_mesh (int) const
virtual void _duplicate_attributes (const Geometry &)
virtual void _rotateX (float)
virtual void _rotateY (float)
virtual void _rotateZ (float)
virtual void _rotate (float, const Vector3 &)
virtual void _rotate (const Matrix3 &)
virtual void _translate (float, float, float)
virtual void _transform (const Matrix4 &)
virtual void _scale (float)
void _translate (const Vector3 &v)

Protected Attributes

double _radius
 radius
double _radiusSqr
 radius^2
Vector3 _cap1Point
 center of the end-cap plane
Vector3 _cap1Normal
 normal of the end-cap plane
Vector3 _cap2Point
 center of the end-cap plane
Vector3 _cap2Normal
 normal of the end-cap plane
Vector3 _axis
 norm(_cap2Point - _cap1Point)
bool _insideOut

Detailed Description

Opened (uncaped) cylinder with finite length and with the same radiuses on both sides.

Definition at line 15 of file Cylinder.h.


Constructor & Destructor Documentation

Cylinder  ) 
 

Implicit constructor. Cylinder has centre of the base plane at (0,0,0), is oriented upward (axis is parallel with y coord), radius and height are 1.0

Definition at line 106 of file Cylinder.cc.

Referenced by Cylinder::clone().

Cylinder const Vector3 point1,
const Vector3 normal1,
const Vector3 point2,
const Vector3 normal2,
double  radius
 

Constructor.

Parameters:
point1 center of end-cap plane
normal1 normalized normal vector of the end-cap plane (need not be parallel with axis of the cylinder)
point2 center of end-cap plane
normal2 normalized normal vector of the end-cap plane (need not be parallel with axis of the cylinder)
radius radius of the cylinder

Definition at line 117 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Point, and Cylinder::_cap2Point.

virtual ~Cylinder  )  [inline, virtual]
 

Destructor.

Definition at line 68 of file Cylinder.h.


Member Function Documentation

virtual void __debug void   )  [inline, virtual, inherited]
 

Reimplemented in _Surface, FDH, Polygon, Sphere, and Surface.

Definition at line 211 of file Geometry.h.

Referenced by BVH::__debug().

void _duplicate_attributes const Geometry  )  [protected, virtual]
 

Reimplemented from Geometry.

Definition at line 6 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, Cylinder::_cap2Point, Geometry::_duplicate_attributes(), Cylinder::_radius, and Cylinder::_radiusSqr.

Referenced by Cylinder::clone().

virtual Mesh* _mesh int   )  const [inline, protected, virtual]
 

Implements Geometry.

Definition at line 26 of file Cylinder.h.

void _rotate const Matrix3  )  [protected, virtual]
 

Implements Geometry.

Definition at line 62 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.

void _rotate float  ,
const Vector3
[protected, virtual]
 

Implements Geometry.

Definition at line 51 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.

void _rotateX float   )  [protected, virtual]
 

Implements Geometry.

Definition at line 18 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.

void _rotateY float   )  [protected, virtual]
 

Implements Geometry.

Definition at line 29 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.

void _rotateZ float   )  [protected, virtual]
 

Implements Geometry.

Definition at line 40 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.

void _scale float   )  [protected, virtual]
 

Implements Geometry.

Definition at line 95 of file Cylinder.cc.

References Cylinder::_cap1Point, Cylinder::_cap2Point, Cylinder::_radius, and Cylinder::_radiusSqr.

void _transform const Matrix4  )  [protected, virtual]
 

Implements Geometry.

Definition at line 77 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, Cylinder::_cap2Point, Cylinder::_radius, and Cylinder::_radiusSqr.

Referenced by Cylinder::clone().

void _translate const Vector3 v  )  [inline, protected, inherited]
 

Definition at line 38 of file Geometry.h.

void _translate float  ,
float  ,
float 
[protected, virtual]
 

Implements Geometry.

Definition at line 71 of file Cylinder.cc.

References Cylinder::_cap1Point, and Cylinder::_cap2Point.

Vector3 centroid void   )  const [virtual]
 

Returns:
centroid (point of gravity) of the geometry

Implements Geometry.

Definition at line 297 of file Cylinder.cc.

References Cylinder::_cap1Point, and Cylinder::_cap2Point.

Referenced by Cylinder::distance().

Geometry* clone void   )  const [inline, inherited]
 

Duplicates geometry

Returns:
duplicate (clone)

Reimplemented in _Surface, and OSGPolygon.

Definition at line 155 of file Geometry.h.

Referenced by BVH::__get_edges(), BVH::__get_meshes(), ObjsInAreaExplorer::_accept_new_transformation(), SphereTree::_enlarge_bv(), FDHTree::_enlarge_bv(), BVExplorer::_iterate(), BVDistRot::BVDistRot(), and ObjsInAreaExplorer::ObjsInAreaExplorer().

Geometry * clone const Matrix4 pTrMat  )  const [virtual]
 

Duplicates and transforms geometry

Parameters:
pTrMat transformation matrix of the clone or NULL
Returns:
duplicate (clone)

Implements Geometry.

Definition at line 324 of file Cylinder.cc.

References Cylinder::_duplicate_attributes(), Cylinder::_transform(), and Cylinder::Cylinder().

double distance const Geometry geom,
Vector3 pDir
[virtual]
 

Computes approximate distance between this and given geometries (lower bound of distance)

Parameters:
geom geometry to check
pDir if presented then is set to normalized measured direction (vector of minimal distance)
Returns:
lower bound of distance, negative value indicates penetration, positive value indicates separation, zero indicates touch

Implements Geometry.

Definition at line 368 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Point, Cylinder::_cap2Point, Cylinder::_radius, Cylinder::centroid(), Geometry::centroid(), Sphere::distance(), Geometry::extent(), MAXDOUBLE, and Cylinder::radius().

void dump const char *  intent,
const char *  tab
[virtual]
 

Writes information about this geometry to std. out.

Parameters:
intent free space before each line
tab free space added to intent inside description of this class

Implements Geometry.

Definition at line 430 of file Cylinder.cc.

Interval extent float  x,
float  y,
float  z
const [inline, inherited]
 

Returns extent occupied by the geometry in given direction

Parameters:
x direction direction of extent - x coordinate
y direction direction of extent - y coordinate
z direction direction of extent - z coordinate
Returns:
extent of occupied space

Definition at line 124 of file Geometry.h.

Interval extent const Vector3 direction  )  const [virtual]
 

Returns extent occupied by the geometry in given direction

Parameters:
direction direction of extent
Returns:
extent of occupied space

Implements Geometry.

Definition at line 269 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Point, and Cylinder::_radius.

double getRadius  )  const [inline]
 

Returns:
radius

Definition at line 107 of file Cylinder.h.

References Cylinder::_radius.

void insideOut bool  b  )  [inline, inherited]
 

Inverts facet normals (turns the object inside-out)

Parameters:
b determines wehether to turn the geometry inside-out

Definition at line 56 of file Geometry.h.

bool mapToUV const Vector3 v,
Vector2 uv
[virtual]
 

Maps 3D point from surface to the UV surface representation

Parameters:
v 3D point in the world coordinates
uv UV coordinates (relative to the surface)
Returns:
true on success, false otherwise (mainly if the 3D point does not lie on the surface)

Implements Geometry.

Definition at line 257 of file Cylinder.cc.

Mesh * mesh int  density = 0  )  const [inherited]
 

Returns polygonal mesh computed from this geometry

Parameters:
density mesh density
Returns:
polygonal mesh

Definition at line 24 of file Geometry.cc.

References Geometry::_insideOut, Geometry::_mesh(), and Mesh::turnInsideOut().

Referenced by BVH::__get_edges(), BVH::__get_meshes(), NurbsSurface::_mesh(), and POVRayExporter::_process_leaf().

double radius void   )  const [virtual]
 

Returns radius of minimal packing sphere with center in the ceontroid of the geometry

Parameters:
centroid center of packing sphere
Returns:
minimal packing radius

Reimplemented from Geometry.

Definition at line 316 of file Cylinder.cc.

References Cylinder::_cap1Point, Cylinder::_cap2Point, and Cylinder::_radiusSqr.

Referenced by Cylinder::distance().

double radius const Vector3 centroid  )  const [virtual]
 

Returns radius of minimal packing sphere having given center

Parameters:
centroid center of packing sphere
Returns:
minimal packing radius

Implements Geometry.

Definition at line 305 of file Cylinder.cc.

References Cylinder::_cap1Point, Cylinder::_cap2Point, and Cylinder::_radius.

virtual bool randomDirection const Vector3 pov,
Vector3 dir,
double *  pdf
[inline, virtual]
 

Computes random direction towards the surface in accord to the point of view.

Parameters:
pov point of view
dir computed random direction
pdf if present then it is set to the value of the Probability Density Function of the random point

Implements Geometry.

Definition at line 80 of file Cylinder.h.

void randomSample int  mask,
PointEnv pe,
double *  pdf
[virtual]
 

Computes random point on the surface

Parameters:
mask bitmask determining what to compute, see PointEnv.h
pe information about the computed random point on surface
pdf if present then it is set to the value of the Probability Density Function of the random point

Implements Geometry.

Definition at line 263 of file Cylinder.cc.

References ENV_HAVE_NOTHING, and PointEnv::mask.

void rayIntersection PointEnv pPE,
int  mask,
const Vector3 origin,
const Vector3 direction,
float  maxD = MAXFLOAT
[virtual]
 

Computes point of intersection of ray with this geometry

Parameters:
pPE structure in which the information about intersection point is stored; must be defined (not NULL)
mask bitmask determining what to compute, see PointEnv.h
origin ray's origin
direction normalized ray's direction
maxD maximal interesting distance; if the point of intersection can't be closer than this distance then the computation stops (object is too far away)

Implements Geometry.

Definition at line 134 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, Cylinder::_cap2Normal, Cylinder::_cap2Point, Cylinder::_radius, Cylinder::_radiusSqr, PointEnv::distance, ENV_HAVE_DISTANCE, ENV_HAVE_INTERFERENCE, ENV_HAVE_INTERSECTION, ENV_HAVE_NORMAL, ENV_HAVE_NOTHING, ENV_WANT_DISTANCE, ENV_WANT_INTERSECTION, ENV_WANT_NORMAL, PointEnv::intersection, PointEnv::mask, MAXDOUBLE, PointEnv::normal, PointEnv::normalOrientation, and PointEnv::OUTWARDS_NORMAL.

bool separation Geometry geom,
Vector3 pDir
[virtual]
 

Checks if there is separation between this and given geometries

Parameters:
geom geometry to check
pDir if presented then is set to normalized direction to found separation (gap)
Returns:
true if thre is separation (gap), false otherwise

Implements Geometry.

Definition at line 332 of file Cylinder.cc.

References Cylinder::_axis, Cylinder::_cap1Point, Cylinder::_cap2Point, Cylinder::_radius, Geometry::centroid(), and Geometry::extent().

void setFirstCap const Vector3 center,
const Vector3 normal
[inline]
 

Parameters:
center new center of the end-cap plane
normal new normal of the end-cap plane

Definition at line 121 of file Cylinder.h.

References Cylinder::_axis, Cylinder::_cap1Normal, Cylinder::_cap1Point, and Cylinder::_cap2Point.

void setRadius double  radius  )  [inline]
 

Parameters:
radius new radius

Definition at line 112 of file Cylinder.h.

References Cylinder::_radius, and Cylinder::_radiusSqr.

void setSecondCap const Vector3 center,
const Vector3 normal
[inline]
 

Parameters:
center new center of the end-cap plane
normal new normal of the end-cap plane

Definition at line 133 of file Cylinder.h.

References Cylinder::_axis, Cylinder::_cap1Point, Cylinder::_cap2Normal, and Cylinder::_cap2Point.


Member Data Documentation

Vector3 _axis [protected]
 

norm(_cap2Point - _cap1Point)

Definition at line 23 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_rotate(), Cylinder::_rotateX(), Cylinder::_rotateY(), Cylinder::_rotateZ(), Cylinder::_transform(), Cylinder::Cylinder(), Cylinder::distance(), Cylinder::extent(), Cylinder::rayIntersection(), Cylinder::separation(), Cylinder::setFirstCap(), and Cylinder::setSecondCap().

Vector3 _cap1Normal [protected]
 

normal of the end-cap plane

Definition at line 20 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_rotate(), Cylinder::_rotateX(), Cylinder::_rotateY(), Cylinder::_rotateZ(), Cylinder::_transform(), Cylinder::rayIntersection(), and Cylinder::setFirstCap().

Vector3 _cap1Point [protected]
 

center of the end-cap plane

Definition at line 19 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_rotate(), Cylinder::_rotateX(), Cylinder::_rotateY(), Cylinder::_rotateZ(), Cylinder::_scale(), Cylinder::_transform(), Cylinder::_translate(), Cylinder::centroid(), Cylinder::Cylinder(), Cylinder::distance(), Cylinder::extent(), Cylinder::radius(), Cylinder::rayIntersection(), Cylinder::separation(), Cylinder::setFirstCap(), and Cylinder::setSecondCap().

Vector3 _cap2Normal [protected]
 

normal of the end-cap plane

Definition at line 22 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_rotate(), Cylinder::_rotateX(), Cylinder::_rotateY(), Cylinder::_rotateZ(), Cylinder::_transform(), Cylinder::rayIntersection(), and Cylinder::setSecondCap().

Vector3 _cap2Point [protected]
 

center of the end-cap plane

Definition at line 21 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_rotate(), Cylinder::_rotateX(), Cylinder::_rotateY(), Cylinder::_rotateZ(), Cylinder::_scale(), Cylinder::_transform(), Cylinder::_translate(), Cylinder::centroid(), Cylinder::Cylinder(), Cylinder::distance(), Cylinder::radius(), Cylinder::rayIntersection(), Cylinder::separation(), Cylinder::setFirstCap(), and Cylinder::setSecondCap().

bool _insideOut [protected, inherited]
 

Definition at line 23 of file Geometry.h.

Referenced by Geometry::_duplicate_attributes(), and Geometry::mesh().

double _radius [protected]
 

radius

Definition at line 17 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_scale(), Cylinder::_transform(), Cylinder::distance(), Cylinder::extent(), Cylinder::getRadius(), Cylinder::radius(), Cylinder::rayIntersection(), Cylinder::separation(), and Cylinder::setRadius().

double _radiusSqr [protected]
 

radius^2

Definition at line 18 of file Cylinder.h.

Referenced by Cylinder::_duplicate_attributes(), Cylinder::_scale(), Cylinder::_transform(), Cylinder::radius(), Cylinder::rayIntersection(), and Cylinder::setRadius().

const float EPS = 1e-03 [static, inherited]
 

epsilon variation (tolerance) of zero

Definition at line 20 of file Geometry.h.

Referenced by FDH::_cut_line(), Sphere::_duplicate_attributes(), FDH::_get_corners(), FDH::_mesh(), Sphere::_scale(), Polygon::_triTriCollision(), Sphere::rayIntersection(), Polygon::rayIntersection(), Point3D::rayIntersection(), Hemisphere::rayIntersection(), Sphere::setRadius(), and Sphere::Sphere().


The documentation for this class was generated from the following files:
Generated on Wed Jun 28 12:24:34 2006 for esg by  doxygen 1.4.6