Chemical Data Processing Library C++ API - Version 1.4.0
TriangleMesh3DFunctions.hpp
Go to the documentation of this file.
1 /*
2  * TriangleMesh3DFunctions.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_TRIANGLEMESH3DFUNCTIONS_HPP
30 #define CDPL_VIS_TRIANGLEMESH3DFUNCTIONS_HPP
31 
32 #include <cstddef>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
35 #include "CDPL/Math/Matrix.hpp"
37 
38 
39 namespace CDPL
40 {
41 
42  namespace Vis
43  {
44 
45  class TriangleMesh3D;
46 
58 
67  CDPL_VIS_API std::size_t removeVertexDuplicates(TriangleMesh3D& mesh, bool check_vn = true, double tol = 0.0);
68 
75  CDPL_VIS_API void calcVertexFromFaceNormals(TriangleMesh3D& mesh, bool weight_face_size = false);
76 
84  CDPL_VIS_API void calcVertexFromFaceNormals(const TriangleMesh3D& mesh, Math::Vector3DArray& normals, bool weight_face_size = false);
85 
96  CDPL_VIS_API void translate(TriangleMesh3D& mesh, double trans_x, double trans_y, double trans_z,
97  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
98 
109  CDPL_VIS_API void scale(TriangleMesh3D& mesh, double scale_x, double scale_y, double scale_z,
110  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
111 
120  CDPL_VIS_API void rotateX(TriangleMesh3D& mesh, double angle,
121  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
122 
131  CDPL_VIS_API void rotateY(TriangleMesh3D& mesh, double angle,
132  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
133 
142  CDPL_VIS_API void rotateZ(TriangleMesh3D& mesh, double angle,
143  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
144 
154  std::size_t vtx_offs = 0, std::size_t vtx_count = 0);
155 
156  } // namespace Vis
157 } // namespace CDPL
158 
159 #endif // CDPL_VIS_TRIANGLEMESH3DFUNCTIONS_HPP
Definition of matrix data types.
Definition of class CDPL::Math::VectorArray.
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Data structure for the storage of 3D triangle mesh vertices, vertex normals and faces.
Definition: TriangleMesh3D.hpp:50
VectorArray< Vector3D > Vector3DArray
Array storing vectors of type Math::Vector3D.
Definition: VectorArray.hpp:87
CDPL_VIS_API void rotateX(TriangleMesh3D &mesh, double angle, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Rotates the vertices of mesh around the x-axis by the angle angle.
CDPL_VIS_API void calcVertexFromFaceNormals(TriangleMesh3D &mesh, bool weight_face_size=false)
Computes per-vertex normals of mesh from its face normals and stores them in the mesh.
CDPL_VIS_API void rotateY(TriangleMesh3D &mesh, double angle, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Rotates the vertices of mesh around the y-axis by the angle angle.
CDPL_VIS_API void scale(TriangleMesh3D &mesh, double scale_x, double scale_y, double scale_z, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Scales the vertices of mesh by the per-axis factors (scale_x, scale_y, scale_z).
CDPL_VIS_API void rotateZ(TriangleMesh3D &mesh, double angle, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Rotates the vertices of mesh around the z-axis by the angle angle.
CDPL_VIS_API void translate(TriangleMesh3D &mesh, double trans_x, double trans_y, double trans_z, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Translates the vertices of mesh by the vector (trans_x, trans_y, trans_z).
CDPL_VIS_API void subdivideSpherical(TriangleMesh3D &mesh)
Subdivides each triangle face of mesh and projects the new vertices onto the unit sphere.
CDPL_VIS_API std::size_t removeVertexDuplicates(TriangleMesh3D &mesh, bool check_vn=true, double tol=0.0)
Merges duplicate vertices of mesh and updates the face vertex indices accordingly.
CDPL_VIS_API void transform(TriangleMesh3D &mesh, const Math::Matrix4D &mtx, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Applies the affine transformation matrix mtx to the vertices of mesh.
The namespace of the Chemical Data Processing Library.