1 -- Created on: 1991-03-25
2 -- Created by: Michel CHAUVAT
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 generic class CLProps from LProp
25 Vec as any; -- as Vec or Vec2d
26 Pnt as any; -- as Pnt or Pnt2d
27 Dir as any; -- as Dir or Dir2d
28 Tool as any) -- as ToolCurve(Curve, Pnt, Vec)
30 ---Purpose: Computation of Curve Local Properties:
37 -- - centre of curvature,
39 uses Status from LProp
41 raises BadContinuity from LProp,
42 DomainError from Standard,
43 OutOfRange from Standard,
48 Create(C: Curve; N: Integer; Resolution: Real)
49 ---Purpose: Initializes the local properties of the curve <C>
50 -- The current point and the derivatives are
51 -- computed at the same time, which allows an
52 -- optimization of the computation time.
53 -- <N> indicates the maximum number of derivations to
54 -- be done (0, 1, 2 or 3). For example, to compute
55 -- only the tangent, N should be equal to 1.
56 -- <Resolution> is the linear tolerance (it is used to test
57 -- if a vector is null).
62 Create(C: Curve; U : Real; N: Integer; Resolution: Real)
63 --- Purpose : Same as previous constructor but here the parameter is
64 -- set to the value <U>.
65 -- All the computations done will be related to <C> and <U>.
70 Create(N : Integer;Resolution:Real)
71 --- Purpose : Same as previous constructor but here the parameter is
72 -- set to the value <U> and the curve is set
74 -- the curve can have a empty constructor
75 -- All the computations done will be related to <C> and <U>
76 -- when the functions "set" will be done.
81 SetParameter(me: in out; U : Real)
82 ---Purpose: Initializes the local properties of the curve
83 -- for the parameter value <U>.
86 SetCurve(me: in out; C : Curve)
87 ---Purpose: Initializes the local properties of the curve
91 Value(me) returns Pnt is static;
92 ---Purpose: Returns the Point.
93 ---C++: return const &
95 D1(me: in out) returns Vec is static;
96 ---Purpose: Returns the first derivative.
97 -- The derivative is computed if it has not been yet.
98 ---C++: return const &
100 D2(me: in out) returns Vec is static;
101 ---Purpose: Returns the second derivative.
102 -- The derivative is computed if it has not been yet.
103 ---C++: return const &
105 D3(me: in out) returns Vec is static;
106 ---Purpose: Returns the third derivative.
107 -- The derivative is computed if it has not been yet.
108 ---C++: return const &
110 IsTangentDefined(me: in out) returns Boolean is static;
111 ---Purpose: Returns True if the tangent is defined.
112 -- For example, the tangent is not defined if the
113 -- three first derivatives are all null.
115 Tangent(me: in out; D : out Dir)
116 ---Purpose: output the tangent direction <D>
118 -- if IsTangentDefined(me)=False.
121 Curvature(me: in out)
122 ---Purpose: Returns the curvature.
125 -- if IsTangentDefined(me) == False.
128 Normal(me: in out; N : out Dir)
129 ---Purpose: Returns the normal direction <N>.
131 -- if Curvature(me) < Resolution
134 CentreOfCurvature(me: in out; P : out Pnt)
135 ---Purpose: Returns the centre of curvature <P>.
137 -- if Curvature(me) < Resolution
142 myCurve : Curve; -- the Curve on which thw calculus are done
143 myU : Real; -- the current value of the parameter
144 myDerOrder : Integer; -- the order of derivation
145 myCN : Real; -- the order of continuity of the Curve
146 myLinTol : Real; -- the tolerance for null Vector
148 myPnt : Pnt; -- the current point value
149 myDerivArr : Vec[3]; -- the current first, second and third derivative
151 myTangent : Dir; -- the tangent value
152 myCurvature : Real; -- the curvature value
154 myTangentStatus : Status from LProp;
155 -- the status of the tangent direction
156 mySignificantFirstDerivativeOrder : Integer;
157 -- the order of the first non null derivative