test
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 final : public Surface {
20 public:
21 
22  template<typename... Args>
24  Surface(std::forward<Args>(args)...), theRadius(radius){}
25 
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 
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
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
Plane fastTangent(const LocalPoint &aPoint) const
tangent plane to surface from local point
Definition: Cylinder.h:87
ReferenceCountingPointer< Cylinder > BoundCylinderPointer
Definition: Cylinder.h:37
const Bounds & bounds() const
Definition: Surface.h:120
virtual Side side(const LocalPoint &p, Scalar tolerance=0) const =0
Plane fastTangent(const GlobalPoint &aPoint) const
tangent plane to surface from global point
Definition: Cylinder.h:80
Definition: Plane.h:17
ConstReferenceCountingPointer< Cylinder > ConstBoundCylinderPointer
Definition: Cylinder.h:38
virtual float thickness() const =0
virtual Side side(const LocalPoint &p, Scalar toler) const
Definition: Cylinder.cc:9
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
Cylinder(Scalar radius, Args &&...args)
Definition: Cylinder.h:23
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
~Cylinder()
Definition: Cylinder.h:61
Scalar theRadius
Definition: Cylinder.h:93
Cylinder(const PositionType &pos, const RotationType &rot, SimpleCylinderBounds const &bounds)
Definition: Cylinder.h:26
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const
tangent plane to surface from global point
Definition: Cylinder.cc:23
ConstReferenceCountingPointer< Cylinder > ConstCylinderPointer
Definition: Cylinder.h:36
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:30
static CylinderPointer build(Scalar radius, const PositionType &pos, const RotationType &rot, Bounds *bounds=0)
Definition: Cylinder.h:56
TkRotation< float > RotationType
const RotationType & rotation() const
Definition: Bounds.h:22
SurfaceOrientation::Side Side
Definition: Surface.h:46
virtual float width() const =0
const PositionType & position() const
ReferenceCountingPointer< Cylinder > CylinderPointer
Definition: Cylinder.h:35