Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
4dd0f083
Commit
4dd0f083
authored
Mar 25, 2013
by
Stefan Philips
Browse files
[ADD] calcSHToTensorSymMatrix that creates its own orientations
parent
36256ff6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
src/core/common/math/WSymmetricSphericalHarmonic.cpp
src/core/common/math/WSymmetricSphericalHarmonic.cpp
+22
-1
src/core/common/math/WSymmetricSphericalHarmonic.h
src/core/common/math/WSymmetricSphericalHarmonic.h
+10
-1
No files found.
src/core/common/math/WSymmetricSphericalHarmonic.cpp
View file @
4dd0f083
...
...
@@ -24,11 +24,13 @@
#include <stdint.h>
#include <cmath>
#include <vector>
#include <boost/math/special_functions/spherical_harmonic.hpp>
#include "core/common/WLogger.h"
#include "core/common/math/WGeometryFunctions.h"
#include "../exceptions/WPreconditionNotMet.h"
#include "linearAlgebra/WLinearAlgebra.h"
#include "WLinearAlgebraFunctions.h"
...
...
@@ -464,8 +466,27 @@ WMatrix<double> WSymmetricSphericalHarmonic::calcFRTMatrix( size_t order )
return
result
;
}
WMatrix
<
double
>
WSymmetricSphericalHarmonic
::
calcSHToTensorSymMatrix
(
std
::
size_t
order
)
{
std
::
vector
<
WVector3d
>
vertices
;
std
::
vector
<
unsigned
int
>
triangles
;
// calc necessary tesselation level
int
level
=
static_cast
<
int
>
(
log
(
static_cast
<
float
>
(
(
order
+
1
)
*
(
order
+
2
)
)
)
/
2.0
f
+
1.0
f
);
tesselateIcosahedron
(
&
vertices
,
&
triangles
,
level
);
std
::
vector
<
WUnitSphereCoordinates
>
orientations
;
for
(
std
::
vector
<
WVector3d
>::
const_iterator
cit
=
vertices
.
begin
();
cit
!=
vertices
.
end
();
cit
++
)
{
// avoid linear dependent orientations
if
(
(
*
cit
)[
0
]
>=
0.0001
)
{
orientations
.
push_back
(
WUnitSphereCoordinates
(
*
cit
)
);
}
}
return
WSymmetricSphericalHarmonic
::
calcSHToTensorSymMatrix
(
order
,
orientations
);
}
WMatrix
<
double
>
WSymmetricSphericalHarmonic
::
calcSHToTensorSymMatrix
(
std
::
size_t
order
,
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
)
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
)
{
std
::
size_t
numElements
=
(
order
+
1
)
*
(
order
+
2
)
/
2
;
WPrecondEquals
(
order
%
2
,
0u
);
...
...
src/core/common/math/WSymmetricSphericalHarmonic.h
View file @
4dd0f083
...
...
@@ -236,7 +236,16 @@ public:
* Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order.
*
* \param order The order of the symmetric tensor.
* \param orientations A vector of at least (orderTensor+1) * (orderTensor+2) / 2 linear independent orientations.
*
* \return the conversion matrix
*/
static
WMatrix
<
double
>
calcSHToTensorSymMatrix
(
std
::
size_t
order
);
/**
* Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order.
*
* \param order The order of the symmetric tensor.
* \param orientations A vector of at least (orderTensor+1) * (orderTensor+2) / 2 orientations.
*
* \return the conversion matrix
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment