0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / StlMesh / StlMesh_Mesh.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-09-21
2// Created by: Philippe GIRODENGO
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _StlMesh_Mesh_HeaderFile
18#define _StlMesh_Mesh_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Integer.hxx>
24#include <StlMesh_SequenceOfMeshDomain.hxx>
25#include <gp_XYZ.hxx>
26#include <MMgt_TShared.hxx>
27#include <Standard_Real.hxx>
28#include <Standard_Boolean.hxx>
29#include <StlMesh_SequenceOfMeshTriangle.hxx>
30#include <TColgp_SequenceOfXYZ.hxx>
31class Standard_NegativeValue;
32class Standard_NullValue;
33class Standard_NoSuchObject;
34class gp_XYZ;
35
36
37class StlMesh_Mesh;
38DEFINE_STANDARD_HANDLE(StlMesh_Mesh, MMgt_TShared)
39
40//! Mesh definition. The mesh contains one or several
41//! domains. Each mesh domain contains a set of
42//! triangles. Each domain can have its own deflection
43//! value.
44class StlMesh_Mesh : public MMgt_TShared
45{
46
47public:
48
49
50 //! Creates an empty mesh.
51 Standard_EXPORT StlMesh_Mesh();
52
53 //! Adds a new mesh domain. The mesh deflection is
54 //! defaulted to Confusion from package Precision.
55 Standard_EXPORT virtual void AddDomain();
56
57 //! Adds a new mesh domain.
58 //! Raised if the deflection is lower than zero
59 //! Raised if the deflection is lower than Confusion
60 //! from package Precision
61 Standard_EXPORT virtual void AddDomain (const Standard_Real Deflection);
62
63 //! Build a triangle with the triplet of vertices (V1,
64 //! V2, V3). This triplet defines the indexes of the
65 //! vertex in the current domain The coordinates Xn,
66 //! Yn, Zn defines the normal direction to the
67 //! triangle. Returns the range of the triangle in
68 //! the current domain.
69 Standard_EXPORT virtual Standard_Integer AddTriangle (const Standard_Integer V1, const Standard_Integer V2, const Standard_Integer V3, const Standard_Real Xn, const Standard_Real Yn, const Standard_Real Zn);
70
71 //! Returns the range of the vertex in the current
72 //! domain.
73 Standard_EXPORT virtual Standard_Integer AddVertex (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
74
75 //! Returns the range of the vertex in the current
76 //! domain. The current vertex is not inserted in the
77 //! mesh if it already exist.
78 Standard_EXPORT virtual Standard_Integer AddOnlyNewVertex (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
79
80 //! Each vertex of the mesh verifies the following
81 //! relations :
82 //! XYZMin.X() <= X <= XYZMax.X()
83 //! XYZMin.Y() <= Y <= XYZMax.y()
84 //! XYZMin.Z() <= Z <= XYZMax.Z()
85 Standard_EXPORT virtual void Bounds (gp_XYZ& XYZmax, gp_XYZ& XYZmin) const;
86
87 Standard_EXPORT virtual void Clear();
88
89 //! Returns the deflection of the mesh of the domain
90 //! of range <DomainIndex>.
91 //! Raised if <DomainIndex> is lower than 1 or greater
92 //! than the number of domains.
93 Standard_EXPORT virtual Standard_Real Deflection (const Standard_Integer DomainIndex) const;
94
95 virtual Standard_Boolean IsEmpty() const;
96
97 //! Number of domains in the mesh.
98 virtual Standard_Integer NbDomains() const;
99
100 //! Cumulative Number of triangles in the mesh.
101 Standard_Integer NbTriangles() const;
102
103 //! Number of triangles in the domain of range
104 //! <DomainIndex>.
105 //! Raised if <DomainIndex> is lower than 1 or greater
106 //! than the number of domains.
107 Standard_EXPORT virtual Standard_Integer NbTriangles (const Standard_Integer DomainIndex) const;
108
109 //! Cumulative Number of vertices in the mesh.
110 virtual Standard_Integer NbVertices() const;
111
112 //! Number of vertices in the domain of range
113 //! <DomainIndex>.
114 //! Raised if <DomainIndex> is lower than 1 or greater
115 //! than the number of domains.
116 Standard_EXPORT virtual Standard_Integer NbVertices (const Standard_Integer DomainIndex) const;
117
118 //! Returns the set of triangle of the mesh domain of range
119 //! <DomainIndex>.
120 //! Raised if <DomainIndex> is lower than 1 or greater
121 //! than the number of domains.
122 Standard_EXPORT virtual const StlMesh_SequenceOfMeshTriangle& Triangles (const Standard_Integer DomainIndex = 1) const;
123
124 //! Returns the coordinates of the vertices of the
125 //! mesh domain of range <DomainIndex>. {XV1, YV1,
126 //! ZV1, XV2, YV2, ZV2, XV3,.....}
127 //! Raised if <DomainIndex> is lower than 1 or greater
128 //! than the number of domains.
129 Standard_EXPORT virtual const TColgp_SequenceOfXYZ& Vertices (const Standard_Integer DomainIndex = 1) const;
130
131
132
133
134 DEFINE_STANDARD_RTTI(StlMesh_Mesh,MMgt_TShared)
135
136protected:
137
138
139 Standard_Integer nbTriangles;
140 Standard_Integer nbVertices;
141 StlMesh_SequenceOfMeshDomain domains;
142 gp_XYZ xyzmax;
143 gp_XYZ xyzmin;
144
145
146private:
147
148
149
150
151};
152
153
154#include <StlMesh_Mesh.lxx>
155
156
157
158
159
160#endif // _StlMesh_Mesh_HeaderFile