Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
iMSTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ruiliang Gao
iMSTK
Commits
4f9a8cbe
Commit
4f9a8cbe
authored
8 years ago
by
Sreekanth Arikatla
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Adds tests for geometric mapping
Adds visual tests for Isometric mapping
parent
72526271
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Base/Geometry/imstkIsometricMap.h
+2
-0
2 additions, 0 deletions
Base/Geometry/imstkIsometricMap.h
Examples/Sandbox/main.cpp
+56
-0
56 additions, 0 deletions
Examples/Sandbox/main.cpp
with
58 additions
and
0 deletions
Base/Geometry/imstkIsometricMap.h
+
2
−
0
View file @
4f9a8cbe
...
...
@@ -36,6 +36,8 @@ public:
void
applyMap
();
void
computeMap
(){};
// Accessors
void
setTransform
(
const
RigidTransform3d
&
affineTransform
);
const
RigidTransform3d
&
getTransform
()
const
;
...
...
This diff is collapsed.
Click to expand it.
Examples/Sandbox/main.cpp
+
56
−
0
View file @
4f9a8cbe
...
...
@@ -11,10 +11,16 @@
#include
"imstkMath.h"
#include
"imstkSimulationManager.h"
// Maps
#include
"imstkIsometricMap.h"
#include
"g3log/g3log.hpp"
void
testGeometryMaps
();
int
main
()
{
std
::
cout
<<
"****************"
<<
std
::
endl
<<
"Starting Sandbox"
<<
std
::
endl
<<
"****************"
<<
std
::
endl
;
...
...
@@ -52,6 +58,7 @@ int main()
sdk
->
startSimulation
(
"SceneTest"
);
/*
//--------------------------------------------
// Geometry
...
...
@@ -140,3 +147,52 @@ int main()
return
0
;
}
void
testGeometryMaps
()
{
std
::
cout
<<
"****************"
<<
std
::
endl
<<
"Test: Geometric maps"
<<
std
::
endl
<<
"****************"
<<
std
::
endl
;
auto
sdk
=
std
::
make_shared
<
imstk
::
SimulationManager
>
();
// Scene object 1
auto
cubeGeom
=
std
::
make_shared
<
imstk
::
Cube
>
();
cubeGeom
->
scale
(
0.5
);
auto
cubeObj
=
std
::
make_shared
<
imstk
::
VisualObject
>
(
"VisualCube"
);
cubeObj
->
setVisualGeometry
(
cubeGeom
);
// Scene object 2
auto
sphereGeom
=
std
::
make_shared
<
imstk
::
Sphere
>
();
sphereGeom
->
scale
(
0.3
);
auto
sphereObj
=
std
::
make_shared
<
imstk
::
VisualObject
>
(
"VisualSphere"
);
sphereObj
->
setVisualGeometry
(
sphereGeom
);
// Isometric Map
auto
rigidMap
=
std
::
make_shared
<
imstk
::
IsometricMap
>
();
rigidMap
->
setMaster
(
sphereObj
->
getVisualGeometry
());
rigidMap
->
setSlave
(
cubeObj
->
getVisualGeometry
());
auto
trans
=
imstk
::
RigidTransform3d
::
Identity
();
trans
.
translate
(
imstk
::
Vec3d
(
1.5
,
1.5
,
1.5
));
auto
rz
=
imstk
::
RigidTransform3d
(
Eigen
::
AngleAxisd
(
imstk
::
PI_4
,
imstk
::
Vec3d
(
0
,
1.0
,
0
)));
trans
.
rotate
(
rz
.
rotation
());
rigidMap
->
setTransform
(
trans
);
// Apply map
rigidMap
->
applyMap
();
// Move master and Apply map again
sphereObj
->
getVisualGeometry
()
->
setPosition
(
-
1.0
,
0
,
0
);
rigidMap
->
applyMap
();
auto
geometryMapTest
=
sdk
->
createNewScene
(
"geometryMapTest"
);
geometryMapTest
->
setLoopDelay
(
1000
);
geometryMapTest
->
addSceneObject
(
cubeObj
);
geometryMapTest
->
addSceneObject
(
sphereObj
);
sdk
->
startSimulation
(
"geometryMapTest"
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment