Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
+18 -18
View File
@@ -4,18 +4,18 @@
#ifndef tools_line
#define tools_line
#include "vec3"
namespace tools {
// Parametric description:
// l(t) = pos + t * dir
template <class T>
template <class VEC3>
class line {
protected:
typedef typename VEC3::elem_t T;
public:
line(){}
line(const vec3<T>& a_p0,const vec3<T>& a_p1) {
line(const VEC3& a_p0,const VEC3& a_p1) {
// Construct a line from two points lying on the line. If you
// want to construct a line from a position and a direction, use
// line(p, p + d).
@@ -45,7 +45,7 @@ public:
return *this;
}
public:
void set_value(const vec3<T>& a_p0,const vec3<T>& a_p1) {
void set_value(const VEC3& a_p0,const VEC3& a_p1) {
m_pos = a_p0;
m_dir = a_p0;
m_dir.multiply(-1);
@@ -59,11 +59,11 @@ public:
m_dir.normalize();
}
const vec3<T>& position() const {return m_pos;}
const vec3<T>& direction() const {return m_dir;}
const VEC3& position() const {return m_pos;}
const VEC3& direction() const {return m_dir;}
/* not tested :
vec3<T> closest_point(const vec3<T>& a_point) const {
VEC3 closest_point(const VEC3& a_point) const {
//from coin3d/SbLine.cpp.
//
@@ -81,7 +81,7 @@ public:
bool closest_points(const line<T>& a_line,
vec3<T>& a_on_this,vec3<T>& a_on_line) const {
VEC3& a_on_this,VEC3& a_on_line) const {
//from coin3d/SbLine.cpp.
//WARNING : if ret false, a_on_this, a_on_line not set.
@@ -91,11 +91,11 @@ public:
if(a_line.m_dir == m_dir) return false;
if(a_line.m_dir == T(-1)*m_dir) return false;
vec3<T> P0 = m_pos;
vec3<T> P1 = a_line.m_pos;
vec3<T> D0 = m_dir;
vec3<T> D1 = a_line.m_dir;
vec3<T> D0N = D0;
VEC3 P0 = m_pos;
VEC3 P1 = a_line.m_pos;
VEC3 D0 = m_dir;
VEC3 D1 = a_line.m_dir;
VEC3 D0N = D0;
T c[3], d[3];
@@ -116,8 +116,8 @@ public:
return true;
}
bool intersect(const line<T>& a_line,vec3<T>& a_out,const T& a_prec) const {
vec3<T> p,q;
bool intersect(const line<T>& a_line,VEC3& a_out,const T& a_prec) const {
VEC3 p,q;
if(!closest_points(a_line,p,q)) return false;
if((q-p).length()>a_prec) return false;
a_out = p;
@@ -126,8 +126,8 @@ public:
*/
protected:
vec3<T> m_pos;
vec3<T> m_dir; //normalized.
VEC3 m_pos;
VEC3 m_dir; //normalized.
};
}