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:
13 
16  FourPointPlaneBounds(const LocalPoint& a, const LocalPoint& b, const LocalPoint& c, const LocalPoint& d);
17  ~FourPointPlaneBounds() override {}
18 
19  float length() const override;
20  float width() const override;
21  float thickness() const override;
22 
23  // basic bounds function
24  bool inside(const Local3DPoint& lp) const override;
25 
26  bool inside(const Local3DPoint& lp, const LocalError& e, float scale) const override { return inside(lp); }
27 
28  Bounds* clone() const override { return new FourPointPlaneBounds(*this); }
29 
30 private:
32 
33  const Local2DPoint& corner(int i) const { return corners_[i % 4]; }
34  double checkSide(int i, const Local2DPoint& lp) const;
35 
36  double checkSide(int i, Scalar x, Scalar y) const {
37  const Local2DPoint& cor(corner(i));
38  Local2DVector v(corner(i + 1) - cor);
39  // Local2DVector normal( -v.y(), v.x()); // 90 deg rotated
40  return -v.y() * (x - cor.x()) + v.x() * (y - cor.y()); // == normal.dot(LP(x,y)-cor))
41  }
42 };
43 
44 #endif
LocalPoint::ScalarType Scalar
Bounds * clone() const override
float width() const override
double checkSide(int i, Scalar x, Scalar y) const
T x() const
Definition: PV2DBase.h:43
const Local2DPoint & corner(int i) const
T y() const
Definition: PV2DBase.h:44
float thickness() const override
bool inside(const Local3DPoint &lp, const LocalError &e, float scale) const override
Determine if a point is inside the bounds, taking error into account.
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
d
Definition: ztail.py:151
float length() const override
bool inside(const Local3DPoint &lp) const override
Determine if the point is inside the bounds.
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
Vector2DBase< float, LocalTag > Local2DVector
Definition: Bounds.h:18
double checkSide(int i, const Local2DPoint &lp) const