CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourPointPlaneBounds.cc
Go to the documentation of this file.
1 // #include "Utilities/Configuration/interface/Architecture.h"
2 
5 #include <algorithm>
6 #include <iostream>
7 
9  const LocalPoint& c, const LocalPoint& d) {
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 }
28 
29 double FourPointPlaneBounds::checkSide( int i, const Local2DPoint& lp) const {
30  return checkSide(i, lp.x(), lp.y());
31 }
32 
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 }
40 
41 float FourPointPlaneBounds::length() const {return 0;}
42 float FourPointPlaneBounds::width() const {return 0;}
43 float FourPointPlaneBounds::thickness() const {return 0;}
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV2DBase.h:45
virtual float width() const
T y() const
Definition: PV3DBase.h:62
virtual float length() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
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
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:61