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
OpenMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
OpenMesh
Commits
a5e04d48
Commit
a5e04d48
authored
Jan 17, 2019
by
Jan Möbius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More unittesting for eigen vectors
parent
58085cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
13 deletions
+37
-13
src/Unittests/unittests_eigen3_type.cc
src/Unittests/unittests_eigen3_type.cc
+37
-13
No files found.
src/Unittests/unittests_eigen3_type.cc
View file @
a5e04d48
...
...
@@ -19,15 +19,6 @@ struct EigenTraits : OpenMesh::DefaultTraits {
using
EigenTriMesh
=
OpenMesh
::
TriMesh_ArrayKernelT
<
EigenTraits
>
;
template
<
class
Scalar
>
Eigen
::
Matrix
<
Scalar
,
3
,
1
>
transformPoint
(
Eigen
::
Matrix
<
Scalar
,
3
,
4
>
const
&
trans
,
Eigen
::
Matrix
<
Scalar
,
3
,
1
>
const
&
point
)
{
return
trans
.
leftCols
(
3
)
*
point
+
trans
.
col
(
3
);
}
namespace
{
...
...
@@ -50,6 +41,20 @@ class OpenMeshEigenTest : public testing::Test {
EigenTriMesh
mesh_
;
};
TEST_F
(
OpenMeshEigenTest
,
Test_external_vectorize
)
{
EigenTriMesh
::
Normal
normal
;
vectorize
(
normal
,
2
);
EXPECT_EQ
(
normal
[
0
],
2.0
f
)
<<
"Wrong x value"
;
EXPECT_EQ
(
normal
[
1
],
2.0
f
)
<<
"Wrong y value"
;
EXPECT_EQ
(
normal
[
2
],
2.0
f
)
<<
"Wrong z value"
;
}
TEST_F
(
OpenMeshEigenTest
,
Test_external_norm
)
{
...
...
@@ -87,15 +92,15 @@ TEST_F(OpenMeshEigenTest, Test_external_normalize) {
EigenTriMesh
::
Normal
normal
(
2
,
0
,
0
);
EigenTriMesh
::
Normal
normalized
=
normalize
(
normal
);
normalize
(
normal
);
EXPECT_EQ
(
norm
(
normal
ized
),
1.0
f
)
<<
"Wrong norm after normalization"
;
EXPECT_EQ
(
norm
(
normal
),
1.0
f
)
<<
"Wrong norm after normalization"
;
normal
=
EigenTriMesh
::
Normal
(
2
,
6
,
9
);
normalize
d
=
normalize
(
normal
);
normalize
(
normal
);
EXPECT_EQ
(
norm
(
normal
ized
),
1.0
f
)
<<
"Wrong norm after normalization"
;
EXPECT_EQ
(
norm
(
normal
),
1.0
f
)
<<
"Wrong norm after normalization"
;
}
...
...
@@ -208,6 +213,25 @@ TEST_F(OpenMeshEigenTest, test_normal_computation) {
}
/* Just load a simple mesh file in obj format and count whether
* the right number of entities has been loaded. Afterwards recompute
* normals
*/
TEST_F
(
OpenMeshEigenTest
,
LoadSimpleOFFFile
)
{
mesh_
.
clear
();
bool
ok
=
OpenMesh
::
IO
::
read_mesh
(
mesh_
,
"cube1.off"
);
EXPECT_TRUE
(
ok
);
EXPECT_EQ
(
7526u
,
mesh_
.
n_vertices
())
<<
"The number of loaded vertices is not correct!"
;
EXPECT_EQ
(
22572u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
15048u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
mesh_
.
update_normals
();
}
}
#endif
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