Chemical Data Processing Library C++ API - Version 1.3.0
TriangleMesh3D.hpp
Go to the documentation of this file.
1 /*
2  * TriangleMesh3D.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_TRIANGLEMESH3D_HPP
30 #define CDPL_VIS_TRIANGLEMESH3D_HPP
31 
32 #include <memory>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
35 #include "CDPL/Vis/Shape3D.hpp"
37 
38 
39 namespace CDPL
40 {
41 
42  namespace Vis
43  {
44 
50  {
51 
52  public:
56  typedef std::shared_ptr<TriangleMesh3D> SharedPointer;
57 
59 
60  void accept(Shape3DVisitor& visitor) const;
61 
63 
65 
66  void addVertex(double x, double y, double z);
67 
68  std::size_t getNumVertices() const;
69 
71 
73 
74  void addVertexNormal(double x, double y, double z);
75 
76  std::size_t getNumVertexNormals() const;
77 
79 
81 
82  void addFace(unsigned long v1_idx, unsigned long v2_idx, unsigned long v3_idx);
83 
84  std::size_t getNumFaces() const;
85 
86  bool isSolid() const;
87 
88  void setSolid(bool solid = true);
89 
90  void clear();
91 
92  void swap(TriangleMesh3D& mesh);
93 
95 
96  private:
97  Math::Vector3DArray vertices;
98  Math::Vector3DArray normals;
100  bool solid{false};
101  };
102  } // namespace Vis
103 } // namespace CDPL
104 
105 #endif // CDPL_VIS_TRIANGLEMESH3D_HPP
Definition of the class CDPL::Vis::Shape3D.
Definition of the 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.
The base of all Vis::Shape3D visitor implementations [VPTN].
Definition: Shape3DVisitor.hpp:49
The abstract base of all classes describing the geometric shape of 3D objects.
Definition: Shape3D.hpp:50
std::shared_ptr< Shape3D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Shape3D instances.
Definition: Shape3D.hpp:56
Data structure for describing the geometric shape of 3D objects by means of a triangle mesh.
Definition: TriangleMesh3D.hpp:50
void addVertex(double x, double y, double z)
std::shared_ptr< TriangleMesh3D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated TriangleMesh3D instances.
Definition: TriangleMesh3D.hpp:56
void accept(Shape3DVisitor &visitor) const
Vis::Shape3DVisitor implementation accept method [VPTN].
const Math::Vector3DArray & getVertices() const
std::size_t getNumVertexNormals() const
std::size_t getNumVertices() const
Shape3D::SharedPointer clone() const
Creates a dynamically allocated copy of the graphics primitive.
Math::Vector3ULArray & getFaces()
Math::Vector3DArray & getVertices()
std::size_t getNumFaces() const
TriangleMesh3D & operator+=(const TriangleMesh3D &mesh)
Math::Vector3DArray & getVertexNormals()
const Math::Vector3ULArray & getFaces() const
const Math::Vector3DArray & getVertexNormals() const
void addFace(unsigned long v1_idx, unsigned long v2_idx, unsigned long v3_idx)
void addVertexNormal(double x, double y, double z)
void setSolid(bool solid=true)
void swap(TriangleMesh3D &mesh)
VectorArray< Vector3D > Vector3DArray
An array of Math::Vector3D objects.
Definition: VectorArray.hpp:84
VectorArray< Vector3UL > Vector3ULArray
An array of Math::Vector3UL objects.
Definition: VectorArray.hpp:104
The namespace of the Chemical Data Processing Library.