Test for 0022778: Bug in BRepMesh
[occt.git] / src / Graphic3d / Graphic3d_Group_5.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
3// Copyright (c) 1999-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
7fd59977 21// Modified
22// 27/08/97 ; PCT : ajout coordonnee texture
23
7fd59977 24
25//-Version
26
27//-Design Declaration des variables specifiques aux groupes
28// de primitives
29
30//-Warning Un groupe est defini dans une structure
31// Il s'agit de la plus petite entite editable
32
33//-References
34
35//-Language C++ 2.0
36
37//-Declarations
38
39// for the class
40#include <Graphic3d_Group.jxx>
41#include <Graphic3d_Group.pxx>
42
43#include <Graphic3d_VertexN.hxx>
44#include <Graphic3d_VertexNT.hxx>
45
46//-Methods, in order
47
48void Graphic3d_Group::Polygon (const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType, const Standard_Boolean EvalMinMax) {
49
50 if (IsDeleted ()) return;
51
52 if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
53 MyContainsFacet = Standard_True;
54 MyIsEmpty = Standard_False;
55
56 // Min-Max Update
57 if (EvalMinMax) {
58
59 Standard_Real X, Y, Z;
60 Standard_Integer i, j;
61 Standard_Integer Lower = ListVertex.Lower ();
62 Standard_Integer Upper = ListVertex.Upper ();
63 // Parcours des sommets
64 for (j=0, i=Lower; i<=Upper; i++, j++) {
65 ListVertex (i).Coord (X, Y, Z);
66 if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
67 if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
68 if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
69 if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
70 if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
71 if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
72 }
73 }
74
75 MyGraphicDriver->Polygon (MyCGroup, ListVertex, AType, EvalMinMax);
76
77 Update ();
78
79}
80
7fd59977 81void Graphic3d_Group::PolygonSet (const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType, const Standard_Boolean EvalMinMax) {
82
83 if (IsDeleted ()) return;
84
85 if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
86 MyContainsFacet = Standard_True;
87 MyIsEmpty = Standard_False;
88
89Standard_Real X, Y, Z;
90
91Standard_Integer i, ii;
92Standard_Integer j;
93Standard_Integer begin_points;
94Standard_Integer end_points;
95Standard_Integer nbpoints;
96Standard_Integer Lower, Upper;
97
98 begin_points = ListVertex.Lower ();
99 end_points = ListVertex.Upper ();
100
101 Lower = Bounds.Lower ();
102 Upper = Bounds.Upper ();
103
104 // Parcours des facettes
105 for (j=Lower; j<=Upper; j++) {
106 nbpoints = Bounds.Value (j);
107
108 Graphic3d_Array1OfVertex ListOfVertex (0, nbpoints-1);
109
110 // Parcours des sommets
111 for (i=0, ii=begin_points;
112 ((ii<=end_points) && (i<=nbpoints-1)); i++, ii++) {
113 ListVertex (ii).Coord (X, Y, Z);
114 ListOfVertex (i).SetCoord (X, Y, Z);
115 }
116
117 Polygon (ListOfVertex, AType, EvalMinMax);
118 begin_points += nbpoints;
119 }
120
121}