9ac96d3305bb1644e3501f73f0331ef0353512c4
[occt.git] / src / Graphic3d / Graphic3d_Group_9.cxx
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
20
21 // Modified
22 //              27/08/97 ; PCT : ajout coordonnee texture
23
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 #include <Graphic3d_Group.jxx>
40 #include <Graphic3d_Group.pxx>
41
42 void Graphic3d_Group::QuadrangleMesh (const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax) {
43
44         if (IsDeleted ()) return;
45
46         if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
47         MyContainsFacet = Standard_True;
48         MyIsEmpty       = Standard_False;
49
50 Standard_Real X, Y, Z;
51
52         // Min-Max Update
53         if (EvalMinMax) {
54 Standard_Integer i, j;
55 Standard_Integer LowerRow       = ListVertex.LowerRow ();
56 Standard_Integer UpperRow       = ListVertex.UpperRow ();
57 Standard_Integer LowerCol       = ListVertex.LowerCol ();
58 Standard_Integer UpperCol       = ListVertex.UpperCol ();
59                 // Parcours des sommets
60                 for (i=LowerRow; i<=UpperRow; i++)
61                     for (j=LowerCol; j<=UpperCol; j++) {
62                         ListVertex (i, j).Coord (X, Y, Z);
63                         if (X < MyBounds.XMin) MyBounds.XMin    = Standard_ShortReal (X);
64                         if (Y < MyBounds.YMin) MyBounds.YMin    = Standard_ShortReal (Y);
65                         if (Z < MyBounds.ZMin) MyBounds.ZMin    = Standard_ShortReal (Z);
66                         if (X > MyBounds.XMax) MyBounds.XMax    = Standard_ShortReal (X);
67                         if (Y > MyBounds.YMax) MyBounds.YMax    = Standard_ShortReal (Y);
68                         if (Z > MyBounds.ZMax) MyBounds.ZMax    = Standard_ShortReal (Z);
69                 }
70         }
71
72         MyGraphicDriver->QuadrangleMesh (MyCGroup, ListVertex, EvalMinMax);
73
74         Update ();
75
76 }
77
78 void Graphic3d_Group::QuadrangleMesh (const Graphic3d_Array2OfVertexN& ListVertex, const Standard_Boolean EvalMinMax) {
79
80         if (IsDeleted ()) return;
81
82         if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
83         MyContainsFacet = Standard_True;
84         MyIsEmpty       = Standard_False;
85
86 Standard_Real X, Y, Z;
87
88 Standard_Integer i, j;
89 Standard_Integer LowerRow       = ListVertex.LowerRow ();
90 Standard_Integer UpperRow       = ListVertex.UpperRow ();
91 Standard_Integer LowerCol       = ListVertex.LowerCol ();
92 Standard_Integer UpperCol       = ListVertex.UpperCol ();
93
94         // Min-Max Update
95         if (EvalMinMax) {
96                 // Parcours des sommets
97                 for (i=LowerRow; i<=UpperRow; i++)
98                     for (j=LowerCol; j<=UpperCol; j++) {
99                         ListVertex (i, j).Coord (X, Y, Z);
100                         if (X < MyBounds.XMin) MyBounds.XMin    = Standard_ShortReal (X);
101                         if (Y < MyBounds.YMin) MyBounds.YMin    = Standard_ShortReal (Y);
102                         if (Z < MyBounds.ZMin) MyBounds.ZMin    = Standard_ShortReal (Z);
103                         if (X > MyBounds.XMax) MyBounds.XMax    = Standard_ShortReal (X);
104                         if (Y > MyBounds.YMax) MyBounds.YMax    = Standard_ShortReal (Y);
105                         if (Z > MyBounds.ZMax) MyBounds.ZMax    = Standard_ShortReal (Z);
106                 }
107         }
108
109         MyGraphicDriver->QuadrangleMesh (MyCGroup, ListVertex, EvalMinMax);
110
111         Update ();
112
113 }
114
115
116 void Graphic3d_Group::QuadrangleMesh(const Graphic3d_Array2OfVertexNT& ListVertex,const Standard_Boolean EvalMinMax) 
117 {
118         if (IsDeleted ()) return;
119
120         if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
121         MyContainsFacet = Standard_True;
122         MyIsEmpty       = Standard_False;
123
124 Standard_Real X, Y, Z;
125
126 Standard_Integer i, j;
127 Standard_Integer LowerRow       = ListVertex.LowerRow ();
128 Standard_Integer UpperRow       = ListVertex.UpperRow ();
129 Standard_Integer LowerCol       = ListVertex.LowerCol ();
130 Standard_Integer UpperCol       = ListVertex.UpperCol ();
131
132         // Min-Max Update
133         if (EvalMinMax) {
134                 // Parcours des sommets
135                 for (i=LowerRow; i<=UpperRow; i++)
136                     for (j=LowerCol; j<=UpperCol; j++) {
137                         ListVertex (i, j).Coord (X, Y, Z);
138                         if (X < MyBounds.XMin) MyBounds.XMin    = Standard_ShortReal (X);
139                         if (Y < MyBounds.YMin) MyBounds.YMin    = Standard_ShortReal (Y);
140                         if (Z < MyBounds.ZMin) MyBounds.ZMin    = Standard_ShortReal (Z);
141                         if (X > MyBounds.XMax) MyBounds.XMax    = Standard_ShortReal (X);
142                         if (Y > MyBounds.YMax) MyBounds.YMax    = Standard_ShortReal (Y);
143                         if (Z > MyBounds.ZMax) MyBounds.ZMax    = Standard_ShortReal (Z);
144                 }
145         }
146
147         MyGraphicDriver->QuadrangleMesh (MyCGroup, ListVertex, EvalMinMax);
148
149         Update ();
150
151 }