/usr/include/CLHEP/Geometry/Point3D.h is in libclhep-dev 2.1.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | // -*- C++ -*-
// $Id: Point3D.h,v 1.5 2010/06/16 16:21:27 garren Exp $
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// History:
// 09.09.96 E.Chernyaev - initial version
// 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple
// the functionality from CLHEP::Hep3Vector
// 01.04.03 E.Chernyaev - CLHEP-1.9: template version
//
#ifndef HEP_POINT3D_H
#define HEP_POINT3D_H
#include <iosfwd>
#include "CLHEP/Geometry/defs.h"
#include "CLHEP/Vector/ThreeVector.h"
#include "CLHEP/Geometry/BasicVector3D.h"
namespace HepGeom {
class Transform3D;
/**
* Geometrical 3D Point.
* This is just a declaration of the class needed to define
* specializations Point3D<float> and Point3D<double>.
*
* @ingroup geometry
* @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
*/
template<class T>
class Point3D : public BasicVector3D<T> {};
/**
* Geometrical 3D Point with components of float type.
*
* @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
* @ingroup geometry
*/
template<>
class Point3D<float> : public BasicVector3D<float> {
public:
/**
* Default constructor. */
Point3D() {}
/**
* Constructor from three numbers. */
Point3D(float x1, float y1, float z1) : BasicVector3D<float>(x1,y1,z1) {}
/**
* Constructor from array of floats. */
explicit Point3D(const float * a)
: BasicVector3D<float>(a[0],a[1],a[2]) {}
/**
* Copy constructor. */
Point3D(const Point3D<float> & v) : BasicVector3D<float>(v) {}
/**
* Constructor from BasicVector3D<float>. */
Point3D(const BasicVector3D<float> & v) : BasicVector3D<float>(v) {}
/**
* Destructor. */
~Point3D() {}
/**
* Assignment. */
Point3D<float> & operator=(const Point3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
/**
* Assignment from BasicVector3D<float>. */
Point3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
/**
* Returns distance to the origin squared. */
float distance2() const { return mag2(); }
/**
* Returns distance to the point squared. */
float distance2(const Point3D<float> & p) const {
float dx = p.x()-x(), dy = p.y()-y(), dz = p.z()-z();
return dx*dx + dy*dy + dz*dz;
}
/**
* Returns distance to the origin. */
float distance() const { return std::sqrt(distance2()); }
/**
* Returns distance to the point. */
float distance(const Point3D<float> & p) const {
return std::sqrt(distance2(p));
}
/**
* Transformation by Transform3D. */
Point3D<float> & transform(const Transform3D & m);
};
/**
* Transformation of Point3D<float> by Transform3D.
* @relates Point3D
*/
Point3D<float>
operator*(const Transform3D & m, const Point3D<float> & p);
/**
* Geometrical 3D Point with components of double type.
*
* @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
* @ingroup geometry
*/
template<>
class Point3D<double> : public BasicVector3D<double> {
public:
/**
* Default constructor. */
Point3D() {}
/**
* Constructor from three numbers. */
Point3D(double x1, double y1, double z1) : BasicVector3D<double>(x1,y1,z1) {}
/**
* Constructor from array of floats. */
explicit Point3D(const float * a)
: BasicVector3D<double>(a[0],a[1],a[2]) {}
/**
* Constructor from array of doubles. */
explicit Point3D(const double * a)
: BasicVector3D<double>(a[0],a[1],a[2]) {}
/**
* Copy constructor. */
Point3D(const Point3D<double> & v) : BasicVector3D<double>(v) {}
/**
* Constructor from BasicVector3D<float>. */
Point3D(const BasicVector3D<float> & v) : BasicVector3D<double>(v) {}
/**
* Constructor from BasicVector3D<double>. */
Point3D(const BasicVector3D<double> & v) : BasicVector3D<double>(v) {}
/**
* Destructor. */
~Point3D() {}
/**
* Constructor from CLHEP::Hep3Vector.
* This constructor is needed only for backward compatibility and
* in principle should be absent.
*/
Point3D(const CLHEP::Hep3Vector & v)
: BasicVector3D<double>(v.x(),v.y(),v.z()) {}
/**
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
/**
* Assignment. */
Point3D<double> & operator=(const Point3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
/**
* Assignment from BasicVector3D<float>. */
Point3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
/**
* Assignment from BasicVector3D<double>. */
Point3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
/**
* Returns distance to the origin squared. */
double distance2() const { return mag2(); }
/**
* Returns distance to the point squared. */
double distance2(const Point3D<double> & p) const {
double dx = p.x()-x(), dy = p.y()-y(), dz = p.z()-z();
return dx*dx + dy*dy + dz*dz;
}
/**
* Returns distance to the origin. */
double distance() const { return std::sqrt(distance2()); }
/**
* Returns distance to the point. */
double distance(const Point3D<double> & p) const {
return std::sqrt(distance2(p));
}
/**
* Transformation by Transform3D. */
Point3D<double> & transform(const Transform3D & m);
};
/**
* Transformation of Point3D<double> by Transform3D.
* @relates Point3D
*/
Point3D<double>
operator*(const Transform3D & m, const Point3D<double> & p);
} /* namespace HepGeom */
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
// backwards compatibility will be enabled ONLY in CLHEP 1.9
#include "CLHEP/config/CLHEP.h"
#include "CLHEP/Geometry/Normal3D.h"
#include "CLHEP/Geometry/Transform3D.h"
typedef HepGeom::Point3D<double> HepPoint3D;
#endif
#endif /* HEP_POINT3D_H */
|