7fd59977 |
1 | -- File: AppCont_SurfLeastSquare.cdl |
2 | -- Created: Wed May 19 11:14:01 1993 |
3 | -- Author: Laurent PAINNOT |
4 | -- <lpa@phobox> |
5 | ---Copyright: Matra Datavision 1993 |
6 | |
7 | |
8 | |
9 | generic class SurfLeastSquare from AppCont(Surface as any; |
10 | SurfTool as any) |
11 | ---as TheSurfTool(Surface) |
12 | |
13 | ---Purpose: |
14 | |
15 | |
16 | uses Matrix from math, |
17 | Vector from math, |
18 | Constraint from AppParCurves, |
19 | MultiCurve from AppParCurves, |
20 | BezierSurface from Geom |
21 | |
22 | |
23 | raises NotDone from StdFail, |
24 | OutOfRange from Standard, |
25 | DimensionError from Standard |
26 | |
27 | |
28 | |
29 | is |
30 | |
31 | Create(Surf: Surface; U0, U1, V0, V1: Real; |
32 | FirstCons, LastUCons, LastVCons, LastCons: Constraint; |
33 | DegU, DegV: Integer; NbPoints: Integer = 12) |
34 | ---Purpose: given a MultiLine, this algorithm computes the |
35 | -- approximation of a continous Surface into a bezier |
36 | -- Surface. |
37 | -- The algorithm minimizes the volume between the |
38 | -- Surface Surf and the Bezier Surface doing the |
39 | -- aproximation. |
40 | -- NbPoints * NbPoints are taken on the Surface Surf. |
41 | -- The Constraints are affected to the following points: |
42 | -- |
43 | -- U0, V0 |--|---|---|---|---|---|-----| U1, V0 |
44 | -- FirstCons | | | | | | | LastUCons |
45 | -- |--|---|---|---|---|---|-----| |
46 | -- |--|---|---|---|---|---|-----| |
47 | -- | | | | | | | | |
48 | -- U0, V1 |--|---|---|---|---|---|-----| U1, V1 |
49 | -- LastVCons LastCons |
50 | |
51 | |
52 | returns SurfLeastSquare from AppCont |
53 | raises DimensionError from Standard; |
54 | |
55 | |
56 | |
57 | IsDone(me) |
58 | ---Purpose: returns True if all has been correctly done. |
59 | |
60 | returns Boolean |
61 | is static; |
62 | |
63 | |
64 | Value(me: in out) |
65 | ---Purpose: returns the result of the approximation. |
66 | -- An exception is raised if NotDone. |
67 | ---C++: return const & |
68 | |
69 | returns BezierSurface from Geom |
70 | raises NotDone from StdFail |
71 | is static; |
72 | |
73 | |
74 | |
75 | Error(me; F: in out Real; MaxE3d: in out Real) |
76 | ---Purpose: F is the sum of the square errors at each of the |
77 | -- NbPoints*NbPoints and MaxE3d is the maximum value |
78 | -- of these errors. |
79 | -- An exception is raised if NotDone. |
80 | |
81 | raises NotDone from StdFail |
82 | is static; |
83 | |
84 | |
85 | |
86 | fields |
87 | |
88 | Done: Boolean; |
89 | SCU: BezierSurface from Geom; |
90 | DegreU: Integer; |
91 | DegreV: Integer; |
92 | Nbdiscret: Integer; |
93 | nbP: Integer; |
94 | PointsX: Matrix; |
95 | PointsY: Matrix; |
96 | PointsZ: Matrix; |
97 | PolesX: Vector; |
98 | PolesY: Vector; |
99 | PolesZ: Vector; |
100 | myUParam: Vector; |
101 | myVParam: Vector; |
102 | VBU: Matrix; |
103 | VBV: Matrix; |
104 | |
105 | end SurfLeastSquare from AppCont; |
106 | |