1 // Created on: 1994-07-04
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Bisector.hxx>
19 #include <Bisector_Bisec.hxx>
20 #include <Bisector_BisecAna.hxx>
21 #include <Bisector_BisecCC.hxx>
22 #include <Bisector_BisecPC.hxx>
23 #include <Bisector_Curve.hxx>
24 #include <GCE2d_MakeSegment.hxx>
25 #include <Geom2d_BSplineCurve.hxx>
26 #include <Geom2d_CartesianPoint.hxx>
27 #include <Geom2d_Circle.hxx>
28 #include <Geom2d_Curve.hxx>
29 #include <Geom2d_Line.hxx>
30 #include <Geom2d_Point.hxx>
31 #include <Geom2d_TrimmedCurve.hxx>
33 #include <gp_Pnt2d.hxx>
34 #include <gp_Vec2d.hxx>
35 #include <Precision.hxx>
36 #include <Standard_NotImplemented.hxx>
37 #include <StdFail_NotDone.hxx>
42 #include <DrawTrSurf.hxx>
43 #pragma comment(lib, "TKDraw.lib")
44 static char name[100];
45 static Standard_Integer nbb = 0;
46 static Standard_Boolean Affich = Standard_False;
51 static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C,
55 static void ReplaceByLineIfIsToSmall (Handle(Bisector_Curve)& Bis,
56 Standard_Real& UFirst,
57 Standard_Real& ULast);
58 //=============================================================================
59 //function : Empty Constructor
60 //=============================================================================
61 Bisector_Bisec::Bisector_Bisec()
65 //===========================================================================
66 // calculate the bissectrice between two curves coming from a point.
68 // afirstcurve : \ curves between which the
69 // asecondcurve : / bissectrice is calculated.
70 // apoint : point through which the bissectrice should pass.
71 // afirstvector : \ vectors to determine the sector where
72 // asecondvector : / the bissectrice should be located.
73 // adirection : shows the side of the bissectrice to be preserved.
74 // tolerance : threshold starting from which the bisectrices are degenerated
75 //===========================================================================
77 void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
78 const Handle(Geom2d_Curve)& asecondcurve ,
79 const gp_Pnt2d& apoint ,
80 const gp_Vec2d& afirstvector ,
81 const gp_Vec2d& asecondvector ,
82 const Standard_Real adirection ,
83 const GeomAbs_JoinType ajointype ,
84 const Standard_Real tolerance ,
85 const Standard_Boolean oncurve )
87 Handle(Standard_Type) Type1 = afirstcurve ->DynamicType();
88 Handle(Standard_Type) Type2 = asecondcurve->DynamicType();
89 Handle(Bisector_Curve) Bis;
90 Standard_Real UFirst,ULast;
92 if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
93 Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve)
94 ->BasisCurve()->DynamicType();
96 if (Type2 == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
97 Type2 = Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve)
98 ->BasisCurve()->DynamicType();
101 Handle(Geom2d_Curve) afirstcurve1 = afirstcurve;
102 Handle(Geom2d_Curve) asecondcurve1 = asecondcurve;
104 if(Type1 == STANDARD_TYPE(Geom2d_BSplineCurve))
106 Handle(Geom2d_BSplineCurve) aBS;
107 if(afirstcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
109 aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve)
114 aBS = Handle(Geom2d_BSplineCurve)::DownCast(afirstcurve);
116 if(aBS->Degree() == 1 && aBS->NbPoles() == 2)
118 if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4)
120 afirstcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2)).Value();
121 Type1 = STANDARD_TYPE(Geom2d_Line);
127 if(Type2 == STANDARD_TYPE(Geom2d_BSplineCurve))
129 Handle(Geom2d_BSplineCurve) aBS;
130 if(asecondcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
132 aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve)
137 aBS = Handle(Geom2d_BSplineCurve)::DownCast(asecondcurve);
139 if(aBS->Degree() == 1 && aBS->NbPoles() == 2)
141 if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4)
143 asecondcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2)).Value();
144 Type2 = STANDARD_TYPE(Geom2d_Line);
149 if ( (Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) &&
150 (Type2 == STANDARD_TYPE(Geom2d_Circle) || Type2 == STANDARD_TYPE(Geom2d_Line)) )
152 //------------------------------------------------------------------
153 // Analytic Bissectrice.
154 //------------------------------------------------------------------
155 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
156 BisAna->Perform(afirstcurve1 ,
165 UFirst = BisAna->ParameterOfStartPoint();
166 ULast = BisAna->ParameterOfEndPoint();
170 Standard_Boolean IsLine = Standard_False;
173 gp_Dir2d Fd(afirstvector);
174 gp_Dir2d Sd(asecondvector);
175 //if (Fd.Dot(Sd) < Precision::Angular() - 1.) {
176 //if (Fd.Dot(Sd) < 10*Precision::Angular() - 1.) //patch
177 if (Fd.Dot(Sd) < Sqrt(2.*Precision::Angular()) - 1.)
178 IsLine = Standard_True;
181 //------------------------------------------------------------------
183 //------------------------------------------------------------------
184 gp_Dir2d N ( - adirection*afirstvector.Y(), adirection*afirstvector.X());
185 Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint);
186 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
187 Handle (Geom2d_TrimmedCurve)
188 BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite());
189 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
191 UFirst = BisAna->ParameterOfStartPoint();
192 ULast = BisAna->ParameterOfEndPoint();
196 //-------------------------------------------------------------------
198 //-------------------------------------------------------------------
199 Handle(Bisector_BisecCC) BisCC = new Bisector_BisecCC();
200 BisCC -> Perform(asecondcurve1,
206 if (BisCC -> IsEmpty()) {
207 // bissectrice is empty. a point is projected at the end of the guide curve.
208 // Construction of a false bissectrice.
209 // modified by NIZHNY-EAP Mon Feb 21 12:00:13 2000 ___BEGIN___
210 gp_Pnt2d aP1 = afirstcurve1->Value(afirstcurve1->LastParameter());
211 gp_Pnt2d aP2 = asecondcurve1->Value(asecondcurve1->FirstParameter());
212 gp_Pnt2d aPm(.5*(aP1.XY()+aP2.XY()));
213 Standard_Real Nx, Ny;
214 if(aPm.Distance(apoint) > 10.*Precision::Confusion())
216 Nx = apoint.X() - aPm.X();
217 Ny = apoint.Y() - aPm.Y();
226 gp_Dir2d dir1(afirstvector), dir2(asecondvector);
227 Nx = - dir1.X() - dir2.X(),
228 Ny = - dir1.Y() - dir2.Y();
229 if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) {
230 Nx = -afirstvector.Y();
231 Ny = afirstvector.X();
234 gp_Dir2d N ( adirection*Nx, adirection*Ny);
235 // modified by NIZHNY-EAP Mon Feb 21 12:00:19 2000 ___END___
237 Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint);
238 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
239 Handle (Geom2d_TrimmedCurve)
240 BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite());
241 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
243 UFirst = BisAna->ParameterOfStartPoint();
244 ULast = BisAna->ParameterOfEndPoint();
248 UFirst = BisCC->FirstParameter();
249 ULast = BisCC->LastParameter ();
251 ReplaceByLineIfIsToSmall(Bis,UFirst,ULast);
255 UFirst = Max(UFirst, Bis->FirstParameter());
256 ULast = Min(ULast, Bis->LastParameter());
257 thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
261 sprintf( name, "c1_%d", ++nbb );
262 DrawTrSurf::Set( name, afirstcurve );
263 sprintf( name, "c2_%d", nbb );
264 DrawTrSurf::Set( name, asecondcurve );
265 sprintf( name, "p%d", nbb );
266 DrawTrSurf::Set( name, apoint );
267 sprintf( name, "b%d", nbb );
268 DrawTrSurf::Set( name, thebisector );
274 //===========================================================================
275 // calculate the bissectrice between a curve and a point starting in a point.
277 // afirstcurve : \ curve and point the bissectrice between which is calculated.
279 // apoint : point through which the bissectrice should pass.
280 // afirstvector : \ vectors to find the sector where
281 // asecondvector : / the bissectrice should be located.
282 // adirection : shows the side of the bissectrice to be preserved.
283 // tolerance : threshold starting from which the bisectrices are degenerated
284 //===========================================================================
286 void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
287 const Handle(Geom2d_Point)& asecondpoint ,
288 const gp_Pnt2d& apoint ,
289 const gp_Vec2d& afirstvector ,
290 const gp_Vec2d& asecondvector,
291 const Standard_Real adirection ,
292 const Standard_Real tolerance ,
293 const Standard_Boolean oncurve )
295 //gp_Pnt2d SecondPnt = asecondpoint->Pnt2d();
297 Handle(Bisector_Curve) Bis;
298 Handle(Standard_Type) Type1 = afirstcurve ->DynamicType();
299 Standard_Real UFirst,ULast;
301 if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
302 Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve)
303 ->BasisCurve()->DynamicType();
306 if ( Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) {
307 //------------------------------------------------------------------
308 // Analytic Bissectrice.
309 //------------------------------------------------------------------
310 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
311 BisAna -> Perform (afirstcurve ,
319 UFirst = BisAna->ParameterOfStartPoint();
320 ULast = BisAna->ParameterOfEndPoint();
324 Standard_Boolean IsLine = Standard_False;
325 Standard_Real RC = Precision::Infinite();
328 if (Bisector::IsConvex(afirstcurve,adirection) ||
329 IsMaxRC(afirstcurve,afirstcurve->LastParameter(),RC)) {
330 IsLine = Standard_True;
334 //------------------------------------------------------------------
336 //------------------------------------------------------------------
337 gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
338 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
339 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC);
340 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
342 UFirst = BisAna->ParameterOfStartPoint();
343 ULast = BisAna->ParameterOfEndPoint();
347 //-------------------------------------------------------------------
349 //-------------------------------------------------------------------
350 Handle(Bisector_BisecPC) BisPC = new Bisector_BisecPC();
351 Handle(Geom2d_Curve) afirstcurvereverse = afirstcurve->Reversed();
353 BisPC -> Perform(afirstcurvereverse ,
354 asecondpoint->Pnt2d(),
356 // Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
357 if (BisPC -> IsEmpty()) {
358 gp_Dir2d dir1(afirstvector), dir2(asecondvector);
360 Nx = - dir1.X() - dir2.X(),
361 Ny = - dir1.Y() - dir2.Y();
362 if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) {
363 Nx = - afirstvector.Y();
364 Ny = afirstvector.X();
366 // gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
367 gp_Dir2d N ( adirection*Nx, adirection*Ny);
368 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
369 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC);
370 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
372 UFirst = BisAna->ParameterOfStartPoint();
373 ULast = BisAna->ParameterOfEndPoint();
376 // Modified by Sergey KHROMOV - Wed Mar 6 17:01:08 2002 End
377 UFirst = BisPC->Parameter(apoint);
378 ULast = BisPC->LastParameter();
381 //Standard_Real t = .9;
382 //UFirst = (1. - t) * BisPC->FirstParameter() + t * ULast;
383 //Extrapolate by line
384 //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
385 gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) );
387 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
388 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC);
389 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
391 UFirst = BisAna->ParameterOfStartPoint();
392 ULast = BisAna->ParameterOfEndPoint();
400 if(UFirst < Bis->FirstParameter())
401 UFirst = Bis->FirstParameter();
402 if(ULast > Bis->LastParameter())
403 ULast = Bis->LastParameter();
404 thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
409 sprintf( name, "c1_%d", ++nbb );
410 DrawTrSurf::Set( name, afirstcurve );
411 sprintf( name, "c2_%d", nbb );
412 DrawTrSurf::Set( name, asecondpoint->Pnt2d() );
413 sprintf( name, "p%d", nbb );
414 DrawTrSurf::Set( name, apoint );
415 sprintf( name, "b%d", nbb );
416 DrawTrSurf::Set( name, thebisector );
421 //===========================================================================
422 // calculate the bissectrice between a curve and a point starting in a point.
424 // afirstpoint : \ curve and point the bissectrice between which is calculated.
426 // apoint : point through which the bissectrice should pass.
427 // afirstvector : \ vectors to find the sector where
428 // asecondvector : / the bissectrice should be located.
429 // adirection : shows the side of the bissectrice to be preserved.
430 // tolerance : threshold starting from which the bisectrices are degenerated
431 //===========================================================================
433 void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
434 const Handle(Geom2d_Curve)& asecondcurve ,
435 const gp_Pnt2d& apoint ,
436 const gp_Vec2d& afirstvector ,
437 const gp_Vec2d& asecondvector,
438 const Standard_Real adirection ,
439 const Standard_Real tolerance ,
440 const Standard_Boolean oncurve )
443 //gp_Pnt2d FirstPnt = afirstpoint->Pnt2d();
445 Handle(Bisector_Curve) Bis;
446 Handle(Standard_Type) Type1 = asecondcurve ->DynamicType();
447 Standard_Real UFirst,ULast;
449 if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
450 Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve)
451 ->BasisCurve()->DynamicType();
454 if ( Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) {
455 //------------------------------------------------------------------
456 // Analytic Bissectrice.
457 //------------------------------------------------------------------
458 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
459 BisAna -> Perform (afirstpoint ,
467 UFirst = BisAna->ParameterOfStartPoint();
468 ULast = BisAna->ParameterOfEndPoint();
472 // Standard_Real UPoint = 0.;
473 Standard_Boolean IsLine = Standard_False;
474 Standard_Real RC = Precision::Infinite();
477 if (Bisector::IsConvex(asecondcurve, adirection) ||
478 IsMaxRC(asecondcurve,asecondcurve->FirstParameter(),RC)) {
479 IsLine = Standard_True;
483 //------------------------------------------------------------------
485 //------------------------------------------------------------------
486 gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
487 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
488 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC);
489 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
491 UFirst = BisAna->ParameterOfStartPoint();
492 ULast = BisAna->ParameterOfEndPoint();
496 //-------------------------------------------------------------------
498 //-------------------------------------------------------------------
499 Handle(Bisector_BisecPC) BisPC = new Bisector_BisecPC();
500 BisPC -> Perform(asecondcurve ,
501 afirstpoint->Pnt2d(),
503 // Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
504 if (BisPC -> IsEmpty()) {
505 gp_Dir2d dir1(afirstvector), dir2(asecondvector);
507 Nx = - dir1.X() - dir2.X(),
508 Ny = - dir1.Y() - dir2.Y();
509 if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) {
510 Nx = - afirstvector.Y();
511 Ny = afirstvector.X();
513 // gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
514 gp_Dir2d N ( adirection*Nx, adirection*Ny);
515 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
516 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC);
517 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
519 UFirst = BisAna->ParameterOfStartPoint();
520 ULast = BisAna->ParameterOfEndPoint();
523 // Modified by Sergey KHROMOV - Thu Feb 21 16:49:58 2002 End
524 UFirst = BisPC->Parameter(apoint);
525 ULast = BisPC->LastParameter();
528 //Extrapolate by line
529 //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
530 gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) );
532 Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
533 Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC);
534 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
536 UFirst = BisAna->ParameterOfStartPoint();
537 ULast = BisAna->ParameterOfEndPoint();
546 UFirst = Max(UFirst, Bis->FirstParameter());
547 ULast = Min(ULast, Bis->LastParameter());
548 thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
553 sprintf( name, "c1_%d", ++nbb );
554 DrawTrSurf::Set( name, afirstpoint->Pnt2d() );
555 sprintf( name, "c2_%d", nbb );
556 DrawTrSurf::Set( name, asecondcurve );
557 sprintf( name, "p%d", nbb );
558 DrawTrSurf::Set( name, apoint );
559 sprintf( name, "b%d", nbb );
560 DrawTrSurf::Set( name, thebisector );
566 //===========================================================================
567 // calculate the bissectrice between two points starting in a point.
569 // afirstpoint : \ curves the bissectrice between which should be
570 // asecondpoint : / calculated.
571 // apoint : point through which the bissectrice should pass.
572 // afirstvector : \ vectors to find the sector where
573 // asecondvector : / the bissectrice should be located.
574 // adirection : shows the side of the bissectrice to be preserved.
575 //===========================================================================
577 void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
578 const Handle(Geom2d_Point)& asecondpoint ,
579 const gp_Pnt2d& apoint ,
580 const gp_Vec2d& afirstvector ,
581 const gp_Vec2d& asecondvector,
582 const Standard_Real adirection ,
583 const Standard_Real tolerance ,
584 const Standard_Boolean oncurve )
586 Handle(Bisector_BisecAna) Bis = new Bisector_BisecAna();
588 Bis -> Perform (afirstpoint ,
596 thebisector = new Geom2d_TrimmedCurve(Bis,
597 Bis->ParameterOfStartPoint(),
598 Bis->ParameterOfEndPoint());
603 sprintf( name, "c1_%d", ++nbb );
604 DrawTrSurf::Set( name, afirstpoint->Pnt2d() );
605 sprintf( name, "c2_%d", nbb );
606 DrawTrSurf::Set( name, asecondpoint->Pnt2d() );
607 sprintf( name, "p%d", nbb );
608 DrawTrSurf::Set( name, apoint );
609 sprintf( name, "b%d", nbb );
610 DrawTrSurf::Set( name, thebisector );
615 //=============================================================================
618 //=============================================================================
619 const Handle(Geom2d_TrimmedCurve)& Bisector_Bisec::Value() const
624 //=============================================================================
625 //function : ChangeValue
627 //=============================================================================
628 const Handle(Geom2d_TrimmedCurve)& Bisector_Bisec::ChangeValue()
633 //=============================================================================
634 //function : ReplaceByLineIfIsToSmall
635 //purpose : If the size of an algorithmic bissectrice is negligeable it is
636 // replaced by a half-straight.
637 //=============================================================================
638 static void ReplaceByLineIfIsToSmall (Handle(Bisector_Curve)& Bis,
639 Standard_Real& UFirst,
640 Standard_Real& ULast )
643 if (Abs(ULast - UFirst) > 2.*Precision::PConfusion()*10.) return; //patch
645 gp_Pnt2d PF = Bis->Value(UFirst);
646 gp_Pnt2d PL = Bis->Value(ULast);
648 if (PF.Distance(PL) > Precision::Confusion()*10.) return;
650 gp_Vec2d T1 = Bis->DN(UFirst,1);
652 Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(PF);
653 Handle (Geom2d_Line) L = new Geom2d_Line (PF,T1);
654 Handle (Geom2d_TrimmedCurve)
655 BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite());
656 Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna ();
658 UFirst = BisAna->ParameterOfStartPoint();
659 ULast = BisAna->ParameterOfEndPoint();
663 //=============================================================================
666 //=============================================================================
667 static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C,
672 Standard_Real US = C->FirstParameter();
673 Standard_Real UL = C->LastParameter();
680 Norm2 = D1.SquareMagnitude();
681 if (Norm2 < gp::Resolution()) { KF = 0.0;}
682 else { KF = Abs(D1^D2)/(Norm2*sqrt(Norm2));}
685 Norm2 = D1.SquareMagnitude();
686 if (Norm2 < gp::Resolution()) { KL = 0.0;}
687 else { KL = Abs(D1^D2)/(Norm2*sqrt(Norm2));}
689 Standard_Boolean IsMax = Standard_False;
693 if (KL == 0.0) R = Precision::Infinite(); else R = 1/KL;
694 IsMax = Standard_True;
699 if (KF == 0.0) R = Precision::Infinite(); else R = 1/KF;
700 IsMax = Standard_True;