1 -- Created on: 1998-11-26
2 -- Created by: Xuan PHAM PHU
3 -- Copyright (c) 1998-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.
22 class TOOL from TopOpeBRepTool
36 Curve from BRepAdaptor,
37 Array1OfShape from TopTools,
38 ListOfShape from TopTools,
39 DataMapOfShapeListOfShape from TopTools,
40 C2DF from TopOpeBRepTool
44 -- orientation in subshapes :
47 OriinSor(myclass; sub, S : Shape from TopoDS; checkclo : Boolean = Standard_False)
49 -- returns 0 if <sub> is not subshape of <S>
50 -- returns 1 if <sub> is FORWARD in <S>
54 -- returns 5 CLOSING shape for <S>, if (checkclo=true)
55 OriinSorclosed(myclass; sub, S : Shape from TopoDS)
57 -- returns 0 if <sub> is not subshape of <S>
58 -- returns 1 if <sub> is FORWARD in <S>
65 ClosedE(myclass; E : Edge from TopoDS; vclo : out Vertex from TopoDS)
68 ClosedS(myclass; F : Face from TopoDS)
72 IsClosingE(myclass; E : Edge from TopoDS; F : Face from TopoDS)
75 IsClosingE(myclass; E : Edge from TopoDS; W : Shape from TopoDS; F : Face from TopoDS)
79 -- parameters on edge / face :
82 Vertices(myclass; E : Edge from TopoDS; Vces : out Array1OfShape from TopTools);
84 Vertex(myclass; Iv : Integer; E : Edge from TopoDS)
85 returns Vertex from TopoDS;
87 ParE(myclass; Iv : Integer; E : Edge from TopoDS)
90 OnBoundary(myclass; par : Real; E : Edge from TopoDS)
92 -- returns 0 : if par is not in [first,last] - <e>'s parameter range
95 -- 3 : in [first,last] range
96 -- 5 : on first/ last and <e> is closed.
98 UVF(myclass; par : Real; C2DF : C2DF from TopOpeBRepTool)
99 returns Pnt2d from gp;
101 ParISO(myclass; p2d : Pnt2d from gp; e : Edge from TopoDS; f : Face from TopoDS;
104 -- <par> = parameter of Pt(<p2d>,<f>) on Iso(<e>,<f>)
105 -- returns false if 2drep(<e>,<f>) is null or is not iso.
107 ParE2d(myclass; p2d : Pnt2d from gp; e : Edge from TopoDS; f : Face from TopoDS;
110 -- <par> = parameter of projected point pproj2d of p2d on 2drep(e,f)
111 -- avoid projections if 2drep(e,f) is uviso.
112 -- returns false if the projection fails.
114 Getduv(myclass; f : Face from TopoDS; uv : Pnt2d from gp;
115 dir : Vec from gp; factor : Real; duv : out Dir2d from gp)
117 -- For <f> on quadratic surface. <dir> is normal to <f> at Pt(<f>,<uv>),
118 -- Pt( <uv>)+factor*<dir> ) is Pt( <uv>+factoruv*<duv> )
120 uvApp(myclass; f : Face from TopoDS; e : Edge from TopoDS; par,eps : Real;
121 uvapp : out Pnt2d from gp)
123 -- uvapp = uv+eps*dxx, (dxx=duvmax in direction dxx2d, uv=pt2d(par,e))
129 TolUV(myclass; F : Face from TopoDS; tol3d : Real)
132 TolP(myclass; E : Edge from TopoDS; F : Face from TopoDS)
135 minDUV(myclass; F : Face from TopoDS)
138 outUVbounds(myclass; uv : Pnt2d from gp; F : Face from TopoDS)
141 stuvF(myclass; uv : Pnt2d from gp; F : Face from TopoDS;
142 onU,onV : out Integer);
143 -- onX = -1 : if x < xf
144 -- onX = -2 : if x > xl
145 -- onX = 1 : if x = xf (a tolx de la face)
146 -- onX = 2 : if x = xl (a tolx de la face)
153 TggeomE(myclass; par : Real; BC : Curve from BRepAdaptor; Tg : out Vec from gp)
156 TggeomE(myclass; par : Real; E : Edge from TopoDS; Tg : out Vec from gp)
158 -- Computes tangent vector to <E> at <par>,
159 -- if <E> is degenerated returns null vector
160 -- else if <par> is boundary of <E> bspline, approximate vector
162 -- returns true if the compute succeeds.
164 TgINSIDE(myclass; v : Vertex from TopoDS; E : Edge from TopoDS;
165 Tg : out Vec from gp; OvinE : out Integer)
167 -- Computes tangent vector to <E> at <v>, oriented INSIDE 1d<E>,
168 -- if <OvinE> is CLOSING <Tg> is tg(vFORWARD,<E>)
170 Tg2d(myclass; iv : Integer; E : Edge from TopoDS;
171 C2DF : C2DF from TopOpeBRepTool)
172 returns Vec2d from gp;
173 -- Computes tangent vector at bound <iv>
174 -- ex : E is FORWARD, iv = 1 (vertex FORWARD in EFOR) -> tggeom2d(v,E)
175 -- REVERSED,iv = 1 (vertex REVERSED in EFOR)-> -tggeom2d(v,E)
177 Tg2dApp(myclass; iv : Integer; E : Edge from TopoDS;
178 C2DF : C2DF from TopOpeBRepTool; factor : Real)
179 returns Vec2d from gp;
180 -- Approximate tangent vector near bound <iv> of <C2DF>.
181 -- If <factor> is null computes tangent vector at bound
184 tryTg2dApp(myclass; iv : Integer; E : Edge from TopoDS;
185 C2DF : C2DF from TopOpeBRepTool; factor : Real)
186 returns Vec2d from gp;
187 -- Approximates tangent vector only is <C2DF> gives quadratic pcurve.
194 XX(myclass; uv : Pnt2d from gp; f : Face from TopoDS;
195 par : Real; e : Edge from TopoDS;
196 xx : out Dir from gp)
199 Nt(myclass; uv : Pnt2d from gp; f : Face from TopoDS; normt : out Dir from gp)
202 NggeomF(myclass; uv : Pnt2d from gp; F : Face from TopoDS;
203 ng : out Vec from gp)
206 NgApp(myclass; par : Real; E : Edge from TopoDS; F : Face from TopoDS; tola : Real;
207 ngApp : out Dir from gp)
209 -- Approximates geometric normal <ngApp> to <F> at point(par,E),
210 -- purpose : !( ng.IsEqual(ngApp, tola) )
212 tryNgApp(myclass; par : Real; E : Edge from TopoDS; F : Face from TopoDS; tola : Real;
213 ng : out Dir from gp)
215 -- if ::NgApp fails, returns ng(par,E,F)
218 -- orientations of subshapes :
221 tryOriEinF(myclass; par : Real; E : Edge from TopoDS; F : Face from TopoDS)
223 -- prequesitory : <E> has 2d rep on <F>
224 -- purpose : the compute of orientation(<E>, <F>)
225 -- if <E> is not edge of <F>, uses its pcurve and <par>
226 -- returns 0 if <sub> is not subshape of <S>
227 -- returns 1 if <sub> is FORWARD in <S>
231 -- returns 5 CLOSING shape for <S>, if (checkclo=true)
237 IsQuad(myclass; E : Edge from TopoDS)
239 -- returns true if <E>'s geometry is quadratic.
241 IsQuad(myclass; F : Face from TopoDS)
243 -- returns true if <E>'s geometry is quadratic.
245 CurvE(myclass; E : Edge from TopoDS; par : Real; tg0 : Dir from gp; Curv : out Real)
247 -- compute for <Curv> = curvature of <E> in the plane normal to Pt(par,E)
248 -- with normal direction <tg0>
251 CurvF(myclass; F : Face from TopoDS; uv : Pnt2d from gp; tg0 : Dir from gp;
252 Curv : out Real; direct : out Boolean)
254 -- compute for <Curv> = curvature of intersection curve
255 -- (<F>,plane normal to Pt(par,E) with normal direction <tg0>)
260 UVISO(myclass; PC : Curve from Geom2d;
261 isou,isov : out Boolean; d2d : out Dir2d from gp; o2d : out Pnt2d from gp)
263 UVISO(myclass; C2DF : C2DF from TopOpeBRepTool;
264 isou,isov : out Boolean; d2d : out Dir2d from gp; o2d : out Pnt2d from gp)
266 UVISO(myclass; E : Edge from TopoDS; F : Face from TopoDS;
267 isou,isov : out Boolean; d2d : out Dir2d from gp; o2d : out Pnt2d from gp)
272 IsonCLO(myclass; PC : Curve from Geom2d;
273 onU : Boolean; xfirst,xperiod,xtol : Real)
275 IsonCLO(myclass; C2DF : C2DF from TopOpeBRepTool;
276 onU : Boolean; xfirst,xperiod,xtol : Real)
281 TrslUV(myclass; t2d : Vec2d from gp; C2DF : in out C2DF from TopOpeBRepTool);
282 TrslUVModifE(myclass; t2d : Vec2d from gp; F : Face from TopoDS; E : in out Edge from TopoDS)
288 Matter(myclass; d1,d2,ref : Vec from gp)
290 -- prequesitory : e1,e2 are edges connexed by vertex v, oriented FORWARD
292 -- v is oriented FORWARD in e1 and REVERSED in e2
293 -- d1 = tggeom(v,e1), d2 = tggeom(v,e2)
294 -- return the 2d angle matter described between d1 and d2 (in range [0.2PI])
296 Matter(myclass; d1,d2 : Vec2d from gp)
299 Matter(myclass; xx1,nt1, xx2,nt2 : Dir from gp; tola : Real; Ang : out Real)
301 -- Give us faces f1,f2 sharing edge e, pt = point on e
302 -- xxi : tangent to face fi at pt oriented INSIDE 2d(fi)
303 -- normal to tg(pt,e)
304 -- nti : topological normal to fi at pt.
306 -- If [ 3d(f1,f2) is smaller than 3d(fi), i=1..2 ]
307 -- Ang = the 3d angle of matter described between f1 and f2
308 -- Elsewhere, returns false
310 Matter(myclass; f1,f2 : Face from TopoDS;
311 e : Edge from TopoDS; pare : Real;
312 tola : Real; Ang : out Real)
315 MatterKPtg(myclass; f1,f2 : Face from TopoDS; e : Edge from TopoDS;
318 -- <f1> and <f2> are tangent on edge <e>, compute the matter angle
319 -- between the 2 faces (0. or 2PI)
325 Getstp3dF(myclass; p : Pnt from gp; f : Face from TopoDS;
326 uv : out Pnt2d from gp; st : out State from TopAbs)
328 -- expensive : uses projections
331 SplitE(myclass; Eanc : Edge from TopoDS; Splits : out ListOfShape from TopTools)
333 -- Splits edge <Eanc> on its INTERNAL vertices if any. Returns true if split succeeds.
335 MkShell(myclass; lF : ListOfShape from TopTools; She : out Shape from TopoDS);
337 Remove(myclass; loS : in out ListOfShape from TopTools;
338 toremove : Shape from TopoDS)
340 -- Removes all shapes equal to <toremove> from list <loS>
341 -- returns true if suceeds.
343 WireToFace(myclass; Fref : Face from TopoDS;
344 mapWlow : DataMapOfShapeListOfShape from TopTools;
345 lFs : out ListOfShape from TopTools)
347 -- <mapWlow> = {(W,low)}
348 -- Builds up <lFs> = {a face built on <Fref> with bounds W,low}
350 EdgeONFace(myclass; par : Real; ed : Edge from TopoDS;
351 uv : Pnt2d from gp; fa : Face from TopoDS;
352 isonfa : out Boolean)
354 -- !!! pas encore fini xpu100299
355 -- prequesitory : Pnt(<par>, <ed>) = Pnt(<uv>,<fa>)
356 -- <isonfa> is true if <ed> is IN <fa>'s geometry.
357 -- returns true if <isonfa>'s compute succeds.