Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
041d3caf
Commit
041d3caf
authored
Apr 12, 2016
by
Sreekanth Arikatla
Browse files
BUG: Minor fixes to returning references to locals
Minor fixes to returning references to locals in various places.
parent
89c4588e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Base/Geometry/imstkGeometryMap.cpp
View file @
041d3caf
...
...
@@ -47,9 +47,10 @@ GeometryMap::setMaster(std::shared_ptr<Geometry> master)
m_master
=
master
;
}
const
std
::
string
&
GeometryMap
::
getTypeName
()
const
const
std
::
string
GeometryMap
::
getTypeName
()
const
{
switch
(
getT
ype
()
)
switch
(
m_t
ype
)
{
case
GeometryMapType
::
Isometric
:
return
"Isometric map"
;
...
...
Base/Geometry/imstkGeometryMap.h
View file @
041d3caf
...
...
@@ -69,12 +69,13 @@ public:
const
GeometryMapType
&
getType
()
const
;
virtual
void
setMaster
(
std
::
shared_ptr
<
Geometry
>
master
);
const
std
::
string
&
getTypeName
()
const
;
virtual
std
::
shared_ptr
<
Geometry
>
getMaster
()
const
;
virtual
void
setSlave
(
std
::
shared_ptr
<
Geometry
>
slave
);
virtual
std
::
shared_ptr
<
Geometry
>
getSlave
()
const
;
const
std
::
string
getTypeName
()
const
;
///
/// \brief Returns true if the map is actively applied at runtime, else false.
///
...
...
@@ -83,11 +84,11 @@ public:
///
/// \brief Print the map
///
virtual
void
print
Map
()
const
=
0
;
virtual
void
print
()
const
=
0
;
protected:
GeometryMap
(
GeometryMapType
type
)
:
m_isActive
(
true
)
{}
GeometryMap
(
GeometryMapType
type
)
:
m_type
(
type
),
m_isActive
(
true
)
{}
GeometryMapType
m_type
;
///> type of the map
...
...
Base/Geometry/imstkIdentityMap.cpp
View file @
041d3caf
...
...
@@ -23,7 +23,7 @@
namespace
imstk
{
const
imstk
::
RigidTransform3d
&
const
imstk
::
RigidTransform3d
IdentityMap
::
getTransform
()
const
{
return
imstk
::
RigidTransform3d
::
Identity
();
...
...
Base/Geometry/imstkIdentityMap.h
View file @
041d3caf
...
...
@@ -43,7 +43,7 @@ public:
// Accessors
void
setTransform
(
const
RigidTransform3d
&
affineTransform
);
const
RigidTransform3d
&
getTransform
()
const
;
const
RigidTransform3d
getTransform
()
const
;
};
}
...
...
Base/Geometry/imstkIsometricMap.cpp
View file @
041d3caf
...
...
@@ -28,13 +28,13 @@ IsometricMap::setTransform(const RigidTransform3d& affineTransform)
m_rigidTransform
=
affineTransform
;
}
const
imstk
::
RigidTransform3d
&
const
imstk
::
RigidTransform3d
IsometricMap
::
getTransform
()
const
{
return
m_rigidTransform
;
}
void
IsometricMap
::
print
Map
()
const
void
IsometricMap
::
print
()
const
{
std
::
cout
<<
this
->
getTypeName
()
<<
std
::
endl
;
}
...
...
Base/Geometry/imstkIsometricMap.h
View file @
041d3caf
...
...
@@ -40,9 +40,9 @@ public:
// Accessors
void
setTransform
(
const
RigidTransform3d
&
affineTransform
);
const
RigidTransform3d
&
getTransform
()
const
;
const
RigidTransform3d
getTransform
()
const
;
void
print
Map
()
const
;
void
print
()
const
;
protected:
RigidTransform3d
m_rigidTransform
;
...
...
Base/Geometry/imstkSurfaceMesh.h
View file @
041d3caf
...
...
@@ -46,8 +46,7 @@ public:
void
computeVertexTangents
();
// Accessors
void
setTriangleVertices
(
const
std
::
vector
<
TriangleArray
>&
triangles
);
void
setTriangleVertices
(
const
std
::
vector
<
TriangleArray
>&
triangles
);
void
setTextureCoordinates
(
const
std
::
vector
<
Vec2f
>&
coords
);
...
...
Base/Geometry/imstkTetraTriangleMap.cpp
View file @
041d3caf
...
...
@@ -37,8 +37,8 @@ TetraTriangleMap::computeMap()
auto
tetMesh
=
std
::
dynamic_pointer_cast
<
imstk
::
TetrahedralMesh
>
(
m_master
);
auto
triMesh
=
std
::
dynamic_pointer_cast
<
imstk
::
SurfaceMesh
>
(
m_slave
);
int
numSurfaceVertices
=
triMesh
->
getNumVertices
();
int
numTetrahedra
=
tetMesh
->
getNumTetrahedra
();
const
int
numSurfaceVertices
=
triMesh
->
getNumVertices
();
const
int
numTetrahedra
=
tetMesh
->
getNumTetrahedra
();
for
(
int
i
=
0
;
i
<
numSurfaceVertices
;
++
i
)
{
...
...
@@ -64,7 +64,7 @@ TetraTriangleMap::computeMap()
}
int
TetraTriangleMap
::
findClosestTetrahedra
(
const
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
)
TetraTriangleMap
::
findClosestTetrahedra
(
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
)
{
// search
double
closestDistance
=
std
::
numeric_limits
<
double
>::
max
();
...
...
@@ -90,7 +90,7 @@ TetraTriangleMap::findClosestTetrahedra(const std::shared_ptr<imstk::Tetrahedral
}
int
TetraTriangleMap
::
findEclosingTetrahedra
(
const
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
)
TetraTriangleMap
::
findEclosingTetrahedra
(
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
)
{
imstk
::
Vec3d
boundingBoxMin
;
imstk
::
Vec3d
boundingBoxMax
;
...
...
@@ -152,18 +152,18 @@ TetraTriangleMap::setSlave(std::shared_ptr<Geometry> slave)
}
void
TetraTriangleMap
::
print
Map
()
const
void
TetraTriangleMap
::
print
()
const
{
std
::
cout
<<
this
->
getTypeName
()
<<
std
::
endl
;
std
::
cout
<<
"Vertex (<vertNum>): Tetrahedra: <TetNum> - Weights: (w1, w2, w3, w4)
\n
\n
"
;
std
::
cout
<<
"Vertex (<vertNum>): Tetrahedra: <TetNum> - Weights: (w1, w2, w3, w4)
\n
"
<<
std
::
endl
;
for
(
size_t
i
=
0
;
i
<
this
->
m_enclosingTetra
.
size
();
i
++
)
{
std
::
cout
<<
"
\t
Vertex ("
<<
i
<<
"):"
<<
"
\t
Tetrahedra: "
<<
m_enclosingTetra
[
i
];
std
::
cout
<<
"Vertex ("
<<
i
<<
"):"
<<
"
\t
Tetrahedra: "
<<
m_enclosingTetra
[
i
];
std
::
cout
<<
" - Weights: "
<<
"("
<<
m_weights
.
at
(
i
)[
0
]
<<
", "
<<
m_weights
.
at
(
i
)[
1
]
<<
", "
<<
m_weights
.
at
(
i
)[
2
]
<<
", "
<<
m_weights
.
at
(
i
)[
3
]
<<
")
\n
"
;
", "
<<
m_weights
.
at
(
i
)[
2
]
<<
", "
<<
m_weights
.
at
(
i
)[
3
]
<<
")
"
<<
std
::
endl
;
}
}
...
...
Base/Geometry/imstkTetraTriangleMap.h
View file @
041d3caf
...
...
@@ -61,12 +61,12 @@ public:
///
/// \brief Find the closest tetrahedra based on the distance to their centroids for a given point in 3D space
///
static
int
findClosestTetrahedra
(
const
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
);
static
int
findClosestTetrahedra
(
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
);
///
/// \brief Find the tetrahedra that encloses a given point in 3D space
///
static
int
findEclosingTetrahedra
(
const
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
);
static
int
findEclosingTetrahedra
(
std
::
shared_ptr
<
imstk
::
TetrahedralMesh
>
tetraMesh
,
const
imstk
::
Vec3d
&
p
);
// Accessors
...
...
@@ -83,7 +83,7 @@ public:
///
/// \brief Print the map
///
void
print
Map
()
const
;
void
print
()
const
;
protected:
std
::
vector
<
weightsArray
>
m_weights
;
///> weights
...
...
Base/Geometry/imstkVolumetricMesh.h
View file @
041d3caf
...
...
@@ -37,7 +37,7 @@ public:
// Accessors
std
::
shared_ptr
<
SurfaceMesh
>
getAttachedSurfaceMesh
();
void
setAttachedSurfaceMesh
(
std
::
shared_ptr
<
SurfaceMesh
>
surfaceMesh
);
void
setAttachedSurfaceMesh
(
std
::
shared_ptr
<
SurfaceMesh
>
surfaceMesh
);
protected:
...
...
Examples/Sandbox/main.cpp
View file @
041d3caf
...
...
@@ -267,7 +267,7 @@ void testTetraTriangleMap()
tetTriMap
->
setSlave
(
triMesh
);
tetTriMap
->
computeMap
();
tetTriMap
->
print
Map
();
tetTriMap
->
print
();
getchar
();
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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