| 1 | -- File: Approx_ComputeCLine.cdl |
| 2 | -- Created: Fri May 14 15:22:38 1993 |
| 3 | -- Author: Laurent PAINNOT |
| 4 | -- <lpa@phobox> |
| 5 | ---Copyright: Matra Datavision 1993 |
| 6 | |
| 7 | |
| 8 | |
| 9 | generic class ComputeCLine from Approx |
| 10 | (MultiLine as any; |
| 11 | LineTool as any) --as TheLineTool from AppCont(MultiLine) |
| 12 | |
| 13 | |
| 14 | uses ParametrizationType from Approx, |
| 15 | SequenceOfReal from TColStd, |
| 16 | HArray1OfReal from TColStd, |
| 17 | SequenceOfMultiCurve from AppParCurves, |
| 18 | MultiCurve from AppParCurves, |
| 19 | Constraint from AppParCurves, |
| 20 | Vector from math |
| 21 | |
| 22 | |
| 23 | |
| 24 | private class MyLeastSquare instantiates LeastSquare from AppCont |
| 25 | (MultiLine, |
| 26 | LineTool); |
| 27 | |
| 28 | is |
| 29 | |
| 30 | |
| 31 | Create(Line: MultiLine; |
| 32 | degreemin: Integer = 3; |
| 33 | degreemax: Integer = 8; |
| 34 | Tolerance3d: Real = 1.0e-5; |
| 35 | Tolerance2d: Real = 1.0e-5; |
| 36 | cutting: Boolean = Standard_False; |
| 37 | FirstC: Constraint = AppParCurves_TangencyPoint; |
| 38 | LastC: Constraint = AppParCurves_TangencyPoint) |
| 39 | |
| 40 | ---Purpose: The MultiLine <Line> will be approximated until tolerances |
| 41 | -- will be reached. |
| 42 | -- The approximation will be done from degreemin to degreemax |
| 43 | -- with a cutting if the corresponding boolean is True. |
| 44 | |
| 45 | returns ComputeCLine; |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | Create(degreemin: Integer = 3; |
| 51 | degreemax: Integer = 8; |
| 52 | Tolerance3d: Real = 1.0e-05; |
| 53 | Tolerance2d: Real = 1.0e-05; |
| 54 | cutting: Boolean = Standard_False; |
| 55 | FirstC: Constraint = AppParCurves_TangencyPoint; |
| 56 | LastC: Constraint = AppParCurves_TangencyPoint) |
| 57 | |
| 58 | ---Purpose: Initializes the fields of the algorithm. |
| 59 | |
| 60 | returns ComputeCLine; |
| 61 | |
| 62 | |
| 63 | Perform(me: in out; Line: MultiLine) |
| 64 | ---Purpose: runs the algorithm after having initialized the fields. |
| 65 | |
| 66 | is static; |
| 67 | |
| 68 | |
| 69 | Compute(me: in out; Line: MultiLine; Ufirst, Ulast: Real; |
| 70 | TheTol3d, TheTol2d: in out Real) |
| 71 | ---Purpose: is internally used by the algorithms. |
| 72 | |
| 73 | returns Boolean |
| 74 | is static private; |
| 75 | |
| 76 | |
| 77 | SetDegrees(me: in out; degreemin, degreemax: Integer) |
| 78 | ---Purpose: changes the degrees of the approximation. |
| 79 | |
| 80 | is static; |
| 81 | |
| 82 | |
| 83 | SetTolerances(me: in out; Tolerance3d, Tolerance2d: Real) |
| 84 | ---Purpose: Changes the tolerances of the approximation. |
| 85 | |
| 86 | is static; |
| 87 | |
| 88 | |
| 89 | SetConstraints(me: in out; FirstC, LastC: Constraint) |
| 90 | ---Purpose: Changes the constraints of the approximation. |
| 91 | |
| 92 | is static; |
| 93 | |
| 94 | |
| 95 | IsAllApproximated(me) |
| 96 | ---Purpose: returns False if at a moment of the approximation, |
| 97 | -- the status NoApproximation has been sent by the user |
| 98 | -- when more points were needed. |
| 99 | |
| 100 | returns Boolean |
| 101 | is static; |
| 102 | |
| 103 | IsToleranceReached(me) |
| 104 | ---Purpose: returns False if the status NoPointsAdded has been sent. |
| 105 | |
| 106 | returns Boolean |
| 107 | is static; |
| 108 | |
| 109 | |
| 110 | Error(me; Index: Integer; tol3d: in out Real; tol2d: in out Real) |
| 111 | ---Purpose: returns the tolerances 2d and 3d of the <Index> MultiCurve. |
| 112 | |
| 113 | is static; |
| 114 | |
| 115 | |
| 116 | NbMultiCurves(me) |
| 117 | ---Purpose: Returns the number of MultiCurve doing the approximation |
| 118 | -- of the MultiLine. |
| 119 | returns Integer |
| 120 | is static; |
| 121 | |
| 122 | |
| 123 | Value(me; Index: Integer = 1) |
| 124 | ---Purpose: returns the approximation MultiCurve of range <Index>. |
| 125 | |
| 126 | returns MultiCurve from AppParCurves; |
| 127 | |
| 128 | |
| 129 | Parameters(me; Index: Integer; firstp, lastp: in out Real) |
| 130 | ---purpose: returns the first and last parameters of the |
| 131 | -- <Index> MultiCurve. |
| 132 | is static; |
| 133 | |
| 134 | |
| 135 | fields |
| 136 | |
| 137 | |
| 138 | myMultiCurves: SequenceOfMultiCurve from AppParCurves; |
| 139 | myfirstparam: SequenceOfReal from TColStd; |
| 140 | mylastparam: SequenceOfReal from TColStd; |
| 141 | TheMultiCurve: MultiCurve from AppParCurves; |
| 142 | alldone: Boolean; |
| 143 | tolreached: Boolean; |
| 144 | Tolers3d: SequenceOfReal from TColStd; |
| 145 | Tolers2d: SequenceOfReal from TColStd; |
| 146 | mydegremin: Integer; |
| 147 | mydegremax: Integer; |
| 148 | mytol3d: Real; |
| 149 | mytol2d: Real; |
| 150 | currenttol3d: Real; |
| 151 | currenttol2d: Real; |
| 152 | mycut: Boolean; |
| 153 | myfirstC: Constraint; |
| 154 | mylastC: Constraint; |
| 155 | |
| 156 | |
| 157 | end ComputeCLine; |