CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  template <typename... Args>
22  Cylinder(Scalar radius, Args&&... args) : Surface(std::forward<Args>(args)...), theRadius(radius) {}
23 
25  : Surface(pos, rot, bounds.clone()), theRadius(computeRadius(bounds)) {}
26 
27  // average Rmin Rmax...
28  static float computeRadius(Bounds const& bounds) { return 0.5f * (bounds.width() - bounds.thickness()); }
29 
34 
38  /*
39  template<typename... Args>
40  static CylinderPointer build(Args&& ... args) {
41  return CylinderPointer(new Cylinder(std::forward<Args>(args)...));
42  }
43  */
44 
45  static CylinderPointer build(const PositionType& pos,
46  const RotationType& rot,
47  Scalar radius,
48  Bounds* bounds = nullptr) {
49  return CylinderPointer(new Cylinder(radius, pos, rot, bounds));
50  }
51 
53  const PositionType& pos,
54  const RotationType& rot,
55  Bounds* bounds = nullptr) {
56  return CylinderPointer(new Cylinder(radius, pos, rot, bounds));
57  }
58 
59  ~Cylinder() override {}
60 
61  // -- Extension of Surface interface for cylinder
62 
64  Scalar radius() const { return theRadius; }
65 
66  // -- Implementation of Surface interface
67 
68  using Surface::side;
69  Side side(const LocalPoint& p, Scalar toler) const override;
70 
75 
77  Plane fastTangent(const GlobalPoint& aPoint) const {
78  GlobalVector yPlane(rotation().z());
79  GlobalVector xPlane(yPlane.cross(aPoint - position()));
80  return Plane(aPoint, RotationType(xPlane, yPlane));
81  }
82 
84  Plane fastTangent(const LocalPoint& aPoint) const { return fastTangent(toGlobal(aPoint)); }
85 
86 private:
88 };
89 
90 #endif
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
Plane fastTangent(const LocalPoint &aPoint) const
tangent plane to surface from local point
Definition: Cylinder.h:84
ReferenceCountingPointer< Cylinder > BoundCylinderPointer
Definition: Cylinder.h:32
const Bounds & bounds() const
Definition: Surface.h:87
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:77
Definition: Plane.h:16
ConstReferenceCountingPointer< Cylinder > ConstBoundCylinderPointer
Definition: Cylinder.h:33
virtual float thickness() const =0
static CylinderPointer build(Scalar radius, const PositionType &pos, const RotationType &rot, Bounds *bounds=nullptr)
Definition: Cylinder.h:52
Cylinder(Scalar radius, Args &&...args)
Definition: Cylinder.h:22
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const override
tangent plane to surface from global point
Definition: Cylinder.cc:19
~Cylinder() override
Definition: Cylinder.h:59
Scalar theRadius
Definition: Cylinder.h:87
Cylinder(const PositionType &pos, const RotationType &rot, SimpleCylinderBounds const &bounds)
Definition: Cylinder.h:24
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
ConstReferenceCountingPointer< Cylinder > ConstCylinderPointer
Definition: Cylinder.h:31
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
Side side(const LocalPoint &p, Scalar toler) const override
Definition: Cylinder.cc:9
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:28
TkRotation< float > RotationType
const RotationType & rotation() const
Definition: Bounds.h:18
SurfaceOrientation::Side Side
Definition: Surface.h:38
virtual float width() const =0
const PositionType & position() const
ReferenceCountingPointer< Cylinder > CylinderPointer
Definition: Cylinder.h:30