b311480e |
1 | -- Created on: 1993-09-09 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | generic class ComputeCSurface from Approx |
18 | (Surface as any; |
19 | SurfaceTool as any) --as TheLineTool from AppCont(MultiLine) |
20 | |
21 | |
22 | uses SequenceOfReal from TColStd, |
23 | HArray1OfReal from TColStd, |
24 | SequenceOfSurface from TColGeom, |
25 | BezierSurface from Geom, |
26 | Constraint from AppParCurves |
27 | |
28 | |
29 | |
30 | private class MySLeastSquare instantiates SurfLeastSquare from AppCont |
31 | (Surface, |
32 | SurfaceTool); |
33 | |
34 | is |
35 | |
36 | |
37 | Create(Surf: Surface; |
38 | degreemin: Integer = 4; |
39 | degreemax: Integer = 8; |
40 | Tolerance3d: Real = 1.0e-3; |
41 | FirstCons: Constraint = AppParCurves_TangencyPoint; |
42 | LastUCons: Constraint = AppParCurves_TangencyPoint; |
43 | LastVCons: Constraint = AppParCurves_TangencyPoint; |
44 | LastCons: Constraint = AppParCurves_TangencyPoint; |
45 | cutting: Boolean = Standard_False) |
46 | |
47 | ---Purpose: The Surface <Surface> will be approximated until tolerances |
48 | -- will be reached. |
49 | -- The approximation will be done from degreemin to degreemax |
50 | -- with a cutting if the corresponding boolean is True. |
51 | |
52 | returns ComputeCSurface; |
53 | |
54 | |
55 | |
56 | |
57 | Create(degreemin: Integer = 3; |
58 | degreemax: Integer = 8; |
59 | Tolerance3d: Real = 1.0e-03; |
60 | FirstCons: Constraint = AppParCurves_TangencyPoint; |
61 | LastUCons: Constraint = AppParCurves_TangencyPoint; |
62 | LastVCons: Constraint = AppParCurves_TangencyPoint; |
63 | LastCons: Constraint = AppParCurves_TangencyPoint; |
64 | cutting: Boolean = Standard_False) |
65 | |
66 | ---Purpose: Initializes the fields of the algorithm. |
67 | |
68 | returns ComputeCSurface; |
69 | |
70 | |
71 | Perform(me: in out; Surf: Surface) |
72 | ---Purpose: runs the algorithm after having initialized the fields. |
73 | |
74 | is static; |
75 | |
76 | |
77 | Compute(me: in out; Surf: Surface; Ufirst, Ulast, Vfirst, Vlast: Real; |
78 | TheTol3d: in out Real) |
79 | ---Purpose: is internally used by the algorithms. |
80 | |
81 | returns Boolean |
82 | is static private; |
83 | |
84 | |
85 | SetDegrees(me: in out; degreemin, degreemax: Integer) |
86 | ---Purpose: changes the degrees of the approximation. |
87 | |
88 | is static; |
89 | |
90 | |
91 | SetTolerance(me: in out; Tolerance3d: Real) |
92 | ---Purpose: Changes the tolerances of the approximation. |
93 | |
94 | is static; |
95 | |
96 | |
97 | IsAllApproximated(me) |
98 | ---Purpose: returns False if at a moment of the approximation, |
99 | -- NotDone was sent. |
100 | |
101 | returns Boolean |
102 | is static; |
103 | |
104 | |
105 | IsToleranceReached(me) |
106 | ---Purpose: returns False if the status no cut has been done |
107 | -- if necessary. |
108 | |
109 | returns Boolean |
110 | is static; |
111 | |
112 | |
113 | Error(me; Index: Integer) |
114 | ---Purpose: returns the tolerance of the <Index> approximated Surface. |
115 | returns Real |
116 | is static; |
117 | |
118 | |
119 | NbSurfaces(me) |
120 | ---Purpose: Returns the number of Bezier Surfaces doing the |
121 | -- approximation of the Surface. |
122 | returns Integer |
123 | is static; |
124 | |
125 | |
126 | Value(me; Index: Integer = 1) |
127 | ---Purpose: returns the approximation Surface of range <Index>. |
128 | |
129 | returns BezierSurface from Geom; |
130 | |
131 | |
132 | Parameters(me; Index: Integer; firstU, lastU, firstV, lastV: in out Real) |
133 | ---purpose: returns the first and last parameters of the |
134 | -- <Index> Surface. |
135 | is static; |
136 | |
137 | |
138 | fields |
139 | |
140 | |
141 | mySurfaces: SequenceOfSurface from TColGeom; |
142 | myfirstUparam: SequenceOfReal from TColStd; |
143 | mylastUparam: SequenceOfReal from TColStd; |
144 | myfirstVparam: SequenceOfReal from TColStd; |
145 | mylastVparam: SequenceOfReal from TColStd; |
146 | TheSurface: BezierSurface from Geom; |
147 | alldone: Boolean; |
148 | tolreached: Boolean; |
149 | Tolers3d: SequenceOfReal from TColStd; |
150 | mydegremin: Integer; |
151 | mydegremax: Integer; |
152 | mytol3d: Real; |
153 | currenttol3d: Real; |
154 | mycut: Boolean; |
155 | myfirstUCons: Constraint; |
156 | mylastUCons: Constraint; |
157 | mylastVCons: Constraint; |
158 | mylastCons: Constraint; |
159 | |
160 | |
161 | |
162 | end ComputeCSurface; |