#include <MagneticField/VolumeGeometry/interface/FourPointPlaneBounds.h>
Public Types | |
typedef LocalPoint::ScalarType | Scalar |
Public Member Functions | |
virtual Bounds * | clone () const |
FourPointPlaneBounds (const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d) | |
The corners are ASSUMED to come in cyclic order. | |
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 bool | inside (const Local3DPoint &lp) const |
Determine if the point is inside the bounds. | |
virtual float | length () const |
"Lenght" of the bounded volume; refer to the concrete class documentation for the specific definition. | |
virtual float | thickness () const |
"Thickness" of the bound around the surface; refer to the concrete class documentation for the specific definition. | |
virtual float | width () const |
"width" of the bounds; refer to the concrete class documentation for the specific definition. | |
~FourPointPlaneBounds () | |
Private Member Functions | |
double | checkSide (int i, Scalar x, Scalar y) const |
double | checkSide (int i, const Local2DPoint &lp) const |
const Local2DPoint & | corner (int i) const |
Private Attributes | |
Local2DPoint | corners_ [4] |
Definition at line 10 of file FourPointPlaneBounds.h.
Definition at line 13 of file FourPointPlaneBounds.h.
FourPointPlaneBounds::FourPointPlaneBounds | ( | const LocalPoint & | a, | |
const LocalPoint & | b, | |||
const LocalPoint & | c, | |||
const LocalPoint & | d | |||
) |
The corners are ASSUMED to come in cyclic order.
Definition at line 8 of file FourPointPlaneBounds.cc.
References checkSide(), corner(), corners_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, std::swap(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by clone().
00009 { 00010 corners_[0] = Local2DPoint( a.x(), a.y()); 00011 corners_[1] = Local2DPoint( b.x(), b.y()); 00012 corners_[2] = Local2DPoint( c.x(), c.y()); 00013 corners_[3] = Local2DPoint( d.x(), d.y()); 00014 00015 // check for convexity 00016 for (int i=0; i<4; ++i) { 00017 if (checkSide( i, corner(i+2)) * checkSide( i, corner(i+3)) < 0) { // not on same side 00018 throw GeometryError("FourPointPlaneBounds: coners not in order or not convex"); 00019 } 00020 } 00021 00022 double side = checkSide( 0, corners_[2]); // - for clockwise corners, + for counterclockwise 00023 if (side < 0) { 00024 std::cout << "FourPointPlaneBounds: Changing order of corners to counterclockwise" << std::endl; 00025 std::swap( corners_[1], corners_[3]); 00026 } 00027 }
FourPointPlaneBounds::~FourPointPlaneBounds | ( | ) | [inline] |
Definition at line 41 of file FourPointPlaneBounds.h.
References corner(), v, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().
00041 { 00042 const Local2DPoint& cor( corner(i)); 00043 Local2DVector v( corner(i+1) - cor); 00044 // Local2DVector normal( -v.y(), v.x()); // 90 deg rotated 00045 return -v.y() * (x-cor.x()) + v.x() * (y-cor.y()); // == normal.dot(LP(x,y)-cor)) 00046 }
double FourPointPlaneBounds::checkSide | ( | int | i, | |
const Local2DPoint & | lp | |||
) | const [private] |
Definition at line 29 of file FourPointPlaneBounds.cc.
References PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().
Referenced by FourPointPlaneBounds(), and inside().
Implements Bounds.
Definition at line 32 of file FourPointPlaneBounds.h.
References FourPointPlaneBounds().
00032 {return new FourPointPlaneBounds(*this);}
const Local2DPoint& FourPointPlaneBounds::corner | ( | int | i | ) | const [inline, private] |
Definition at line 38 of file FourPointPlaneBounds.h.
References corners_.
Referenced by checkSide(), and FourPointPlaneBounds().
virtual bool FourPointPlaneBounds::inside | ( | const Local3DPoint & | , | |
const LocalError & | , | |||
float | scale | |||
) | const [inline, virtual] |
bool FourPointPlaneBounds::inside | ( | const Local3DPoint & | ) | const [virtual] |
Determine if the point is inside the bounds.
Implements Bounds.
Definition at line 33 of file FourPointPlaneBounds.cc.
References checkSide(), i, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by inside().
00034 { 00035 for (int i=0; i<4; ++i) { 00036 if (checkSide(i,lp.x(),lp.y()) < 0) return false; 00037 } 00038 return true; 00039 }
float FourPointPlaneBounds::length | ( | ) | const [virtual] |
"Lenght" of the bounded volume; refer to the concrete class documentation for the specific definition.
Implements Bounds.
Definition at line 41 of file FourPointPlaneBounds.cc.
float FourPointPlaneBounds::thickness | ( | ) | const [virtual] |
"Thickness" of the bound around the surface; refer to the concrete class documentation for the specific definition.
Implements Bounds.
Definition at line 43 of file FourPointPlaneBounds.cc.
float FourPointPlaneBounds::width | ( | ) | const [virtual] |
"width" of the bounds; refer to the concrete class documentation for the specific definition.
Implements Bounds.
Definition at line 42 of file FourPointPlaneBounds.cc.
Local2DPoint FourPointPlaneBounds::corners_[4] [private] |
Definition at line 36 of file FourPointPlaneBounds.h.
Referenced by corner(), and FourPointPlaneBounds().