b311480e |
1 | // Created on: 1992-10-22 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | #include <GeomAbs_CurveType.hxx> |
18 | #include <GeomAbs_Shape.hxx> |
19 | |
20 | #include <gp_Lin2d.hxx> |
21 | #include <gp_Circ2d.hxx> |
22 | #include <gp_Elips2d.hxx> |
23 | #include <gp_Parab2d.hxx> |
24 | #include <gp_Hypr2d.hxx> |
25 | |
26 | #include <TColStd_Array1OfReal.hxx> |
47cbf134 |
27 | #include <Adaptor2d_Curve2d.hxx> |
7fd59977 |
28 | |
29 | #define IS_C2_COMPOSITE 0 |
30 | //============================================================ |
47cbf134 |
31 | inline GeomAbs_CurveType Geom2dInt_Geom2dCurveTool::GetType(const Adaptor2d_Curve2d& C) { |
7fd59977 |
32 | return(C.GetType()); |
33 | } |
34 | //============================================================ |
47cbf134 |
35 | inline gp_Lin2d Geom2dInt_Geom2dCurveTool::Line (const Adaptor2d_Curve2d& C) { |
7fd59977 |
36 | return(C.Line()); |
37 | } |
38 | //============================================================ |
47cbf134 |
39 | inline gp_Circ2d Geom2dInt_Geom2dCurveTool::Circle (const Adaptor2d_Curve2d& C) { |
7fd59977 |
40 | return(C.Circle()); |
41 | } |
42 | //============================================================ |
47cbf134 |
43 | inline gp_Elips2d Geom2dInt_Geom2dCurveTool::Ellipse (const Adaptor2d_Curve2d& C) { |
7fd59977 |
44 | return(C.Ellipse()); |
45 | } |
46 | //============================================================ |
47cbf134 |
47 | inline gp_Parab2d Geom2dInt_Geom2dCurveTool::Parabola (const Adaptor2d_Curve2d& C) { |
7fd59977 |
48 | return(C.Parabola()); |
49 | } |
50 | //============================================================ |
47cbf134 |
51 | inline gp_Hypr2d Geom2dInt_Geom2dCurveTool::Hyperbola (const Adaptor2d_Curve2d& C) { |
7fd59977 |
52 | return(C.Hyperbola()); |
53 | } |
54 | //============================================================ |
47cbf134 |
55 | inline gp_Pnt2d Geom2dInt_Geom2dCurveTool::Value (const Adaptor2d_Curve2d& C, |
7fd59977 |
56 | const Standard_Real U) { |
57 | return(C.Value(U)); |
58 | } |
59 | //============================================================ |
47cbf134 |
60 | inline void Geom2dInt_Geom2dCurveTool::D0(const Adaptor2d_Curve2d& C, |
7fd59977 |
61 | const Standard_Real U, |
62 | gp_Pnt2d& P) { |
63 | C.D0(U,P); |
64 | } |
65 | //============================================================ |
47cbf134 |
66 | inline void Geom2dInt_Geom2dCurveTool::D1 (const Adaptor2d_Curve2d& C, |
7fd59977 |
67 | const Standard_Real U, |
68 | gp_Pnt2d& P, |
69 | gp_Vec2d& T) { |
70 | C.D1(U,P,T); |
71 | } |
72 | //============================================================ |
47cbf134 |
73 | inline void Geom2dInt_Geom2dCurveTool::D2 (const Adaptor2d_Curve2d& C, |
7fd59977 |
74 | const Standard_Real U, |
75 | gp_Pnt2d& P, |
76 | gp_Vec2d& T, |
77 | gp_Vec2d& N) { |
78 | |
79 | C.D2(U,P,T,N); |
80 | } |
32ca7a51 |
81 | |
82 | //============================================================ |
47cbf134 |
83 | inline void Geom2dInt_Geom2dCurveTool::D3 (const Adaptor2d_Curve2d& C, |
32ca7a51 |
84 | const Standard_Real U, |
85 | gp_Pnt2d& P, |
86 | gp_Vec2d& T, |
87 | gp_Vec2d& N, |
88 | gp_Vec2d& V) { |
89 | |
90 | C.D3(U,P,T,N,V); |
91 | } |
92 | //============================================================ |
47cbf134 |
93 | inline gp_Vec2d Geom2dInt_Geom2dCurveTool::DN(const Adaptor2d_Curve2d& C, |
32ca7a51 |
94 | const Standard_Real U, |
95 | const Standard_Integer N) |
96 | { |
97 | return C.DN(U,N); |
98 | } |
99 | |
7fd59977 |
100 | //============================================================ |
47cbf134 |
101 | inline Standard_Real Geom2dInt_Geom2dCurveTool::FirstParameter (const Adaptor2d_Curve2d& C) { |
7fd59977 |
102 | return(C.FirstParameter()); |
103 | } |
104 | //============================================================ |
47cbf134 |
105 | inline Standard_Real Geom2dInt_Geom2dCurveTool::LastParameter (const Adaptor2d_Curve2d& C) { |
7fd59977 |
106 | return(C.LastParameter()); |
107 | } |
108 | //============================================================ |
109 | //== tolerance used by mathemetical algorithms |
110 | //== |
47cbf134 |
111 | inline Standard_Real Geom2dInt_Geom2dCurveTool::EpsX (const Adaptor2d_Curve2d& ) { |
7fd59977 |
112 | return(1.0e-10); |
113 | } |
114 | //------------------------------------------------------------ |
47cbf134 |
115 | inline Standard_Real Geom2dInt_Geom2dCurveTool::EpsX (const Adaptor2d_Curve2d& C,const Standard_Real Eps_XYZ) { |
7fd59977 |
116 | return(C.Resolution(Eps_XYZ)); |
117 | } |
118 | //============================================================ |
47cbf134 |
119 | inline void Geom2dInt_Geom2dCurveTool::Intervals(const Adaptor2d_Curve2d& C, |
7fd59977 |
120 | TColStd_Array1OfReal& Tab) { |
121 | #if IS_C2_COMPOSITE |
122 | C.Intervals(Tab,GeomAbs_C2); |
123 | #else |
124 | C.Intervals(Tab,GeomAbs_C1); |
125 | #endif |
126 | } |
127 | //============================================================ |
47cbf134 |
128 | //inline void Geom2dInt_Geom2dCurveTool::GetInterval(const Adaptor2d_Curve2d& C, |
129 | inline void Geom2dInt_Geom2dCurveTool::GetInterval(const Adaptor2d_Curve2d& , |
7fd59977 |
130 | const Standard_Integer i, |
131 | const TColStd_Array1OfReal& Tab, |
132 | Standard_Real& a, |
133 | Standard_Real& b) { |
134 | a = Tab.Value(i); |
135 | b = Tab.Value(i+1); |
136 | } |
137 | //============================================================ |
47cbf134 |
138 | inline Standard_Integer Geom2dInt_Geom2dCurveTool::NbIntervals(const Adaptor2d_Curve2d& C) { |
7fd59977 |
139 | Standard_Integer N=1; |
140 | #if IS_C2_COMPOSITE |
141 | N = C.NbIntervals(GeomAbs_C2); |
142 | #else |
143 | N = C.NbIntervals(GeomAbs_C1); |
144 | #endif |
145 | return(N); |
146 | } |
147 | //============================================================ |
148 | |
47cbf134 |
149 | inline Standard_Integer Geom2dInt_Geom2dCurveTool::Degree(const Adaptor2d_Curve2d& C) |
32ca7a51 |
150 | { |
151 | return C.Degree(); |
152 | } |