7fd59977 |
1 | -- File: Law_Interpolate.cdl |
2 | -- Created: Wed Nov 15 17:30:50 1995 |
3 | -- Author: Laurent BOURESCHE |
4 | -- <lbo@phylox> |
5 | ---Copyright: Matra Datavision 1995 |
6 | --- cut and past from GeomAPI_Interpolate in order |
7 | -- to provide 1D interpolation. |
8 | |
9 | class Interpolate from Law |
10 | |
11 | ---Purpose: This class is used to interpolate a BsplineCurve |
12 | -- passing through an array of points, with a C2 |
13 | -- Continuity if tangency is not requested at the point. |
14 | -- If tangency is requested at the point the continuity |
15 | -- will be C1. If Perodicity is requested the curve will |
16 | -- be closed and the junction will be the first point |
17 | -- given. The curve will than be only C1 |
18 | -- |
19 | -- |
20 | |
21 | |
22 | |
23 | uses |
24 | |
25 | Array1OfReal from TColStd, |
26 | HArray1OfReal from TColStd, |
27 | HArray1OfBoolean from TColStd, |
28 | BSpline from Law |
29 | |
30 | raises |
31 | NotDone from StdFail, |
32 | ConstructionError from Standard |
33 | is |
34 | |
35 | Create(Points : HArray1OfReal from TColStd; |
36 | PeriodicFlag : Boolean from Standard; |
37 | Tolerance : Real) |
38 | ---Purpose: Tolerance is to check if the points are not too close |
39 | -- to one an other. It is also used to check if the |
40 | -- tangent vector is not too small. There should be at |
41 | -- least 2 points. If PeriodicFlag is True then the curve |
42 | -- will be periodic be periodic |
43 | returns Interpolate from Law |
44 | raises ConstructionError from Standard; |
45 | |
46 | Create(Points : HArray1OfReal from TColStd; |
47 | Parameters : HArray1OfReal from TColStd; |
48 | PeriodicFlag : Boolean from Standard; |
49 | Tolerance : Real from Standard) |
50 | ---Purpose: Tolerance is to check if the points are not too close |
51 | -- to one an other. It is also used to check if the |
52 | -- tangent vector is not too small. There should be at |
53 | -- least 2 points. If PeriodicFlag is True then the curve |
54 | -- will be periodic be periodic |
55 | |
56 | -- Warning: There should be as many parameters as there are points |
57 | -- except if PeriodicFlag is True then there should be |
58 | -- one more parameter to close the curve |
59 | returns Interpolate from Law |
60 | raises ConstructionError from Standard; |
61 | |
62 | Load(me : in out; |
63 | InitialTangent : Real from Standard; |
64 | FinalTangent : Real from Standard) |
65 | ---Purpose: loads initial and final tangents if any. |
66 | is static; |
67 | |
68 | Load(me : in out; |
69 | Tangents : Array1OfReal from TColStd; |
70 | TangentFlags : HArray1OfBoolean from TColStd) |
71 | ---Purpose: loads the tangents. We should have as many tangents as |
72 | -- they are points in the array if TangentFlags.Value(i) |
73 | -- is Standard_True use the tangent Tangents.Value(i) |
74 | -- otherwise the tangent is not constrained. |
75 | -- |
76 | is static; |
77 | |
78 | ClearTangents(me : in out); |
79 | ---Purpose: Clears the tangents if any |
80 | |
81 | Perform(me : in out); |
82 | ---Purpose: Makes the interpolation |
83 | |
84 | Curve(me) |
85 | ---C++: return const & |
86 | returns BSpline from Law |
87 | raises NotDone from StdFail |
88 | is static; |
89 | |
90 | |
91 | IsDone(me) |
92 | returns Boolean from Standard |
93 | is static; |
94 | |
95 | PerformNonPeriodic(me : in out) |
96 | ---Purpose: Interpolates in a non periodic fashion. |
97 | is private; |
98 | |
99 | PerformPeriodic(me : in out) |
100 | ---Purpose: Interpolates in a C1 periodic fashion. |
101 | is private; |
102 | |
103 | fields |
104 | |
105 | myTolerance : Real from Standard; |
106 | -- the 3D tolerance to check for degenerate points |
107 | myPoints : HArray1OfReal from TColStd; |
108 | -- the points to interpolates |
109 | myIsDone : Boolean from Standard; |
110 | -- the algorithm did complete OK if Standard_True |
111 | myCurve : BSpline from Law; |
112 | -- the interpolated curve |
113 | myTangents : HArray1OfReal from TColStd; |
114 | -- the tangents only defined at slot i if |
115 | -- myTangenFlags->Value(i) is Standard_True |
116 | myTangentFlags : HArray1OfBoolean from TColStd; |
117 | -- the flags defining the tangents |
118 | myParameters : HArray1OfReal from TColStd; |
119 | -- the parameters used for the cubic interpolation |
120 | myPeriodic : Boolean from Standard; |
121 | -- if Standard_True the curve will be periodic |
122 | myTangentRequest : Boolean from Standard; |
123 | -- Tangents are given if True False otherwise |
124 | |
125 | end Interpolate from Law; |