10 #include "CLHEP/Geometry/Point3D.h"
11 #include "CLHEP/Geometry/Normal3D.h"
12 #include "CLHEP/Geometry/Plane3D.h"
17 HepGeom::Point3D<double>
pp;
18 HepGeom::Vector3D<double>
uu;
22 HepLine3D(
const HepGeom::Point3D<double>&
p,
const HepGeom::Vector3D<double>&
v,
double sml = 1.
e-10)
23 :
pp(p),
uu(v * (v.
mag() > 1.
e-10 ? 1. / v.
mag() : 1)),
eps(fabs(sml)) {}
25 HepLine3D(
const HepGeom::Point3D<double>&
p1,
const HepGeom::Point3D<double>&
p2,
double sml = 1.
e-10)
26 :
pp(p1),
uu((p2 - p1) * ((p2 - p1).
mag() > 1.
e-10 ? 1. / (p2 - p1).
mag() : 1)),
eps(fabs(sml)) {}
48 const HepGeom::Point3D<double>&
pt()
const {
return pp; }
50 const HepGeom::Vector3D<double>&
uv()
const {
return uu; }
52 HepGeom::Point3D<double>
point(
const HepGeom::Plane3D<double>& pl,
bool& parallel)
const {
53 const double num(-pl.d() - pl.a() *
pp.x() - pl.b() *
pp.y() - pl.c() *
pp.z());
54 const double den(pl.a() *
uu.x() + pl.b() *
uu.y() + pl.c() *
uu.z());
56 parallel = (
eps > fabs(
num)) || (
eps > fabs(den));
58 return (parallel ?
pp : HepGeom::Point3D<double>(
pp +
uu * (
num / den)));
61 HepGeom::Point3D<double>
point(
const HepGeom::Point3D<double>&
q)
const {
62 return (
pp + ((q.x() -
pp.x()) *
uu.x() + (q.y() -
pp.y()) *
uu.y() + (q.z() -
pp.z()) *
uu.z()) *
uu);
65 double dist2(
const HepGeom::Point3D<double>&
q)
const {
return (q -
point(q)).mag2(); }
66 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)