test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
FourPointPlaneBounds Class Reference

#include <FourPointPlaneBounds.h>

Inheritance diagram for FourPointPlaneBounds:
Bounds

Public Types

typedef LocalPoint::ScalarType Scalar
 

Public Member Functions

virtual Boundsclone () 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. More...
 
virtual bool inside (const Local3DPoint &lp, const LocalError &e, float scale) const
 Determine if a point is inside the bounds, taking error into account. More...
 
virtual float length () const
 
virtual float thickness () const
 
virtual float width () const
 
 ~FourPointPlaneBounds ()
 
- Public Member Functions inherited from Bounds
void computeSpan (Surface const &plane)
 
virtual bool inside (const Local2DPoint &p) const
 
virtual bool inside (const Local2DPoint &p, float tollerance) const
 Determine if a point is inside the bounds, taking a tollerance into account. More...
 
virtual bool inside (const Local2DPoint &p, const LocalError &err, float scale=1.f) const
 Determine if a 2D point is inside the bounds, taking error into account. More...
 
std::pair< float, float > const & phiSpan () const
 
std::pair< float, float > const & rSpan () const
 
virtual float widthAtHalfLength () const
 Width at half length. Useful for e.g. pitch definition. More...
 
std::pair< float, float > const & zSpan () const
 
virtual ~Bounds ()
 

Private Member Functions

double checkSide (int i, const Local2DPoint &lp) const
 
double checkSide (int i, Scalar x, Scalar y) const
 
const Local2DPointcorner (int i) const
 

Private Attributes

Local2DPoint corners_ [4]
 

Detailed Description

Definition at line 10 of file FourPointPlaneBounds.h.

Member Typedef Documentation

Definition at line 13 of file FourPointPlaneBounds.h.

Constructor & Destructor Documentation

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_, gather_cfg::cout, i, std::swap(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by clone().

9  {
10  corners_[0] = Local2DPoint( a.x(), a.y());
11  corners_[1] = Local2DPoint( b.x(), b.y());
12  corners_[2] = Local2DPoint( c.x(), c.y());
13  corners_[3] = Local2DPoint( d.x(), d.y());
14 
15 // check for convexity
16  for (int i=0; i<4; ++i) {
17  if (checkSide( i, corner(i+2)) * checkSide( i, corner(i+3)) < 0) { // not on same side
18  throw GeometryError("FourPointPlaneBounds: coners not in order or not convex");
19  }
20  }
21 
22  double side = checkSide( 0, corners_[2]); // - for clockwise corners, + for counterclockwise
23  if (side < 0) {
24  std::cout << "FourPointPlaneBounds: Changing order of corners to counterclockwise" << std::endl;
25  std::swap( corners_[1], corners_[3]);
26  }
27 }
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:63
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const Local2DPoint & corner(int i) const
double checkSide(int i, const Local2DPoint &lp) const
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
FourPointPlaneBounds::~FourPointPlaneBounds ( )
inline

Definition at line 19 of file FourPointPlaneBounds.h.

19 {}

Member Function Documentation

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().

29  {
30  return checkSide(i, lp.x(), lp.y());
31 }
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:46
double checkSide(int i, const Local2DPoint &lp) const
T x() const
Definition: PV2DBase.h:45
double FourPointPlaneBounds::checkSide ( int  i,
Scalar  x,
Scalar  y 
) const
inlineprivate

Definition at line 41 of file FourPointPlaneBounds.h.

References corner(), findQualityFiles::v, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

41  {
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  }
int i
Definition: DBlmapReader.cc:9
const Local2DPoint & corner(int i) const
virtual Bounds* FourPointPlaneBounds::clone ( void  ) const
inlinevirtual

Implements Bounds.

Definition at line 32 of file FourPointPlaneBounds.h.

References FourPointPlaneBounds().

32 {return new FourPointPlaneBounds(*this);}
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
const Local2DPoint& FourPointPlaneBounds::corner ( int  i) const
inlineprivate

Definition at line 38 of file FourPointPlaneBounds.h.

References corners_.

Referenced by checkSide(), and FourPointPlaneBounds().

38 {return corners_[i%4];}
int i
Definition: DBlmapReader.cc:9
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().

34 {
35  for (int i=0; i<4; ++i) {
36  if (checkSide(i,lp.x(),lp.y()) < 0) return false;
37  }
38  return true;
39 }
int i
Definition: DBlmapReader.cc:9
double checkSide(int i, const Local2DPoint &lp) const
virtual bool FourPointPlaneBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale 
) const
inlinevirtual

Determine if a point is inside the bounds, taking error into account.

Implements Bounds.

Definition at line 28 of file FourPointPlaneBounds.h.

References inside().

28  {
29  return inside( lp);
30  }
virtual bool inside(const Local3DPoint &lp) const
Determine if the point is inside the bounds.
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.

41 {return 0;}
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.

43 {return 0;}
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.

Referenced by Vispa.Main.MainWindow.MainWindow::_saveIni(), Vispa.Views.PropertyView.PropertyView::resizeEvent(), Vispa.Views.PropertyView.PropertyView::sectionResized(), and Vispa.Main.MainWindow.MainWindow::updateStartupScreenGeometry().

42 {return 0;}

Member Data Documentation

Local2DPoint FourPointPlaneBounds::corners_[4]
private

Definition at line 36 of file FourPointPlaneBounds.h.

Referenced by corner(), and FourPointPlaneBounds().