b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
42cf5bc1 |
15 | |
16 | #include <Adaptor2d_Curve2d.hxx> |
17 | #include <Adaptor3d_Curve.hxx> |
18 | #include <GCPnts_QuasiUniformDeflection.hxx> |
19 | #include <gp_Pnt.hxx> |
7fd59977 |
20 | #include <gp_Pnt2d.hxx> |
7fd59977 |
21 | #include <gp_Vec.hxx> |
42cf5bc1 |
22 | #include <gp_Vec2d.hxx> |
23 | #include <Standard_ConstructionError.hxx> |
24 | #include <Standard_DomainError.hxx> |
25 | #include <Standard_NotImplemented.hxx> |
26 | #include <Standard_OutOfRange.hxx> |
27 | #include <StdFail_NotDone.hxx> |
28 | |
dcf0889f |
29 | static const Standard_Integer MyMaxQuasiFleshe = 2000; |
30 | |
7fd59977 |
31 | // mask the return of a Adaptor2d_Curve2d as a gp_Pnt |
7fd59977 |
32 | static gp_Pnt Value(const Adaptor3d_Curve & C, |
33 | const Standard_Real Parameter) |
34 | { |
35 | return C.Value(Parameter) ; |
36 | } |
37 | static gp_Pnt Value(const Adaptor2d_Curve2d & C, |
38 | const Standard_Real Parameter) |
39 | { |
40 | gp_Pnt aPoint ; |
41 | gp_Pnt2d a2dPoint(C.Value(Parameter)); |
42 | aPoint.SetCoord(a2dPoint.X(),a2dPoint.Y(),0.); |
43 | return aPoint ; |
44 | } |
45 | |
46 | static void D1(const Adaptor3d_Curve & C, |
47 | const Standard_Real Parameter, |
48 | gp_Pnt& P, |
49 | gp_Vec& V) |
50 | { |
51 | C.D1(Parameter,P,V); |
52 | } |
53 | |
54 | static void D1(const Adaptor2d_Curve2d & C, |
55 | const Standard_Real Parameter, |
56 | gp_Pnt& P, |
57 | gp_Vec& V) |
58 | { |
59 | gp_Pnt2d a2dPoint; |
60 | gp_Vec2d a2dVec; |
61 | C.D1(Parameter,a2dPoint,a2dVec); |
62 | P.SetCoord(a2dPoint.X(),a2dPoint.Y(),0.); |
63 | V.SetCoord(a2dVec.X(),a2dVec.Y(),0.); |
64 | } |
65 | |
66 | |
67 | //======================================================================= |
68 | //function : Value |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | gp_Pnt GCPnts_QuasiUniformDeflection::Value |
73 | (const Standard_Integer Index) const |
74 | { |
75 | StdFail_NotDone_Raise_if(!myDone, |
76 | "GCPnts_QuasiUniformAbscissa::Parameter()"); |
77 | return myPoints.Value(Index) ; |
78 | } |
79 | //======================================================================= |
80 | //function : GCPnts_QuasiUniformDeflection |
81 | //purpose : |
82 | //======================================================================= |
83 | |
84 | GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection () |
d533dafb |
85 | : myDone(Standard_False), |
86 | myDeflection(0.0), |
87 | myCont(GeomAbs_C1) |
7fd59977 |
88 | { |
89 | } |
90 | |
91 | #include <Geom_BezierCurve.hxx> |
92 | #include <Geom_BSplineCurve.hxx> |
93 | |
94 | #define TheCurve Adaptor3d_Curve |
95 | #define Handle_TheBezierCurve Handle(Geom_BezierCurve) |
96 | #define Handle_TheBSplineCurve Handle(Geom_BSplineCurve) |
97 | |
9bf3ef83 |
98 | #include "GCPnts_QuasiUniformDeflection.pxx" |
7fd59977 |
99 | |
100 | #undef TheCurve |
101 | #undef Handle_TheBezierCurve |
102 | #undef Handle_TheBSplineCurve |
103 | |
104 | #include <Geom2d_BezierCurve.hxx> |
105 | #include <Geom2d_BSplineCurve.hxx> |
106 | |
107 | #define TheCurve Adaptor2d_Curve2d |
108 | #define Handle_TheBezierCurve Handle(Geom2d_BezierCurve) |
109 | #define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve) |
110 | |
9bf3ef83 |
111 | #include "GCPnts_QuasiUniformDeflection.pxx" |
7fd59977 |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |