10 #include "CLHEP/Geometry/Point3D.h" 11 #include "CLHEP/Geometry/Normal3D.h" 12 #include "CLHEP/Geometry/Plane3D.h" 24 HepGeom::Point3D<double>
pp ;
25 HepGeom::Vector3D<double>
uu ;
31 const HepGeom::Vector3D<double> &
v,
32 double sml = 1.
e-10 ) :
34 uu ( v*( v.
mag()>1.
e-10 ? 1./v.
mag() : 1 ) ),
35 eps ( fabs( sml ) ) {}
38 const HepGeom::Point3D<double> &
p2,
39 double sml = 1.
e-10 ) :
41 uu ( (p2-p1)*( (p2-p1).
mag()>1.
e-10 ? 1./(p2-p1).
mag() : 1 ) ),
42 eps ( fabs( sml ) ) {}
46 pp (line.pp), uu(line.uu), eps(line.eps) {}
54 pp = line.
pp; uu = line.
uu; eps = line.
eps;
return *
this;
60 return pp == l.
pp && uu == l.
uu ;
66 return pp != l.
pp || uu != l.
uu ;
69 const HepGeom::Point3D<double> &
pt()
const {
return pp ; }
71 const HepGeom::Vector3D<double> &
uv()
const {
return uu ; }
73 HepGeom::Point3D<double>
point(
const HepGeom::Plane3D<double>& pl,
bool& parallel )
const 75 const double num ( -pl.d() - pl.a()*pp.x() - pl.b()*pp.y() - pl.c()*pp.z() ) ;
76 const double den ( pl.a()*uu.x() + pl.b()*uu.y() + pl.c()*uu.z() ) ;
78 parallel = ( eps > fabs(
num ) ) || ( eps > fabs( den ) ) ;
80 return ( parallel ? pp : HepGeom::Point3D<double> ( pp + uu*(
num/den) ) ) ;
83 HepGeom::Point3D<double>
point(
const HepGeom::Point3D<double> &
q )
const 85 return ( pp + ( ( q.x() - pp.x() )*uu.x() +
86 ( q.y() - pp.y() )*uu.y() +
87 ( q.z() - pp.z() )*uu.z() )*uu ) ;
90 double dist2(
const HepGeom::Point3D<double> &
q )
const {
return ( q -
point( q ) ).mag2() ; }
91 double dist(
const HepGeom::Point3D<double> &
q )
const {
return ( q -
point( q ) ).mag() ; }
double dist2(const HepGeom::Point3D< double > &q) const
HepLine3D & operator=(const HepLine3D &line)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
HepGeom::Point3D< double > pp
HepLine3D(const HepGeom::Point3D< double > &p, const HepGeom::Vector3D< double > &v, double sml=1.e-10)
const HepGeom::Vector3D< double > & uv() const
bool operator==(const HepLine3D &l) const
double dist(const HepGeom::Point3D< double > &q) const
HepLine3D(const HepGeom::Point3D< double > &p1, const HepGeom::Point3D< double > &p2, double sml=1.e-10)
bool operator!=(const HepLine3D &l) const
HepGeom::Vector3D< double > uu
HepGeom::Point3D< double > point(const HepGeom::Plane3D< double > &pl, bool ¶llel) const
HepGeom::Point3D< double > point(const HepGeom::Point3D< double > &q) const
const HepGeom::Point3D< double > & pt() const
HepLine3D(const HepLine3D &line)