diff --git a/Core/Core.pro b/Core/Core.pro index 47d648c81aadef09e390203ac71ec6a8a4bc981b..6a866987c3e019b244204c3f1a62c8c6a848338b 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -13,11 +13,7 @@ QMAKE_EXTENSION_SHLIB = so # making standard *.so extension # ----------------------------------------------------------------------------- SOURCES += \ Geometry/src/BasicVector3D.cpp \ - Geometry/src/Normal3D.cpp \ - Geometry/src/Plane3D.cpp \ - Geometry/src/Point3D.cpp \ Geometry/src/Transform3D.cpp \ - Geometry/src/Vector3D.cpp \ \ Tools/src/AxisBin.cpp \ Tools/src/AxisDouble.cpp \ @@ -134,11 +130,7 @@ SOURCES += \ HEADERS += \ Geometry/inc/BasicVector3D.h \ - Geometry/inc/Normal3D.h \ - Geometry/inc/Plane3D.h \ - Geometry/inc/Point3D.h \ Geometry/inc/Transform3D.h \ - Geometry/inc/Vector3D.h \ \ Tools/inc/AxisBin.h \ Tools/inc/AxisDouble.h \ diff --git a/Core/Geometry/inc/Normal3D.h b/Core/Geometry/inc/Normal3D.h deleted file mode 100755 index 123f544c33042c215116750bc7997e97a28bd3c1..0000000000000000000000000000000000000000 --- a/Core/Geometry/inc/Normal3D.h +++ /dev/null @@ -1,96 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.3 2003/10/23 21:29:50 -// -//! @file Geometry/inc/Normal3D.h -//! @brief defines class Normal3D<double>, and implements most functions -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#ifndef GEOMETRY_NORMAL3D_H -#define GEOMETRY_NORMAL3D_H - -#include "BasicVector3D.h" - -namespace Geometry { - -class Transform3D; - -//! A three-dimensional normal vector of templated coordinate type. - -//! Note that this is not a unit vector. -//! It seems to be a regular vector, except for the behaviour under -//! reflection and scaling. -//! -//! @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -template<class T> -class Normal3D : public BasicVector3D<T> {}; - - -//! A three-dimensional normal vector with double-precision coordinates. - -//! @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -template<> -class Normal3D<double> : public BasicVector3D<double> { -public: - - //! Default constructor. - Normal3D() {} - //! Constructor from three numbers. - Normal3D(double x1, double y1, double z1) - : BasicVector3D<double>(x1,y1,z1) {} - - //! Constructor from array of doubles. - explicit Normal3D(const double* a) - : BasicVector3D<double>(a[0],a[1],a[2]) {} - - //! Constructor from BasicVector3D<double>. - Normal3D(const BasicVector3D<double>& v) - : BasicVector3D<double>(v) {} - - //! Copy constructor. - Normal3D(const Normal3D<double>& v) - : BasicVector3D<double>(v) {} - - //! Destructor. - ~Normal3D() {} - - //! Assignment. - Normal3D<double>& operator=(const Normal3D<double>& v) - { setXYZ(v.x(),v.y(),v.z()); return *this; } - - //! Assignment from BasicVector3D<double>. - Normal3D<double>& operator=(const BasicVector3D<double>& v) - { setXYZ(v.x(),v.y(),v.z()); return *this; } - - //! Transformation by Transform3D. - Normal3D<double>& transform(const Transform3D& m); -}; - -//! Transformation of Normal<double> by Transform3D. - -//! @relates Normal3D -//! -Normal3D<double> -operator*(const Transform3D & m, const Normal3D<double> & n); - -} // namespace Geometry - -#endif /* GEOMETRY_NORMAL3D_H */ diff --git a/Core/Geometry/inc/Plane3D.h b/Core/Geometry/inc/Plane3D.h deleted file mode 100755 index 72f1e2d7752d2e18c4b8888916ae847ab54f9f30..0000000000000000000000000000000000000000 --- a/Core/Geometry/inc/Plane3D.h +++ /dev/null @@ -1,134 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.5 2010/06/16 16:21:27 -// -//! @file Geometry/inc/Plane3D.h -//! @brief defines class Plane3D<double>, and implements most functions -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -// -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#ifndef GEOMETRY_PLANE3D_H -#define GEOMETRY_PLANE3D_H - -#include "Point3D.h" -#include "Normal3D.h" -#include "Transform3D.h" - -namespace Geometry { - -//! A geometrical plane in three-dimensional space; templated coordinate type. - -//! @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -template<class T> -class Plane3D { - protected: - T a_, b_, c_, d_; - - public: - //! Default constructor - creates plane z=0. - Plane3D() : a_(0.), b_(0.), c_(1.), d_(0.) {} - - //! Constructor from four numbers - creates plane a*x+b*y+c*z+d=0. - Plane3D(T a1, T b1, T c1, T d1) : a_(a1), b_(b1), c_(c1), d_(d1) {} - - //! Constructor from normal and point. - Plane3D(const Normal3D<T> & n, const Point3D<T> & p) - : a_(n.x()), b_(n.y()), c_(n.z()), d_(-n*p) {} - - //! Constructor from three points. - Plane3D(const Point3D<T> & p1, - const Point3D<T> & p2, - const Point3D<T> & p3) { - Normal3D<T> n = (p2-p1).cross(p3-p1); - a_ = n.x(); b_ = n.y(); c_ = n.z(); d_ = -n*p1; - } - - //! Destructor. - ~Plane3D() {}; - - //! Assignment. - Plane3D<T> & operator=(const Plane3D<T> & p) { - a_ = p.a_; b_ = p.b_; c_ = p.c_; d_ = p.d_; return *this; } - - //! Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. - T a() const { return a_; } - - //! Returns the b-coefficient in the plane equation: a*x+b*y+c*z+d=0. - T b() const { return b_; } - - //! Returns the c-coefficient in the plane equation: a*x+b*y+c*z+d=0. - T c() const { return c_; } - - //! Returns the free member of the plane equation: a*x+b*y+c*z+d=0. - T d() const { return d_; } - - //! Returns normal. - Normal3D<T> normal() const { return Normal3D<T>(a_,b_,c_); } - - //! Normalization. - Plane3D<T> & normalize() { - double ll = std::sqrt(a_*a_ + b_*b_ + c_*c_); - if (ll > 0.) { a_ /= ll; b_ /= ll; c_ /= ll, d_ /= ll; } - return *this; - } - - //! Returns distance to the point. - T distance(const Point3D<T> & p) const { - return a()*p.x() + b()*p.y() + c()*p.z() + d(); - } - - //! Returns projection of the point to the plane. - Point3D<T> point(const Point3D<T> & p) const { - T k = distance(p)/(a()*a()+b()*b()+c()*c()); - return Point3D<T>(p.x()-a()*k, p.y()-b()*k, p.z()-c()*k); - } - - //! Returns projection of the origin to the plane. - Point3D<T> point() const { - T k = -d()/(a()*a()+b()*b()+c()*c()); - return Point3D<T>(a()*k, b()*k, c()*k); - } - - //! Test for equality. - bool operator == (const Plane3D<T> & p) const { - return a() == p.a() && b() == p.b() && c() == p.c() && d() == p.d(); - } - - //! Test for inequality. - bool operator != (const Plane3D<T> & p) const { - return a() != p.a() || b() != p.b() || c() != p.c() || d() != p.d(); - } - - //! Transformation by Transform3D. - Plane3D<T> & transform(const Transform3D & m) { - Normal3D<T> n = normal(); - n.transform(m); - d_ = -n*point().transform(m); a_ = n.x(); b_ = n.y(); c_ = n.z(); - return *this; - } -}; - -//! Output to the stream. -//! @relates Plane3D - -std::ostream & operator<<(std::ostream & os, const Plane3D<double> & p); - -} // namespace Geometry - -#endif /* GEOMETRY_PLANE3D_H */ diff --git a/Core/Geometry/inc/Point3D.h b/Core/Geometry/inc/Point3D.h deleted file mode 100755 index 639d2631ac86aabc2a573bdbb6f878df7fccf29f..0000000000000000000000000000000000000000 --- a/Core/Geometry/inc/Point3D.h +++ /dev/null @@ -1,90 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.5 2010/06/16 16:21:27 -// -//! @file Geometry/inc/Point3D.h -//! @brief defines class Point3D<double>, and implements most functions -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -// -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#ifndef GEOMETRY_POINT3D_H -#define GEOMETRY_POINT3D_H - -#include "BasicVector3D.h" - -namespace Geometry { - -class Transform3D; - -//! A geometrical point in three dimensions with of templated coordinate type. - -//! @author Evgeni Chernyaev 1996-2003 -//! -template<class T> -class Point3D : public BasicVector3D<T> {}; - -//! A geometrical point in three dimensions, with double-precision coordinates. - -//! @author Evgeni Chernyaev 1996-2003 -//! -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 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<double>. - Point3D(const BasicVector3D<double> & v) : BasicVector3D<double>(v) {} - //! Destructor. - ~Point3D() {} - //! Assignment. - Point3D<double> & operator=(const Point3D<double> & v) { - setXYZ(v.x(),v.y(),v.z()); return *this; } - //! Assignment from BasicVector3D<double>. - Point3D<double> & operator=(const BasicVector3D<double> & v) { - setXYZ(v.x(),v.y(),v.z()); return *this; } - - //! Returns squared distance to a given point. - 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 a given 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 Geometry - -#endif /* GEOMETRY_POINT3D_H */ diff --git a/Core/Geometry/inc/Transform3D.h b/Core/Geometry/inc/Transform3D.h index d5dd7f408fc2a2eca19b56c7db0e2c6c485af261..963655a467489f2f16a027b3e0d265afa8194ac9 100755 --- a/Core/Geometry/inc/Transform3D.h +++ b/Core/Geometry/inc/Transform3D.h @@ -26,9 +26,12 @@ #define GEOMETRY_TRANSFROM3D_H #include <cmath> -#include "Point3D.h" -#include "Vector3D.h" -#include "Normal3D.h" +#include "BasicVector3D.h" + +// remnants of CLHEP: +#define Point3D BasicVector3D +#define Vector3D BasicVector3D +#define Normal3D BasicVector3D namespace Geometry { @@ -273,24 +276,6 @@ class Transform3D { //! Transform3D operator*(const Transform3D& b) const; - //! Decomposition of general transformation. - //! - //! This function returns a decomposition of the transformation - //! into three sequential transformations: Scale3D, - //! then Rotate3D, then Translate3, i.e. - //! @code - //! Transform3D = Translate3D * Rotate3D * Scale3D - //! @endcode - //! - //! @param scale output: scaling transformation; - //! if there was a reflection, then scale factor for - //! z-component (scale(2,2)) will be negative. - //! @param rotation output: rotation transformaion. - //! @param translation output: translation transformaion. - void getDecomposition(Scale3D& scale, - Rotate3D& rotation, - Translate3D& translation) const; - //! Test for equality. bool operator == (const Transform3D& transform) const; @@ -409,214 +394,6 @@ public: } }; -// ************************************************************************** // -// Translations -// ************************************************************************** // - -//! A translation of 3D geometrical objects (points, vectors, normals). - -//! This class provides additional constructors for Transform3D -//! and should not be used as a separate class. -//! -//! Example of use: -//! @code -//! Transform3D m; -//! m = Translate3D(10.,20.,30.); -//! @endcode -//! -//! @author <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -class Translate3D : public Transform3D { -public: - //! Default constructor: sets the Identity transformation. - Translate3D() : Transform3D() {} - - //! Constructor from three numbers. - Translate3D(double x, double y, double z) - : Transform3D(1.0,0.0,0.0,x, 0.0,1.0,0.0,y, 0.0,0.0,1.0,z) {} -}; - -//! A translation along the x-axis. - -//! Should not be instantiated: see Translate3D for example of use. -//! -class TranslateX3D : public Translate3D { -public: - //! Default constructor: sets the Identity transformation. - TranslateX3D() : Translate3D() {} - - //! Constructor from a number. - TranslateX3D(double x) : Translate3D(x, 0.0, 0.0) {} -}; - -//! A translation along the y-axis. - -//! Should not be instantiated: see Translate3D for example of use. -//! -class TranslateY3D : public Translate3D { -public: - //! Default constructor: sets the Identity transformation. - TranslateY3D() : Translate3D() {} - - //! Constructor from a number. - TranslateY3D(double y) : Translate3D(0.0, y, 0.0) {} -}; - -//! A translation along the z-axis. - -//! Should not be instantiated: see Translate3D for example of use. -//! -class TranslateZ3D : public Translate3D { -public: - //! Default constructor: sets the Identity transformation. - TranslateZ3D() : Translate3D() {} - - //! Constructor from a number. - TranslateZ3D(double z) : Translate3D(0.0, 0.0, z) {} -}; - -// ************************************************************************** // -// Reflections -// ************************************************************************** // - -//! A reflection transformation. - -//! This class provides additional constructors for Transform3D -//! and should not be used as a separate class. -//! -//! Example of use: -//! @code -//! Transform3D m; -//! m = Reflect3D(1.,1.,1.,0.); -//! @endcode -//! -//! @author <Evgueni.Tcherniaev@cern.ch> - -class Reflect3D : public Transform3D { -protected: - Reflect3D(double XX, double XY, double XZ, double DX, - double YX, double YY, double YZ, double DY, - double ZX, double ZY, double ZZ, double DZ) - : Transform3D(XX,XY,XZ,DX, YX,YY,YZ,DY, ZX,ZY,ZZ,DZ) {} - -public: - //! Default constructor: sets the Identity transformation. - Reflect3D() : Transform3D() {} - - //! Construct reflection from a plane a*x+b*y+c*z+d=0. - Reflect3D(double a, double b, double c, double d); - - //! Construct reflection from a plane given by its normal a point. - - inline Reflect3D(const Normal3D<double>& normal, - const Point3D<double>& point) - // TODO(C++11): simplify using delegating constructor - { *this = Reflect3D(normal.x(), normal.y(), normal.z(), -normal*point); } -}; - -//! A reflection in a plane x=const. - -//! Should not be instantiated: see Reflect3D for example of use. -//! -class ReflectX3D : public Reflect3D { -public: - //! Constructor from a number. - ReflectX3D(double x=0) - : Reflect3D(-1.0,0.0,0.0,x+x, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0) {} -}; - -//! A reflection in a plane y=const. - -//! Should not be instantiated: see Reflect3D for example of use. -//! -class ReflectY3D : public Reflect3D { -public: - //! Constructor from a number. - ReflectY3D(double y=0) - : Reflect3D(1.0,0.0,0.0,0.0, 0.0,-1.0,0.0,y+y, 0.0,0.0,1.0,0.0) {} -}; - -//! A reflection in a plane z=const. - -//! Should not be instantiated: see Reflect3D for example of use. -//! -class ReflectZ3D : public Reflect3D { -public: - //! Constructor from a number. - ReflectZ3D(double z=0) - : Reflect3D(1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,-1.0,z+z) {} -}; - -// ************************************************************************** // -// Scalings -// ************************************************************************** // - -//! A scaling transformation. - -//! This class provides additional constructors for Transform3D -//! and should not be used as a separate class. -//! -//! Example of use: -//! @code -//! Transform3D m; -//! m = Scale3D(2.); -//! @endcode -//! -//! @author <Evgueni.Tcherniaev@cern.ch> -//! -class Scale3D : public Transform3D { -public: - //! Default constructor: sets the Identity transformation. - Scale3D() : Transform3D() {} - - //! Constructor from three numbers - scale factors in different directions. - Scale3D(double x, double y, double z) - : Transform3D(x,0.0,0.0,0.0, 0.0,y,0.0,0.0, 0.0,0.0,z,0.0) {} - - //! Constructor from a number: sets uniform scaling in all directions. - Scale3D(double s) - : Transform3D(s,0.0,0.0,0.0, 0.0,s,0.0,0.0, 0.0,0.0,s,0.0) {} -}; - -//! A scaling transformation in x-direction. - -//! Should not be instantiated: see Scale3D for example of use. -//! -class ScaleX3D : public Scale3D { -public: - //! Default constructor: sets the Identity transformation. - ScaleX3D() : Scale3D() {} - - //! Constructor from a number (scale factor in x-direction). - ScaleX3D(double x) : Scale3D(x, 1.0, 1.0) {} -}; - -//! A scaling transformation in y-direction. - -//! Should not be instantiated: see Scale3D for example of use. -//! -class ScaleY3D : public Scale3D { -public: - //! Default constructor: sets the Identity transformation. - ScaleY3D() : Scale3D() {} - - //! Constructor from a number (scale factor in y-direction). - ScaleY3D(double y) : Scale3D(1.0, y, 1.0) {} -}; - -//! A scaling transformation in z-direction. - -//! Should not be instantiated: see Scale3D for example of use. -//! -class ScaleZ3D : public Scale3D { -public: - //! Default constructor: sets the Identity transformation. - ScaleZ3D() : Scale3D() {} - - //! Constructor from a number (scale factor in z-direction). - ScaleZ3D(double z) : Scale3D(1.0, 1.0, z) {} -}; - // ************************************************************************** // // Inlines that involve both Transform3D and Transform3D_row // ************************************************************************** // diff --git a/Core/Geometry/inc/Vector3D.h b/Core/Geometry/inc/Vector3D.h deleted file mode 100755 index cd80614ebf394b4d79398169ec6f0a02569e52e3..0000000000000000000000000000000000000000 --- a/Core/Geometry/inc/Vector3D.h +++ /dev/null @@ -1,97 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.3 2003/10/23 21:29:50 -// -//! @file Geometry/inc/Vector3D.h -//! @brief defines class Vector3D<double>, and implements most functions -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#ifndef GEOMETRY_VECTOR3D_H -#define GEOMETRY_VECTOR3D_H - -//#include <iosfwd> -//#include "CLHEP/Geometry/defs.h" -//#include "CLHEP/Vector/ThreeVector.h" -//#include "CLHEP/Geometry/BasicVector3D.h" -#include "BasicVector3D.h" - -namespace Geometry { - -class Transform3D; - -//! A three-dimensional vector of templated coordinate type. - -//! @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -template<class T> -class Vector3D : public BasicVector3D<T> {}; - -//! A three-dimensional vector with double-precision coordinates. - -//! @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! -template<> -class Vector3D<double> : public BasicVector3D<double> { -public: - - //! Default constructor. - Vector3D() {} - - //! Constructor from three numbers. - Vector3D(double x1, double y1, double z1) - : BasicVector3D<double>(x1,y1,z1) {} - - //! Constructor from array of doubles. - explicit Vector3D(const double * a) - : BasicVector3D<double>(a[0],a[1],a[2]) {} - - //! Copy constructor. - Vector3D(const Vector3D<double> & v) - : BasicVector3D<double>(v) {} - - //! Constructor from BasicVector3D<double>. - Vector3D(const BasicVector3D<double> & v) - : BasicVector3D<double>(v) {} - - //! Destructor. - ~Vector3D() {} - - //! Assignment. - Vector3D<double> & operator=(const Vector3D<double> & v) - { setXYZ(v.x(),v.y(),v.z()); return *this; } - - //! Assignment from BasicVector3D<double>. - Vector3D<double> & operator=(const BasicVector3D<double> & v) - { setXYZ(v.x(),v.y(),v.z()); return *this; } - - //! Transformation by Transform3D. - Vector3D<double> & transform(const Transform3D & m); -}; - - -//! Transformation of Vector<double> by Transform3D. - -//! @relates Vector3D -//! -Vector3D<double> -operator*(const Transform3D & m, const Vector3D<double> & v); - -} // namespace Geometry - -#endif /* GEOMETRY_VECTOR3D_H */ diff --git a/Core/Geometry/src/Normal3D.cpp b/Core/Geometry/src/Normal3D.cpp deleted file mode 100755 index 3b55e991afda59b158ecb33eab695d93a749e786..0000000000000000000000000000000000000000 --- a/Core/Geometry/src/Normal3D.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.3 2003/08/13 20:00:11 -// -//! @file Geometry/src/Normal3D.cpp -//! @brief implements some methods of class Normal3D<double> -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - reworked doxygen comments -// -// ************************************************************************** // - -#include "Normal3D.h" -#include "Transform3D.h" - -namespace Geometry { - -Normal3D<double>& Normal3D<double>::transform (const Transform3D & m) -{ - double vx = x(), vy = y(), vz = z(); - double xx = m.xx(), xy = m.xy(), xz = m.xz(); - double yx = m.yx(), yy = m.yy(), yz = m.yz(); - double zx = m.zx(), zy = m.zy(), zz = m.zz(); - setXYZ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, - (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, - (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); - return *this; -} - -Normal3D<double> operator*(const Transform3D& m, const Normal3D<double>& v) -{ - double vx = v.x(), vy = v.y(), vz = v.z(); - double xx = m.xx(), xy = m.xy(), xz = m.xz(); - double yx = m.yx(), yy = m.yy(), yz = m.yz(); - double zx = m.zx(), zy = m.zy(), zz = m.zz(); - return Normal3D<double> - ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, - (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, - (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); -} - -} // namespace Geometry diff --git a/Core/Geometry/src/Plane3D.cpp b/Core/Geometry/src/Plane3D.cpp deleted file mode 100755 index 12ae90040e81b5167c08d271240cb0b28ad77fe3..0000000000000000000000000000000000000000 --- a/Core/Geometry/src/Plane3D.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.4 2003/08/13 20:00:11 -// -//! @file Geometry/src/Plane3D.cpp -//! @brief implements some methods of class Plane3D<double> -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#include <iostream> -#include "Plane3D.h" - -namespace Geometry { - -std::ostream& operator<< ( - std::ostream& os, const Plane3D<double>& p) -{ - return os << - '(' << p.a() << ',' << p.b() << ',' << p.c() << ',' << p.d() << ')'; - } - -} // namespace Geometry diff --git a/Core/Geometry/src/Point3D.cpp b/Core/Geometry/src/Point3D.cpp deleted file mode 100755 index dc430c133a84b034d8c52fb1c817957025f2a874..0000000000000000000000000000000000000000 --- a/Core/Geometry/src/Point3D.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.3 2003/08/13 20:00:11 -// -//! @file Geometry/src/Point3D.cpp -//! @brief implements some methods of class Point3D<double> -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#include "Point3D.h" -#include "Transform3D.h" - -namespace Geometry { - -Point3D<double>& Point3D<double>::transform( - const Transform3D& m) -{ - double vx = x(), vy = y(), vz = z(); - setXYZ(m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), - m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), - m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); - return *this; -} - -Point3D<double> operator* ( - const Transform3D& m, const Point3D<double>& v) -{ - double vx = v.x(), vy = v.y(), vz = v.z(); - return Point3D<double> - (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), - m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), - m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); -} - -} // namespace Geometry diff --git a/Core/Geometry/src/Transform3D.cpp b/Core/Geometry/src/Transform3D.cpp index a34d7ea51b949d6bbcad543f5ce03988691f9d97..358b1dade980d891a0eff394f01e9f3901b7dd2d 100755 --- a/Core/Geometry/src/Transform3D.cpp +++ b/Core/Geometry/src/Transform3D.cpp @@ -177,28 +177,6 @@ Transform3D Transform3D::inverse() const detxz, -detyz, detzz, -detxz*dx_+detyz*dy_-detzz*dz_); } -//! Decomposition of general transformation. -//! -//! @author E. Chernyaev 2001 - -void Transform3D::getDecomposition(Scale3D & scale, - Rotate3D & rotation, - Translate3D & translation) const -{ - double sx = std::sqrt(xx_*xx_ + yx_*yx_ + zx_*zx_); - double sy = std::sqrt(xy_*xy_ + yy_*yy_ + zy_*zy_); - double sz = std::sqrt(xz_*xz_ + yz_*yz_ + zz_*zz_); - - if (xx_*(yy_*zz_-yz_*zy_) - - xy_*(yx_*zz_-yz_*zx_) + - xz_*(yx_*zy_-yy_*zx_) < 0) sz = -sz; - scale.setTransform(sx,0.0,0.0,0.0, 0.0,sy,0.0,0.0, 0.0,0.0,sz,0.0); - rotation.setTransform(xx_/sx,xy_/sy,xz_/sz,0.0, - yx_/sx,yy_/sy,yz_/sz,0.0, - zx_/sx,zy_/sy,zz_/sz,0.0); - translation.setTransform(1.0,0.0,0.0,dx_, 0.0,1.0,0.0,dy_, 0.0,0.0,1.0,dz_); -} - //! Difference between corresponding matrix elements less than tolerance? bool Transform3D::isNear(const Transform3D & t, double tolerance) const @@ -267,25 +245,4 @@ Rotate3D::Rotate3D(double a, } } -//! Construct reflection in a plane a*x+b*y+c*z+d=0. -//! -//! @author E. Chernyaev 1996 - -Reflect3D::Reflect3D (double a, double b, double c, double d) -{ - double ll = a*a+b*b+c*c; - if (ll == 0) { - std::cerr << "Reflect3D: zero normal" << std::endl; - setIdentity(); - } else { - ll = 1/ll; - double aa = a*a*ll, ab = a*b*ll, ac = a*c*ll, ad = a*d*ll, - bb = b*b*ll, bc = b*c*ll, bd = b*d*ll, - cc = c*c*ll, cd = c*d*ll; - setTransform(-aa+bb+cc, -ab-ab, -ac-ac, -ad-ad, - -ab-ab, aa-bb+cc, -bc-bc, -bd-bd, - -ac-ac, -bc-bc, aa+bb-cc, -cd-cd); - } -} - } // namespace Geometry diff --git a/Core/Geometry/src/Vector3D.cpp b/Core/Geometry/src/Vector3D.cpp deleted file mode 100755 index 1697864bb91309ad07fdbff0fc83d5938069827f..0000000000000000000000000000000000000000 --- a/Core/Geometry/src/Vector3D.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// ************************************************************************** // -// -// heinzlibs: Library collection of the Scientific Computing Group at -// Heinz Maier-Leibnitz Zentrum (MLZ) Garching -// -// libgeo3d: Library for three-dimensional Euclidian geometry, -// based on CLHEP/Geometry 1.9 of 1.4.2003, -// forked after v 1.3 2003/08/13 20:00:11 -// -//! @file Geometry/src/Vector3D.cpp -//! @brief implements some methods of class Vector3D<double> -//! -//! @homepage http://apps.jcns.fz-juelich.de/BornAgain -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors E. Chernyaev <Evgueni.Tcherniaev@cern.ch> 1996-2003 -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -//! -//! Changes w.r.t. CLHEP: -//! - eliminated support for type float -//! - reworked doxygen comments -// -// ************************************************************************** // - -#include "Vector3D.h" -#include "Transform3D.h" - -namespace Geometry { - -Vector3D<double>& Vector3D<double>::transform( const Transform3D & m) -{ - double vx = x(), vy = y(), vz = z(); - setXYZ(m.xx()*vx + m.xy()*vy + m.xz()*vz, - m.yx()*vx + m.yy()*vy + m.yz()*vz, - m.zx()*vx + m.zy()*vy + m.zz()*vz); - return *this; -} - -Vector3D<double>operator* (const Transform3D & m, const Vector3D<double> & v) -{ - double vx = v.x(), vy = v.y(), vz = v.z(); - return Vector3D<double> - (m.xx()*vx + m.xy()*vy + m.xz()*vz, - m.yx()*vx + m.yy()*vy + m.yz()*vz, - m.zx()*vx + m.zy()*vy + m.zz()*vz); -} - -} // namespace Geometry diff --git a/Core/Samples/inc/HomogeneousMaterial.h b/Core/Samples/inc/HomogeneousMaterial.h index cd7190605b61fd0fc40549f0bce247205db01c83..deece73256ff5793ed6657563d375d9d5271bc39 100644 --- a/Core/Samples/inc/HomogeneousMaterial.h +++ b/Core/Samples/inc/HomogeneousMaterial.h @@ -24,7 +24,7 @@ class HomogeneousMaterial : public IMaterial { public: - HomogeneousMaterial(); + HomogeneousMaterial() {} HomogeneousMaterial(const complex_t &refractive_index) : IMaterial("noname"), m_refractive_index(refractive_index) {} HomogeneousMaterial(const std::string &name, @@ -41,16 +41,6 @@ public: : IMaterial(other), m_refractive_index(other.m_refractive_index) {} virtual ~HomogeneousMaterial() {} - HomogeneousMaterial &operator=(const HomogeneousMaterial &other) - { - if(this != &other) - { - IMaterial::operator=(other); - m_refractive_index = other.m_refractive_index; - } - return *this; - } - //! Return refractive index. complex_t getRefractiveIndex() const { return m_refractive_index; }