CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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);
20 
21  virtual float length() const;
22  virtual float width() const;
23  virtual float thickness() const;
24 
25  // basic bounds function
26  virtual bool inside( const Local3DPoint& lp) const;
27 
28  virtual bool inside( const Local3DPoint& lp , const LocalError& e, float scale) const {
29  return inside( lp);
30  }
31 
32  virtual Bounds* clone() const {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
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:46
virtual bool inside(const Local3DPoint &lp, const LocalError &e, float scale) const
Determine if a point is inside the bounds, taking error into account.
virtual float width() const
virtual float length() const
Vector2DBase< float, LocalTag > Local2DVector
virtual Bounds * clone() const
tuple d
Definition: ztail.py:151
double checkSide(int i, Scalar x, Scalar y) const
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
virtual bool inside(const Local3DPoint &lp) const
Determine if the point is inside the bounds.
virtual float thickness() const
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