Test for 0022778: Bug in BRepMesh
[occt.git] / src / AppCont / AppCont_SurfLeastSquare.cdl
1 -- Created on: 1993-05-19
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21
22
23
24 generic class SurfLeastSquare from AppCont(Surface   as any;
25                                            SurfTool  as any)
26                                            ---as TheSurfTool(Surface)
27
28     ---Purpose:
29
30
31 uses  Matrix          from math,
32       Vector          from math,
33       Constraint      from AppParCurves,
34       MultiCurve      from AppParCurves,
35       BezierSurface   from Geom
36
37
38 raises NotDone        from StdFail, 
39        OutOfRange     from Standard,
40        DimensionError from Standard
41
42
43
44 is
45
46     Create(Surf: Surface; U0, U1, V0, V1: Real; 
47            FirstCons, LastUCons, LastVCons, LastCons: Constraint; 
48            DegU, DegV: Integer; NbPoints: Integer = 12)
49         ---Purpose: given a MultiLine, this algorithm computes the
50         --          approximation of a continous Surface into a bezier
51         --          Surface.
52         --          The algorithm minimizes the volume between the 
53         --          Surface Surf and the Bezier Surface doing the 
54         --          aproximation.
55         --          NbPoints * NbPoints are taken on the Surface Surf.
56         --          The Constraints are affected to the following points:
57         --          
58         --              U0, V0 |--|---|---|---|---|---|-----| U1, V0 
59         --              FirstCons |   |   |   |   |   |     | LastUCons
60         --                     |--|---|---|---|---|---|-----|
61         --                     |--|---|---|---|---|---|-----|
62         --                     |  |   |   |   |   |   |     |
63         --              U0, V1 |--|---|---|---|---|---|-----| U1, V1
64         --              LastVCons                             LastCons
65
66
67     returns SurfLeastSquare from AppCont
68     raises DimensionError from Standard;    
69
70
71     
72     IsDone(me)
73         ---Purpose: returns True if all has been correctly done.
74
75     returns Boolean
76     is static;
77     
78     
79     Value(me: in out)
80         ---Purpose: returns the result of the approximation.
81         --          An exception is raised if NotDone.
82         ---C++: return const &
83
84     returns BezierSurface from Geom
85     raises NotDone from StdFail
86     is static;
87
88
89
90     Error(me; F: in out Real; MaxE3d: in out Real)
91         ---Purpose: F is the sum of the square errors at each of the 
92         --          NbPoints*NbPoints and MaxE3d is the maximum value 
93         --          of these errors.
94         --          An exception is raised if NotDone.
95
96     raises NotDone from StdFail
97     is static;
98
99
100
101 fields
102
103 Done:      Boolean;
104 SCU:       BezierSurface from Geom;
105 DegreU:    Integer;
106 DegreV:    Integer;
107 Nbdiscret: Integer;
108 nbP:       Integer;
109 PointsX:   Matrix;
110 PointsY:   Matrix;
111 PointsZ:   Matrix;
112 PolesX:    Vector;
113 PolesY:    Vector;
114 PolesZ:    Vector;
115 myUParam:  Vector;
116 myVParam:  Vector;
117 VBU:       Matrix;
118 VBV:       Matrix;
119
120 end SurfLeastSquare from AppCont;
121