Simbody
3.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PolygonalMesh.h
Go to the documentation of this file.
1
#ifndef SimTK_SimTKCOMMON_POLYGONAL_MESH_H_
2
#define SimTK_SimTKCOMMON_POLYGONAL_MESH_H_
3
4
/* -------------------------------------------------------------------------- *
5
* Simbody(tm): SimTKcommon *
6
* -------------------------------------------------------------------------- *
7
* This is part of the SimTK biosimulation toolkit originating from *
8
* Simbios, the NIH National Center for Physics-Based Simulation of *
9
* Biological Structures at Stanford, funded under the NIH Roadmap for *
10
* Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11
* *
12
* Portions copyright (c) 2008-13 Stanford University and the Authors. *
13
* Authors: Peter Eastman *
14
* Contributors: Michael Sherman *
15
* *
16
* Licensed under the Apache License, Version 2.0 (the "License"); you may *
17
* not use this file except in compliance with the License. You may obtain a *
18
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19
* *
20
* Unless required by applicable law or agreed to in writing, software *
21
* distributed under the License is distributed on an "AS IS" BASIS, *
22
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23
* See the License for the specific language governing permissions and *
24
* limitations under the License. *
25
* -------------------------------------------------------------------------- */
26
27
#include "
SimTKcommon/Simmatrix.h
"
28
#include "
SimTKcommon/internal/PrivateImplementation.h
"
29
30
namespace
SimTK {
31
32
class
PolygonalMesh;
33
class
PolygonalMeshImpl;
34
35
// We only want the template instantiation to occur once. This symbol is defined
36
// in the SimTKcommon compilation unit that defines the PolygonalMesh class but
37
// should not be defined any other time.
38
#ifndef SimTK_SIMTKCOMMON_DEFINING_POLYGONALMESH
39
extern
template
class
PIMPLHandle<PolygonalMesh, PolygonalMeshImpl, true>;
40
#endif
41
71
class
SimTK_SimTKCOMMON_EXPORT
PolygonalMesh
72
:
public
PIMPLHandle<PolygonalMesh, PolygonalMeshImpl, true>
{
73
public
:
75
PolygonalMesh
() {}
76
88
static
PolygonalMesh
createSphereMesh(
Real
radius,
89
int
resolution = 1);
90
123
static
PolygonalMesh
createBrickMesh(
const
Vec3
& halfDims,
124
int
resolution = 1);
125
154
static
PolygonalMesh
createCylinderMesh(
const
UnitVec3
& axis,
155
Real
radius,
156
Real
halfLength,
157
int
resolution=1);
158
161
void
clear();
162
164
int
getNumFaces()
const
;
166
int
getNumVertices()
const
;
167
172
const
Vec3
& getVertexPosition(
int
vertex)
const
;
175
int
getNumVerticesForFace(
int
face)
const
;
182
int
getFaceVertex(
int
face,
int
vertex)
const
;
183
188
int
addVertex(
const
Vec3
& position);
189
198
int
addFace(
const
Array_<int>
& vertices);
199
207
PolygonalMesh
& scaleMesh(
Real
scale);
208
215
PolygonalMesh
& transformMesh(
const
Transform
& X_AM);
216
221
void
loadObjFile(std::istream& file);
222
226
void
loadVtpFile(
const
String
& pathname);
227
228
private
:
229
explicit
PolygonalMesh
(PolygonalMeshImpl* impl) : HandleBase(impl) {}
230
void
initializeHandleIfEmpty();
231
};
232
233
}
// namespace SimTK
234
235
#endif // SimTK_SimTKCOMMON_POLYGONAL_MESH_H_
SimTKcommon
Geometry
include
SimTKcommon
internal
PolygonalMesh.h
Generated on Tue Dec 2 2014 13:13:27 for Simbody by
1.8.1.2