CommitLineData
b311480e 1-- Created on: 1993-05-19
2-- Created by: Laurent PAINNOT
3-- Copyright (c) 1993-1999 Matra Datavision
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
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--
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
7fd59977 21
22
23
24generic class SurfLeastSquare from AppCont(Surface as any;
25 SurfTool as any)
26 ---as TheSurfTool(Surface)
27
28 ---Purpose:
29
30
31uses Matrix from math,
32 Vector from math,
33 Constraint from AppParCurves,
34 MultiCurve from AppParCurves,
35 BezierSurface from Geom
36
37
38raises NotDone from StdFail,
39 OutOfRange from Standard,
40 DimensionError from Standard
41
42
43
44is
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
101fields
102
103Done: Boolean;
104SCU: BezierSurface from Geom;
105DegreU: Integer;
106DegreV: Integer;
107Nbdiscret: Integer;
108nbP: Integer;
109PointsX: Matrix;
110PointsY: Matrix;
111PointsZ: Matrix;
112PolesX: Vector;
113PolesY: Vector;
114PolesZ: Vector;
115myUParam: Vector;
116myVParam: Vector;
117VBU: Matrix;
118VBV: Matrix;
119
120end SurfLeastSquare from AppCont;
121