CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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& b,
10  const LocalPoint& c,
11  const LocalPoint& d) {
12  corners_[0] = Local2DPoint(a.x(), a.y());
13  corners_[1] = Local2DPoint(b.x(), b.y());
14  corners_[2] = Local2DPoint(c.x(), c.y());
15  corners_[3] = Local2DPoint(d.x(), d.y());
16 
17  // check for convexity
18  for (int i = 0; i < 4; ++i) {
19  if (checkSide(i, corner(i + 2)) * checkSide(i, corner(i + 3)) < 0) { // not on same side
20  throw GeometryError("FourPointPlaneBounds: coners not in order or not convex");
21  }
22  }
23 
24  double side = checkSide(0, corners_[2]); // - for clockwise corners, + for counterclockwise
25  if (side < 0) {
26  std::cout << "FourPointPlaneBounds: Changing order of corners to counterclockwise" << std::endl;
27  std::swap(corners_[1], corners_[3]);
28  }
29 }
30 
31 double FourPointPlaneBounds::checkSide(int i, const Local2DPoint& lp) const { return checkSide(i, lp.x(), lp.y()); }
32 
34  for (int i = 0; i < 4; ++i) {
35  if (checkSide(i, lp.x(), lp.y()) < 0)
36  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; }
float width() const override
const edm::EventSetup & c
T y() const
Definition: PV2DBase.h:44
T y() const
Definition: PV3DBase.h:60
tuple d
Definition: ztail.py:151
float thickness() const override
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
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
const Local2DPoint & corner(int i) const
double checkSide(int i, const Local2DPoint &lp) const
double a
Definition: hdecay.h:119
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
tuple cout
Definition: gather_cfg.py:144
T x() const
Definition: PV2DBase.h:43
T x() const
Definition: PV3DBase.h:59