CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Cylinder.h
Go to the documentation of this file.
1 #ifndef Geom_Cylinder_H
2 #define Geom_Cylinder_H
3 
18 
19 class Cylinder GCC11_FINAL : public Surface {
20 public:
21 
22  template<typename... Args>
24  Surface(std::forward<Args>(args)...), theRadius(radius){}
25 
26  Cylinder(const PositionType& pos, const RotationType& rot, SimpleCylinderBounds const & bounds) :
27  Surface(pos,rot, bounds.clone()), theRadius(computeRadius(bounds)){}
28 
29  // average Rmin Rmax...
30  static float computeRadius(Bounds const & bounds) {
31  return 0.5f*(bounds.width() - bounds.thickness());
32  }
33 
34 
39 
40 
44  /*
45  template<typename... Args>
46  static CylinderPointer build(Args&& ... args) {
47  return CylinderPointer(new Cylinder(std::forward<Args>(args)...));
48  }
49  */
50 
51  static CylinderPointer build(const PositionType& pos, const RotationType& rot,
52  Scalar radius, Bounds* bounds=0) {
53  return CylinderPointer(new Cylinder(radius,pos,rot,bounds));
54  }
55 
57  Bounds* bounds=0) {
58  return CylinderPointer(new Cylinder(radius,pos,rot,bounds));
59  }
60 
62 
63 
64  // -- Extension of Surface interface for cylinder
65 
67  Scalar radius() const {return theRadius;}
68 
69  // -- Implementation of Surface interface
70 
71  using Surface::side;
72  virtual Side side( const LocalPoint& p, Scalar toler) const;
73 
75  virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
77  virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
78 
80  Plane fastTangent(const GlobalPoint& aPoint) const{
81  GlobalVector yPlane(rotation().z());
82  GlobalVector xPlane(yPlane.cross(aPoint-position()));
83  return Plane(aPoint,RotationType(xPlane, yPlane));
84  }
85 
87  Plane fastTangent(const LocalPoint& aPoint) const {
88  return fastTangent(toGlobal(aPoint));
89  }
90 
91 private:
92 
94 
95 };
96 
97 #endif
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
ReferenceCountingPointer< Cylinder > CylinderPointer
Definition: Cylinder.h:35
double Scalar
Definition: Definitions.h:27
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MagVolume.h:20
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
Base::Scalar Scalar
Plane fastTangent(const LocalPoint &aPoint) const
tangent plane to surface from local point
Definition: Cylinder.h:87
virtual Side side(const LocalPoint &p, Scalar tolerance=0) const =0
Definition: Plane.h:17
float float float z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:30
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:30
virtual float thickness() const =0
Plane fastTangent(const GlobalPoint &aPoint) const
tangent plane to surface from global point
Definition: Cylinder.h:80
Cylinder(Scalar radius, Args &&...args)
Definition: Cylinder.h:23
Cylinder(const PositionType &pos, const RotationType &rot, SimpleCylinderBounds const &bounds)
Definition: Cylinder.h:26
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
ConstReferenceCountingPointer< Cylinder > ConstBoundCylinderPointer
Definition: Cylinder.h:38
GloballyPositioned< float >::GlobalVector GlobalVector
Definition: MagVolume.h:21
Scalar theRadius
Definition: Cylinder.h:93
Definition: Bounds.h:22
GloballyPositioned< float >::LocalPoint LocalPoint
ReferenceCountingPointer< Cylinder > BoundCylinderPointer
Definition: Cylinder.h:37
virtual float width() const =0
static CylinderPointer build(Scalar radius, const PositionType &pos, const RotationType &rot, Bounds *bounds=0)
Definition: Cylinder.h:56
ConstReferenceCountingPointer< Cylinder > ConstCylinderPointer
Definition: Cylinder.h:36
Unlimited (trivial) bounds.