Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
test
test_intersection2.cxx
Go to the documentation of this file.
1
#include "
WireCellUtil/Point.h
"
2
#include "
WireCellUtil/Intersection.h
"
3
#include "
WireCellUtil/Testing.h
"
4
5
#include <iostream>
6
#include <cmath>
7
#include <map>
8
9
using namespace
WireCell
;
10
using namespace
std
;
11
12
13
int
main
()
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
}
WireCell::Ray
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition:
Point.h:21
WireCell::Point
D3Vector< double > Point
A 3D Cartesian point in double precision.
Definition:
Point.h:15
Point.h
std
STL namespace.
WireCell::D3Vector
Definition:
D3Vector.h:23
Assert
#define Assert
Definition:
Testing.h:7
y
double y
Definition:
GapWidth_module.cc:109
MakeVectorFile.direction
direction
Definition:
MakeVectorFile.py:78
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:53
WireCell::D3Vector::norm
D3Vector norm() const
Return a normalized vector in the direction of this vector.
Definition:
D3Vector.h:91
z
double z
Definition:
GapWidth_module.cc:108
Testing.h
main
int main()
Definition:
test_intersection2.cxx:13
bounds
BoundingBox bounds(int x, int y, int w, int h)
Definition:
main.cpp:37
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition:
pointer.h:1124
WireCell
Definition:
Main.h:22
Vector
std::vector< float > Vector
Definition:
test_AdcSampleScaler.cxx:27
Intersection.h
b
static bool * b
Definition:
config.cpp:1043
train.x
list x
Definition:
train.py:276
WireCell::box_intersection
int box_intersection(const Ray &bounds, const Ray &ray, Ray &hits)
Definition:
Intersection.cxx:61
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11