-// File: ApproxInt_PrmPrmSvSurfaces.gxx
-// Created: Wed Mar 17 12:42:28 1993
-// Author: Laurent BUCHARD
-// <lbr@topsn3>
+// Created on: 1993-03-17
+// Created by: Laurent BUCHARD
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#define TOLTANGENCY 0.0000000001
#include <TColStd_Array1OfReal.hxx>
#include <math_FunctionSetRoot.hxx>
+#include <Precision.hxx>
#define Debug(expr) cout<<" expr :"<<expr;
#define MySurf1 MyIntersectionOn2S.Function().AuxillarSurface1()
MyIntersectionOn2S(Surf1,Surf2,TOLTANGENCY)
{
}
-//--------------------------------------------------------------------------------
+
+//=======================================================================
+//function : Compute
+//purpose : Computes point on curve, 3D and 2D-tangents of a curve and
+// parameters on the surfaces.
+//=======================================================================
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
,Standard_Real& v1
,Standard_Real& u2
MyIsTangent = Standard_True;
- static TColStd_Array1OfReal Param(1,4);
+ Standard_Real aParam[4];//stack vs heap allocation
+ TColStd_Array1OfReal Param (aParam[0],1,4);
Param(1) = u1; Param(2) = v1;
Param(3) = u2; Param(4) = v2;
math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function());
-#ifdef DEB
- IntImp_ConstIsoparametric ChoixIso = MyIntersectionOn2S.Perform(Param,Rsnld);
-#else
MyIntersectionOn2S.Perform(Param,Rsnld);
-#endif
if (!MyIntersectionOn2S.IsDone()) {
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
DIS = TUTU * TVTV - TUTV * TUTV;
+ if(fabs(DIS)<Precision::Angular()) {
+ MyIsTangent=Standard_False;
+ MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
+ return(Standard_False);
+ }
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
DIS = TUTU * TVTV - TUTV * TUTV;
+ if(fabs(DIS)<Precision::Angular()) {
+ MyIsTangent=Standard_False;
+ MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
+ return(Standard_False);
+ }
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
-#ifdef DEB
- Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-#else
this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
-#endif
P=MyPnt;
}
+
+//=======================================================================
+//function : SeekPoint
+//purpose : Computes point on curve and
+// parameters on the surfaces.
+//=======================================================================
+Standard_Boolean ApproxInt_PrmPrmSvSurfaces::SeekPoint(const Standard_Real u1,
+ const Standard_Real v1,
+ const Standard_Real u2,
+ const Standard_Real v2,
+ IntSurf_PntOn2S& Point)
+{
+ gp_Pnt aP;
+ gp_Vec aT;
+ gp_Vec2d aTS1,aTS2;
+ Standard_Real tu1=u1;
+ Standard_Real tu2=u2;
+ Standard_Real tv1=v1;
+ Standard_Real tv2=v2;
+ if (!Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2))
+ return Standard_False;
+
+ Point.SetValue(aP, tu1,tv1,tu2,tv2);
+ return Standard_True;
+}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Tangency(const Standard_Real u1,
const Standard_Real v1,