diff options
Diffstat (limited to 'extern/solid/include')
-rw-r--r-- | extern/solid/include/GEN_MinMax.h | 76 | ||||
-rw-r--r-- | extern/solid/include/GEN_random.h | 49 | ||||
-rw-r--r-- | extern/solid/include/MT/Interval.h | 180 | ||||
-rw-r--r-- | extern/solid/include/MT/Matrix3x3.h | 380 | ||||
-rw-r--r-- | extern/solid/include/MT/Quaternion.h | 316 | ||||
-rw-r--r-- | extern/solid/include/MT/Transform.h | 189 | ||||
-rw-r--r-- | extern/solid/include/MT/Tuple3.h | 120 | ||||
-rw-r--r-- | extern/solid/include/MT/Tuple4.h | 112 | ||||
-rw-r--r-- | extern/solid/include/MT/Vector3.h | 283 | ||||
-rw-r--r-- | extern/solid/include/MT_BBox.h | 119 | ||||
-rw-r--r-- | extern/solid/include/MT_Interval.h | 33 | ||||
-rw-r--r-- | extern/solid/include/MT_Matrix3x3.h | 34 | ||||
-rw-r--r-- | extern/solid/include/MT_Point3.h | 31 | ||||
-rw-r--r-- | extern/solid/include/MT_Quaternion.h | 35 | ||||
-rw-r--r-- | extern/solid/include/MT_Scalar.h | 158 | ||||
-rw-r--r-- | extern/solid/include/MT_Transform.h | 38 | ||||
-rw-r--r-- | extern/solid/include/MT_Vector3.h | 50 | ||||
-rw-r--r-- | extern/solid/include/SOLID.h | 279 | ||||
-rw-r--r-- | extern/solid/include/SOLID_broad.h | 75 | ||||
-rw-r--r-- | extern/solid/include/SOLID_types.h | 53 |
20 files changed, 0 insertions, 2610 deletions
diff --git a/extern/solid/include/GEN_MinMax.h b/extern/solid/include/GEN_MinMax.h deleted file mode 100644 index 9ea961cfe4f..00000000000 --- a/extern/solid/include/GEN_MinMax.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef GEN_MINMAX_H -#define GEN_MINMAX_H - -template <class T> -inline const T& GEN_min(const T& a, const T& b) -{ - return b < a ? b : a; -} - -template <class T> -inline const T& GEN_max(const T& a, const T& b) -{ - return a < b ? b : a; -} - -template <class T> -inline const T& GEN_clamped(const T& a, const T& lb, const T& ub) -{ - return a < lb ? lb : (ub < a ? ub : a); -} - -template <class T> -inline void GEN_set_min(T& a, const T& b) -{ - if (b < a) - { - a = b; - } -} - -template <class T> -inline void GEN_set_max(T& a, const T& b) -{ - if (a < b) - { - a = b; - } -} - -template <class T> -inline void GEN_clamp(T& a, const T& lb, const T& ub) -{ - if (a < lb) - { - a = lb; - } - else if (ub < a) - { - a = ub; - } -} - -#endif diff --git a/extern/solid/include/GEN_random.h b/extern/solid/include/GEN_random.h deleted file mode 100644 index 4690a05511a..00000000000 --- a/extern/solid/include/GEN_random.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef GEN_RANDOM_H -#define GEN_RANDOM_H - -#ifdef MT19937 - -#include <limits.h> -#include <mt19937.h> - -#define GEN_RAND_MAX UINT_MAX - -inline void GEN_srand(unsigned int seed) { init_genrand(seed); } -inline unsigned int GEN_rand() { return genrand_int32(); } - -#else - -#include <stdlib.h> - -#define GEN_RAND_MAX RAND_MAX - -inline void GEN_srand(unsigned int seed) { srand(seed); } -inline unsigned int GEN_rand() { return rand(); } - -#endif - -#endif - diff --git a/extern/solid/include/MT/Interval.h b/extern/solid/include/MT/Interval.h deleted file mode 100644 index c6ba2fc1681..00000000000 --- a/extern/solid/include/MT/Interval.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef INTERVAL_H -#define INTERVAL_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include <iostream> -#include <algorithm> - -namespace MT { - - template <typename Scalar> - class Interval { - public: - Interval() {} - - -#if _MSC_VER <= 1200 - explicit Interval(const Scalar& x) - : m_lb(x), m_ub(x) - {} - - - Interval(const Scalar& lb, const Scalar& ub) - : m_lb(lb), m_ub(ub) - { - assert(lb <= ub); - } -#else - template <typename Scalar2> - explicit Interval(const Scalar2& x) - : m_lb(x), m_ub(x) - {} - - template <typename Scalar2> - Interval(const Scalar2& lb, const Scalar2& ub) - : m_lb(lb), m_ub(ub) - { - assert(lb <= ub); - } - - template <typename Scalar2> - Interval(const Interval<Scalar2>& z) - { - *this = z; - } - - template <typename Scalar2> - Interval<Scalar>& operator=(const Interval<Scalar2>& z) - { - m_lb = Scalar(z.lower()); - m_ub = Scalar(z.upper()); - return *this; - } -#endif - - - - Scalar& lower() { return m_lb; } - const Scalar& lower() const { return m_lb; } - - Scalar& upper() { return m_ub; } - const Scalar& upper() const { return m_ub; } - - Scalar center() const { return (m_lb + m_ub) * Scalar(0.5); } - Scalar extent() const { return (m_ub - m_lb) * Scalar(0.5); } - - - protected: - Scalar m_lb, m_ub; - }; - - template <typename Scalar> - inline Interval<Scalar> - operator+(const Interval<Scalar>& z1, const Interval<Scalar>& z2) - { - return Interval<Scalar>(z1.lower() + z2.lower(), - z1.upper() + z2.upper()); - } - - template <typename Scalar> - inline Interval<Scalar> - operator-(const Interval<Scalar>& z1, const Interval<Scalar>& z2) - { - return Interval<Scalar>(z1.lower() - z2.upper(), - z1.upper() - z2.lower()); - } - - template <typename Scalar> - inline std::ostream& - operator<<(std::ostream& os, const Interval<Scalar>& z) - { - return os << '[' << z.lower() << ", " << z.upper() << ']'; - } - - template <typename Scalar> - inline Scalar - median(const Interval<Scalar>& z) - { - return (z.lower() + z.upper()) * Scalar(0.5); - } - - template <typename Scalar> - inline Scalar - width(const Interval<Scalar>& z) - { - return z.upper() - z.lower(); - } - - template <typename Scalar> - inline bool - overlap(const Interval<Scalar>& z1, const Interval<Scalar>& z2) - { - return z1.lower() <= z2.upper() && z2.lower() <= z1.upper(); - } - - template <typename Scalar> - inline bool - in(const Interval<Scalar>& z1, const Interval<Scalar>& z2) - { - return z2.lower() <= z1.lower() && z1.upper() <= z2.upper(); - } - - template <typename Scalar> - inline bool - in(Scalar x, const Interval<Scalar>& z) - { - return z.lower() <= x && x <= z.upper(); - } - - template <typename Scalar> - inline Interval<Scalar> - widen(const Interval<Scalar>& z, const Scalar& x) - { - return Interval<Scalar>(z.lower() - x, z.upper() + x); - } - - template<typename Scalar> - inline Interval<Scalar> - hull(const Interval<Scalar>& z1, const Interval<Scalar>& z2) - { - return Interval<Scalar>(GEN_min(z1.lower(), z2.lower()), - GEN_max(z1.upper(), z2.upper())); - } - - template<typename Scalar> - inline Interval<Scalar> - operator+(Scalar x, const Interval<Scalar>& z) - { - return Interval<Scalar>(x + z.lower(), x + z.upper()); - } -} - -#endif diff --git a/extern/solid/include/MT/Matrix3x3.h b/extern/solid/include/MT/Matrix3x3.h deleted file mode 100644 index 85e0d4cac84..00000000000 --- a/extern/solid/include/MT/Matrix3x3.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MATRIX3X3_H -#define MATRIX3X3_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include "Vector3.h" -#include "Quaternion.h" - -namespace MT { - - // Row-major 3x3 matrix - - template <typename Scalar> - class Matrix3x3 { - public: - Matrix3x3() {} - - template <typename Scalar2> - explicit Matrix3x3(const Scalar2 *m) { setValue(m); } - - explicit Matrix3x3(const Quaternion<Scalar>& q) { setRotation(q); } - - template <typename Scalar2> - Matrix3x3(const Scalar2& yaw, const Scalar2& pitch, const Scalar2& roll) - { - setEuler(yaw, pitch, roll); - } - - template <typename Scalar2> - Matrix3x3(const Scalar2& xx, const Scalar2& xy, const Scalar2& xz, - const Scalar2& yx, const Scalar2& yy, const Scalar2& yz, - const Scalar2& zx, const Scalar2& zy, const Scalar2& zz) - { - setValue(xx, xy, xz, - yx, yy, yz, - zx, zy, zz); - } - - Vector3<Scalar>& operator[](int i) - { - assert(0 <= i && i < 3); - return m_el[i]; - } - - const Vector3<Scalar>& operator[](int i) const - { - assert(0 <= i && i < 3); - return m_el[i]; - } - - Matrix3x3<Scalar>& operator*=(const Matrix3x3<Scalar>& m); - - template <typename Scalar2> - void setValue(const Scalar2 *m) - { - m_el[0][0] = Scalar(m[0]); - m_el[1][0] = Scalar(m[1]); - m_el[2][0] = Scalar(m[2]); - m_el[0][1] = Scalar(m[4]); - m_el[1][1] = Scalar(m[5]); - m_el[2][1] = Scalar(m[6]); - m_el[0][2] = Scalar(m[8]); - m_el[1][2] = Scalar(m[9]); - m_el[2][2] = Scalar(m[10]); - } - - template <typename Scalar2> - void setValue(const Scalar2& xx, const Scalar2& xy, const Scalar2& xz, - const Scalar2& yx, const Scalar2& yy, const Scalar2& yz, - const Scalar2& zx, const Scalar2& zy, const Scalar2& zz) - { - m_el[0][0] = Scalar(xx); - m_el[0][1] = Scalar(xy); - m_el[0][2] = Scalar(xz); - m_el[1][0] = Scalar(yx); - m_el[1][1] = Scalar(yy); - m_el[1][2] = Scalar(yz); - m_el[2][0] = Scalar(zx); - m_el[2][1] = Scalar(zy); - m_el[2][2] = Scalar(zz); - } - - void setRotation(const Quaternion<Scalar>& q) - { - Scalar d = q.length2(); - assert(d != Scalar(0.0)); - Scalar s = Scalar(2.0) / d; - Scalar xs = q[0] * s, ys = q[1] * s, zs = q[2] * s; - Scalar wx = q[3] * xs, wy = q[3] * ys, wz = q[3] * zs; - Scalar xx = q[0] * xs, xy = q[0] * ys, xz = q[0] * zs; - Scalar yy = q[1] * ys, yz = q[1] * zs, zz = q[2] * zs; - setValue(Scalar(1.0) - (yy + zz), xy - wz, xz + wy, - xy + wz, Scalar(1.0) - (xx + zz), yz - wx, - xz - wy, yz + wx, Scalar(1.0) - (xx + yy)); - } - - template <typename Scalar2> - void setEuler(const Scalar2& yaw, const Scalar2& pitch, const Scalar2& roll) - { - Scalar cy(Scalar_traits<Scalar>::cos(yaw)); - Scalar sy(Scalar_traits<Scalar>::sin(yaw)); - Scalar cp(Scalar_traits<Scalar>::cos(pitch)); - Scalar sp(Scalar_traits<Scalar>::sin(pitch)); - Scalar cr(Scalar_traits<Scalar>::cos(roll)); - Scalar sr(Scalar_traits<Scalar>::sin(roll)); - Scalar cc = cy * cr; - Scalar cs = cy * sr; - Scalar sc = sy * cr; - Scalar ss = sy * sr; - setValue(cy * cp, -sc + sp * cs, ss - sp * cc, - sy * cp, cc + sp * ss, -cs + sp * sc, - -sp, cp * sr, cp * cr); - } - void setIdentity() - { - setValue(Scalar(1.0), Scalar(0.0), Scalar(0.0), - Scalar(0.0), Scalar(1.0), Scalar(0.0), - Scalar(0.0), Scalar(0.0), Scalar(1.0)); - } - - template <typename Scalar2> - void getValue(Scalar2 *m) const - { - m[0] = Scalar2(m_el[0][0]); - m[1] = Scalar2(m_el[1][0]); - m[2] = Scalar2(m_el[2][0]); - m[3] = Scalar2(0.0); - m[4] = Scalar2(m_el[0][1]); - m[5] = Scalar2(m_el[1][1]); - m[6] = Scalar2(m_el[2][1]); - m[7] = Scalar2(0.0); - m[8] = Scalar2(m_el[0][2]); - m[9] = Scalar2(m_el[1][2]); - m[10] = Scalar2(m_el[2][2]); - m[11] = Scalar2(0.0); - } - - void getRotation(Quaternion<Scalar>& q) const - { - Scalar trace = m_el[0][0] + m_el[1][1] + m_el[2][2]; - - if (trace > Scalar(0.0)) - { - Scalar s = Scalar_traits<Scalar>::sqrt(trace + Scalar(1.0)); - q[3] = s * Scalar(0.5); - s = Scalar(0.5) / s; - - q[0] = (m_el[2][1] - m_el[1][2]) * s; - q[1] = (m_el[0][2] - m_el[2][0]) * s; - q[2] = (m_el[1][0] - m_el[0][1]) * s; - } - else - { - int i = m_el[0][0] < m_el[1][1] ? - (m_el[1][1] < m_el[2][2] ? 2 : 1) : - (m_el[0][0] < m_el[2][2] ? 2 : 0); - int j = (i + 1) % 3; - int k = (i + 2) % 3; - - Scalar s = Scalar_traits<Scalar>::sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + Scalar(1.0)); - q[i] = s * Scalar(0.5); - s = Scalar(0.5) / s; - - q[3] = (m_el[k][j] - m_el[j][k]) * s; - q[j] = (m_el[j][i] + m_el[i][j]) * s; - q[k] = (m_el[k][i] + m_el[i][k]) * s; - } - } - - - - template <typename Scalar2> - void getEuler(Scalar2& yaw, Scalar2& pitch, Scalar2& roll) const - { - pitch = Scalar2(Scalar_traits<Scalar>::asin(-m_el[2][0])); - if (pitch < Scalar_traits<Scalar2>::TwoTimesPi()) - { - if (pitch > Scalar_traits<Scalar2>::TwoTimesPi()) - { - yaw = Scalar2(Scalar_traits<Scalar>::atan2(m_el[1][0], m_el[0][0])); - roll = Scalar2(Scalar_traits<Scalar>::atan2(m_el[2][1], m_el[2][2])); - } - else - { - yaw = Scalar2(-Scalar_traits<Scalar>::atan2(-m_el[0][1], m_el[0][2])); - roll = Scalar2(0.0); - } - } - else - { - yaw = Scalar2(Scalar_traits<Scalar>::atan2(-m_el[0][1], m_el[0][2])); - roll = Scalar2(0.0); - } - } - - Vector3<Scalar> getScaling() const - { - return Vector3<Scalar>(m_el[0][0] * m_el[0][0] + m_el[1][0] * m_el[1][0] + m_el[2][0] * m_el[2][0], - m_el[0][1] * m_el[0][1] + m_el[1][1] * m_el[1][1] + m_el[2][1] * m_el[2][1], - m_el[0][2] * m_el[0][2] + m_el[1][2] * m_el[1][2] + m_el[2][2] * m_el[2][2]); - } - - - Matrix3x3<Scalar> scaled(const Vector3<Scalar>& s) const - { - return Matrix3x3<Scalar>(m_el[0][0] * s[0], m_el[0][1] * s[1], m_el[0][2] * s[2], - m_el[1][0] * s[0], m_el[1][1] * s[1], m_el[1][2] * s[2], - m_el[2][0] * s[0], m_el[2][1] * s[1], m_el[2][2] * s[2]); - } - - Scalar determinant() const; - Matrix3x3<Scalar> adjoint() const; - Matrix3x3<Scalar> absolute() const; - Matrix3x3<Scalar> transpose() const; - Matrix3x3<Scalar> inverse() const; - - Matrix3x3<Scalar> transposeTimes(const Matrix3x3<Scalar>& m) const; - Matrix3x3<Scalar> timesTranspose(const Matrix3x3<Scalar>& m) const; - - Scalar tdot(int c, const Vector3<Scalar>& v) const - { - return m_el[0][c] * v[0] + m_el[1][c] * v[1] + m_el[2][c] * v[2]; - } - - protected: - Scalar cofac(int r1, int c1, int r2, int c2) const - { - return m_el[r1][c1] * m_el[r2][c2] - m_el[r1][c2] * m_el[r2][c1]; - } - - Vector3<Scalar> m_el[3]; - }; - - template <typename Scalar> - inline std::ostream& - operator<<(std::ostream& os, const Matrix3x3<Scalar>& m) - { - return os << m[0] << std::endl << m[1] << std::endl << m[2] << std::endl; - } - - template <typename Scalar> - inline Matrix3x3<Scalar>& - Matrix3x3<Scalar>::operator*=(const Matrix3x3<Scalar>& m) - { - setValue(m.tdot(0, m_el[0]), m.tdot(1, m_el[0]), m.tdot(2, m_el[0]), - m.tdot(0, m_el[1]), m.tdot(1, m_el[1]), m.tdot(2, m_el[1]), - m.tdot(0, m_el[2]), m.tdot(1, m_el[2]), m.tdot(2, m_el[2])); - return *this; - } - - template <typename Scalar> - inline Scalar - Matrix3x3<Scalar>::determinant() const - { - return triple((*this)[0], (*this)[1], (*this)[2]); - } - - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::absolute() const - { - return Matrix3x3<Scalar>( - Scalar_traits<Scalar>::abs(m_el[0][0]), Scalar_traits<Scalar>::abs(m_el[0][1]), Scalar_traits<Scalar>::abs(m_el[0][2]), - Scalar_traits<Scalar>::abs(m_el[1][0]), Scalar_traits<Scalar>::abs(m_el[1][1]), Scalar_traits<Scalar>::abs(m_el[1][2]), - Scalar_traits<Scalar>::abs(m_el[2][0]), Scalar_traits<Scalar>::abs(m_el[2][1]), Scalar_traits<Scalar>::abs(m_el[2][2])); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::transpose() const - { - return Matrix3x3<Scalar>(m_el[0][0], m_el[1][0], m_el[2][0], - m_el[0][1], m_el[1][1], m_el[2][1], - m_el[0][2], m_el[1][2], m_el[2][2]); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::adjoint() const - { - return Matrix3x3<Scalar>(cofac(1, 1, 2, 2), cofac(0, 2, 2, 1), cofac(0, 1, 1, 2), - cofac(1, 2, 2, 0), cofac(0, 0, 2, 2), cofac(0, 2, 1, 0), - cofac(1, 0, 2, 1), cofac(0, 1, 2, 0), cofac(0, 0, 1, 1)); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::inverse() const - { - Vector3<Scalar> co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)); - Scalar det = (*this)[0].dot(co); - assert(det != Scalar(0.0)); - Scalar s = Scalar(1.0) / det; - return Matrix3x3<Scalar>(co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, - co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, - co[2] * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::transposeTimes(const Matrix3x3<Scalar>& m) const - { - return Matrix3x3<Scalar>( - m_el[0][0] * m[0][0] + m_el[1][0] * m[1][0] + m_el[2][0] * m[2][0], - m_el[0][0] * m[0][1] + m_el[1][0] * m[1][1] + m_el[2][0] * m[2][1], - m_el[0][0] * m[0][2] + m_el[1][0] * m[1][2] + m_el[2][0] * m[2][2], - m_el[0][1] * m[0][0] + m_el[1][1] * m[1][0] + m_el[2][1] * m[2][0], - m_el[0][1] * m[0][1] + m_el[1][1] * m[1][1] + m_el[2][1] * m[2][1], - m_el[0][1] * m[0][2] + m_el[1][1] * m[1][2] + m_el[2][1] * m[2][2], - m_el[0][2] * m[0][0] + m_el[1][2] * m[1][0] + m_el[2][2] * m[2][0], - m_el[0][2] * m[0][1] + m_el[1][2] * m[1][1] + m_el[2][2] * m[2][1], - m_el[0][2] * m[0][2] + m_el[1][2] * m[1][2] + m_el[2][2] * m[2][2]); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - Matrix3x3<Scalar>::timesTranspose(const Matrix3x3<Scalar>& m) const - { - return Matrix3x3<Scalar>( - m_el[0].dot(m[0]), m_el[0].dot(m[1]), m_el[0].dot(m[2]), - m_el[1].dot(m[0]), m_el[1].dot(m[1]), m_el[1].dot(m[2]), - m_el[2].dot(m[0]), m_el[2].dot(m[1]), m_el[2].dot(m[2])); - - } - - template <typename Scalar> - inline Vector3<Scalar> - operator*(const Matrix3x3<Scalar>& m, const Vector3<Scalar>& v) - { - return Vector3<Scalar>(m[0].dot(v), m[1].dot(v), m[2].dot(v)); - } - - - template <typename Scalar> - inline Vector3<Scalar> - operator*(const Vector3<Scalar>& v, const Matrix3x3<Scalar>& m) - { - return Vector3<Scalar>(m.tdot(0, v), m.tdot(1, v), m.tdot(2, v)); - } - - template <typename Scalar> - inline Matrix3x3<Scalar> - operator*(const Matrix3x3<Scalar>& m1, const Matrix3x3<Scalar>& m2) - { - return Matrix3x3<Scalar>( - m2.tdot(0, m1[0]), m2.tdot(1, m1[0]), m2.tdot(2, m1[0]), - m2.tdot(0, m1[1]), m2.tdot(1, m1[1]), m2.tdot(2, m1[1]), - m2.tdot(0, m1[2]), m2.tdot(1, m1[2]), m2.tdot(2, m1[2])); - } -} - -#endif diff --git a/extern/solid/include/MT/Quaternion.h b/extern/solid/include/MT/Quaternion.h deleted file mode 100644 index a925f21cd5d..00000000000 --- a/extern/solid/include/MT/Quaternion.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef QUATERNION_H -#define QUATERNION_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include "Tuple4.h" -#include "Vector3.h" - -namespace MT { - - template <typename Scalar> - class Quaternion : public Tuple4<Scalar> { - public: - Quaternion() {} - - template <typename Scalar2> - explicit Quaternion(const Scalar2 *v) : Tuple4<Scalar>(v) {} - - template <typename Scalar2> - Quaternion(const Scalar2& x, const Scalar2& y, const Scalar2& z, const Scalar2& w) - : Tuple4<Scalar>(x, y, z, w) - {} - - Quaternion(const Vector3<Scalar>& axis, const Scalar& angle) - { - setRotation(axis, angle); - } - - template <typename Scalar2> - Quaternion(const Scalar2& yaw, const Scalar2& pitch, const Scalar2& roll) - { - setEuler(yaw, pitch, roll); - } - - void setRotation(const Vector3<Scalar>& axis, const Scalar& angle) - { - Scalar d = axis.length(); - assert(d != Scalar(0.0)); - Scalar s = Scalar_traits<Scalar>::sin(angle * Scalar(0.5)) / d; - setValue(axis[0] * s, axis[1] * s, axis[2] * s, - Scalar_traits<Scalar>::cos(angle * Scalar(0.5))); - } - - template <typename Scalar2> - void setEuler(const Scalar2& yaw, const Scalar2& pitch, const Scalar2& roll) - { - Scalar halfYaw = Scalar(yaw) * Scalar(0.5); - Scalar halfPitch = Scalar(pitch) * Scalar(0.5); - Scalar halfRoll = Scalar(roll) * Scalar(0.5); - Scalar cosYaw = Scalar_traits<Scalar>::cos(halfYaw); - Scalar sinYaw = Scalar_traits<Scalar>::sin(halfYaw); - Scalar cosPitch = Scalar_traits<Scalar>::cos(halfPitch); - Scalar sinPitch = Scalar_traits<Scalar>::sin(halfPitch); - Scalar cosRoll = Scalar_traits<Scalar>::cos(halfRoll); - Scalar sinRoll = Scalar_traits<Scalar>::sin(halfRoll); - setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw, - cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw, - sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw, - cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw); - } - - Quaternion<Scalar>& operator+=(const Quaternion<Scalar>& q) - { - this->m_co[0] += q[0]; this->m_co[1] += q[1]; this->m_co[2] += q[2]; this->m_co[3] += q[3]; - return *this; - } - - Quaternion<Scalar>& operator-=(const Quaternion<Scalar>& q) - { - this->m_co[0] -= q[0]; this->m_co[1] -= q[1]; this->m_co[2] -= q[2]; this->m_co[3] -= q[3]; - return *this; - } - - Quaternion<Scalar>& operator*=(const Scalar& s) - { - this->m_co[0] *= s; this->m_co[1] *= s; this->m_co[2] *= s; this->m_co[3] *= s; - return *this; - } - - Quaternion<Scalar>& operator/=(const Scalar& s) - { - assert(s != Scalar(0.0)); - return *this *= Scalar(1.0) / s; - } - - Quaternion<Scalar>& operator*=(const Quaternion<Scalar>& q) - { - setValue(this->m_co[3] * q[0] + this->m_co[0] * q[3] + this->m_co[1] * q[2] - this->m_co[2] * q[1], - this->m_co[3] * q[1] + this->m_co[1] * q[3] + this->m_co[2] * q[0] - this->m_co[0] * q[2], - this->m_co[3] * q[2] + this->m_co[2] * q[3] + this->m_co[0] * q[1] - this->m_co[1] * q[0], - this->m_co[3] * q[3] - this->m_co[0] * q[0] - this->m_co[1] * q[1] - this->m_co[2] * q[2]); - return *this; - } - - Scalar dot(const Quaternion<Scalar>& q) const - { - return this->m_co[0] * q[0] + this->m_co[1] * q[1] + this->m_co[2] * q[2] + this->m_co[3] * q[3]; - } - - Scalar length2() const - { - return dot(*this); - } - - Scalar length() const - { - return Scalar_traits<Scalar>::sqrt(length2()); - } - - Quaternion<Scalar>& normalize() - { - return *this /= length(); - } - - Quaternion<Scalar> normalized() const - { - return *this / length(); - } - - Scalar angle(const Quaternion<Scalar>& q) const - { - Scalar s = Scalar_traits<Scalar>::sqrt(length2() * q.length2()); - assert(s != Scalar(0.0)); - return Scalar_traits<Scalar>::acos(dot(q) / s); - } - - Quaternion<Scalar> conjugate() const - { - return Quaternion<Scalar>(-this->m_co[0], -this->m_co[1], -this->m_co[2], this->m_co[3]); - } - - Quaternion<Scalar> inverse() const - { - return conjugate / length2(); - } - - Quaternion<Scalar> slerp(const Quaternion<Scalar>& q, const Scalar& t) const - { - Scalar theta = angle(q); - if (theta != Scalar(0.0)) - { - Scalar d = Scalar(1.0) / Scalar_traits<Scalar>::sin(theta); - Scalar s0 = Scalar_traits<Scalar>::sin((Scalar(1.0) - t) * theta); - Scalar s1 = Scalar_traits<Scalar>::sin(t * theta); - return Quaternion<Scalar>((this->m_co[0] * s0 + q[0] * s1) * d, - (this->m_co[1] * s0 + q[1] * s1) * d, - (this->m_co[2] * s0 + q[2] * s1) * d, - (this->m_co[3] * s0 + q[3] * s1) * d); - } - else - { - return *this; - } - } - - static Quaternion<Scalar> random() - { - // From: "Uniform Random Rotations", Ken Shoemake, Graphics Gems III, - // pg. 124-132 - Scalar x0 = Scalar_traits<Scalar>::random(); - Scalar r1 = Scalar_traits<Scalar>::sqrt(Scalar(1.0) - x0); - Scalar r2 = Scalar_traits<Scalar>::sqrt(x0); - Scalar t1 = Scalar_traits<Scalar>::TwoTimesPi() * Scalar_traits<Scalar>::random(); - Scalar t2 = Scalar_traits<Scalar>::TwoTimesPi() * Scalar_traits<Scalar>::random(); - Scalar c1 = Scalar_traits<Scalar>::cos(t1); - Scalar s1 = Scalar_traits<Scalar>::sin(t1); - Scalar c2 = Scalar_traits<Scalar>::cos(t2); - Scalar s2 = Scalar_traits<Scalar>::sin(t2); - return Quaternion<Scalar>(s1 * r1, c1 * r1, s2 * r2, c2 * r2); - } - - }; - - template <typename Scalar> - inline Quaternion<Scalar> - operator+(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2) - { - return Quaternion<Scalar>(q1[0] + q2[0], q1[1] + q2[1], q1[2] + q2[2], q1[3] + q2[3]); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator-(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2) - { - return Quaternion<Scalar>(q1[0] - q2[0], q1[1] - q2[1], q1[2] - q2[2], q1[3] - q2[3]); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator-(const Quaternion<Scalar>& q) - { - return Quaternion<Scalar>(-q[0], -q[1], -q[2], -q[3]); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator*(const Quaternion<Scalar>& q, const Scalar& s) - { - return Quaternion<Scalar>(q[0] * s, q[1] * s, q[2] * s, q[3] * s); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator*(const Scalar& s, const Quaternion<Scalar>& q) - { - return q * s; - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator*(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2) { - return Quaternion<Scalar>(q1[3] * q2[0] + q1[0] * q2[3] + q1[1] * q2[2] - q1[2] * q2[1], - q1[3] * q2[1] + q1[1] * q2[3] + q1[2] * q2[0] - q1[0] * q2[2], - q1[3] * q2[2] + q1[2] * q2[3] + q1[0] * q2[1] - q1[1] * q2[0], - q1[3] * q2[3] - q1[0] * q2[0] - q1[1] * q2[1] - q1[2] * q2[2]); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator*(const Quaternion<Scalar>& q, const Vector3<Scalar>& w) - { - return Quaternion<Scalar>( q[3] * w[0] + q[1] * w[2] - q[2] * w[1], - q[3] * w[1] + q[2] * w[0] - q[0] * w[2], - q[3] * w[2] + q[0] * w[1] - q[1] * w[0], - -q[0] * w[0] - q[1] * w[1] - q[2] * w[2]); - } - - template <typename Scalar> - inline Quaternion<Scalar> - operator*(const Vector3<Scalar>& w, const Quaternion<Scalar>& q) - { - return Quaternion<Scalar>( w[0] * q[3] + w[1] * q[2] - w[2] * q[1], - w[1] * q[3] + w[2] * q[0] - w[0] * q[2], - w[2] * q[3] + w[0] * q[1] - w[1] * q[0], - -w[0] * q[0] - w[1] * q[1] - w[2] * q[2]); - } - - template <typename Scalar> - inline Scalar - dot(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2) - { - return q1.dot(q2); - } - - template <typename Scalar> - inline Scalar - length2(const Quaternion<Scalar>& q) - { - return q.length2(); - } - - template <typename Scalar> - inline Scalar - length(const Quaternion<Scalar>& q) - { - return q.length(); - } - - template <typename Scalar> - inline Scalar - angle(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2) - { - return q1.angle(q2); - } - - template <typename Scalar> - inline Quaternion<Scalar> - conjugate(const Quaternion<Scalar>& q) - { - return q.conjugate(); - } - - template <typename Scalar> - inline Quaternion<Scalar> - inverse(const Quaternion<Scalar>& q) - { - return q.inverse(); - } - - template <typename Scalar> - inline Quaternion<Scalar> - slerp(const Quaternion<Scalar>& q1, const Quaternion<Scalar>& q2, const Scalar& t) - { - return q1.slerp(q2, t); - } - -} - -#endif diff --git a/extern/solid/include/MT/Transform.h b/extern/solid/include/MT/Transform.h deleted file mode 100644 index b80dc1bc18b..00000000000 --- a/extern/solid/include/MT/Transform.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef TRANSFORM_H -#define TRANSFORM_H - -#include "Vector3.h" -#include "Matrix3x3.h" - -namespace MT { - - template <typename Scalar> - class Transform { - enum { - TRANSLATION = 0x01, - ROTATION = 0x02, - RIGID = TRANSLATION | ROTATION, - SCALING = 0x04, - LINEAR = ROTATION | SCALING, - AFFINE = TRANSLATION | LINEAR - }; - - public: - Transform() {} - - template <typename Scalar2> - explicit Transform(const Scalar2 *m) { setValue(m); } - - explicit Transform(const Quaternion<Scalar>& q, - const Vector3<Scalar>& c = Vector3<Scalar>(Scalar(0), Scalar(0), Scalar(0))) - : m_basis(q), - m_origin(c), - m_type(RIGID) - {} - - explicit Transform(const Matrix3x3<Scalar>& b, - const Vector3<Scalar>& c = Vector3<Scalar>(Scalar(0), Scalar(0), Scalar(0)), - unsigned int type = AFFINE) - : m_basis(b), - m_origin(c), - m_type(type) - {} - - Vector3<Scalar> operator()(const Vector3<Scalar>& x) const - { - return Vector3<Scalar>(m_basis[0].dot(x) + m_origin[0], - m_basis[1].dot(x) + m_origin[1], - m_basis[2].dot(x) + m_origin[2]); - } - - Vector3<Scalar> operator*(const Vector3<Scalar>& x) const - { - return (*this)(x); - } - - Matrix3x3<Scalar>& getBasis() { return m_basis; } - const Matrix3x3<Scalar>& getBasis() const { return m_basis; } - - Vector3<Scalar>& getOrigin() { return m_origin; } - const Vector3<Scalar>& getOrigin() const { return m_origin; } - - Quaternion<Scalar> getRotation() const { return m_basis.getRotation(); } - template <typename Scalar2> - void setValue(const Scalar2 *m) - { - m_basis.setValue(m); - m_origin.setValue(&m[12]); - m_type = AFFINE; - } - - template <typename Scalar2> - void getValue(Scalar2 *m) const - { - m_basis.getValue(m); - m_origin.getValue(&m[12]); - m[15] = Scalar2(1.0); - } - - void setOrigin(const Vector3<Scalar>& origin) - { - m_origin = origin; - m_type |= TRANSLATION; - } - - void setBasis(const Matrix3x3<Scalar>& basis) - { - m_basis = basis; - m_type |= LINEAR; - } - - void setRotation(const Quaternion<Scalar>& q) - { - m_basis.setRotation(q); - m_type = (m_type & ~LINEAR) | ROTATION; - } - - void scale(const Vector3<Scalar>& scaling) - { - m_basis = m_basis.scaled(scaling); - m_type |= SCALING; - } - - void setIdentity() - { - m_basis.setIdentity(); - m_origin.setValue(Scalar(0.0), Scalar(0.0), Scalar(0.0)); - m_type = 0x0; - } - - bool isIdentity() const { return m_type == 0x0; } - - Transform<Scalar>& operator*=(const Transform<Scalar>& t) - { - m_origin += m_basis * t.m_origin; - m_basis *= t.m_basis; - m_type |= t.m_type; - return *this; - } - - Transform<Scalar> inverse() const - { - Matrix3x3<Scalar> inv = (m_type & SCALING) ? - m_basis.inverse() : - m_basis.transpose(); - - return Transform<Scalar>(inv, inv * -m_origin, m_type); - } - - Transform<Scalar> inverseTimes(const Transform<Scalar>& t) const; - - Transform<Scalar> operator*(const Transform<Scalar>& t) const; - - private: - - Matrix3x3<Scalar> m_basis; - Vector3<Scalar> m_origin; - unsigned int m_type; - }; - - - template <typename Scalar> - inline Transform<Scalar> - Transform<Scalar>::inverseTimes(const Transform<Scalar>& t) const - { - Vector3<Scalar> v = t.getOrigin() - m_origin; - if (m_type & SCALING) - { - Matrix3x3<Scalar> inv = m_basis.inverse(); - return Transform<Scalar>(inv * t.getBasis(), inv * v, - m_type | t.m_type); - } - else - { - return Transform<Scalar>(m_basis.transposeTimes(t.m_basis), - v * m_basis, m_type | t.m_type); - } - } - - template <typename Scalar> - inline Transform<Scalar> - Transform<Scalar>::operator*(const Transform<Scalar>& t) const - { - return Transform<Scalar>(m_basis * t.m_basis, - (*this)(t.m_origin), - m_type | t.m_type); - } -} - -#endif diff --git a/extern/solid/include/MT/Tuple3.h b/extern/solid/include/MT/Tuple3.h deleted file mode 100644 index 52ea33b7f58..00000000000 --- a/extern/solid/include/MT/Tuple3.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef TUPLE3_H -#define TUPLE3_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include <iostream> - -namespace MT { - - template <typename Scalar> - class Tuple3 { - public: - Tuple3() {} - - template <typename Scalar2> - explicit Tuple3(const Scalar2 *v) - { - setValue(v); - } - - template <typename Scalar2> - Tuple3(const Scalar2& x, const Scalar2& y, const Scalar2& z) - { - setValue(x, y, z); - } - - template <typename Scalar2> - Tuple3(const Tuple3<Scalar2>& t) - { - *this = t; - } - - template <typename Scalar2> - Tuple3<Scalar>& operator=(const Tuple3<Scalar2>& t) - { - m_co[0] = Scalar(t[0]); - m_co[1] = Scalar(t[1]); - m_co[2] = Scalar(t[2]); - return *this; - } - - operator Scalar *() { return m_co; } - operator const Scalar *() const { return m_co; } - - Scalar& operator[](int i) { return m_co[i]; } - const Scalar& operator[](int i) const { return m_co[i]; } - - Scalar& x() { return m_co[0]; } - const Scalar& x() const { return m_co[0]; } - - Scalar& y() { return m_co[1]; } - const Scalar& y() const { return m_co[1]; } - - Scalar& z() { return m_co[2]; } - const Scalar& z() const { return m_co[2]; } - - template <typename Scalar2> - void setValue(const Scalar2 *v) - { - m_co[0] = Scalar(v[0]); - m_co[1] = Scalar(v[1]); - m_co[2] = Scalar(v[2]); - } - - template <typename Scalar2> - void setValue(const Scalar2& x, const Scalar2& y, const Scalar2& z) - { - m_co[0] = Scalar(x); - m_co[1] = Scalar(y); - m_co[2] = Scalar(z); - } - - template <typename Scalar2> - void getValue(Scalar2 *v) const - { - v[0] = Scalar2(m_co[0]); - v[1] = Scalar2(m_co[1]); - v[2] = Scalar2(m_co[2]); - } - - protected: - Scalar m_co[3]; - }; - - template <typename Scalar> - inline std::ostream& - operator<<(std::ostream& os, const Tuple3<Scalar>& t) - { - return os << t[0] << ' ' << t[1] << ' ' << t[2]; - } -} - -#endif diff --git a/extern/solid/include/MT/Tuple4.h b/extern/solid/include/MT/Tuple4.h deleted file mode 100644 index 6930541271e..00000000000 --- a/extern/solid/include/MT/Tuple4.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef TUPLE4_H -#define TUPLE4_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include <iostream> - -namespace MT { - - template <typename Scalar> - class Tuple4 { - public: - Tuple4() {} - - template <typename Scalar2> - explicit Tuple4(const Scalar2 *v) - { - setValue(v); - } - - template <typename Scalar2> - Tuple4(const Scalar2& x, const Scalar2& y, const Scalar2& z, const Scalar2& w) - { - setValue(x, y, z, w); - } - - operator Scalar *() { return m_co; } - operator const Scalar *() const { return m_co; } - - Scalar& operator[](int i) { return m_co[i]; } - const Scalar& operator[](int i) const { return m_co[i]; } - - Scalar& x() { return m_co[0]; } - const Scalar& x() const { return m_co[0]; } - - Scalar& y() { return m_co[1]; } - const Scalar& y() const { return m_co[1]; } - - Scalar& z() { return m_co[2]; } - const Scalar& z() const { return m_co[2]; } - - Scalar& w() { return m_co[3]; } - const Scalar& w() const { return m_co[3]; } - - template <typename Scalar2> - void setValue(const Scalar2 *v) - { - m_co[0] = Scalar(v[0]); - m_co[1] = Scalar(v[1]); - m_co[2] = Scalar(v[2]); - m_co[3] = Scalar(v[3]); - } - - template <typename Scalar2> - void setValue(const Scalar2& x, const Scalar2& y, const Scalar2& z, const Scalar2& w) - { - m_co[0] = Scalar(x); - m_co[1] = Scalar(y); - m_co[2] = Scalar(z); - m_co[3] = Scalar(w); - } - - template <typename Scalar2> - void getValue(Scalar2 *v) const - { - v[0] = Scalar2(m_co[0]); - v[1] = Scalar2(m_co[1]); - v[2] = Scalar2(m_co[2]); - v[3] = Scalar2(m_co[3]); - } - - protected: - Scalar m_co[4]; - }; - - template <typename Scalar> - inline std::ostream& - operator<<(std::ostream& os, const Tuple4<Scalar>& t) - { - return os << t[0] << ' ' << t[1] << ' ' << t[2] << ' ' << t[3]; - } - -} - -#endif diff --git a/extern/solid/include/MT/Vector3.h b/extern/solid/include/MT/Vector3.h deleted file mode 100644 index b569c003f59..00000000000 --- a/extern/solid/include/MT/Vector3.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef VECTOR3_H -#define VECTOR3_H - -#if defined (__sgi) -#include <assert.h> -#else -#include <cassert> -#endif - -#include "Tuple3.h" - -namespace MT { - - template <typename Scalar> - class Vector3 : public Tuple3<Scalar> { - public: - Vector3() {} - - template <typename Scalar2> - explicit Vector3(const Scalar2 *v) : Tuple3<Scalar>(v) {} - - template <typename Scalar2> - Vector3(const Scalar2& x, const Scalar2& y, const Scalar2& z) - : Tuple3<Scalar>(x, y, z) - {} - - Vector3<Scalar>& operator+=(const Vector3<Scalar>& v) - { - this->m_co[0] += v[0]; this->m_co[1] += v[1]; this->m_co[2] += v[2]; - return *this; - } - - Vector3<Scalar>& operator-=(const Vector3<Scalar>& v) - { - this->m_co[0] -= v[0]; this->m_co[1] -= v[1]; this->m_co[2] -= v[2]; - return *this; - } - - Vector3<Scalar>& operator*=(const Scalar& s) - { - this->m_co[0] *= s; this->m_co[1] *= s; this->m_co[2] *= s; - return *this; - } - - Vector3<Scalar>& operator/=(const Scalar& s) - { - assert(s != Scalar(0.0)); - return *this *= Scalar(1.0) / s; - } - - Scalar dot(const Vector3<Scalar>& v) const - { - return this->m_co[0] * v[0] + this->m_co[1] * v[1] + this->m_co[2] * v[2]; - } - - Scalar length2() const - { - return dot(*this); - } - - Scalar length() const - { - return Scalar_traits<Scalar>::sqrt(length2()); - } - - Scalar distance2(const Vector3<Scalar>& v) const - { - return (v - *this).length2(); - } - - Scalar distance(const Vector3<Scalar>& v) const - { - return (v - *this).length(); - } - - Vector3<Scalar>& normalize() - { - return *this /= length(); - } - - Vector3<Scalar> normalized() const - { - return *this / length(); - } - - Scalar angle(const Vector3<Scalar>& v) const - { - Scalar s = Scalar_traits<Scalar>::sqrt(length2() * v.length2()); - assert(s != Scalar(0.0)); - return Scalar_traits<Scalar>::acos(dot(v) / s); - } - - Vector3<Scalar> absolute() const - { - return Vector3<Scalar>(Scalar_traits<Scalar>::abs(this->m_co[0]), - Scalar_traits<Scalar>::abs(this->m_co[1]), - Scalar_traits<Scalar>::abs(this->m_co[2])); - } - - Vector3<Scalar> cross(const Vector3<Scalar>& v) const - { - return Vector3<Scalar>(this->m_co[1] * v[2] - this->m_co[2] * v[1], - this->m_co[2] * v[0] - this->m_co[0] * v[2], - this->m_co[0] * v[1] - this->m_co[1] * v[0]); - } - - Scalar triple(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) const - { - return this->m_co[0] * (v1[1] * v2[2] - v1[2] * v2[1]) + - this->m_co[1] * (v1[2] * v2[0] - v1[0] * v2[2]) + - this->m_co[2] * (v1[0] * v2[1] - v1[1] * v2[0]); - } - - int minAxis() const - { - return this->m_co[0] < this->m_co[1] ? (this->m_co[0] < this->m_co[2] ? 0 : 2) : (this->m_co[1] < this->m_co[2] ? 1 : 2); - } - - int maxAxis() const - { - return this->m_co[0] < this->m_co[1] ? (this->m_co[1] < this->m_co[2] ? 2 : 1) : (this->m_co[0] < this->m_co[2] ? 2 : 0); - } - - int furthestAxis() const - { - return absolute().minAxis(); - } - - int closestAxis() const - { - return absolute().maxAxis(); - } - - Vector3<Scalar> lerp(const Vector3<Scalar>& v, const Scalar& t) const - { - return Vector3<Scalar>(this->m_co[0] + (v[0] - this->m_co[0]) * t, - this->m_co[1] + (v[1] - this->m_co[1]) * t, - this->m_co[2] + (v[2] - this->m_co[2]) * t); - } - - static Vector3<Scalar> random() - { - Scalar z = Scalar(2.0) * Scalar_traits<Scalar>::random() - Scalar(1.0); - Scalar r = Scalar_traits<Scalar>::sqrt(Scalar(1.0) - z * z); - Scalar t = Scalar_traits<Scalar>::TwoTimesPi() * Scalar_traits<Scalar>::random(); - return Vector3<Scalar>(r * Scalar_traits<Scalar>::cos(t), - r * Scalar_traits<Scalar>::sin(t), - z); - } - }; - - template <typename Scalar> - inline Vector3<Scalar> - operator+(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return Vector3<Scalar>(v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]); - } - - template <typename Scalar> - inline Vector3<Scalar> - operator-(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return Vector3<Scalar>(v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]); - } - - template <typename Scalar> - inline Vector3<Scalar> - operator-(const Vector3<Scalar>& v) - { - return Vector3<Scalar>(-v[0], -v[1], -v[2]); - } - - template <typename Scalar> - inline Vector3<Scalar> - operator*(const Vector3<Scalar>& v, const Scalar& s) - { - return Vector3<Scalar>(v[0] * s, v[1] * s, v[2] * s); - } - - template <typename Scalar> - inline Vector3<Scalar> - operator*(const Scalar& s, const Vector3<Scalar>& v) - { - return v * s; - } - - template <typename Scalar> - inline Vector3<Scalar> - operator/(const Vector3<Scalar>& v, const Scalar& s) - { - assert(s != Scalar(0.0)); - return v * (Scalar(1.0) / s); - } - - template <typename Scalar> - inline Scalar - dot(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return v1.dot(v2); - } - - template <typename Scalar> - inline Scalar - length2(const Vector3<Scalar>& v) - { - return v.length2(); - } - - template <typename Scalar> - inline Scalar - length(const Vector3<Scalar>& v) - { - return v.length(); - } - - template <typename Scalar> - inline Scalar - distance2(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return v1.distance2(v2); - } - - template <typename Scalar> - inline Scalar - distance(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return v1.distance(v2); - } - - template <typename Scalar> - inline Scalar - angle(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return v1.angle(v2); - } - - template <typename Scalar> - inline Vector3<Scalar> - cross(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2) - { - return v1.cross(v2); - } - - template <typename Scalar> - inline Scalar - triple(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2, const Vector3<Scalar>& v3) - { - return v1.triple(v2, v3); - } - - template <typename Scalar> - inline Vector3<Scalar> - lerp(const Vector3<Scalar>& v1, const Vector3<Scalar>& v2, const Scalar& t) - { - return v1.lerp(v2, t); - } - -} - -#endif diff --git a/extern/solid/include/MT_BBox.h b/extern/solid/include/MT_BBox.h deleted file mode 100644 index b5dc537e0d9..00000000000 --- a/extern/solid/include/MT_BBox.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_BBOX_H -#define MT_BBOX_H - -#include "MT_Scalar.h" -#include "MT_Point3.h" -#include "MT_Vector3.h" - -#include <MT/Tuple3.h> -#include "MT_Interval.h" - - - -class MT_BBox : public MT::Tuple3<MT_Interval> { -public: - MT_BBox() {} - MT_BBox(const MT_Point3& p) - : MT::Tuple3<MT_Interval>(MT_Interval(p[0]), - MT_Interval(p[1]), - MT_Interval(p[2])) - {} - MT_BBox(const MT_Point3& lb, const MT_Point3& ub) - : MT::Tuple3<MT_Interval>(MT_Interval(lb[0], ub[0]), - MT_Interval(lb[1], ub[1]), - MT_Interval(lb[2], ub[2])) - {} - MT_BBox(const MT_Interval& x, const MT_Interval& y, const MT_Interval& z) - : MT::Tuple3<MT_Interval>(x, y, z) - {} - - MT_Point3 getMin() const - { - return MT_Point3(m_co[0].lower(), m_co[1].lower(), m_co[2].lower()); - } - - MT_Point3 getMax() const - { - return MT_Point3(m_co[0].upper(), m_co[1].upper(), m_co[2].upper()); - } - - MT_Point3 getCenter() const - { - return MT_Point3(MT::median(m_co[0]), MT::median(m_co[1]), MT::median(m_co[2])); - } - - MT_Vector3 getExtent() const - { - return MT_Vector3(MT::width(m_co[0]) * MT_Scalar(0.5), MT::width(m_co[1]) * MT_Scalar(0.5), MT::width(m_co[2]) * MT_Scalar(0.5)); - } - - void extend(const MT_Vector3& v) - { - m_co[0] = MT::widen(m_co[0], v[0]); - m_co[1] = MT::widen(m_co[1], v[1]); - m_co[2] = MT::widen(m_co[2], v[2]); - } - - bool overlaps(const MT_BBox& b) const - { - return MT::overlap(m_co[0], b[0]) && - MT::overlap(m_co[1], b[1]) && - MT::overlap(m_co[2], b[2]); - } - - bool inside(const MT_BBox& b) const - { - return MT::in(m_co[0], b[0]) && - MT::in(m_co[1], b[1]) && - MT::in(m_co[2], b[2]); - } - - MT_BBox hull(const MT_BBox& b) const - { - return MT_BBox(MT::hull(m_co[0], b[0]), - MT::hull(m_co[1], b[1]), - MT::hull(m_co[2], b[2])); - } - - bool contains(const MT_Point3& p) const - { - return MT::in(p[0], m_co[0]) && MT::in(p[1], m_co[1]) && MT::in(p[2], m_co[2]); - } -}; - -inline MT_BBox operator+(const MT_BBox& b1, const MT_BBox& b2) -{ - return MT_BBox(b1[0] + b2[0], b1[1] + b2[1], b1[2] + b2[2]); -} - -inline MT_BBox operator-(const MT_BBox& b1, const MT_BBox& b2) -{ - return MT_BBox(b1[0] - b2[0], b1[1] - b2[1], b1[2] - b2[2]); -} - -#endif - - diff --git a/extern/solid/include/MT_Interval.h b/extern/solid/include/MT_Interval.h deleted file mode 100644 index 25ebfd0a67d..00000000000 --- a/extern/solid/include/MT_Interval.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_INTERVAL_H -#define MT_INTERVAL_H - -#include <MT/Interval.h> - -#include "MT_Scalar.h" - -typedef MT::Interval<MT_Scalar> MT_Interval; - -#endif diff --git a/extern/solid/include/MT_Matrix3x3.h b/extern/solid/include/MT_Matrix3x3.h deleted file mode 100644 index f7572f90fa2..00000000000 --- a/extern/solid/include/MT_Matrix3x3.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_MATRIX3X3_H -#define MT_MATRIX3X3_H - -#include "MT_Scalar.h" -#include <MT/Matrix3x3.h> - -typedef MT::Matrix3x3<MT_Scalar> MT_Matrix3x3; - - - -#endif diff --git a/extern/solid/include/MT_Point3.h b/extern/solid/include/MT_Point3.h deleted file mode 100644 index ca84f652b65..00000000000 --- a/extern/solid/include/MT_Point3.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_POINT3_H -#define MT_POINT3_H - -#include "MT_Vector3.h" - -typedef MT_Vector3 MT_Point3; - -#endif diff --git a/extern/solid/include/MT_Quaternion.h b/extern/solid/include/MT_Quaternion.h deleted file mode 100644 index ca860db711c..00000000000 --- a/extern/solid/include/MT_Quaternion.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_QUATERNION_H -#define MT_QUATERNION_H - -#include "MT_Scalar.h" -#include <MT/Quaternion.h> - -typedef MT::Quaternion<MT_Scalar> MT_Quaternion; - -#endif - - - diff --git a/extern/solid/include/MT_Scalar.h b/extern/solid/include/MT_Scalar.h deleted file mode 100644 index 663a1f1839c..00000000000 --- a/extern/solid/include/MT_Scalar.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_SCALAR_H -#define MT_SCALAR_H - -#if defined (__sun__) || defined ( __sun ) || defined (__sparc) || defined (__sparc__) || defined (__sgi) -#include <math.h> -#include <float.h> -#else -#include <cmath> -#include <cstdlib> -#include <cfloat> -#endif - -#undef max - -#include "SOLID_types.h" - -#include "GEN_MinMax.h" -#include "GEN_random.h" - -template <typename Scalar> -struct Scalar_traits {}; - -template<> -struct Scalar_traits<float> { - static float TwoTimesPi() { return 6.283185307179586232f; } - static float epsilon() { return FLT_EPSILON; } - static float max() { return FLT_MAX; } - - static float random() { return float(GEN_rand()) / float(GEN_RAND_MAX); } -#if defined (__sun) || defined (__sun__) || defined (__sparc) || defined (__APPLE__) - static float sqrt(float x) { return ::sqrt(x); } - static float abs(float x) { return ::fabs(x); } - - static float cos(float x) { return ::cos(x); } - static float sin(float x) { return ::sin(x); } - static float tan(float x) { return ::tan(x); } - - static float acos(float x) { return ::acos(x); } - static float asin(float x) { return ::asin(x); } - static float atan(float x) { return ::atan(x); } - static float atan2(float x, float y) { return ::atan2(x, y); } - - static float exp(float x) { return ::exp(x); } - static float log(float x) { return ::log(x); } - static float pow(float x, float y) { return ::pow(x, y); } - -#else - static float sqrt(float x) { return ::sqrtf(x); } - static float abs(float x) { return ::fabsf(x); } - - static float cos(float x) { return ::cosf(x); } - static float sin(float x) { return ::sinf(x); } - static float tan(float x) { return ::tanf(x); } - - static float acos(float x) { return ::acosf(x); } - static float asin(float x) { return ::asinf(x); } - static float atan(float x) { return ::atanf(x); } - static float atan2(float x, float y) { return ::atan2f(x, y); } - - static float exp(float x) { return ::expf(x); } - static float log(float x) { return ::logf(x); } - static float pow(float x, float y) { return ::powf(x, y); } -#endif -}; - -template<> -struct Scalar_traits<double> { - static double TwoTimesPi() { return 6.283185307179586232; } - static double epsilon() { return DBL_EPSILON; } - static double max() { return DBL_MAX; } - - static double random() { return double(GEN_rand()) / double(GEN_RAND_MAX); } - static double sqrt(double x) { return ::sqrt(x); } - static double abs(double x) { return ::fabs(x); } - - static double cos(double x) { return ::cos(x); } - static double sin(double x) { return ::sin(x); } - static double tan(double x) { return ::tan(x); } - - static double acos(double x) { return ::acos(x); } - static double asin(double x) { return ::asin(x); } - static double atan(double x) { return ::atan(x); } - static double atan2(double x, double y) { return ::atan2(x, y); } - - static double exp(double x) { return ::exp(x); } - static double log(double x) { return ::log(x); } - static double pow(double x, double y) { return ::pow(x, y); } -}; - -#ifdef USE_TRACER -#include "MT_ScalarTracer.h" - -#ifdef USE_DOUBLES -typedef MT_ScalarTracer<double> MT_Scalar; -#else -typedef MT_ScalarTracer<float> MT_Scalar; -#endif - -#else - -#ifdef USE_DOUBLES -typedef double MT_Scalar; -#else -typedef float MT_Scalar; -#endif - -#endif - - -const MT_Scalar MT_2_PI = Scalar_traits<MT_Scalar>::TwoTimesPi(); -const MT_Scalar MT_PI = MT_2_PI * MT_Scalar(0.5); -const MT_Scalar MT_HALF_PI = MT_2_PI * MT_Scalar(0.25); -const MT_Scalar MT_RADS_PER_DEG = MT_2_PI / MT_Scalar(360.0); -const MT_Scalar MT_DEGS_PER_RAD = MT_Scalar(360.0) / MT_2_PI; - -const MT_Scalar MT_EPSILON = Scalar_traits<MT_Scalar>::epsilon(); -const MT_Scalar MT_INFINITY = Scalar_traits<MT_Scalar>::max(); - -inline MT_Scalar MT_random() { return Scalar_traits<MT_Scalar>::random(); } -inline MT_Scalar MT_abs(MT_Scalar x) { return Scalar_traits<MT_Scalar>::abs(x); } -inline MT_Scalar MT_sqrt(MT_Scalar x) { return Scalar_traits<MT_Scalar>::sqrt(x); } - -inline MT_Scalar MT_cos(MT_Scalar x) { return Scalar_traits<MT_Scalar>::cos(x); } -inline MT_Scalar MT_sin(MT_Scalar x) { return Scalar_traits<MT_Scalar>::sin(x); } -inline MT_Scalar MT_tan(MT_Scalar x) { return Scalar_traits<MT_Scalar>::tan(x); } - -inline MT_Scalar MT_acos(MT_Scalar x) { return Scalar_traits<MT_Scalar>::acos(x); } -inline MT_Scalar MT_asin(MT_Scalar x) { return Scalar_traits<MT_Scalar>::asin(x); } -inline MT_Scalar MT_atan(MT_Scalar x) { return Scalar_traits<MT_Scalar>::atan(x); } -inline MT_Scalar MT_atan2(MT_Scalar x, MT_Scalar y) { return Scalar_traits<MT_Scalar>::atan2(x, y); } - -inline MT_Scalar MT_radians(MT_Scalar x) { return x * MT_RADS_PER_DEG; } -inline MT_Scalar MT_degrees(MT_Scalar x) { return x * MT_DEGS_PER_RAD; } - -#endif diff --git a/extern/solid/include/MT_Transform.h b/extern/solid/include/MT_Transform.h deleted file mode 100644 index 66f92428054..00000000000 --- a/extern/solid/include/MT_Transform.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_TRANSFORM_H -#define MT_TRANSFORM_H - -#include "MT_Scalar.h" -#include <MT/Transform.h> - -typedef MT::Matrix3x3<MT_Scalar> MT_Matrix3x3; -typedef MT::Transform<MT_Scalar> MT_Transform; - -#endif - - - - - diff --git a/extern/solid/include/MT_Vector3.h b/extern/solid/include/MT_Vector3.h deleted file mode 100644 index d50e80dc287..00000000000 --- a/extern/solid/include/MT_Vector3.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef MT_VECTOR3_H -#define MT_VECTOR3_H - -#include "MT_Scalar.h" -#include <MT/Vector3.h> - -typedef MT::Vector3<MT_Scalar> MT_Vector3; - -#ifdef CPU_CMP - -inline bool operator==(const MT_Vector3& p1, const MT_Vector3& p2) -{ - const unsigned int *i1 = (const unsigned int *)&p1; - const unsigned int *i2 = (const unsigned int *)&p2; - return i1[0] == i2[0] && i1[1] == i2[1] && i1[2] == i2[2]; -} - -#else - -inline bool operator==(const MT_Vector3& p1, const MT_Vector3& p2) -{ - return p1[0] == p2[0] && p1[1] == p2[1] && p1[2] == p2[2]; -} - -#endif - -#endif diff --git a/extern/solid/include/SOLID.h b/extern/solid/include/SOLID.h deleted file mode 100644 index 96d40f1ea6b..00000000000 --- a/extern/solid/include/SOLID.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef SOLID_H -#define SOLID_H - -#include "SOLID_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - DT_DECLARE_HANDLE(DT_ObjectHandle); - DT_DECLARE_HANDLE(DT_SceneHandle); - DT_DECLARE_HANDLE(DT_ShapeHandle); - DT_DECLARE_HANDLE(DT_VertexBaseHandle); - DT_DECLARE_HANDLE(DT_RespTableHandle); - DT_DECLARE_HANDLE(DT_ArchiveHandle); - - typedef unsigned int DT_ResponseClass; - - typedef enum DT_ResponseType { - DT_NO_RESPONSE, /* No response (obsolete) */ - DT_BROAD_RESPONSE, /* Broad phase response is returned. */ - DT_SIMPLE_RESPONSE, /* No collision data */ - DT_WITNESSED_RESPONSE, /* A point common to both objects - is returned as collision data - */ - DT_DEPTH_RESPONSE /* The penetration depth is returned - as collision data. The penetration depth - is the shortest vector over which one - object needs to be translated in order - to bring the objects in touching contact. - */ - } DT_ResponseType; - -/* For witnessed response, the following structure represents a common point. The world - coordinates of 'point1' and 'point2' coincide. 'normal' is the zero vector. - - For depth response, the following structure represents the penetration depth. - 'point1' en 'point2' are the witness points of the penetration depth in world coordinates. - The penetration depth vector in world coordinates is represented by 'normal'. -*/ - - typedef struct DT_CollData { - DT_Vector3 point1; /* Point in object1 in world coordinates */ - DT_Vector3 point2; /* Point in object2 in world coordinates */ - DT_Vector3 normal; /* point2 - point1 */ - } DT_CollData; - -/* A response callback is called by SOLID for each pair of collding objects. 'client-data' - is a pointer to an arbitrary structure in the client application. The client objects are - pointers to structures in the client application associated with the coliding objects. - 'coll_data' is the collision data computed by SOLID. -*/ - - typedef DT_Bool (*DT_ResponseCallback)(void *client_data, - void *client_object1, - void *client_object2, - const DT_CollData *coll_data); - -/* Shape definition */ - - - extern DECLSPEC DT_ShapeHandle DT_NewBox(DT_Scalar x, DT_Scalar y, DT_Scalar z); - extern DECLSPEC DT_ShapeHandle DT_NewCone(DT_Scalar radius, DT_Scalar height); - extern DECLSPEC DT_ShapeHandle DT_NewCylinder(DT_Scalar radius, DT_Scalar height); - extern DECLSPEC DT_ShapeHandle DT_NewSphere(DT_Scalar radius); - extern DECLSPEC DT_ShapeHandle DT_NewPoint(const DT_Vector3 point); - extern DECLSPEC DT_ShapeHandle DT_NewLineSegment(const DT_Vector3 source, const DT_Vector3 target); - extern DECLSPEC DT_ShapeHandle DT_NewMinkowski(DT_ShapeHandle shape1, DT_ShapeHandle shape2); - extern DECLSPEC DT_ShapeHandle DT_NewHull(DT_ShapeHandle shape1, DT_ShapeHandle shape2); - - extern DECLSPEC DT_VertexBaseHandle DT_NewVertexBase(const void *pointer, DT_Size stride); - extern DECLSPEC void DT_DeleteVertexBase(DT_VertexBaseHandle vertexBase); - extern DECLSPEC void DT_ChangeVertexBase(DT_VertexBaseHandle vertexBase, const void *pointer); - - extern DECLSPEC DT_ShapeHandle DT_NewComplexShape(DT_VertexBaseHandle vertexBase); - extern DECLSPEC void DT_EndComplexShape(); - - extern DECLSPEC DT_ShapeHandle DT_NewPolytope(DT_VertexBaseHandle vertexBase); - extern DECLSPEC void DT_EndPolytope(); - - extern DECLSPEC void DT_Begin(); - extern DECLSPEC void DT_End(); - - extern DECLSPEC void DT_Vertex(const DT_Vector3 vertex); - extern DECLSPEC void DT_VertexIndex(DT_Index index); - - extern DECLSPEC void DT_VertexIndices(DT_Count count, const DT_Index *indices); - extern DECLSPEC void DT_VertexRange(DT_Index first, DT_Count count); - - extern DECLSPEC void DT_DeleteShape(DT_ShapeHandle shape); - -/* Object */ - - extern DECLSPEC DT_ObjectHandle DT_CreateObject( - void *client_object, /* pointer to object in client memory */ - DT_ShapeHandle shape /* the shape or geometry of the object */ - ); - - extern DECLSPEC void DT_DestroyObject(DT_ObjectHandle object); - - - - extern DECLSPEC void DT_SetPosition(DT_ObjectHandle object, const DT_Vector3 position); - extern DECLSPEC void DT_SetOrientation(DT_ObjectHandle object, const DT_Quaternion orientation); - extern DECLSPEC void DT_SetScaling(DT_ObjectHandle object, const DT_Vector3 scaling); - -/* The margin is an offset from the actual shape. The actual geometry of an - object is the set of points whose distance to the transformed shape is at - most the margin. During the lifetime of an object the margin can be - modified. -*/ - - extern DECLSPEC void DT_SetMargin(DT_ObjectHandle object, DT_Scalar margin); - - -/* These commands assume a column-major 4x4 OpenGL matrix representation */ - - extern DECLSPEC void DT_SetMatrixf(DT_ObjectHandle object, const float *m); - extern DECLSPEC void DT_GetMatrixf(DT_ObjectHandle object, float *m); - - extern DECLSPEC void DT_SetMatrixd(DT_ObjectHandle object, const double *m); - extern DECLSPEC void DT_GetMatrixd(DT_ObjectHandle object, double *m); - - extern DECLSPEC void DT_GetBBox(DT_ObjectHandle object, DT_Vector3 min, DT_Vector3 max); - - - extern DECLSPEC DT_Bool DT_GetIntersect(DT_ObjectHandle object1, DT_ObjectHandle object2, - DT_Vector3 v); -/* This next command returns the distance between the objects. De returned - closest points are given in world coordinates. -*/ - extern DECLSPEC DT_Scalar DT_GetClosestPair(DT_ObjectHandle object1, DT_ObjectHandle object2, - DT_Vector3 point1, DT_Vector3 point2); - - extern DECLSPEC DT_Bool DT_GetCommonPoint(DT_ObjectHandle object1, DT_ObjectHandle object2, - DT_Vector3 point); - - extern DECLSPEC DT_Bool DT_GetPenDepth(DT_ObjectHandle object1, DT_ObjectHandle object2, - DT_Vector3 point1, DT_Vector3 point2); - -/* Scene */ - - extern DECLSPEC DT_SceneHandle DT_CreateScene(); - extern DECLSPEC void DT_DestroyScene(DT_SceneHandle scene); - - extern DECLSPEC void DT_AddObject(DT_SceneHandle scene, DT_ObjectHandle object); - extern DECLSPEC void DT_RemoveObject(DT_SceneHandle scene, DT_ObjectHandle object); - -/* Note that objects can be assigned to multiple scenes! */ - -/* Response */ - -/* Response tables are defined independent of the scenes in which they are used. - Multiple response tables can be used in one scene, and a response table - can be shared among scenes. -*/ - extern DECLSPEC DT_RespTableHandle DT_CreateRespTable(); - extern DECLSPEC void DT_DestroyRespTable(DT_RespTableHandle respTable); - -/* Responses are defined on (pairs of) response classes. Each response table - maintains its set of response classes. -*/ - extern DECLSPEC DT_ResponseClass DT_GenResponseClass(DT_RespTableHandle respTable); - -/* To each object for which a response is defined in the response table a - response class needs to be assigned. -*/ - - extern DECLSPEC void DT_SetResponseClass(DT_RespTableHandle respTable, - DT_ObjectHandle object, - DT_ResponseClass responseClass); - - extern DECLSPEC void DT_ClearResponseClass(DT_RespTableHandle respTable, - DT_ObjectHandle object); - - extern DECLSPEC void DT_CallResponse(DT_RespTableHandle respTable, - DT_ObjectHandle object1, - DT_ObjectHandle object2, - const DT_CollData *coll_data); - -/* For each pair of objects multiple responses can be defined. A response is a callback - together with its response type and client data. */ - -/* Responses can be defined for all pairs of response classes... */ - extern DECLSPEC void DT_AddDefaultResponse(DT_RespTableHandle respTable, - DT_ResponseCallback response, - DT_ResponseType type, void *client_data); - - extern DECLSPEC void DT_RemoveDefaultResponse(DT_RespTableHandle respTable, - DT_ResponseCallback response); -/* ...per response class... */ - extern DECLSPEC void DT_AddClassResponse(DT_RespTableHandle respTable, - DT_ResponseClass responseClass, - DT_ResponseCallback response, - DT_ResponseType type, void *client_data); - - extern DECLSPEC void DT_RemoveClassResponse(DT_RespTableHandle respTable, - DT_ResponseClass responseClass, - DT_ResponseCallback response); - -/* ... and per pair of response classes...*/ - extern DECLSPEC void DT_AddPairResponse(DT_RespTableHandle respTable, - DT_ResponseClass responseClass1, - DT_ResponseClass responseClass2, - DT_ResponseCallback response, - DT_ResponseType type, void *client_data); - extern DECLSPEC void DT_RemovePairResponse(DT_RespTableHandle respTable, - DT_ResponseClass responseClass1, - DT_ResponseClass responseClass2, - DT_ResponseCallback response); - -/* The next command calls the response callbacks for all intersecting pairs of objects in a scene. - 'DT_Test' returns the number of pairs of objects for which callbacks have been called. -*/ - - extern DECLSPEC DT_Count DT_Test(DT_SceneHandle scene, DT_RespTableHandle respTable); - -/* Set the maximum relative error in the closest points and penetration depth - computation. The default for `max_error' is 1.0e-3. Larger errors result - in better performance. Non-positive error tolerances are ignored. -*/ - - extern DECLSPEC void DT_SetAccuracy(DT_Scalar max_error); - -/* Set the maximum tolerance on relative errors due to rounding. The default for `tol_error' - is the machine epsilon. Very large tolerances result in false collisions. Setting tol_error too small - results in missed collisions. Non-positive error tolerances are ignored. -*/ - - extern DECLSPEC void DT_SetTolerance(DT_Scalar tol_error); - - -/* This function returns the client pointer to the first object in a scene hit by the ray - (actually a line segment) defined by the points 'from' en 'to'. The spot is the hit point - on the object in local coordinates. 'normal' is the normal to the surface of the object in - world coordinates. The ignore_client pointer is used to make one of the objects transparent. - - NB: Currently ray tests are implemented for spheres, boxes, and meshes only!! -*/ - - extern DECLSPEC void *DT_RayCast(DT_SceneHandle scene, void *ignore_client, - const DT_Vector3 source, const DT_Vector3 target, - DT_Scalar max_param, DT_Scalar *param, DT_Vector3 normal); - -/* Similar, only here a single object is tested and a boolean is returned */ - - extern DECLSPEC DT_Bool DT_ObjectRayCast(DT_ObjectHandle object, - const DT_Vector3 source, const DT_Vector3 target, - DT_Scalar max_param, DT_Scalar *param, DT_Vector3 normal); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/extern/solid/include/SOLID_broad.h b/extern/solid/include/SOLID_broad.h deleted file mode 100644 index 74e4214fa67..00000000000 --- a/extern/solid/include/SOLID_broad.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef SOLID_BROAD_H -#define SOLID_BROAD_H - -#include "SOLID_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - DT_DECLARE_HANDLE(BP_SceneHandle); - DT_DECLARE_HANDLE(BP_ProxyHandle); - - typedef void (*BP_Callback)(void *client_data, - void *object1, - void *object2); - - typedef bool (*BP_RayCastCallback)(void *client_data, - void *object, - const DT_Vector3 source, - const DT_Vector3 target, - DT_Scalar *lambda); - - extern DECLSPEC BP_SceneHandle BP_CreateScene(void *client_data, - BP_Callback beginOverlap, - BP_Callback endOverlap); - - extern DECLSPEC void BP_DestroyScene(BP_SceneHandle scene); - - extern DECLSPEC BP_ProxyHandle BP_CreateProxy(BP_SceneHandle scene, - void *object, - const DT_Vector3 min, - const DT_Vector3 max); - - extern DECLSPEC void BP_DestroyProxy(BP_SceneHandle scene, - BP_ProxyHandle proxy); - - extern DECLSPEC void BP_SetBBox(BP_ProxyHandle proxy, - const DT_Vector3 min, - const DT_Vector3 max); - - extern DECLSPEC void *BP_RayCast(BP_SceneHandle scene, - BP_RayCastCallback objectRayCast, - void *client_data, - const DT_Vector3 source, - const DT_Vector3 target, - DT_Scalar *lambda); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/extern/solid/include/SOLID_types.h b/extern/solid/include/SOLID_types.h deleted file mode 100644 index 630594e447f..00000000000 --- a/extern/solid/include/SOLID_types.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SOLID - Software Library for Interference Detection - * - * Copyright (C) 2001-2003 Dtecta. All rights reserved. - * - * This library may be distributed under the terms of the Q Public License - * (QPL) as defined by Trolltech AS of Norway and appearing in the file - * LICENSE.QPL included in the packaging of this file. - * - * This library may be distributed and/or modified under the terms of the - * GNU General Public License (GPL) version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Commercial use or any other use of this library not covered by either - * the QPL or the GPL requires an additional license from Dtecta. - * Please contact info@dtecta.com for enquiries about the terms of commercial - * use of this library. - */ - -#ifndef SOLID_TYPES_H -#define SOLID_TYPES_H - -#ifndef DECLSPEC -# ifdef WIN32 -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif -#endif - -#define DT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - - -typedef unsigned short DT_Index; -typedef unsigned short DT_Count; -typedef unsigned int DT_Size; -typedef float DT_Scalar; -typedef int DT_Bool; - -#define DT_FALSE 0 -#define DT_TRUE 1 - -#define DT_CONTINUE 0 -#define DT_DONE 1 - -typedef DT_Scalar DT_Vector3[3]; -typedef DT_Scalar DT_Quaternion[4]; - -#endif |