Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:14:38

0001 // Created on: 2001-01-04
0002 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Graphic3d_ArrayOfPolygons_HeaderFile
0016 #define _Graphic3d_ArrayOfPolygons_HeaderFile
0017 
0018 #include <Graphic3d_ArrayOfPrimitives.hxx>
0019 
0020 //! Contains polygons array definition.
0021 //! WARNING! Polygon primitives might be unsupported by graphics library.
0022 //! Triangulation should be used instead of quads for better compatibility.
0023 class Graphic3d_ArrayOfPolygons : public Graphic3d_ArrayOfPrimitives
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
0026 public:
0027   //! Creates an array of polygons (Graphic3d_TOPA_POLYGONS), a polygon can be filled as:
0028   //! 1) Creating a single polygon defined with his vertexes, i.e:
0029   //! @code
0030   //!   myArray = Graphic3d_ArrayOfPolygons (7);
0031   //!   myArray->AddVertex (x1, y1, z1);
0032   //!   ....
0033   //!   myArray->AddVertex (x7, y7, z7);
0034   //! @endcode
0035   //! 2) Creating separate polygons defined with a predefined number of bounds and the number of
0036   //! vertex per bound, i.e:
0037   //! @code
0038   //!   myArray = Graphic3d_ArrayOfPolygons (7, 2);
0039   //!   myArray->AddBound (4);
0040   //!   myArray->AddVertex (x1, y1, z1);
0041   //!   ....
0042   //!   myArray->AddVertex (x4, y4, z4);
0043   //!   myArray->AddBound (3);
0044   //!   myArray->AddVertex (x5, y5, z5);
0045   //!   ....
0046   //!   myArray->AddVertex (x7, y7, z7);
0047   //! @endcode
0048   //! 3) Creating a single indexed polygon defined with his vertex ans edges, i.e:
0049   //! @code
0050   //!   myArray = Graphic3d_ArrayOfPolygons (4, 0, 6);
0051   //!   myArray->AddVertex (x1, y1, z1);
0052   //!   ....
0053   //!   myArray->AddVertex (x4, y4, z4);
0054   //!   myArray->AddEdge (1);
0055   //!   myArray->AddEdge (2);
0056   //!   myArray->AddEdge (3);
0057   //!   myArray->AddEdge (1);
0058   //!   myArray->AddEdge (2);
0059   //!   myArray->AddEdge (4);
0060   //! @endcode
0061   //! 4) Creating separate polygons defined with a predefined number of bounds and the number of
0062   //! edges per bound, i.e:
0063   //! @code
0064   //!   myArray = Graphic3d_ArrayOfPolygons (6, 4, 14);
0065   //!   myArray->AddBound (3);
0066   //!   myArray->AddVertex (x1, y1, z1);
0067   //!   myArray->AddVertex (x2, y2, z2);
0068   //!   myArray->AddVertex (x3, y3, z3);
0069   //!   myArray->AddEdge (1);
0070   //!   myArray->AddEdge (2);
0071   //!   myArray->AddEdge (3);
0072   //!   myArray->AddBound (3);
0073   //!   myArray->AddVertex (x4, y4, z4);
0074   //!   myArray->AddVertex (x5, y5, z5);
0075   //!   myArray->AddVertex (x6, y6, z6);
0076   //!   myArray->AddEdge (4);
0077   //!   myArray->AddEdge (5);
0078   //!   myArray->AddEdge (6);
0079   //!   myArray->AddBound (4);
0080   //!   myArray->AddEdge (2);
0081   //!   myArray->AddEdge (3);
0082   //!   myArray->AddEdge (5);
0083   //!   myArray->AddEdge (6);
0084   //!   myArray->AddBound (4);
0085   //!   myArray->AddEdge (1);
0086   //!   myArray->AddEdge (3);
0087   //!   myArray->AddEdge (5);
0088   //!   myArray->AddEdge (4);
0089   //! @endcode
0090   //! @param theMaxVertexs defines the maximum allowed vertex number in the array
0091   //! @param theMaxBounds  defines the maximum allowed bound  number in the array
0092   //! @param theMaxEdges   defines the maximum allowed edge   number in the array
0093   //! @param theArrayFlags array flags
0094   Graphic3d_ArrayOfPolygons(int                  theMaxVertexs,
0095                             int                  theMaxBounds,
0096                             int                  theMaxEdges,
0097                             Graphic3d_ArrayFlags theArrayFlags)
0098       : Graphic3d_ArrayOfPrimitives(Graphic3d_TOPA_POLYGONS,
0099                                     theMaxVertexs,
0100                                     theMaxBounds,
0101                                     theMaxEdges,
0102                                     theArrayFlags)
0103   {
0104   }
0105 
0106   //! Creates an array of polygons (Graphic3d_TOPA_POLYGONS):
0107   //! @param theMaxVertexs defines the maximum allowed vertex number in the array
0108   //! @param theMaxBounds  defines the maximum allowed bound  number in the array
0109   //! @param theMaxEdges   defines the maximum allowed edge   number in the array
0110   Graphic3d_ArrayOfPolygons(const int  theMaxVertexs,
0111                             const int  theMaxBounds   = 0,
0112                             const int  theMaxEdges    = 0,
0113                             const bool theHasVNormals = false,
0114                             const bool theHasVColors  = false,
0115                             const bool theHasBColors  = false,
0116                             const bool theHasVTexels  = false)
0117       : Graphic3d_ArrayOfPrimitives(
0118           Graphic3d_TOPA_POLYGONS,
0119           theMaxVertexs,
0120           theMaxBounds,
0121           theMaxEdges,
0122           (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None)
0123             | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None)
0124             | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None)
0125             | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None))
0126   {
0127   }
0128 };
0129 
0130 #endif // _Graphic3d_ArrayOfPolygons_HeaderFile