12 const Point& bmin = bounds.first;
13 const Point& bmax = bounds.second;
15 double hit1[3] = {0}, hit2[3] = {0};
18 if (0 == dir[axis0]) {
22 int axis1 = (axis0 + 1)%3;
23 int axis2 = (axis1 + 1)%3;
26 double intercept = bmin[axis0];
27 double scale = (intercept - point[axis0])/dir[axis0];
29 double one = point[axis1] + scale*dir[axis1];
30 double two = point[axis2] + scale*dir[axis2];
32 if (bmin[axis1] <= one && one <= bmax[axis1] &&
33 bmin[axis2] <= two && two <= bmax[axis2]) {
35 hit1[axis0] = intercept;
42 double intercept = bmax[axis0];
43 double scale = (intercept - point[axis0])/dir[axis0];
45 double one = point[axis1] + scale*dir[axis1];
46 double two = point[axis2] + scale*dir[axis2];
48 if (bmin[axis1] <= one && one <= bmax[axis1] &&
49 bmin[axis2] <= two && two <= bmax[axis2]) {
51 hit2[axis0] = intercept;
64 const Point& point = ray.first;
68 for (
int axis=0; axis<3; ++axis) {
70 int got =
hit_square(axis, bounds, point, dir, res);
74 results.insert(res.first);
78 results.insert(res.second);
82 if (results.size() > 2) {
87 for (
auto hitit = results.begin(); hitit != results.end(); ++hitit) {
89 Vector hitdir = hit - point;
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
int hit_square(int axis0, const Ray &bounds, const Point &point, const Vector &dir, Ray &hits)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
D3Vector norm() const
Return a normalized vector in the direction of this vector.
std::set< Point, ComparePoints > PointSet
BoundingBox bounds(int x, int y, int w, int h)
auto norm(Vector const &v)
Return norm of the specified vector.
Detector simulation of raw signals on wires.
T dot(const D3Vector &rhs) const
Return the dot product of this vector and the other.
int box_intersection(const Ray &bounds, const Ray &ray, Ray &hits)