b311480e |
1 | -- Created on: 1996-02-26 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1996-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 | |
7fd59977 |
21 | |
22 | |
23 | class MinimalVariation from FairCurve inherits Batten from FairCurve |
24 | |
25 | ---Purpose: Computes a 2D curve using an algorithm which |
26 | -- minimizes tension, sagging, and jerk energy. As in |
27 | -- FairCurve_Batten, two reference points are used. |
28 | -- Unlike that class, FairCurve_MinimalVariation |
29 | -- requires curvature settings at the first and second |
30 | -- reference points. These are defined by the rays of |
31 | -- curvature desired at each point. |
32 | |
33 | uses Pnt2d from gp, |
34 | Vec2d from gp, |
35 | AnalysisCode from FairCurve |
36 | |
37 | raises NegativeValue, NullValue, DomainError |
38 | |
39 | is |
40 | Create (P1,P2 : Pnt2d; Heigth : Real; Slope : Real = 0; PhysicalRatio : Real = 0) |
41 | |
42 | ---Purpose: Constructs the two contact points P1 and P2 and the geometrical |
43 | -- characteristics of the batten (elastic beam) |
44 | -- These include the real number values for height of |
45 | -- deformation Height, slope value Slope, and kind of |
46 | -- energy PhysicalRatio. The kinds of energy include: |
47 | -- - Jerk (0) |
48 | -- - Sagging (1). |
49 | -- Note that the default setting for Physical Ration is in FairCurve_Batten |
50 | -- Other parameters are initialized as follow : |
51 | -- - FreeSliding = False |
52 | -- - ConstraintOrder1 = 1 |
53 | -- - ConstraintOrder2 = 1 |
54 | -- - Angle1 = 0 |
55 | -- - Angle2 = 0 |
56 | -- - Curvature1 = 0 |
57 | -- - Curvature2 = 0 |
58 | -- - SlidingFactor = 1 |
59 | -- Warning |
60 | -- If PhysicalRatio equals 1, you cannot impose constraints on curvature. |
61 | -- Exceptions |
62 | -- NegativeValue if Height is less than or equal to 0. |
63 | -- NullValue if the distance between P1 and P2 is less |
64 | -- than or equal to the tolerance value for distance in |
65 | -- Precision::Confusion: P1.IsEqual(P2, |
66 | -- Precision::Confusion()). The function |
67 | -- gp_Pnt2d::IsEqual tests to see if this is the case. |
68 | returns MinimalVariation |
69 | raises NegativeValue, |
70 | NullValue; |
71 | |
72 | |
73 | -- Definition Methods ------------------------------------ |
74 | -- |
75 | ---Purpose: Definition of the geometricals constraints |
76 | |
77 | SetCurvature1 (me : in out; Curvature : Real); |
78 | ---C++: inline |
79 | ---Purpose: Allows you to set a new constraint on curvature at the first point. |
80 | |
81 | SetCurvature2 (me : in out; Curvature : Real); |
82 | ---C++: inline |
83 | ---Purpose: Allows you to set a new constraint on curvature at the second point. |
84 | -- |
85 | SetPhysicalRatio (me : in out; Ratio : Real) |
86 | ---C++: inline |
87 | ---Purpose: Allows you to set the physical ratio Ratio. |
88 | -- The kinds of energy which you can specify include: |
89 | -- 0 is only "Jerk" Energy |
90 | -- 1 is only "Sagging" Energy like batten |
91 | -- Warning: if Ratio is 1 it is impossible to impose curvature constraints. |
92 | -- Raises DomainError if Ratio < 0 or Ratio > 1 |
93 | raises DomainError; |
94 | |
95 | |
96 | Compute (me :in out; |
97 | ACode : in out AnalysisCode; |
98 | NbIterations : Integer = 50; |
99 | Tolerance : Real = 1.0e-3 ) |
100 | ---Purpose: Computes the curve with respect to the constraints, |
101 | -- NbIterations and Tolerance. The tolerance setting |
102 | -- allows you to control the precision of computation, and |
103 | -- the maximum number of iterations allows you to set a limit on computation time. |
104 | returns Boolean |
105 | is redefined; |
106 | |
107 | Compute (me :in out; |
108 | DeltaP1 : Vec2d; |
109 | DeltaP2 : Vec2d; |
110 | DeltaAngle1 : Real; |
111 | DeltaAngle2 : Real; |
112 | DeltaCurvature1 : Real; |
113 | DeltaCurvature2 : Real; |
114 | ACode : in out AnalysisCode; |
115 | NbIterations : Integer; |
116 | Tolerance: Real ) |
117 | ---Purpose: compute the curve with respect of the delta-constraints. |
118 | returns Boolean is private; |
119 | |
120 | GetCurvature1 (me) |
121 | ---C++: inline |
122 | ---Purpose: Returns the first established curvature. |
123 | returns Real; |
124 | |
125 | GetCurvature2 (me) |
126 | ---C++: inline |
127 | ---Purpose: Returns the second established curvature. |
128 | returns Real; |
129 | |
130 | GetPhysicalRatio(me) |
131 | ---C++: inline |
132 | ---Purpose : Returns the physical ratio, or kind of energy. |
133 | returns Real; |
134 | |
135 | Dump(me ; o : in out OStream) |
136 | ---Purpose: Prints on the stream o information on the current state |
137 | -- of the object. |
138 | -- Is used to redefine the operator <<. |
139 | is redefined; |
140 | |
141 | fields |
142 | OldCurvature1 : Real; |
143 | OldCurvature2 : Real; |
144 | OldPhysicalRatio : Real; |
145 | NewCurvature1 : Real; |
146 | NewCurvature2 : Real; |
147 | NewPhysicalRatio : Real; |
148 | end MinimalVariation; |