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
2e08cbce
Commit
2e08cbce
authored
Apr 22, 2016
by
Sreekanth Arikatla
Browse files
STYLE: Adds comments in geometry module
Adds comments to the classes and their functions in geometry module
parent
3662ebfb
Changes
15
Hide whitespace changes
Inline
Side-by-side
Base/Geometry/Analytic/imstkCube.h
View file @
2e08cbce
...
...
@@ -25,6 +25,12 @@
#include "imstkGeometry.h"
namespace
imstk
{
///
/// \class Cube
///
/// \brief Cube geometry
///
class
Cube
:
public
Geometry
{
public:
...
...
@@ -39,13 +45,26 @@ public:
~
Cube
()
=
default
;
///
/// \brief Returns the volume of the cube
///
double
getVolume
()
const
;
// Accessors
///
/// \brief Returns the width of the cube
///
const
double
&
getWidth
()
const
;
void
setWidth
(
const
double
&
width
);
double
getVolume
()
const
;
///
/// \brief Sets the width of the cube
///
void
setWidth
(
const
double
&
width
);
protected:
double
m_width
;
double
m_width
;
///> width of the cube
};
}
...
...
Base/Geometry/Analytic/imstkPlane.h
View file @
2e08cbce
...
...
@@ -25,6 +25,12 @@
#include "imstkGeometry.h"
namespace
imstk
{
///
/// \class Plane
///
/// \brief Plane geometry
///
class
Plane
:
public
Geometry
{
public:
...
...
@@ -40,16 +46,33 @@ public:
~
Plane
()
=
default
;
///
/// \brief Returns the normal of the plane
///
Vec3d
getNormal
()
const
;
///
/// \brief Sets the normal to the plane
///
void
setNormal
(
const
Vec3d
&
normal
);
///
/// \brief Returns the width of the plane
///
const
double
&
getWidth
()
const
;
///
/// \brief Sets the width of the plane
///
void
setWidth
(
const
double
&
width
);
///
/// \brief Returns the volume (=0.0) for the plane
///
double
getVolume
()
const
;
protected:
double
m_width
;
double
m_width
;
///> Width of the plane (for display)
};
}
...
...
Base/Geometry/Analytic/imstkSphere.h
View file @
2e08cbce
...
...
@@ -25,6 +25,12 @@
#include "imstkGeometry.h"
namespace
imstk
{
///
/// \class Sphere
///
/// \brief Sphere geometry
///
class
Sphere
:
public
Geometry
{
public:
...
...
@@ -39,13 +45,23 @@ public:
~
Sphere
()
=
default
;
///
/// \brief Returns the radius of the sphere
///
const
double
&
getRadius
()
const
;
///
/// \brief Sets the radius of the sphere
///
void
setRadius
(
const
double
&
radius
);
///
/// \brief Returns the volume of the sphere
///
double
getVolume
()
const
;
protected:
double
m_radius
;
double
m_radius
;
///> Radius of the sphere
};
}
...
...
Base/Geometry/Map/imstkGeometryMap.h
View file @
2e08cbce
...
...
@@ -40,6 +40,11 @@ enum class GeometryMapType
TetraTetra
};
///
/// \class GeometryMap
///
/// \brief Base class for any geometric map
///
class
GeometryMap
{
public:
...
...
@@ -82,12 +87,26 @@ public:
bool
isActive
()
const
;
// Accessors
///
/// \brief Returns the type of the map
///
const
GeometryMapType
&
getType
()
const
;
///
/// \brief Returns the string representing the type name of the map
///
const
std
::
string
getTypeName
()
const
;
///
/// \brief Get/Set master geometry
///
virtual
void
setMaster
(
std
::
shared_ptr
<
Geometry
>
master
);
virtual
std
::
shared_ptr
<
Geometry
>
getMaster
()
const
;
///
/// \brief Get/Set slace geometry
///
virtual
void
setSlave
(
std
::
shared_ptr
<
Geometry
>
slave
);
virtual
std
::
shared_ptr
<
Geometry
>
getSlave
()
const
;
...
...
Base/Geometry/Map/imstkIdentityMap.h
View file @
2e08cbce
...
...
@@ -26,6 +26,11 @@
namespace
imstk
{
///
/// \class IdentityMap
///
/// \brief A maps that lets the slave follow the master's position and orientation
///
class
IdentityMap
:
public
GeometryMap
{
public:
...
...
@@ -50,7 +55,15 @@ public:
bool
isValid
()
const
{
return
true
;
};
// Accessors
///
/// \brief DISABLED: Set the transform of the Identity map
///
void
setTransform
(
const
RigidTransform3d
&
affineTransform
)
=
delete
;
///
/// \brief Get the transform of Identity map which is an Identity (3x3)
///
const
RigidTransform3d
getTransform
()
const
;
};
}
...
...
Base/Geometry/Map/imstkIsometricMap.h
View file @
2e08cbce
...
...
@@ -26,6 +26,12 @@
namespace
imstk
{
///
/// \class IsometricMap
///
/// \brief A maps that lets the slave follow the master with a
/// specified offset in position and orientation
///
class
IsometricMap
:
public
GeometryMap
{
public:
...
...
@@ -58,7 +64,7 @@ public:
protected:
RigidTransform3d
m_rigidTransform
;
RigidTransform3d
m_rigidTransform
;
///> Rigid transform
};
}
...
...
Base/Geometry/Map/imstkOneToOneMap.h
View file @
2e08cbce
...
...
@@ -85,7 +85,7 @@ public:
void
setSlave
(
std
::
shared_ptr
<
Geometry
>
slave
)
override
;
protected:
std
::
map
<
int
,
int
>
m_oneToOneMap
;
std
::
map
<
int
,
int
>
m_oneToOneMap
;
///> One to one mapping data
};
}
...
...
Base/Geometry/Mesh/imstkHexahedralMesh.h
View file @
2e08cbce
...
...
@@ -27,6 +27,12 @@
#include "imstkVolumetricMesh.h"
namespace
imstk
{
///
/// \class HexahedralMesh
///
/// \brief Hexahedral mesh
///
class
HexahedralMesh
:
public
VolumetricMesh
{
public:
...
...
@@ -38,8 +44,16 @@ public:
~
HexahedralMesh
()
=
default
;
// Accessors
///
/// \brief Sets/Returns the hexahedral connectivity
///
void
setHexahedraVertices
(
const
std
::
vector
<
HexaArray
>&
hexahedra
);
const
std
::
vector
<
HexaArray
>&
getHexahedraVertices
()
const
;
///
/// \brief Returns the connectivity of a hexahedron given its index
///
const
HexaArray
&
getHexahedronVertices
(
const
int
&
hexaNum
)
const
;
///
...
...
Base/Geometry/Mesh/imstkMesh.h
View file @
2e08cbce
...
...
@@ -25,34 +25,84 @@
#include "imstkGeometry.h"
namespace
imstk
{
///
/// \class Mesh
///
/// \brief Base class for all geometries represented by discrete points and elements
///
class
Mesh
:
public
Geometry
{
public:
~
Mesh
()
=
default
;
///
/// \brief Compute the bounding box for the entire mesh
///
void
computeBoundingBox
(
Vec3d
&
min
,
Vec3d
&
max
,
const
double
percent
=
0.0
)
const
;
///
/// \brief Clears all the mesh data
///
virtual
void
clear
();
// Accessors
///
/// \brief Sets initial positions from an array
///
void
setInitialVerticesPositions
(
const
std
::
vector
<
Vec3d
>&
vertices
);
///
/// \brief Returns the vector of initial positions of the mesh vertices
///
const
std
::
vector
<
Vec3d
>&
getInitialVerticesPositions
()
const
;
///
/// \brief Returns the initial position of a vertex given its index
///
const
Vec3d
&
getInitialVertexPosition
(
const
int
&
vertNum
)
const
;
///
/// \brief Sets current vertex positions of the mesh from an array
///
void
setVerticesPositions
(
const
std
::
vector
<
Vec3d
>&
vertices
);
///
/// \brief Returns the vector of current positions of the mesh vertices
///
const
std
::
vector
<
Vec3d
>&
getVerticesPositions
()
const
;
///
/// \brief Set the current position of a vertex given its index to certain position
///
void
setVerticePosition
(
const
int
&
vertNum
,
const
Vec3d
&
pos
);
///
/// \brief Returns the position of a vertex given its index
///
const
Vec3d
&
getVertexPosition
(
const
int
&
vertNum
)
const
;
///
/// \brief Sets the displacements of mesh vertices from an array
///
void
setVerticesDisplacements
(
const
std
::
vector
<
Vec3d
>&
diff
);
const
std
::
vector
<
Vec3d
>&
getVerticesDisplacements
()
const
;
const
Vec3d
&
getVerticeDisplacement
(
const
int
&
vertNum
)
const
;
const
int
getNumVertices
()
const
;
///
/// \brief Returns the vector displacements of mesh vertices
///
const
std
::
vector
<
Vec3d
>&
getVerticesDisplacements
()
const
;
void
computeBoundingBox
(
Vec3d
&
min
,
Vec3d
&
max
,
const
double
percent
=
0.0
)
const
;
///
/// \brief Returns the displacement of a given vertex
///
const
Vec3d
&
getVerticeDisplacement
(
const
int
&
vertNum
)
const
;
///
/// \brief
Clear all
the mesh
data
/// \brief
Returns the number of total vertices in
the mesh
///
virtual
void
clear
()
;
const
int
getNumVertices
()
const
;
protected:
Mesh
(
GeometryType
type
)
:
Geometry
(
type
,
WORLD_ORIGIN
,
Quatd
())
{}
...
...
@@ -61,9 +111,9 @@ protected:
// + Position (Initial translation)
// + verticesDisplacements
// = verticesPositions
std
::
vector
<
Vec3d
>
m_initialVerticesPositions
;
std
::
vector
<
Vec3d
>
m_verticesPositions
;
std
::
vector
<
Vec3d
>
m_verticesDisplacements
;
std
::
vector
<
Vec3d
>
m_initialVerticesPositions
;
//> Initial positions of vertices
std
::
vector
<
Vec3d
>
m_verticesPositions
;
//> Current positions of vertices
std
::
vector
<
Vec3d
>
m_verticesDisplacements
;
//> Displacements of vertices
};
}
...
...
Base/Geometry/Mesh/imstkSurfaceMesh.h
View file @
2e08cbce
...
...
@@ -28,6 +28,12 @@
#include "imstkMesh.h"
namespace
imstk
{
///
/// \class SurfaceMesh
///
/// \brief Surface triangular mesh
///
class
SurfaceMesh
:
public
Mesh
{
public:
...
...
@@ -48,45 +54,91 @@ public:
const
std
::
vector
<
Vec2f
>&
texCoords
=
std
::
vector
<
Vec2f
>
(),
const
bool
computDerivedData
=
false
);
///
/// \brief Computes neighboring triangles for all vertices
///
void
computeVerticesNeighborTriangles
();
///
/// \brief Computes neighboring vertices for all vertices
///
void
computeVerticesNeighborVertices
();
///
/// \brief Compute the normals to the triangles
///
void
computeTrianglesNormals
();
///
/// \brief Computes the normals of all the vertices
///
void
computeVerticesNormals
();
///
/// \brief Computes the tangents
///
void
computeVerticesTangents
();
///
/// \brief Get the volume enclosed by the surface mesh
///
double
getVolume
()
const
;
///
/// \brief Clear all the mesh data
///
void
clear
();
// Accessors
///
/// \brief Get/Set triangle connectivity
///
void
setTrianglesVertices
(
const
std
::
vector
<
TriangleArray
>&
triangles
);
const
std
::
vector
<
TriangleArray
>&
getTrianglesVertices
()
const
;
///
/// \brief Get/Set texture coordinates
///
void
setTextureCoordinates
(
const
std
::
vector
<
Vec2f
>&
coords
);
const
std
::
vector
<
Vec2f
>&
getTextureCoordinates
()
const
;
///
/// \brief Get vector of normals of all the triangles
///
const
std
::
vector
<
Vec3d
>&
getTrianglesNormals
()
const
;
///
/// \brief Get normal of a triangle given its index
///
const
Vec3d
&
getTriangleNormal
(
size_t
i
)
const
;
///
/// \brief Get vector of normals of all the vertices
///
const
std
::
vector
<
Vec3d
>&
getVerticesNormals
()
const
;
const
Vec3d
&
getVerticeNormal
(
size_t
i
)
const
;
const
std
::
vector
<
Vec4d
>&
getVerticesTangents
()
const
;
const
Vec4d
&
getVerticeTangent
(
size_t
i
)
const
;
double
getVolume
()
const
;
///
/// \brief Get normal of a vertex given its index
///
const
Vec3d
&
getVerticeNormal
(
size_t
i
)
const
;
///
/// \brief
Clear all the mesh data
/// \brief
Get/Set vertex tangents
///
void
clear
();
const
std
::
vector
<
Vec4d
>&
getVerticesTangents
()
const
;
const
Vec4d
&
getVerticeTangent
(
size_t
i
)
const
;
protected:
std
::
vector
<
TriangleArray
>
m_trianglesVertices
;
std
::
vector
<
Vec2f
>
m_textureCoordinates
;
std
::
vector
<
TriangleArray
>
m_trianglesVertices
;
///> Triangle connectivity
std
::
vector
<
Vec2f
>
m_textureCoordinates
;
///> Texture coordinates
std
::
vector
<
NeighborsType
>
m_verticesNeighborTriangles
;
std
::
vector
<
NeighborsType
>
m_verticesNeighborVertices
;
std
::
vector
<
NeighborsType
>
m_verticesNeighborTriangles
;
///> Neighbor triangles to vertices
std
::
vector
<
NeighborsType
>
m_verticesNeighborVertices
;
///> Neighbor vertices to vertices
std
::
vector
<
Vec3d
>
m_trianglesNormals
;
std
::
vector
<
Vec3d
>
m_verticesNormals
;
std
::
vector
<
Vec4d
>
m_verticesTangents
;
std
::
vector
<
Vec3d
>
m_trianglesNormals
;
///> Normals to the triangles
std
::
vector
<
Vec3d
>
m_verticesNormals
;
///> Normals of the vertices
std
::
vector
<
Vec4d
>
m_verticesTangents
;
///> Tangents of the vertices
};
}
...
...
Base/Geometry/Mesh/imstkTetrahedralMesh.h
View file @
2e08cbce
...
...
@@ -28,6 +28,12 @@
#include "imstkVolumetricMesh.h"
namespace
imstk
{
///
/// \class TetrahedralMesh
///
/// \brief Tetrahedral mesh
///
class
TetrahedralMesh
:
public
VolumetricMesh
{
public:
...
...
Base/Geometry/Mesh/imstkVolumetricMesh.h
View file @
2e08cbce
...
...
@@ -28,6 +28,12 @@
#include "imstkSurfaceMesh.h"
namespace
imstk
{
///
/// \class VolumetricMesh
///
/// \brief Base class for all volume mesh types
///
class
VolumetricMesh
:
public
Mesh
{
public:
...
...
@@ -35,15 +41,22 @@ public:
~
VolumetricMesh
()
=
default
;
// Accessors
///
/// \brief Returns the attached surface mesh
///
std
::
shared_ptr
<
SurfaceMesh
>
getAttachedSurfaceMesh
();
///
/// \brief Sets the surface mesh that is attached
///
void
setAttachedSurfaceMesh
(
std
::
shared_ptr
<
SurfaceMesh
>
surfaceMesh
);
protected:
VolumetricMesh
(
GeometryType
type
)
:
Mesh
(
type
)
{}
std
::
shared_ptr
<
SurfaceMesh
>
m_attachedSurfaceMesh
;
std
::
shared_ptr
<
SurfaceMesh
>
m_attachedSurfaceMesh
;
///> Attached surface mesh
};
}
...
...
Base/Geometry/Reader/imstkMeshReader.h
View file @
2e08cbce
...
...
@@ -29,6 +29,11 @@
namespace
imstk
{
///
/// \class MeshReader
///
/// \brief
///
class
MeshReader
{
public:
...
...
@@ -48,8 +53,14 @@ public:
MeshReader
()
=
default
;
~
MeshReader
()
=
default
;
///
/// \brief
///
static
std
::
shared_ptr
<
Mesh
>
read
(
const
std
::
string
&
filePath
);
///
/// \brief
///
static
std
::
shared_ptr
<
SurfaceMesh
>
createSurfaceMesh
(
const
std
::
vector
<
Vec3d
>&
vertices
,
const
std
::
vector
<
SurfaceMesh
::
TriangleArray
>&
triangles
,
const
std
::
vector
<
Vec2f
>&
textCoords
);
...
...
Base/Geometry/Reader/imstkVTKMeshReader.h
View file @
2e08cbce
...
...
@@ -36,6 +36,11 @@
namespace
imstk
{
///
/// \class VTKMeshReader
///
/// \brief
///
class
VTKMeshReader
{
public:
...
...
@@ -43,21 +48,39 @@ public:
VTKMeshReader
()
=
default
;
~
VTKMeshReader
()
=
default
;
///
/// \brief
///
static
std
::
shared_ptr
<
Mesh
>
read
(
const
std
::
string
&
filePath
,
MeshReader
::
FileType
meshType
);
protected:
///
/// \brief
///
template
<
typename
ReaderType
>
static
std
::
shared_ptr
<
Mesh
>
readAsGenericFormatData
(
const
std
::
string
&
filePath
);
///
/// \brief
///
template
<
typename
ReaderType
>
static
std
::
shared_ptr
<
SurfaceMesh
>
readAsAbstractPolyData
(
const
std
::
string
&
filePath
);
///
/// \brief
///
static
void
copyVertices
(
vtkPoints
*
points
,
std
::
vector
<
Vec3d
>&
vertices
);
///
/// \brief
///
template
<
size_t
dim
>
static
void
copyCells
(
vtkCellArray
*
vtkCells
,
std
::
vector
<
std
::
array
<
size_t
,
dim
>>&
cells
);
///
/// \brief
///
static
void
copyTextureCoordinates
(
vtkPointData
*
pointData
,
std
::
vector
<
Vec2f
>&
textCoords
);
//static void copyData(vtkFieldData* fields, ...);
...
...
Base/Geometry/imstkGeometry.h
View file @
2e08cbce
...
...
@@ -36,42 +36,76 @@ enum class GeometryType
HexahedralMesh
};
///
/// \class Geometry
///
/// \brief Base class for any geometrical representation
///
class
Geometry
{
public:
virtual
~
Geometry
()
{}