CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes

Cone Class Reference

#include <Cone.h>

Inheritance diagram for Cone:
Surface GloballyPositioned< float > BasicReferenceCounted

List of all members.

Public Types

typedef
ReferenceCountingPointer< Cone
ConePointer
typedef
ReferenceCountingPointer< Cone
ConstConePointer

Public Member Functions

 Cone (const PositionType &pos, const RotationType &rot, const PositionType &vert, Geom::Theta< Scalar > angle)
Geom::Theta< float > openingAngle () const
 Angle of the cone.
virtual Side side (const LocalPoint &p, Scalar tolerance) const
virtual Side side (const GlobalPoint &p, Scalar tolerance) const
virtual
ReferenceCountingPointer
< TangentPlane > 
tangentPlane (const GlobalPoint &) const
virtual
ReferenceCountingPointer
< TangentPlane > 
tangentPlane (const LocalPoint &) const
GlobalPoint vertex () const
 Global position of the cone vertex.

Static Public Member Functions

static ConePointer build (const PositionType &pos, const RotationType &rot, const PositionType &vert, Geom::Theta< Scalar > angle)

Protected Member Functions

 Cone (const PositionType &pos, const RotationType &rot, const PositionType &vert, Geom::Theta< Scalar > angle, MediumProperties *mp)

Private Attributes

Geom::Theta< ScalartheAngle
GlobalPoint theVertex

Detailed Description

A Cone.

Warning:
Surfaces are reference counted, so only ReferenceCountingPointer should be used to point to them. For this reason, they should be using the static build() method. (The normal constructors will become private in the future).
Date:
2007/07/31 15:20:07
Revision:
1.2

Definition at line 20 of file Cone.h.


Member Typedef Documentation

Definition at line 22 of file Cone.h.

Definition at line 23 of file Cone.h.


Constructor & Destructor Documentation

Cone::Cone ( const PositionType pos,
const RotationType rot,
const PositionType vert,
Geom::Theta< Scalar angle 
) [inline]

Do not use this constructor directly; use the static build method, which returns a ReferenceCountingPointer. This constructor will soon become private

Definition at line 42 of file Cone.h.

Referenced by build().

                                                           :
    Surface( pos, rot), theVertex(vert), theAngle(angle) {}
Cone::Cone ( const PositionType pos,
const RotationType rot,
const PositionType vert,
Geom::Theta< Scalar angle,
MediumProperties mp 
) [inline, protected]

Definition at line 68 of file Cone.h.

                             : 
    Surface(pos, rot, mp), theVertex(vert), theAngle(angle) {}

Member Function Documentation

static ConePointer Cone::build ( const PositionType pos,
const RotationType rot,
const PositionType vert,
Geom::Theta< Scalar angle 
) [inline, static]

Construct a cone with the specified vertex and opening angle. The reference frame is defined by pos and rot; the cone axis is parallel to the local Z axis.

Definition at line 29 of file Cone.h.

References Cone().

                                                    {
    return ConePointer(new Cone(pos, rot, vert, angle));
  }
Geom::Theta<float> Cone::openingAngle ( ) const [inline]

Angle of the cone.

Definition at line 53 of file Cone.h.

References theAngle.

Referenced by MagGeoBuilderFromDDD::volumeHandle::sameSurface(), and side().

{return theAngle;}
virtual Side Cone::side ( const LocalPoint p,
Scalar  tolerance 
) const [inline, virtual]

Returns the side of the surface on which the point is. Not defined for 1-sided surfaces (Moebius leaf etc.) For normal 2-sided surfaces the meaning of side is surface type dependent.

Implements Surface.

Definition at line 58 of file Cone.h.

References side(), and Surface::toGlobal().

Referenced by side().

{return side( toGlobal(p), tolerance);}
Surface::Side Cone::side ( const GlobalPoint p,
Scalar  tolerance 
) const [virtual]

Reimplemented from Surface.

Definition at line 22 of file Cone.cc.

References delta, SurfaceOrientation::negativeSide, SurfaceOrientation::onSurface, openingAngle(), p1, pi, SurfaceOrientation::positiveSide, vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                                    {
  // FIXME: should be done in local coordinates as this is not correct in the case the verstex is not on the (global) Z axis!!!!

  // tolerance is interpreted as max distance from cone surface.
  // FIXME: check case when vertex().z()==inf.
  GlobalPoint p1(p.x(), p.y(), p.z()-vertex().z());

  // handle the singularity of p=vertex (i.e. p1.mag() undefined)
  if (p1.mag()<tolerance) return SurfaceOrientation::onSurface;
  double delta = double(p1.theta())- double(openingAngle());
  if (fabs(delta) < tolerance/p1.mag()) return SurfaceOrientation::onSurface;
  
  if (p1.theta() < Geom::pi()/2.) {
    return (delta>0. ?  SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide);
  } else {
    return (delta>0. ?  SurfaceOrientation::negativeSide : SurfaceOrientation::positiveSide);
  }
}
ReferenceCountingPointer< TangentPlane > Cone::tangentPlane ( const GlobalPoint ) const [virtual]

Tangent plane to surface from global point. Returns a new plane, tangent to the Surface at a point. The point must be on the surface. The return type is a ReferenceCountingPointer, so the plane will be deleted automatically when no longer needed.

Implements Surface.

Definition at line 8 of file Cone.cc.

References gather_cfg::cout.

                                                                                   {
  // FIXME: to be implemented...
  std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
  abort();
  return ReferenceCountingPointer<TangentPlane>();
}
ReferenceCountingPointer< TangentPlane > Cone::tangentPlane ( const LocalPoint ) const [virtual]

Tangent plane to surface from local point.

Implements Surface.

Definition at line 15 of file Cone.cc.

References gather_cfg::cout.

                                                                                  {
  // FIXME: to be implemented...
  std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
  abort();
  return ReferenceCountingPointer<TangentPlane>();
}
GlobalPoint Cone::vertex ( ) const [inline]

Global position of the cone vertex.

Definition at line 50 of file Cone.h.

References theVertex.

Referenced by MagGeoBuilderFromDDD::volumeHandle::sameSurface(), and side().

{return theVertex;}

Member Data Documentation

Definition at line 76 of file Cone.h.

Referenced by openingAngle().

Definition at line 75 of file Cone.h.

Referenced by vertex().