Functions
test_intersection2.cxx File Reference
#include "WireCellUtil/Point.h"
#include "WireCellUtil/Intersection.h"
#include "WireCellUtil/Testing.h"
#include <iostream>
#include <cmath>
#include <map>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 13 of file test_intersection2.cxx.

14 {
15  D3Vector<int> a( 3 , 4 , 5 ) , b ( 4 , 3 , 5 ) , c( -5 , -12 , -13 ) ;
16  cout << "a . b : " << a.dot( b ) << endl ;
17  cout << "a x b : " << a.cross( b ) << endl ;
18  cout << "a . b x c : " << a.triplescal( b , c ) << endl ;
19  cout << "a x b x c : " << a.triplevec( b , c ) << endl ;
20 
21  Ray bounds(Point(0,0,0), Point(1,1,1));
22  Vector direction = Point(1,1,1).norm();
23 
24  for (double x = -1.1; x <= 1; x+=0.5) {
25  for (double y = -1.1; y <= 1; y+=0.5) {
26  for (double z = -1.0; z <= 1; z+=0.5) {
27  Vector point(x,y,z);
28  Ray ray(point, point+direction);
29  Ray hits(Point(-111,-111,-111), Point(-222,-222,-222));
30 
31  int hitmask = box_intersection(bounds, ray, hits);
32  cerr << "RESULT: " << hitmask
33  << " p=" << point
34  << " hits=" << hits << endl;
35  Assert(hitmask >= 0);
36  }
37 
38  }
39  }
40 
41 
42  return 0 ;
43 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
#define Assert
Definition: Testing.h:7
double y
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
double z
BoundingBox bounds(int x, int y, int w, int h)
Definition: main.cpp:37
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
std::vector< float > Vector
static bool * b
Definition: config.cpp:1043
list x
Definition: train.py:276
int box_intersection(const Ray &bounds, const Ray &ray, Ray &hits)
QTextStream & endl(QTextStream &s)