Cone

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
#ifndef Geom_Cone_H
#define Geom_Cone_H

/** \class Cone
 *
 *  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).
 *
 */

#include "DataFormats/GeometrySurface/interface/Surface.h"

class Cone final : public Surface {
public:
  template <typename... Args>
  Cone(const PositionType& vert, Geom::Theta<Scalar> angle, Args&&... args)
      : Surface(std::forward<Args>(args)...), theVertex(vert), theAngle(angle) {}

  typedef ReferenceCountingPointer<Cone> ConePointer;
  typedef ReferenceCountingPointer<Cone> ConstConePointer;

  /// 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.
  static ConePointer build(const PositionType& pos,
                           const RotationType& rot,
                           const PositionType& vert,
                           Geom::Theta<Scalar> angle) {
    return ConePointer(new Cone(vert, angle, pos, rot));
  }

  // -- DEPRECATED CONSTRUCTOR

  /// Do not use this constructor directly; use the static build method,
  /// which returns a ReferenceCountingPointer.
  /// This constructor will soon become private
  Cone(const PositionType& pos, const RotationType& rot, const PositionType& vert, Geom::Theta<Scalar> angle)
      : Surface(pos, rot), theVertex(vert), theAngle(angle) {}

  // -- Extension of Surface interface for cone

  /// Global position of the cone vertex
  GlobalPoint vertex() const { return theVertex; }

  /// Angle of the cone
  Geom::Theta<float> openingAngle() const { return theAngle; }

  // -- Implementation of Surface interface

  Side side(const LocalPoint& p, Scalar tolerance) const override { return side(toGlobal(p), tolerance); }
  Side side(const GlobalPoint& p, Scalar tolerance) const override;

  // Tangent plane to surface from global point
  ConstReferenceCountingPointer<TangentPlane> tangentPlane(const GlobalPoint&) const override;
  // Tangent plane to surface from local point
  ConstReferenceCountingPointer<TangentPlane> tangentPlane(const LocalPoint&) const override;

private:
  GlobalPoint theVertex;
  Geom::Theta<Scalar> theAngle;
};

#endif