37template <
class T,
class U,
typename Int>
40 for (
Int i = 0; i < nDim; i++) d +=
pow(a[i] - b[i], 2);
45template <
class T,
class U,
typename Int>
51template <
class T,
typename Int>
53 for (
Int i = 0; i < nDim; i++) d[i] = a[i] - b[i];
58template <
class T,
typename Int>
60 for (
Int i = 0; i < nDim; i++) d[i] = 2 * b[i] - a[i];
64template <
class T,
typename Int>
67 for (
Int i = 0; i < nDim; ++i) d += a[i] * b[i];
72template <
class T,
typename Int>
78template <
class T,
typename Int>
84template <
class T,
typename Int>
94 c[0] = a[1] * b[2] - a[2] * b[1];
95 c[1] = a[2] * b[0] - a[0] * b[2];
96 c[2] = a[0] * b[1] - a[1] * b[0];
104template <
class T,
int nDim>
106 T dist[nDim] = {0.0};
109 for (
int iDim = 0; iDim < nDim; ++iDim) c[iDim] = l0[iDim] + alpha * d[iDim];
110 return fabs(alpha) *
Norm(nDim, d);
118template <
class T,
int nDim>
120 return LinePlaneIntersection<T, nDim>(p1, n, p0, n, c);
124template <
class T,
class U>
126 normal[0] = coords[0][1] - coords[1][1];
127 normal[1] = coords[1][0] - coords[0][0];
131template <
class T,
class U>
135 for (
int iDim = 0; iDim < 3; iDim++) {
136 a[iDim] = coords[1][iDim] - coords[0][iDim];
137 b[iDim] = coords[2][iDim] - coords[0][iDim];
147template <
class T,
class U>
151 for (
int iDim = 0; iDim < 3; iDim++) {
152 a[iDim] = coords[2][iDim] - coords[0][iDim];
153 b[iDim] = coords[3][iDim] - coords[1][iDim];
163template <
class T,
class U>
165 U normal[3], distance[3];
167 Distance(3, point, coords[0], distance);
175template <
class Scalar,
class Matrix>
177 Scalar cosTheta = cos(theta);
180 Scalar sinTheta = sin(theta);
184 mat[0][0] = cosPhi * cosPsi;
185 mat[1][0] = cosPhi * sinPsi;
188 mat[0][1] = sinTheta * sinPhi * cosPsi - cosTheta * sinPsi;
189 mat[1][1] = sinTheta * sinPhi * sinPsi + cosTheta * cosPsi;
190 mat[2][1] = sinTheta * cosPhi;
192 mat[0][2] = cosTheta * sinPhi * cosPsi + sinTheta * sinPsi;
193 mat[1][2] = cosTheta * sinPhi * sinPsi - sinTheta * cosPsi;
194 mat[2][2] = cosTheta * cosPhi;
198template <
class Scalar,
class Matrix>
211template <
class Scalar,
int nDim>
213 for (
int iDim = 0; iDim < nDim; ++iDim) {
215 for (
int k = 0; k < nDim; ++k) c[iDim] += R[iDim][k] * d[k];
220template <
class Scalar>
223 return angles[0] != 0.0 || angles[1] != 0.0 || angles[2] != 0.0;
227template <
class Scalar,
int nDim>
231 Scalar rotMin[nDim] = {0.0}, rotMax[nDim] = {0.0};
232 for (
int iDim = 0; iDim < nDim; ++iDim) {
233 for (
int jDim = 0; jDim < nDim; ++jDim) {
234 const Scalar fromMin = R[iDim][jDim] * vMin[jDim];
235 const Scalar fromMax = R[iDim][jDim] * vMax[jDim];
236 rotMin[iDim] += min(fromMin, fromMax);
237 rotMax[iDim] += max(fromMin, fromMax);
240 std::copy_n(rotMin, nDim, vMin);
241 std::copy_n(rotMax, nDim, vMax);
245template <
class Mat,
class Scalar,
class Int>
247 for (
Int iDim = 0; iDim < nDim; iDim++) proj[iDim] =
DotProduct(nDim, tensor[iDim], vector);
249 auto normalProj =
DotProduct(nDim, proj, vector);
251 for (
Int iDim = 0; iDim < nDim; iDim++) proj[iDim] -= normalProj * vector[iDim];
CNewtonIntegration::Scalar Scalar
Definition CNewtonIntegration.cpp:31
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
A simple SIMD type relying on implicit vectorization, i.e. done by the compiler, explicitly vectorize...
Definition vectorization.hpp:89
FORCEINLINE ARRAY_T sqrt(const ARRAY_T &x)
Definition special_vectorization.hpp:116
FORCEINLINE ARRAY_T pow(const ARRAY_T &a, const ARRAY_T &b)
Definition special_vectorization.hpp:179