42cf5bc1 |
1 | // Created on: 1995-04-26 |
2 | // Created by: Modelistation |
3 | // Copyright (c) 1995-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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 |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ChFi3d_ChBuilder_HeaderFile |
18 | #define _ChFi3d_ChBuilder_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <ChFi3d_Builder.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <ChFiDS_ChamfMethod.hxx> |
29 | #include <ChFiDS_SecHArray1.hxx> |
30 | #include <math_Vector.hxx> |
31 | #include <TopAbs_Orientation.hxx> |
32 | #include <TopAbs_State.hxx> |
33 | #include <ChFiDS_SequenceOfSurfData.hxx> |
34 | #include <ChFiDS_ListOfStripe.hxx> |
35 | class Standard_ConstructionError; |
36 | class Standard_DomainError; |
37 | class TopoDS_Shape; |
38 | class TopoDS_Edge; |
39 | class TopoDS_Face; |
40 | class ChFiDS_SurfData; |
41 | class ChFiDS_HElSpine; |
42 | class ChFiDS_Spine; |
43 | class BRepAdaptor_HSurface; |
44 | class Adaptor3d_TopolTool; |
45 | class BRepAdaptor_HCurve2d; |
46 | class TopoDS_Vertex; |
47 | class ChFiDS_Stripe; |
48 | |
49 | |
50 | //! construction tool for 3D chamfers on edges (on a solid). |
51 | class ChFi3d_ChBuilder : public ChFi3d_Builder |
52 | { |
53 | public: |
54 | |
55 | DEFINE_STANDARD_ALLOC |
56 | |
57 | |
58 | //! initializes the Builder with the Shape <S> for the |
59 | //! computation of chamfers |
60 | Standard_EXPORT ChFi3d_ChBuilder(const TopoDS_Shape& S, const Standard_Real Ta = 1.0e-2); |
61 | |
62 | //! initializes a contour with the edge <E> as first |
63 | //! (the next are found by propagation ). |
64 | //! The two distances (parameters of the chamfer) must |
65 | //! be set after. |
66 | //! if the edge <E> has more than 2 adjacent faces |
67 | Standard_EXPORT void Add (const TopoDS_Edge& E); |
68 | |
69 | //! initializes a new contour with the edge <E> as first |
70 | //! (the next are found by propagation ), and the |
71 | //! distance <Dis> |
72 | //! if the edge <E> has more than 2 adjacent faces |
73 | Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E, const TopoDS_Face& F); |
74 | |
75 | //! set the distance <Dis> of the fillet |
76 | //! contour of index <IC> in the DS with <Dis> on <F>. |
77 | //! if the face <F> is not one of common faces |
78 | //! of an edge of the contour <IC> |
79 | Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F); |
80 | |
81 | //! gives the distances <Dis> of the fillet |
82 | //! contour of index <IC> in the DS |
83 | Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const; |
84 | |
85 | //! initializes a new contour with the edge <E> as first |
86 | //! (the next are found by propagation ), and the |
87 | //! distance <Dis1> and <Dis2> |
88 | //! if the edge <E> has more than 2 adjacent faces |
89 | Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F); |
90 | |
91 | //! set the distances <Dis1> and <Dis2> of the fillet |
92 | //! contour of index <IC> in the DS with <Dis1> on <F>. |
93 | //! if the face <F> is not one of common faces |
94 | //! of an edge of the contour <IC> |
95 | Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F); |
96 | |
97 | //! gives the distances <Dis1> and <Dis2> of the fillet |
98 | //! contour of index <IC> in the DS |
99 | Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const; |
100 | |
101 | //! initializes a new contour with the edge <E> as first |
102 | //! (the next are found by propagation ), and the |
103 | //! distance <Dis1> and <Angle> |
104 | //! if the edge <E> has more than 2 adjacent faces |
105 | Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F); |
106 | |
107 | //! set the distance <Dis> and <Angle> of the fillet |
108 | //! contour of index <IC> in the DS with <Dis> on <F>. |
109 | //! if the face <F> is not one of common faces |
110 | //! of an edge of the contour <IC> |
111 | Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F); |
112 | |
113 | //! gives the distances <Dis> and <Angle> of the fillet |
114 | //! contour of index <IC> in the DS |
115 | Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnFace1) const; |
116 | |
117 | //! renvoi la methode des chanfreins utilisee |
118 | Standard_EXPORT ChFiDS_ChamfMethod IsChamfer (const Standard_Integer IC) const; |
119 | |
120 | //! Reset tous rayons du contour IC. |
121 | Standard_EXPORT void ResetContour (const Standard_Integer IC); |
122 | |
123 | Standard_EXPORT void Simulate (const Standard_Integer IC); |
124 | |
125 | Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const; |
126 | |
127 | Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const; |
128 | |
129 | Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE; |
130 | |
131 | Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE; |
132 | |
133 | Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep) Standard_OVERRIDE; |
134 | |
135 | //! Methode, implemented in inheritants, calculates |
136 | //! the elements of construction of the surface (fillet |
137 | //! or chamfer). |
dde68833 |
138 | Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) Standard_OVERRIDE; |
42cf5bc1 |
139 | |
140 | //! Method, implemented in the inheritants, calculates |
141 | //! the elements of construction of the surface (fillet |
142 | //! or chamfer) contact edge/face. |
143 | Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE; |
144 | |
145 | //! Method, implemented in inheritants, calculates |
146 | //! the elements of construction of the surface (fillet |
147 | //! or chamfer) contact edge/face. |
148 | Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE; |
149 | |
150 | //! Method, implemented in inheritants, calculates |
151 | //! the elements of construction of the surface (fillet |
152 | //! or chamfer) contact edge/edge. |
153 | Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep) Standard_OVERRIDE; |
154 | |
155 | Standard_EXPORT Standard_Integer FindChoiceDistAngle (const Standard_Integer Choice, const Standard_Boolean DisOnF1) const; |
156 | |
157 | |
158 | |
159 | |
160 | protected: |
161 | |
162 | |
79104795 |
163 | Standard_EXPORT void SimulKPart (const Handle(ChFiDS_SurfData)& SD) const Standard_OVERRIDE; |
42cf5bc1 |
164 | |
dde68833 |
165 | Standard_EXPORT Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) Standard_OVERRIDE; |
42cf5bc1 |
166 | |
79104795 |
167 | Standard_EXPORT Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Integer Choix, Handle(BRepAdaptor_HSurface)& S1, Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real Par, math_Vector& SolDep, TopAbs_State& Pos1, TopAbs_State& Pos2) const Standard_OVERRIDE; |
42cf5bc1 |
168 | |
169 | //! computes the intersection of two chamfers on |
170 | //! the vertex of index <Index> in myVDataMap. |
79104795 |
171 | Standard_EXPORT void PerformTwoCorner (const Standard_Integer Index) Standard_OVERRIDE; |
42cf5bc1 |
172 | |
173 | //! computes the intersection of three chamfers on |
174 | //! the vertex of index <Index> in myVDataMap. |
79104795 |
175 | Standard_EXPORT void PerformThreeCorner (const Standard_Integer Index) Standard_OVERRIDE; |
42cf5bc1 |
176 | |
177 | //! extends the spine of the Stripe <S> at the |
178 | //! extremity of the vertex <V>. |
79104795 |
179 | Standard_EXPORT void ExtentOneCorner (const TopoDS_Vertex& V, const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE; |
42cf5bc1 |
180 | |
181 | //! extends the spine of the 2 stripes of <LS> at the |
182 | //! extremity of the vertex <V> |
79104795 |
183 | Standard_EXPORT void ExtentTwoCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE; |
42cf5bc1 |
184 | |
185 | //! extends the spine of the 2 stripes of <LS> at the |
186 | //! extremity of the vertex <V> |
79104795 |
187 | Standard_EXPORT void ExtentThreeCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE; |
42cf5bc1 |
188 | |
189 | //! set the regularities |
79104795 |
190 | Standard_EXPORT void SetRegul() Standard_OVERRIDE; |
42cf5bc1 |
191 | |
192 | |
193 | |
194 | |
195 | private: |
196 | |
197 | |
198 | Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp, const Standard_Integer IEdge, TopoDS_Face& F1, TopoDS_Face& F2) const; |
199 | |
200 | |
201 | |
202 | |
203 | }; |
204 | |
205 | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | #endif // _ChFi3d_ChBuilder_HeaderFile |