CMS 3D CMS Logo

FourPointPlaneBounds.h
Go to the documentation of this file.
1 #ifndef FourPointPlaneBounds_H
2 #define FourPointPlaneBounds_H
3 
7 
9 
10 class FourPointPlaneBounds : public Bounds {
11 public:
12 
14 
17  FourPointPlaneBounds( const LocalPoint& a, const LocalPoint& b,
18  const LocalPoint& c, const LocalPoint& d);
19  ~FourPointPlaneBounds() override {}
20 
21  float length() const override;
22  float width() const override;
23  float thickness() const override;
24 
25  // basic bounds function
26  bool inside( const Local3DPoint& lp) const override;
27 
28  bool inside( const Local3DPoint& lp , const LocalError& e, float scale) const override {
29  return inside( lp);
30  }
31 
32  Bounds* clone() const override {return new FourPointPlaneBounds(*this);}
33 
34 private:
35 
37 
38  const Local2DPoint& corner(int i) const {return corners_[i%4];}
39  double checkSide( int i, const Local2DPoint& lp) const;
40 
41  double checkSide( int i, Scalar x, Scalar y) const {
42  const Local2DPoint& cor( corner(i));
43  Local2DVector v( corner(i+1) - cor);
44  // Local2DVector normal( -v.y(), v.x()); // 90 deg rotated
45  return -v.y() * (x-cor.x()) + v.x() * (y-cor.y()); // == normal.dot(LP(x,y)-cor))
46  }
47 
48 };
49 
50 #endif
LocalPoint::ScalarType Scalar
bool inside(const Local3DPoint &lp, const LocalError &e, float scale) const override
Determine if a point is inside the bounds, taking error into account.
T y() const
Definition: PV2DBase.h:46
float thickness() const override
Vector2DBase< float, LocalTag > Local2DVector
T ScalarType
Definition: PV3DBase.h:18
double checkSide(int i, Scalar x, Scalar y) const
float width() const override
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
Bounds * clone() const override
float length() const override
double b
Definition: hdecay.h:120
const Local2DPoint & corner(int i) const
double checkSide(int i, const Local2DPoint &lp) const
double a
Definition: hdecay.h:121
Definition: Bounds.h:22
T x() const
Definition: PV2DBase.h:45
bool inside(const Local3DPoint &lp) const override
Determine if the point is inside the bounds.