From: azv Date: Mon, 2 Nov 2015 09:03:23 +0000 (+0300) Subject: 0026255: Adaptor3d_OffsetCurve is misleading X-Git-Tag: V7_0_0_beta~134 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=5201d3e66cb30a87ed0ffcb3dc500076b3b3233f;p=occt-copy.git 0026255: Adaptor3d_OffsetCurve is misleading 1. Rename Adaptor3d_OffsetCurve to Adaptor2d_OffsetCurve and relative classes 2. Remove redundant class Geom2dGcc_CurveToolGeo --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 755ad03ba0..a140de8c88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,6 +239,7 @@ endif() OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS) if (NOT DEFINED ANDROID AND CAN_USE_GL2PS) +message(STATUS "USE_GL2PS = $ENV{USE_GL2PS} or ${USE_GL2PS}") set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}") if (USE_GL2PS) diff --git a/src/Adaptor2d/Adaptor2d_HOffsetCurve.hxx b/src/Adaptor2d/Adaptor2d_HOffsetCurve.hxx new file mode 100644 index 0000000000..e613cb8740 --- /dev/null +++ b/src/Adaptor2d/Adaptor2d_HOffsetCurve.hxx @@ -0,0 +1,93 @@ +// Created on: 1992-10-08 +// Created by: Isabelle GRIGNON +// Copyright (c) 1992-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. + +#ifndef _Adaptor2d_HOffsetCurve_HeaderFile +#define _Adaptor2d_HOffsetCurve_HeaderFile + +#include +#include + +#include +#include +class Standard_OutOfRange; +class Standard_NoSuchObject; +class Standard_DomainError; +class Adaptor2d_OffsetCurve; +class Adaptor2d_Curve2d; + + +class Adaptor2d_HOffsetCurve; +DEFINE_STANDARD_HANDLE(Adaptor2d_HOffsetCurve, Adaptor2d_HCurve2d) + + +class Adaptor2d_HOffsetCurve : public Adaptor2d_HCurve2d +{ + +public: + + + //! Creates an empty GenHCurve2d. + Standard_EXPORT Adaptor2d_HOffsetCurve(); + + //! Creates a GenHCurve2d from a Curve + Standard_EXPORT Adaptor2d_HOffsetCurve(const Adaptor2d_OffsetCurve& C); + + //! Sets the field of the GenHCurve2d. + Standard_EXPORT void Set (const Adaptor2d_OffsetCurve& C); + + //! Returns the curve used to create the GenHCurve2d. + //! This is redefined from HCurve2d, cannot be inline. + Standard_EXPORT const Adaptor2d_Curve2d& Curve2d() const; + + //! Returns the curve used to create the GenHCurve. + Adaptor2d_OffsetCurve& ChangeCurve2d(); + + + + + DEFINE_STANDARD_RTTI(Adaptor2d_HOffsetCurve,Adaptor2d_HCurve2d) + +protected: + + + Adaptor2d_OffsetCurve myCurve; + + +private: + + + + +}; + +#define TheCurve Adaptor2d_OffsetCurve +#define TheCurve_hxx +#define Adaptor2d_GenHCurve2d Adaptor2d_HOffsetCurve +#define Adaptor2d_GenHCurve2d_hxx +#define Handle_Adaptor2d_GenHCurve2d Handle(Adaptor2d_HOffsetCurve) + +#include + +#undef TheCurve +#undef TheCurve_hxx +#undef Adaptor2d_GenHCurve2d +#undef Adaptor2d_GenHCurve2d_hxx +#undef Handle_Adaptor2d_GenHCurve2d + + + + +#endif // _Adaptor2d_HOffsetCurve_HeaderFile diff --git a/src/Adaptor2d/Adaptor2d_HOffsetCurve_0.cxx b/src/Adaptor2d/Adaptor2d_HOffsetCurve_0.cxx new file mode 100644 index 0000000000..47a5b1a984 --- /dev/null +++ b/src/Adaptor2d/Adaptor2d_HOffsetCurve_0.cxx @@ -0,0 +1,42 @@ +// Created on: 1992-10-08 +// Created by: Isabelle GRIGNON +// Copyright (c) 1992-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. + +#include + +#include + +#include +#include +#include +#include +#include + + + + + + + + + + +#define TheCurve Adaptor2d_OffsetCurve +#define TheCurve_hxx +#define Adaptor2d_GenHCurve2d Adaptor2d_HOffsetCurve +#define Adaptor2d_GenHCurve2d_hxx +#define Handle_Adaptor2d_GenHCurve2d Handle(Adaptor2d_HOffsetCurve) +#include + diff --git a/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx b/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx new file mode 100644 index 0000000000..fc18a6d633 --- /dev/null +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx @@ -0,0 +1,669 @@ +// 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. + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : Adaptor2d_OffsetCurve +//purpose : +//======================================================================= +Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve() +: myOffset(0.0), + myFirst (0.0), + myLast (0.0) +{ +} + +//======================================================================= +//function : Adaptor2d_OffsetCurve +//purpose : +//======================================================================= + +Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& theCurve) +: myCurve (theCurve), + myOffset(0.0), + myFirst (0.0), + myLast (0.0) +{ +} + +//======================================================================= +//function : Adaptor2d_OffsetCurve +//purpose : +//======================================================================= + +Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve + (const Handle(Adaptor2d_HCurve2d)& theCurve, const Standard_Real theOffset) +: myCurve (theCurve), + myOffset(theOffset), + myFirst (theCurve->FirstParameter()), + myLast (theCurve->LastParameter()) +{ +} + +//======================================================================= +//function : Adaptor2d_OffsetCurve +//purpose : +//======================================================================= + +Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve( + const Handle(Adaptor2d_HCurve2d)& theCurve, + const Standard_Real theOffset, + const Standard_Real theWFirst, + const Standard_Real theWLast ) +: myCurve (theCurve), + myOffset(theOffset), + myFirst (theWFirst), + myLast (theWLast) +{ +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::Load(const Handle(Adaptor2d_HCurve2d)& C ) +{ + myCurve = C; + myOffset = 0.; +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::Load( const Standard_Real Offset) +{ + myOffset = Offset; + myFirst = myCurve->FirstParameter(); + myLast = myCurve->LastParameter(); + +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::Load(const Standard_Real Offset, + const Standard_Real WFirst, + const Standard_Real WLast) +{ + myOffset = Offset; + myFirst = WFirst; + myLast = WLast; +} + +//======================================================================= +//function : Continuity +//purpose : +//======================================================================= + +GeomAbs_Shape Adaptor2d_OffsetCurve::Continuity() const +{ + switch (myCurve->Continuity()) { + case GeomAbs_CN: return GeomAbs_CN; + case GeomAbs_C3: return GeomAbs_C2; + case GeomAbs_C2: return GeomAbs_G2; + case GeomAbs_G2: return GeomAbs_C1; + case GeomAbs_C1: return GeomAbs_G1; + case GeomAbs_G1: return GeomAbs_C0; + case GeomAbs_C0: +// No Continuity !! + Standard_TypeMismatch::Raise("Adaptor2d_OffsetCurve::IntervalContinuity"); + break; + } + + //portage WNT + return GeomAbs_C0; +} + +//======================================================================= +//function : NbIntervals +//purpose : +//======================================================================= + +Standard_Integer Adaptor2d_OffsetCurve::NbIntervals(const GeomAbs_Shape S) const +{ + GeomAbs_Shape Sh; + if ( S >= GeomAbs_C2) Sh = GeomAbs_CN; + else + Sh = (GeomAbs_Shape)((Standard_Integer)S + 2); + + Standard_Integer nbInter = myCurve->NbIntervals(Sh); + + if(nbInter == 1) return nbInter; + + TColStd_Array1OfReal T(1,nbInter+1); + + myCurve->Intervals(T,Sh); + + Standard_Integer first = 1; + while (T(first) <= myFirst) first++; + Standard_Integer last = nbInter+1; + while (T(last) >= myLast) last--; + return (last - first + 2); +} + +//======================================================================= +//function : Intervals +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::Intervals(TColStd_Array1OfReal& TI, + const GeomAbs_Shape S) const +{ + GeomAbs_Shape Sh; + if ( S >= GeomAbs_C2) Sh = GeomAbs_CN; + else + Sh = (GeomAbs_Shape)((Standard_Integer)S + 2); + + Standard_Integer nbInter = myCurve->NbIntervals(Sh); + + + if(nbInter == 1) { + TI(TI.Lower()) = myFirst ; + TI(TI.Lower() + 1) = myLast ; + return; + } + + TColStd_Array1OfReal T(1,nbInter+1); + myCurve->Intervals(T,Sh); + + Standard_Integer first = 1; + while (T(first) <= myFirst) first++; + Standard_Integer last = nbInter+1; + while (T(last) >= myLast) last--; + + Standard_Integer i = TI.Lower(), j; + for (j = first-1; j <= last+1; j++) { + TI(i) = T(j); + i++; + } + + TI(TI.Lower()) = myFirst ; + TI(TI.Lower() + last-first + 2) = myLast ; + +} + + +//======================================================================= +//function : Trim +//purpose : +//======================================================================= + +Handle(Adaptor2d_HCurve2d) Adaptor2d_OffsetCurve::Trim +(const Standard_Real First, + const Standard_Real Last, + const Standard_Real) const +{ + Handle(Adaptor2d_HOffsetCurve) HO = new Adaptor2d_HOffsetCurve(*this); + HO->ChangeCurve2d().Load(myOffset,First,Last); + return HO; +} + + +//======================================================================= +//function : IsClosed +//purpose : +//======================================================================= + +Standard_Boolean Adaptor2d_OffsetCurve::IsClosed() const +{ + if ( myOffset == 0.) { + return myCurve->IsClosed(); + } + else { + if (myCurve->Continuity() == GeomAbs_C0) + return Standard_False; + else { + if ( myCurve->IsClosed()) { + gp_Vec2d Dummy[2]; + gp_Pnt2d P; + myCurve->D1 + (myCurve->FirstParameter(),P,Dummy[0]); + myCurve->D1 + (myCurve->LastParameter(),P,Dummy[1]); + if (Dummy[0].IsParallel(Dummy[1],Precision::Angular()) && + !(Dummy[0].IsOpposite(Dummy[1],Precision::Angular()))) + return Standard_True; + else + return Standard_False; + } + else + return Standard_False; + } + } +} + +//======================================================================= +//function : IsPeriodic +//purpose : +//======================================================================= + +Standard_Boolean Adaptor2d_OffsetCurve::IsPeriodic() const +{ + return myCurve->IsPeriodic(); +} + +//======================================================================= +//function : Period +//purpose : +//======================================================================= + +Standard_Real Adaptor2d_OffsetCurve::Period() const +{ + return myCurve->Period(); +} + +//======================================================================= +//function : Value +//purpose : +//======================================================================= + +gp_Pnt2d Adaptor2d_OffsetCurve::Value(const Standard_Real U) const +{ + if ( myOffset != 0.) { + gp_Pnt2d P; + gp_Vec2d V; + Standard_Real Norme; + myCurve->D1(U, P, V); + Norme = V.Magnitude(); + V.SetCoord(-V.Y(),V.X()); + if (Norme >= gp::Resolution()) { + return gp_Pnt2d(P.XY()+myOffset*V.XY()/Norme); + } + else { + gp_VectorWithNullMagnitude::Raise("Adaptor2d_OffsetCurve::Value"); + return gp_Pnt2d(); + } + } + else { + return myCurve->Value(U); + } +} + +//======================================================================= +//function : D0 +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::D0(const Standard_Real U, gp_Pnt2d& P) const +{ + P = Value( U); +} + +//======================================================================= +//function : D1 +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::D1 + (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const +{ + gp_Vec2d V1,V2,V3; + gp_Pnt2d PP; + Standard_Real Norme; + if ( myOffset != 0. ) { + myCurve->D2(U,PP,V1,V2); + Norme = V1.Magnitude(); + V3.SetCoord( -V1.Y(),V1.X()); + V2.SetCoord( -V2.Y(),V2.X()); + if ( Norme >= gp::Resolution()) { + P = gp_Pnt2d( PP.XY()+myOffset*V3.XY()/Norme); + V = gp_Vec2d( V1.XY()+ + (myOffset/Norme)*(V2.XY()-V3.XY()* + (V2.XY()*V3.XY())/(Norme*Norme))); + } + else { + gp_VectorWithNullMagnitude::Raise("Adaptor2d_OffsetCurve::D1"); + } + } + else { + myCurve->D1(U,P,V); + } +} + +//======================================================================= +//function : D2 +//purpose : +//======================================================================= + +void Adaptor2d_OffsetCurve::D2 + (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const +{ + if ( myOffset != 0.) { + gp_Vec2d T1,T2,T3; + gp_Pnt2d PP; + Standard_Real Norme; + myCurve->D3(U,PP,T1,T2,T3); + + Norme = T1.Magnitude(); + if ( Norme >= gp::Resolution()) { + gp_Vec2d N1,N2,N3; // Ni = Z ^ Ti + N1.SetCoord( -T1.Y(), T1.X()); + N2.SetCoord( -T2.Y(), T2.X()); + N3.SetCoord( -T3.Y(), T3.X()); + Standard_Real d12,d13,d22,Nor3,Nor11; + d12 = T1*T2; + d22 = T2*T2; + d13 = T1*T3; + Nor3 = Norme*Norme*Norme; + Nor11 = Nor3*Nor3*Nor3*Norme*Norme; + V2 = gp_Vec2d( -1 * ( (d22+d13)/Nor3 + 3*d12*d12/Nor11) * N1.XY()); + V2 = gp_Vec2d( V2.XY() - (2*d12/Nor3)*N2.XY() + N3.XY()/Norme); + V2 = gp_Vec2d( myOffset*V2.XY() + T2.XY()); + + D1( U,P,V1); + } + else { + gp_VectorWithNullMagnitude::Raise("Adaptor2d_OffsetCurve::D2"); + } + } + else { + myCurve->D2(U,P,V1,V2); + } +} + +//======================================================================= +//function : D3 +//purpose : +//======================================================================= + +//void Adaptor2d_OffsetCurve::D3 +// (const Standard_Real T, +// gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const +void Adaptor2d_OffsetCurve::D3 + (const Standard_Real , + gp_Pnt2d& , gp_Vec2d& , gp_Vec2d& , gp_Vec2d& ) const +{ + Standard_NotImplemented::Raise("Adaptor2d_OffsetCurve::D3"); +} + +//======================================================================= +//function : DN +//purpose : +//======================================================================= + +gp_Vec2d Adaptor2d_OffsetCurve::DN +// (const Standard_Real T, const Standard_Integer N) const + (const Standard_Real , const Standard_Integer ) const +{ + Standard_NotImplemented::Raise("Adaptor2d_OffsetCurve::DN"); + return gp_Vec2d(); +} + + +//======================================================================= +//function : Resolution +//purpose : +//======================================================================= + +Standard_Real Adaptor2d_OffsetCurve::Resolution(const Standard_Real R3d) const +{ + return Precision::PConfusion(R3d); +} + + +//======================================================================= +//function : GetType +//purpose : +//======================================================================= + +GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const { + + if ( myOffset == 0.) { + return myCurve->GetType(); + } + else { + switch (myCurve->GetType()) { + + case GeomAbs_Line: + return GeomAbs_Line; + + case GeomAbs_Circle: + return GeomAbs_Circle; + + default: + return GeomAbs_OtherCurve; + + } + } +} + +//======================================================================= +//function : Line +//purpose : +//======================================================================= + +gp_Lin2d Adaptor2d_OffsetCurve::Line() const +{ + if ( GetType() == GeomAbs_Line) { + gp_Pnt2d P; + gp_Vec2d V; + D1(0,P,V); + return gp_Lin2d(P,V); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::Line"); + return gp_Lin2d(); + } +} + + +//======================================================================= +//function : Circle +//purpose : +//======================================================================= + +gp_Circ2d Adaptor2d_OffsetCurve::Circle() const +{ + if ( GetType() == GeomAbs_Circle) { + if (myOffset == 0.) { + return myCurve->Circle(); + } + else { + gp_Circ2d C1( myCurve->Circle()); + Standard_Real radius = C1.Radius(); + gp_Ax22d axes( C1.Axis()); + gp_Dir2d Xd = axes.XDirection(); + gp_Dir2d Yd = axes.YDirection(); + Standard_Real Crossed = Xd.X()*Yd.Y()-Xd.Y()*Yd.X(); + Standard_Real Signe = ( Crossed > 0.) ? 1. : -1.; + + radius += Signe*myOffset; + if ( radius > 0.) { + return gp_Circ2d( axes,radius); + } + else if ( radius < 0.) { + radius = - radius; + axes.SetXDirection( (axes.XDirection()).Reversed()); + return gp_Circ2d( axes,radius); + } + else { // Cercle de rayon Nul + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::Circle"); + } + } + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::Circle"); + } + // portage WNT + return gp_Circ2d(); +} + +//======================================================================= +//function : Ellipse +//purpose : +//======================================================================= + +gp_Elips2d Adaptor2d_OffsetCurve::Ellipse() const +{ + if (myCurve->GetType() == GeomAbs_Ellipse && myOffset == 0.) { + return myCurve->Ellipse();; + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve:Ellipse"); + } + // portage WNT + return gp_Elips2d(); +} + +//======================================================================= +//function : Hyperbola +//purpose : +//======================================================================= + +gp_Hypr2d Adaptor2d_OffsetCurve::Hyperbola() const +{ + if (myCurve->GetType()==GeomAbs_Hyperbola && myOffset==0.) { + return myCurve->Hyperbola(); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve:Hyperbola"); + } + // portage WNT + return gp_Hypr2d(); +} + +//======================================================================= +//function : Parabola +//purpose : +//======================================================================= + +gp_Parab2d Adaptor2d_OffsetCurve::Parabola() const +{ + if (myCurve->GetType() == GeomAbs_Parabola && myOffset == 0.) { + return myCurve->Parabola(); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve:Parabola"); + } + // portage WNT + return gp_Parab2d(); +} +//======================================================================= +//function : Degree +//purpose : +//======================================================================= + +Standard_Integer Adaptor2d_OffsetCurve::Degree() const +{ + GeomAbs_CurveType type = myCurve->GetType(); + if ( (type==GeomAbs_BezierCurve || type==GeomAbs_BSplineCurve) + && myOffset == 0.) { + return myCurve->Degree(); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::Degree"); + return 0; + } +} +//======================================================================= +//function : IsRational +//purpose : +//======================================================================= + +Standard_Boolean Adaptor2d_OffsetCurve::IsRational() const +{ + if ( myOffset == 0.) { + return myCurve->IsRational(); + } + return Standard_False; +} +//======================================================================= +//function : NbPoles +//purpose : +//======================================================================= + +Standard_Integer Adaptor2d_OffsetCurve::NbPoles() const +{ + GeomAbs_CurveType type = myCurve->GetType(); + if ( (type==GeomAbs_BezierCurve || type==GeomAbs_BSplineCurve) + && myOffset == 0.) { + return myCurve->NbPoles(); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::NbPoles"); + return 0; + } +} + +//======================================================================= +//function : NbKnots +//purpose : +//======================================================================= + +Standard_Integer Adaptor2d_OffsetCurve::NbKnots() const +{ + if( myOffset == 0.) { + return myCurve->NbKnots(); + } + else { + Standard_NoSuchObject::Raise("Adaptor2d_OffsetCurve::NbKnots"); + return 0; + } +} + +//======================================================================= +//function : Bezier +//purpose : +//======================================================================= + +Handle(Geom2d_BezierCurve) Adaptor2d_OffsetCurve::Bezier() const +{ + Standard_NoSuchObject_Raise_if + ( myOffset != 0.0e0 || GetType() != GeomAbs_BezierCurve, ""); + return myCurve->Bezier(); +} + + +//======================================================================= +//function : BSpline +//purpose : +//======================================================================= + +Handle(Geom2d_BSplineCurve) Adaptor2d_OffsetCurve::BSpline() const +{ + Standard_NoSuchObject_Raise_if + ( myOffset != 0.0e0 || GetType() != GeomAbs_BSplineCurve, ""); + + return myCurve->BSpline(); +} + + diff --git a/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx b/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx new file mode 100644 index 0000000000..b1b1c356f3 --- /dev/null +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx @@ -0,0 +1,205 @@ +// Created on: 1993-04-15 +// Created by: Bruno DUMORTIER +// 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. + +#ifndef _Adaptor2d_OffsetCurve_HeaderFile +#define _Adaptor2d_OffsetCurve_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +class Adaptor2d_HCurve2d; +class Standard_NoSuchObject; +class Standard_DomainError; +class Standard_OutOfRange; +class Standard_TypeMismatch; +class gp_Pnt2d; +class gp_Vec2d; +class gp_Lin2d; +class gp_Circ2d; +class gp_Elips2d; +class gp_Hypr2d; +class gp_Parab2d; +class Geom2d_BezierCurve; +class Geom2d_BSplineCurve; + + +//! Defines an Offset curve (algorithmic 2d curve). +class Adaptor2d_OffsetCurve : public Adaptor2d_Curve2d +{ +public: + + DEFINE_STANDARD_ALLOC + + + //! The Offset is set to 0. + Standard_EXPORT Adaptor2d_OffsetCurve(); + + //! The curve is loaded. The Offset is set to 0. + Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C); + + //! Creates an OffsetCurve curve. + //! The Offset is set to Offset. + Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset); + + //! Create an Offset curve. + //! WFirst,WLast define the bounds of the Offset curve. + Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast); + + //! Changes the curve. The Offset is reset to 0. + Standard_EXPORT void Load (const Handle(Adaptor2d_HCurve2d)& S); + + //! Changes the Offset on the current Curve. + Standard_EXPORT void Load (const Standard_Real Offset); + + //! Changes the Offset Curve on the current Curve. + Standard_EXPORT void Load (const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast); + + const Handle(Adaptor2d_HCurve2d)& Curve() const; + + Standard_Real Offset() const; + + Standard_Real FirstParameter() const Standard_OVERRIDE; + + Standard_Real LastParameter() const Standard_OVERRIDE; + + Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + + //! If necessary, breaks the curve in intervals of + //! continuity . And returns the number of + //! intervals. + Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Stores in the parameters bounding the intervals + //! of continuity . + //! + //! The array must provide enough room to accomodate + //! for the parameters. i.e. T.Length() > NbIntervals() + Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Returns a curve equivalent of between + //! parameters and . is used to + //! test for 3d points confusion. + //! If >= + Standard_EXPORT Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; + + //! Computes the point of parameter U on the curve. + Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const Standard_OVERRIDE; + + //! Computes the point of parameter U on the curve. + Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; + + //! Computes the point of parameter U on the curve with its + //! first derivative. + //! Raised if the continuity of the current interval + //! is not C1. + Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE; + + + //! Returns the point P of parameter U, the first and second + //! derivatives V1 and V2. + //! Raised if the continuity of the current interval + //! is not C2. + Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; + + + //! Returns the point P of parameter U, the first, the second + //! and the third derivative. + //! Raised if the continuity of the current interval + //! is not C3. + Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; + + + //! The returned vector gives the value of the derivative for the + //! order of derivation N. + //! Raised if the continuity of the current interval + //! is not CN. + //! Raised if N < 1. + Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; + + //! Returns the parametric resolution corresponding + //! to the real space resolution . + Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE; + + //! Returns the type of the curve in the current + //! interval : Line, Circle, Ellipse, Hyperbola, + //! Parabola, BezierCurve, BSplineCurve, OtherCurve. + Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + + Standard_EXPORT gp_Lin2d Line() const Standard_OVERRIDE; + + Standard_EXPORT gp_Circ2d Circle() const Standard_OVERRIDE; + + Standard_EXPORT gp_Elips2d Ellipse() const Standard_OVERRIDE; + + Standard_EXPORT gp_Hypr2d Hyperbola() const Standard_OVERRIDE; + + Standard_EXPORT gp_Parab2d Parabola() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + + Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const Standard_OVERRIDE; + + Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE; + + + + +protected: + + + + + +private: + + + + Handle(Adaptor2d_HCurve2d) myCurve; + Standard_Real myOffset; + Standard_Real myFirst; + Standard_Real myLast; + + +}; + + +#include + + + + + +#endif // _Adaptor2d_OffsetCurve_HeaderFile diff --git a/src/Adaptor2d/Adaptor2d_OffsetCurve.lxx b/src/Adaptor2d/Adaptor2d_OffsetCurve.lxx new file mode 100644 index 0000000000..d088c4bfad --- /dev/null +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.lxx @@ -0,0 +1,54 @@ +// 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. + +//======================================================================= +//function : Curve +//purpose : +//======================================================================= + +inline const Handle(Adaptor2d_HCurve2d)& Adaptor2d_OffsetCurve::Curve() const +{ + return myCurve; +} + + +//======================================================================= +//function : Offset +//purpose : +//======================================================================= + +inline Standard_Real Adaptor2d_OffsetCurve::Offset() const +{ + return myOffset; +} + + +//======================================================================= +//function : FirstParameter +//purpose : +//======================================================================= + +inline Standard_Real Adaptor2d_OffsetCurve::FirstParameter() const +{ + return myFirst; +} + +//======================================================================= +//function : LastParameter +//purpose : +//======================================================================= + +inline Standard_Real Adaptor2d_OffsetCurve::LastParameter() const +{ + return myLast; +} diff --git a/src/Adaptor2d/FILES b/src/Adaptor2d/FILES index 842fa8a602..c202b55999 100644 --- a/src/Adaptor2d/FILES +++ b/src/Adaptor2d/FILES @@ -8,5 +8,10 @@ Adaptor2d_HCurve2d.hxx Adaptor2d_HCurve2d.lxx Adaptor2d_HLine2d.hxx Adaptor2d_HLine2d_0.cxx +Adaptor2d_HOffsetCurve.hxx +Adaptor2d_HOffsetCurve_0.cxx Adaptor2d_Line2d.cxx Adaptor2d_Line2d.hxx +Adaptor2d_OffsetCurve.cxx +Adaptor2d_OffsetCurve.hxx +Adaptor2d_OffsetCurve.lxx diff --git a/src/Adaptor3d/Adaptor3d_HOffsetCurve.hxx b/src/Adaptor3d/Adaptor3d_HOffsetCurve.hxx deleted file mode 100644 index 210f893938..0000000000 --- a/src/Adaptor3d/Adaptor3d_HOffsetCurve.hxx +++ /dev/null @@ -1,93 +0,0 @@ -// Created on: 1992-10-08 -// Created by: Isabelle GRIGNON -// Copyright (c) 1992-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. - -#ifndef _Adaptor3d_HOffsetCurve_HeaderFile -#define _Adaptor3d_HOffsetCurve_HeaderFile - -#include -#include - -#include -#include -class Standard_OutOfRange; -class Standard_NoSuchObject; -class Standard_DomainError; -class Adaptor3d_OffsetCurve; -class Adaptor2d_Curve2d; - - -class Adaptor3d_HOffsetCurve; -DEFINE_STANDARD_HANDLE(Adaptor3d_HOffsetCurve, Adaptor2d_HCurve2d) - - -class Adaptor3d_HOffsetCurve : public Adaptor2d_HCurve2d -{ - -public: - - - //! Creates an empty GenHCurve2d. - Standard_EXPORT Adaptor3d_HOffsetCurve(); - - //! Creates a GenHCurve2d from a Curve - Standard_EXPORT Adaptor3d_HOffsetCurve(const Adaptor3d_OffsetCurve& C); - - //! Sets the field of the GenHCurve2d. - Standard_EXPORT void Set (const Adaptor3d_OffsetCurve& C); - - //! Returns the curve used to create the GenHCurve2d. - //! This is redefined from HCurve2d, cannot be inline. - Standard_EXPORT const Adaptor2d_Curve2d& Curve2d() const; - - //! Returns the curve used to create the GenHCurve. - Adaptor3d_OffsetCurve& ChangeCurve2d(); - - - - - DEFINE_STANDARD_RTTI(Adaptor3d_HOffsetCurve,Adaptor2d_HCurve2d) - -protected: - - - Adaptor3d_OffsetCurve myCurve; - - -private: - - - - -}; - -#define TheCurve Adaptor3d_OffsetCurve -#define TheCurve_hxx -#define Adaptor2d_GenHCurve2d Adaptor3d_HOffsetCurve -#define Adaptor2d_GenHCurve2d_hxx -#define Handle_Adaptor2d_GenHCurve2d Handle(Adaptor3d_HOffsetCurve) - -#include - -#undef TheCurve -#undef TheCurve_hxx -#undef Adaptor2d_GenHCurve2d -#undef Adaptor2d_GenHCurve2d_hxx -#undef Handle_Adaptor2d_GenHCurve2d - - - - -#endif // _Adaptor3d_HOffsetCurve_HeaderFile diff --git a/src/Adaptor3d/Adaptor3d_HOffsetCurve_0.cxx b/src/Adaptor3d/Adaptor3d_HOffsetCurve_0.cxx deleted file mode 100644 index 2c05465472..0000000000 --- a/src/Adaptor3d/Adaptor3d_HOffsetCurve_0.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Created on: 1992-10-08 -// Created by: Isabelle GRIGNON -// Copyright (c) 1992-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. - -#include - -#include - -#include -#include -#include -#include -#include - - - - - - - - - - -#define TheCurve Adaptor3d_OffsetCurve -#define TheCurve_hxx -#define Adaptor2d_GenHCurve2d Adaptor3d_HOffsetCurve -#define Adaptor2d_GenHCurve2d_hxx -#define Handle_Adaptor2d_GenHCurve2d Handle(Adaptor3d_HOffsetCurve) -#include - diff --git a/src/Adaptor3d/Adaptor3d_OffsetCurve.cxx b/src/Adaptor3d/Adaptor3d_OffsetCurve.cxx deleted file mode 100644 index 93b88ba7e5..0000000000 --- a/src/Adaptor3d/Adaptor3d_OffsetCurve.cxx +++ /dev/null @@ -1,669 +0,0 @@ -// 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. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : Adaptor3d_OffsetCurve -//purpose : -//======================================================================= -Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve() -: myOffset(0.0), - myFirst (0.0), - myLast (0.0) -{ -} - -//======================================================================= -//function : Adaptor3d_OffsetCurve -//purpose : -//======================================================================= - -Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& theCurve) -: myCurve (theCurve), - myOffset(0.0), - myFirst (0.0), - myLast (0.0) -{ -} - -//======================================================================= -//function : Adaptor3d_OffsetCurve -//purpose : -//======================================================================= - -Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve - (const Handle(Adaptor2d_HCurve2d)& theCurve, const Standard_Real theOffset) -: myCurve (theCurve), - myOffset(theOffset), - myFirst (theCurve->FirstParameter()), - myLast (theCurve->LastParameter()) -{ -} - -//======================================================================= -//function : Adaptor3d_OffsetCurve -//purpose : -//======================================================================= - -Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve( - const Handle(Adaptor2d_HCurve2d)& theCurve, - const Standard_Real theOffset, - const Standard_Real theWFirst, - const Standard_Real theWLast ) -: myCurve (theCurve), - myOffset(theOffset), - myFirst (theWFirst), - myLast (theWLast) -{ -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::Load(const Handle(Adaptor2d_HCurve2d)& C ) -{ - myCurve = C; - myOffset = 0.; -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::Load( const Standard_Real Offset) -{ - myOffset = Offset; - myFirst = myCurve->FirstParameter(); - myLast = myCurve->LastParameter(); - -} - -//======================================================================= -//function : Load -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::Load(const Standard_Real Offset, - const Standard_Real WFirst, - const Standard_Real WLast) -{ - myOffset = Offset; - myFirst = WFirst; - myLast = WLast; -} - -//======================================================================= -//function : Continuity -//purpose : -//======================================================================= - -GeomAbs_Shape Adaptor3d_OffsetCurve::Continuity() const -{ - switch (myCurve->Continuity()) { - case GeomAbs_CN: return GeomAbs_CN; - case GeomAbs_C3: return GeomAbs_C2; - case GeomAbs_C2: return GeomAbs_G2; - case GeomAbs_G2: return GeomAbs_C1; - case GeomAbs_C1: return GeomAbs_G1; - case GeomAbs_G1: return GeomAbs_C0; - case GeomAbs_C0: -// No Continuity !! - Standard_TypeMismatch::Raise("Adaptor3d_OffsetCurve::IntervalContinuity"); - break; - } - - //portage WNT - return GeomAbs_C0; -} - -//======================================================================= -//function : NbIntervals -//purpose : -//======================================================================= - -Standard_Integer Adaptor3d_OffsetCurve::NbIntervals(const GeomAbs_Shape S) const -{ - GeomAbs_Shape Sh; - if ( S >= GeomAbs_C2) Sh = GeomAbs_CN; - else - Sh = (GeomAbs_Shape)((Standard_Integer)S + 2); - - Standard_Integer nbInter = myCurve->NbIntervals(Sh); - - if(nbInter == 1) return nbInter; - - TColStd_Array1OfReal T(1,nbInter+1); - - myCurve->Intervals(T,Sh); - - Standard_Integer first = 1; - while (T(first) <= myFirst) first++; - Standard_Integer last = nbInter+1; - while (T(last) >= myLast) last--; - return (last - first + 2); -} - -//======================================================================= -//function : Intervals -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::Intervals(TColStd_Array1OfReal& TI, - const GeomAbs_Shape S) const -{ - GeomAbs_Shape Sh; - if ( S >= GeomAbs_C2) Sh = GeomAbs_CN; - else - Sh = (GeomAbs_Shape)((Standard_Integer)S + 2); - - Standard_Integer nbInter = myCurve->NbIntervals(Sh); - - - if(nbInter == 1) { - TI(TI.Lower()) = myFirst ; - TI(TI.Lower() + 1) = myLast ; - return; - } - - TColStd_Array1OfReal T(1,nbInter+1); - myCurve->Intervals(T,Sh); - - Standard_Integer first = 1; - while (T(first) <= myFirst) first++; - Standard_Integer last = nbInter+1; - while (T(last) >= myLast) last--; - - Standard_Integer i = TI.Lower(), j; - for (j = first-1; j <= last+1; j++) { - TI(i) = T(j); - i++; - } - - TI(TI.Lower()) = myFirst ; - TI(TI.Lower() + last-first + 2) = myLast ; - -} - - -//======================================================================= -//function : Trim -//purpose : -//======================================================================= - -Handle(Adaptor2d_HCurve2d) Adaptor3d_OffsetCurve::Trim -(const Standard_Real First, - const Standard_Real Last, - const Standard_Real) const -{ - Handle(Adaptor3d_HOffsetCurve) HO = new Adaptor3d_HOffsetCurve(*this); - HO->ChangeCurve2d().Load(myOffset,First,Last); - return HO; -} - - -//======================================================================= -//function : IsClosed -//purpose : -//======================================================================= - -Standard_Boolean Adaptor3d_OffsetCurve::IsClosed() const -{ - if ( myOffset == 0.) { - return myCurve->IsClosed(); - } - else { - if (myCurve->Continuity() == GeomAbs_C0) - return Standard_False; - else { - if ( myCurve->IsClosed()) { - gp_Vec2d Dummy[2]; - gp_Pnt2d P; - myCurve->D1 - (myCurve->FirstParameter(),P,Dummy[0]); - myCurve->D1 - (myCurve->LastParameter(),P,Dummy[1]); - if (Dummy[0].IsParallel(Dummy[1],Precision::Angular()) && - !(Dummy[0].IsOpposite(Dummy[1],Precision::Angular()))) - return Standard_True; - else - return Standard_False; - } - else - return Standard_False; - } - } -} - -//======================================================================= -//function : IsPeriodic -//purpose : -//======================================================================= - -Standard_Boolean Adaptor3d_OffsetCurve::IsPeriodic() const -{ - return myCurve->IsPeriodic(); -} - -//======================================================================= -//function : Period -//purpose : -//======================================================================= - -Standard_Real Adaptor3d_OffsetCurve::Period() const -{ - return myCurve->Period(); -} - -//======================================================================= -//function : Value -//purpose : -//======================================================================= - -gp_Pnt2d Adaptor3d_OffsetCurve::Value(const Standard_Real U) const -{ - if ( myOffset != 0.) { - gp_Pnt2d P; - gp_Vec2d V; - Standard_Real Norme; - myCurve->D1(U, P, V); - Norme = V.Magnitude(); - V.SetCoord(-V.Y(),V.X()); - if (Norme >= gp::Resolution()) { - return gp_Pnt2d(P.XY()+myOffset*V.XY()/Norme); - } - else { - gp_VectorWithNullMagnitude::Raise("Adaptor3d_OffsetCurve::Value"); - return gp_Pnt2d(); - } - } - else { - return myCurve->Value(U); - } -} - -//======================================================================= -//function : D0 -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::D0(const Standard_Real U, gp_Pnt2d& P) const -{ - P = Value( U); -} - -//======================================================================= -//function : D1 -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::D1 - (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const -{ - gp_Vec2d V1,V2,V3; - gp_Pnt2d PP; - Standard_Real Norme; - if ( myOffset != 0. ) { - myCurve->D2(U,PP,V1,V2); - Norme = V1.Magnitude(); - V3.SetCoord( -V1.Y(),V1.X()); - V2.SetCoord( -V2.Y(),V2.X()); - if ( Norme >= gp::Resolution()) { - P = gp_Pnt2d( PP.XY()+myOffset*V3.XY()/Norme); - V = gp_Vec2d( V1.XY()+ - (myOffset/Norme)*(V2.XY()-V3.XY()* - (V2.XY()*V3.XY())/(Norme*Norme))); - } - else { - gp_VectorWithNullMagnitude::Raise("Adaptor3d_OffsetCurve::D1"); - } - } - else { - myCurve->D1(U,P,V); - } -} - -//======================================================================= -//function : D2 -//purpose : -//======================================================================= - -void Adaptor3d_OffsetCurve::D2 - (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const -{ - if ( myOffset != 0.) { - gp_Vec2d T1,T2,T3; - gp_Pnt2d PP; - Standard_Real Norme; - myCurve->D3(U,PP,T1,T2,T3); - - Norme = T1.Magnitude(); - if ( Norme >= gp::Resolution()) { - gp_Vec2d N1,N2,N3; // Ni = Z ^ Ti - N1.SetCoord( -T1.Y(), T1.X()); - N2.SetCoord( -T2.Y(), T2.X()); - N3.SetCoord( -T3.Y(), T3.X()); - Standard_Real d12,d13,d22,Nor3,Nor11; - d12 = T1*T2; - d22 = T2*T2; - d13 = T1*T3; - Nor3 = Norme*Norme*Norme; - Nor11 = Nor3*Nor3*Nor3*Norme*Norme; - V2 = gp_Vec2d( -1 * ( (d22+d13)/Nor3 + 3*d12*d12/Nor11) * N1.XY()); - V2 = gp_Vec2d( V2.XY() - (2*d12/Nor3)*N2.XY() + N3.XY()/Norme); - V2 = gp_Vec2d( myOffset*V2.XY() + T2.XY()); - - D1( U,P,V1); - } - else { - gp_VectorWithNullMagnitude::Raise("Adaptor3d_OffsetCurve::D2"); - } - } - else { - myCurve->D2(U,P,V1,V2); - } -} - -//======================================================================= -//function : D3 -//purpose : -//======================================================================= - -//void Adaptor3d_OffsetCurve::D3 -// (const Standard_Real T, -// gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const -void Adaptor3d_OffsetCurve::D3 - (const Standard_Real , - gp_Pnt2d& , gp_Vec2d& , gp_Vec2d& , gp_Vec2d& ) const -{ - Standard_NotImplemented::Raise("Adaptor3d_OffsetCurve::D3"); -} - -//======================================================================= -//function : DN -//purpose : -//======================================================================= - -gp_Vec2d Adaptor3d_OffsetCurve::DN -// (const Standard_Real T, const Standard_Integer N) const - (const Standard_Real , const Standard_Integer ) const -{ - Standard_NotImplemented::Raise("Adaptor3d_OffsetCurve::DN"); - return gp_Vec2d(); -} - - -//======================================================================= -//function : Resolution -//purpose : -//======================================================================= - -Standard_Real Adaptor3d_OffsetCurve::Resolution(const Standard_Real R3d) const -{ - return Precision::PConfusion(R3d); -} - - -//======================================================================= -//function : GetType -//purpose : -//======================================================================= - -GeomAbs_CurveType Adaptor3d_OffsetCurve::GetType() const { - - if ( myOffset == 0.) { - return myCurve->GetType(); - } - else { - switch (myCurve->GetType()) { - - case GeomAbs_Line: - return GeomAbs_Line; - - case GeomAbs_Circle: - return GeomAbs_Circle; - - default: - return GeomAbs_OtherCurve; - - } - } -} - -//======================================================================= -//function : Line -//purpose : -//======================================================================= - -gp_Lin2d Adaptor3d_OffsetCurve::Line() const -{ - if ( GetType() == GeomAbs_Line) { - gp_Pnt2d P; - gp_Vec2d V; - D1(0,P,V); - return gp_Lin2d(P,V); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve::Line"); - return gp_Lin2d(); - } -} - - -//======================================================================= -//function : Circle -//purpose : -//======================================================================= - -gp_Circ2d Adaptor3d_OffsetCurve::Circle() const -{ - if ( GetType() == GeomAbs_Circle) { - if (myOffset == 0.) { - return myCurve->Circle(); - } - else { - gp_Circ2d C1( myCurve->Circle()); - Standard_Real radius = C1.Radius(); - gp_Ax22d axes( C1.Axis()); - gp_Dir2d Xd = axes.XDirection(); - gp_Dir2d Yd = axes.YDirection(); - Standard_Real Crossed = Xd.X()*Yd.Y()-Xd.Y()*Yd.X(); - Standard_Real Signe = ( Crossed > 0.) ? 1. : -1.; - - radius += Signe*myOffset; - if ( radius > 0.) { - return gp_Circ2d( axes,radius); - } - else if ( radius < 0.) { - radius = - radius; - axes.SetXDirection( (axes.XDirection()).Reversed()); - return gp_Circ2d( axes,radius); - } - else { // Cercle de rayon Nul - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve::Circle"); - } - } - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve::Circle"); - } - // portage WNT - return gp_Circ2d(); -} - -//======================================================================= -//function : Ellipse -//purpose : -//======================================================================= - -gp_Elips2d Adaptor3d_OffsetCurve::Ellipse() const -{ - if (myCurve->GetType() == GeomAbs_Ellipse && myOffset == 0.) { - return myCurve->Ellipse();; - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve:Ellipse"); - } - // portage WNT - return gp_Elips2d(); -} - -//======================================================================= -//function : Hyperbola -//purpose : -//======================================================================= - -gp_Hypr2d Adaptor3d_OffsetCurve::Hyperbola() const -{ - if (myCurve->GetType()==GeomAbs_Hyperbola && myOffset==0.) { - return myCurve->Hyperbola(); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve:Hyperbola"); - } - // portage WNT - return gp_Hypr2d(); -} - -//======================================================================= -//function : Parabola -//purpose : -//======================================================================= - -gp_Parab2d Adaptor3d_OffsetCurve::Parabola() const -{ - if (myCurve->GetType() == GeomAbs_Parabola && myOffset == 0.) { - return myCurve->Parabola(); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve:Parabola"); - } - // portage WNT - return gp_Parab2d(); -} -//======================================================================= -//function : Degree -//purpose : -//======================================================================= - -Standard_Integer Adaptor3d_OffsetCurve::Degree() const -{ - GeomAbs_CurveType type = myCurve->GetType(); - if ( (type==GeomAbs_BezierCurve || type==GeomAbs_BSplineCurve) - && myOffset == 0.) { - return myCurve->Degree(); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_offsetCurve::Degree"); - return 0; - } -} -//======================================================================= -//function : IsRational -//purpose : -//======================================================================= - -Standard_Boolean Adaptor3d_OffsetCurve::IsRational() const -{ - if ( myOffset == 0.) { - return myCurve->IsRational(); - } - return Standard_False; -} -//======================================================================= -//function : NbPoles -//purpose : -//======================================================================= - -Standard_Integer Adaptor3d_OffsetCurve::NbPoles() const -{ - GeomAbs_CurveType type = myCurve->GetType(); - if ( (type==GeomAbs_BezierCurve || type==GeomAbs_BSplineCurve) - && myOffset == 0.) { - return myCurve->NbPoles(); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve::NbPoles"); - return 0; - } -} - -//======================================================================= -//function : NbKnots -//purpose : -//======================================================================= - -Standard_Integer Adaptor3d_OffsetCurve::NbKnots() const -{ - if( myOffset == 0.) { - return myCurve->NbKnots(); - } - else { - Standard_NoSuchObject::Raise("Adaptor3d_OffsetCurve::NbKnots"); - return 0; - } -} - -//======================================================================= -//function : Bezier -//purpose : -//======================================================================= - -Handle(Geom2d_BezierCurve) Adaptor3d_OffsetCurve::Bezier() const -{ - Standard_NoSuchObject_Raise_if - ( myOffset != 0.0e0 || GetType() != GeomAbs_BezierCurve, ""); - return myCurve->Bezier(); -} - - -//======================================================================= -//function : BSpline -//purpose : -//======================================================================= - -Handle(Geom2d_BSplineCurve) Adaptor3d_OffsetCurve::BSpline() const -{ - Standard_NoSuchObject_Raise_if - ( myOffset != 0.0e0 || GetType() != GeomAbs_BSplineCurve, ""); - - return myCurve->BSpline(); -} - - diff --git a/src/Adaptor3d/Adaptor3d_OffsetCurve.hxx b/src/Adaptor3d/Adaptor3d_OffsetCurve.hxx deleted file mode 100644 index 6b692cd402..0000000000 --- a/src/Adaptor3d/Adaptor3d_OffsetCurve.hxx +++ /dev/null @@ -1,205 +0,0 @@ -// Created on: 1993-04-15 -// Created by: Bruno DUMORTIER -// 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. - -#ifndef _Adaptor3d_OffsetCurve_HeaderFile -#define _Adaptor3d_OffsetCurve_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class Adaptor2d_HCurve2d; -class Standard_NoSuchObject; -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_TypeMismatch; -class gp_Pnt2d; -class gp_Vec2d; -class gp_Lin2d; -class gp_Circ2d; -class gp_Elips2d; -class gp_Hypr2d; -class gp_Parab2d; -class Geom2d_BezierCurve; -class Geom2d_BSplineCurve; - - -//! Defines an Offset curve (algorithmic 2d curve). -class Adaptor3d_OffsetCurve : public Adaptor2d_Curve2d -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! The Offset is set to 0. - Standard_EXPORT Adaptor3d_OffsetCurve(); - - //! The curve is loaded. The Offset is set to 0. - Standard_EXPORT Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C); - - //! Creates an OffsetCurve curve. - //! The Offset is set to Offset. - Standard_EXPORT Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset); - - //! Create an Offset curve. - //! WFirst,WLast define the bounds of the Offset curve. - Standard_EXPORT Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast); - - //! Changes the curve. The Offset is reset to 0. - Standard_EXPORT void Load (const Handle(Adaptor2d_HCurve2d)& S); - - //! Changes the Offset on the current Curve. - Standard_EXPORT void Load (const Standard_Real Offset); - - //! Changes the Offset Curve on the current Curve. - Standard_EXPORT void Load (const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast); - - const Handle(Adaptor2d_HCurve2d)& Curve() const; - - Standard_Real Offset() const; - - Standard_Real FirstParameter() const Standard_OVERRIDE; - - Standard_Real LastParameter() const Standard_OVERRIDE; - - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; - - //! If necessary, breaks the curve in intervals of - //! continuity . And returns the number of - //! intervals. - Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Stores in the parameters bounding the intervals - //! of continuity . - //! - //! The array must provide enough room to accomodate - //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Returns a curve equivalent of between - //! parameters and . is used to - //! test for 3d points confusion. - //! If >= - Standard_EXPORT Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve with its - //! first derivative. - //! Raised if the continuity of the current interval - //! is not C1. - Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE; - - - //! Returns the point P of parameter U, the first and second - //! derivatives V1 and V2. - //! Raised if the continuity of the current interval - //! is not C2. - Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; - - - //! Returns the point P of parameter U, the first, the second - //! and the third derivative. - //! Raised if the continuity of the current interval - //! is not C3. - Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; - - - //! The returned vector gives the value of the derivative for the - //! order of derivation N. - //! Raised if the continuity of the current interval - //! is not CN. - //! Raised if N < 1. - Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; - - //! Returns the parametric resolution corresponding - //! to the real space resolution . - Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE; - - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, - //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; - - Standard_EXPORT gp_Lin2d Line() const Standard_OVERRIDE; - - Standard_EXPORT gp_Circ2d Circle() const Standard_OVERRIDE; - - Standard_EXPORT gp_Elips2d Ellipse() const Standard_OVERRIDE; - - Standard_EXPORT gp_Hypr2d Hyperbola() const Standard_OVERRIDE; - - Standard_EXPORT gp_Parab2d Parabola() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; - - Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const Standard_OVERRIDE; - - Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE; - - - - -protected: - - - - - -private: - - - - Handle(Adaptor2d_HCurve2d) myCurve; - Standard_Real myOffset; - Standard_Real myFirst; - Standard_Real myLast; - - -}; - - -#include - - - - - -#endif // _Adaptor3d_OffsetCurve_HeaderFile diff --git a/src/Adaptor3d/Adaptor3d_OffsetCurve.lxx b/src/Adaptor3d/Adaptor3d_OffsetCurve.lxx deleted file mode 100644 index a975eac02b..0000000000 --- a/src/Adaptor3d/Adaptor3d_OffsetCurve.lxx +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -//======================================================================= -//function : Curve -//purpose : -//======================================================================= - -inline const Handle(Adaptor2d_HCurve2d)& Adaptor3d_OffsetCurve::Curve() const -{ - return myCurve; -} - - -//======================================================================= -//function : Offset -//purpose : -//======================================================================= - -inline Standard_Real Adaptor3d_OffsetCurve::Offset() const -{ - return myOffset; -} - - -//======================================================================= -//function : FirstParameter -//purpose : -//======================================================================= - -inline Standard_Real Adaptor3d_OffsetCurve::FirstParameter() const -{ - return myFirst; -} - -//======================================================================= -//function : LastParameter -//purpose : -//======================================================================= - -inline Standard_Real Adaptor3d_OffsetCurve::LastParameter() const -{ - return myLast; -} diff --git a/src/Adaptor3d/FILES b/src/Adaptor3d/FILES index 01b7dc9043..ed0771ffd9 100644 --- a/src/Adaptor3d/FILES +++ b/src/Adaptor3d/FILES @@ -15,8 +15,6 @@ Adaptor3d_HCurveOnSurface.hxx Adaptor3d_HCurveOnSurface_0.cxx Adaptor3d_HIsoCurve.hxx Adaptor3d_HIsoCurve_0.cxx -Adaptor3d_HOffsetCurve.hxx -Adaptor3d_HOffsetCurve_0.cxx Adaptor3d_HSurface.cxx Adaptor3d_HSurface.hxx Adaptor3d_HSurface.lxx @@ -34,9 +32,6 @@ Adaptor3d_InterFunc.hxx Adaptor3d_IsoCurve.cxx Adaptor3d_IsoCurve.hxx Adaptor3d_IsoCurve.lxx -Adaptor3d_OffsetCurve.cxx -Adaptor3d_OffsetCurve.hxx -Adaptor3d_OffsetCurve.lxx Adaptor3d_Surface.cxx Adaptor3d_Surface.hxx Adaptor3d_SurfaceOfLinearExtrusion.cxx diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx index 06a2b5b322..3e03686bd5 100644 --- a/src/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/BRepFill/BRepFill_OffsetWire.cxx @@ -17,7 +17,7 @@ // Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 #include -#include +#include #include #include #include @@ -269,7 +269,7 @@ static Standard_Boolean KPartCircle { if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1; - Adaptor3d_OffsetCurve Off(AHC,anOffset); + Adaptor2d_OffsetCurve Off(AHC,anOffset); OC = new Geom2d_Line(Off.Line()); } else if (AHC->GetType() == GeomAbs_Circle) @@ -2089,7 +2089,7 @@ void MakeOffset (const TopoDS_Edge& E, Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(G2d); - Adaptor3d_OffsetCurve Off(AHC,-anOffset); + Adaptor2d_OffsetCurve Off(AHC,-anOffset); Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle()); Standard_Real Delta = 2*M_PI - l + f; @@ -2124,7 +2124,7 @@ void MakeOffset (const TopoDS_Edge& E, else if (AC.GetType() == GeomAbs_Line) { Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(G2d); - Adaptor3d_OffsetCurve Off(AHC,anOffset); + Adaptor2d_OffsetCurve Off(AHC,anOffset); Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line()); Standard_Real Delta = (l - f); if (ToExtendFirstPar) diff --git a/src/Geom2dGcc/FILES b/src/Geom2dGcc/FILES index fcdb9874a0..6462c74c4f 100644 --- a/src/Geom2dGcc/FILES +++ b/src/Geom2dGcc/FILES @@ -24,8 +24,6 @@ Geom2dGcc_Circ2dTanOnRadGeo.cxx Geom2dGcc_Circ2dTanOnRadGeo.hxx Geom2dGcc_CurveTool.cxx Geom2dGcc_CurveTool.hxx -Geom2dGcc_CurveToolGeo.cxx -Geom2dGcc_CurveToolGeo.hxx Geom2dGcc_FunctionTanCirCu.cxx Geom2dGcc_FunctionTanCirCu.hxx Geom2dGcc_FunctionTanCuCu.cxx diff --git a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx index 3e9260fdef..bf0a226d61 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx @@ -24,7 +24,7 @@ // Courbes. + //========================================================================= -#include +#include #include #include #include @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -95,11 +94,11 @@ Geom2dGcc_Circ2d2TanOnGeo (const GccEnt_QualifiedCirc& Qualified1 , Geom2dInt_TheIntConicCurveOfGInter Intp; Standard_Integer nbsolution = Bis.NbSolutions(); Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve Cu2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(Cu2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(Cu2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(Cu2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(Cu2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve Cu2(HCu2,0.); + firstparam = Max(Cu2.FirstParameter(),thefirst); + lastparam = Min(Cu2.LastParameter(),thelast); + IntRes2d_Domain D2(Cu2.Value(firstparam), firstparam, Tol, + Cu2.Value(lastparam), lastparam, Tol); Standard_Real Tol1 = Abs(Tolerance); Standard_Real Tol2 = Tol1; for (Standard_Integer i = 1 ; i <= nbsolution; i++) { @@ -323,11 +322,11 @@ parcen3(1,8) Geom2dInt_TheIntConicCurveOfGInter Intp; Standard_Integer nbsolution = Bis.NbSolutions(); Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve C2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,0.); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); for (Standard_Integer i = 1 ; i <= nbsolution; i++) { Handle(GccInt_Bisec) Sol = Bis.ThisSolution(i); GccInt_IType type = Sol->ArcType(); @@ -501,11 +500,11 @@ parcen3(1,8) Geom2dInt_TheIntConicCurveOfGInter Intp; Standard_Integer nbsolution = Bis.NbSolutions(); Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve C2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,0.); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); IntRes2d_Domain D1; for (Standard_Integer i = 1 ; i <= nbsolution; i++) { Intp.Perform(Bis.ThisSolution(i),D1,C2,D2,Tol1,Tol2); @@ -649,11 +648,11 @@ parcen3(1,8) Geom2dInt_TheIntConicCurveOfGInter Intp; Standard_Integer nbsolution = Bis.NbSolutions(); Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve C2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,0.); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); for (Standard_Integer i = 1 ; i <= nbsolution; i++) { Handle(GccInt_Bisec) Sol = Bis.ThisSolution(i); GccInt_IType type = Sol->ArcType(); @@ -810,11 +809,11 @@ parcen3(1,8) Standard_Real Tol2 = Tol1; Geom2dInt_TheIntConicCurveOfGInter Intp; Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve C2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,0.); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); Handle(GccInt_Bisec) Sol = Bis.ThisSolution(); GccInt_IType type = Sol->ArcType(); switch (type) { @@ -938,11 +937,11 @@ parcen3(1,8) Standard_Real Tol2 = Tol1; Geom2dInt_TheIntConicCurveOfGInter Intp; Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve Cu2(HCu2,0.); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(Cu2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(Cu2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(Cu2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(Cu2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve Cu2(HCu2,0.); + firstparam = Max(Cu2.FirstParameter(),thefirst); + lastparam = Min(Cu2.LastParameter(),thelast); + IntRes2d_Domain D2(Cu2.Value(firstparam), firstparam, Tol, + Cu2.Value(lastparam), lastparam, Tol); IntRes2d_Domain D1; if (Bis.HasSolution()) { Intp.Perform(Bis.ThisSolution(),D1,Cu2,D2,Tol1,Tol2); diff --git a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx index bc5f03352c..529157bb0f 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx @@ -13,7 +13,7 @@ // commercial license or contractual agreement. -#include +#include #include #include #include @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -184,11 +183,11 @@ pararg2(1,aNbSolMAX) IntRes2d_Domain D1; for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) { Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2); - Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,cote2(jcote2)); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); Geom2dInt_TheIntConicCurveOfGInter Intp(Line,D1,C2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { @@ -368,11 +367,11 @@ pararg2(1,aNbSolMAX) D1.SetEquivalentParameters(0.,2.*M_PI); for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) { Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2); - Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu2,cote2(jcote2)); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); Intp.Perform(Circ,D1,C2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { @@ -500,11 +499,11 @@ pararg2(1,aNbSolMAX) Geom2dInt_TheIntConicCurveOfGInter Intp; for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) { Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1); - Adaptor3d_OffsetCurve Cu2(HCu1,cote1(jcote1)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(Cu2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(Cu2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(Cu2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(Cu2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve Cu2(HCu1,cote1(jcote1)); + firstparam = Max(Cu2.FirstParameter(),thefirst); + lastparam = Min(Cu2.LastParameter(),thelast); + IntRes2d_Domain D2(Cu2.Value(firstparam), firstparam, Tol, + Cu2.Value(lastparam), lastparam, Tol); Intp.Perform(Circ,D1,Cu2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { @@ -541,8 +540,8 @@ pararg2(1,aNbSolMAX) // tangent vector and vector between points in two curves must // be equal to zero). //======================================================================= -static void PrecRoot(const Adaptor3d_OffsetCurve& theC1, - const Adaptor3d_OffsetCurve& theC2, +static void PrecRoot(const Adaptor2d_OffsetCurve& theC1, + const Adaptor2d_OffsetCurve& theC2, const Standard_Real theU0, const Standard_Real theV0, Standard_Real& theUfinal, @@ -597,8 +596,8 @@ where u_{0} and v_{0} are initial values or values computed on previous iteratio Standard_Real aSQDistPrev = RealFirst(); - Geom2dGcc_CurveToolGeo::D2(theC1, aU, aPu, aD1u, aD2u); - Geom2dGcc_CurveToolGeo::D2(theC2, aV, aPv, aD1v, aD2v); + theC1.D2(aU, aPu, aD1u, aD2u); + theC2.D2(aV, aPv, aD1v, aD2v); const Standard_Real aCrProd = Abs(aD1u.Crossed(aD1v)); if(aCrProd*aCrProd > 1.0e-6* @@ -690,8 +689,8 @@ where u_{0} and v_{0} are initial values or values computed on previous iteratio aV += aStepV; } - Geom2dGcc_CurveToolGeo::D2(theC1, aU, aPu, aD1u, aD2u); - Geom2dGcc_CurveToolGeo::D2(theC2, aV, aPv, aD1v, aD2v); + theC1.D2(aU, aPu, aD1u, aD2u); + theC2.D2(aV, aPv, aD1v, aD2v); } while(aNbIter <= aNbIterMax); } @@ -739,10 +738,10 @@ pararg2(1,aNbSolMAX) //======================================================================== Standard_Real Tol = Abs(Tolerance); - Standard_Real thefirst = -100000.; - Standard_Real thelast = 100000.; - Standard_Real firstparam; - Standard_Real lastparam; +#ifdef OCCT_DEBUG + const Standard_Real thefirst = -100000.; + const Standard_Real thelast = 100000.; +#endif gp_Dir2d dirx(1.,0.); TColStd_Array1OfReal cote1(1,2); TColStd_Array1OfReal cote2(1,2); @@ -833,27 +832,21 @@ pararg2(1,aNbSolMAX) Geom2dInt_GInter Intp; for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) { Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1); - Adaptor3d_OffsetCurve C1(HCu1,cote1(jcote1)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C1),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C1),thelast); + Adaptor2d_OffsetCurve C1(HCu1,cote1(jcote1)); #ifdef OCCT_DEBUG + Standard_Real firstparam = Max(C1.FirstParameter(), thefirst); + Standard_Real lastparam = Min(C1.LastParameter(), thelast); IntRes2d_Domain D2C1(Geom2dGcc_CurveToolGeo::Value(C1,firstparam),firstparam,Tol, Geom2dGcc_CurveToolGeo::Value(C1,lastparam),lastparam,Tol); -#else - Geom2dGcc_CurveToolGeo::Value(C1,firstparam); - Geom2dGcc_CurveToolGeo::Value(C1,lastparam); #endif for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) { Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2); - Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); + Adaptor2d_OffsetCurve C2(HCu2,cote2(jcote2)); #ifdef OCCT_DEBUG + firstparam = Max(C2.FirstParameter(), thefirst); + lastparam = Min(C2.LastParameter(),thelast); IntRes2d_Domain D2C2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); -#else - Geom2dGcc_CurveToolGeo::Value(C2,firstparam); - Geom2dGcc_CurveToolGeo::Value(C2,lastparam); #endif Intp.Perform(C1,C2,Tol,Tol); if (Intp.IsDone()) { @@ -871,10 +864,10 @@ pararg2(1,aNbSolMAX) Standard_Real aU2 = aU0+Precision::PApproximation(); Standard_Real aV2 = aV0+Precision::PApproximation(); - gp_Pnt2d P11 = Geom2dGcc_CurveToolGeo::Value(C1,aU1); - gp_Pnt2d P12 = Geom2dGcc_CurveToolGeo::Value(C2,aV1); - gp_Pnt2d P21 = Geom2dGcc_CurveToolGeo::Value(C1,aU2); - gp_Pnt2d P22 = Geom2dGcc_CurveToolGeo::Value(C2,aV2); + gp_Pnt2d P11 = C1.Value(aU1); + gp_Pnt2d P12 = C2.Value(aV1); + gp_Pnt2d P21 = C1.Value(aU2); + gp_Pnt2d P22 = C2.Value(aV2); Standard_Real aDist1112 = P11.SquareDistance(P12); Standard_Real aDist1122 = P11.SquareDistance(P22); @@ -889,7 +882,7 @@ pararg2(1,aNbSolMAX) } NbrSol++; - gp_Pnt2d Center(Geom2dGcc_CurveToolGeo::Value(C1, aU0)); + gp_Pnt2d Center(C1.Value(aU0)); cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius); // ======================================================= qualifier1(NbrSol) = Qualified1.Qualifier(); diff --git a/src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx b/src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx index 7e677e4aa9..44cb1b9515 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx @@ -21,7 +21,7 @@ // de rayon donne : Radius. + //======================================================================== -#include +#include #include #include #include @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -124,11 +123,11 @@ parcen3(1,8) Geom2dInt_TheIntConicCurveOfGInter Intp; for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) { Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1); - Adaptor3d_OffsetCurve C2(HCu1,Coef(jcote1)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu1,Coef(jcote1)); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); Intp.Perform(OnLine,D1,C2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { @@ -237,11 +236,11 @@ parcen3(1,8) Geom2dInt_TheIntConicCurveOfGInter Intp; for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) { Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1); - Adaptor3d_OffsetCurve C2(HCu1,cote1(jcote1)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HCu1,cote1(jcote1)); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam),firstparam,Tol, + C2.Value(lastparam),lastparam,Tol); Intp.Perform(OnCirc,D1,C2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { @@ -592,17 +591,17 @@ parcen3(1,8) Geom2dInt_GInter Intp; for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) { Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1); - Adaptor3d_OffsetCurve C1(HCu1,cote1(jcote1)); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C1),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C1),thelast); - IntRes2d_Domain D1(Geom2dGcc_CurveToolGeo::Value(C1,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C1,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C1(HCu1,cote1(jcote1)); + firstparam = Max(C1.FirstParameter(),thefirst); + lastparam = Min(C1.LastParameter(),thelast); + IntRes2d_Domain D1(C1.Value(firstparam), firstparam, Tol, + C1.Value(lastparam), lastparam, Tol); Handle(Geom2dAdaptor_HCurve) HOnCurv = new Geom2dAdaptor_HCurve(OnCurv); - Adaptor3d_OffsetCurve C2(HOnCurv); - firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst); - lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast); - IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol, - Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol); + Adaptor2d_OffsetCurve C2(HOnCurv); + firstparam = Max(C2.FirstParameter(),thefirst); + lastparam = Min(C2.LastParameter(),thelast); + IntRes2d_Domain D2(C2.Value(firstparam), firstparam, Tol, + C2.Value(lastparam), lastparam, Tol); Intp.Perform(C1,D1,C2,D2,Tol,Tol); if (Intp.IsDone()) { if (!Intp.IsEmpty()) { diff --git a/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cxx b/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cxx deleted file mode 100644 index 351847de43..0000000000 --- a/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 1995-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. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -GeomAbs_CurveType Geom2dGcc_CurveToolGeo:: -TheType(const Adaptor3d_OffsetCurve& ) { - return GeomAbs_OtherCurve; -} - -gp_Lin2d Geom2dGcc_CurveToolGeo:: -Line (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return gp_Lin2d(); -} - -gp_Circ2d Geom2dGcc_CurveToolGeo:: -Circle (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return gp_Circ2d(); -} - -gp_Elips2d Geom2dGcc_CurveToolGeo:: -Ellipse (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return gp_Elips2d(); -} - -gp_Parab2d Geom2dGcc_CurveToolGeo:: -Parabola (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return gp_Parab2d(); -} - -gp_Hypr2d Geom2dGcc_CurveToolGeo:: -Hyperbola (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return gp_Hypr2d(); -} - -Standard_Real -Geom2dGcc_CurveToolGeo::EpsX (const Adaptor3d_OffsetCurve& /*C*/, - const Standard_Real Tol) { - return Tol; -} - -Standard_Integer -Geom2dGcc_CurveToolGeo::NbSamples (const Adaptor3d_OffsetCurve& C) { - GeomAbs_CurveType typC = C.GetType(); - Standard_Integer nbs = 20; - if(typC == GeomAbs_Line) - nbs = 2; - else if(typC == GeomAbs_BezierCurve) - nbs = 3 + C.Bezier()->NbPoles(); - else if(typC == GeomAbs_BSplineCurve) { - Handle(Geom2d_BSplineCurve) BSC = C.BSpline(); - nbs = BSC->NbKnots(); - nbs*= BSC->Degree(); - if(nbs < 2) nbs=2; - } - return(nbs); -} - -Standard_Real -Geom2dGcc_CurveToolGeo::FirstParameter (const Adaptor3d_OffsetCurve& C) { - return C.FirstParameter(); -} - -Standard_Real -Geom2dGcc_CurveToolGeo::LastParameter (const Adaptor3d_OffsetCurve& C) { - return C.LastParameter(); -} - -gp_Pnt2d -Geom2dGcc_CurveToolGeo::Value (const Adaptor3d_OffsetCurve& C, - const Standard_Real U) { - - return C.Value(U); -} - -void Geom2dGcc_CurveToolGeo::D1(const Adaptor3d_OffsetCurve& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& T) { - C.D1(U,P,T); -} - -void Geom2dGcc_CurveToolGeo::D2(const Adaptor3d_OffsetCurve& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& T, - gp_Vec2d& N) { - C.D2(U,P,T,N); -} - -Standard_Boolean Geom2dGcc_CurveToolGeo:: -IsComposite (const Adaptor3d_OffsetCurve& ) { - return Standard_False; -} - -Standard_Integer Geom2dGcc_CurveToolGeo:: -GetIntervals (const Adaptor3d_OffsetCurve& ) { - cout << "Not implemented" << endl; - return 0; -} - -void Geom2dGcc_CurveToolGeo:: -GetInterval (const Adaptor3d_OffsetCurve& , - const Standard_Integer , - Standard_Real& , - Standard_Real& ) { - cout << "Not implemented" << endl; -} - -void Geom2dGcc_CurveToolGeo:: -SetCurrentInterval ( Adaptor3d_OffsetCurve& , - const Standard_Integer ) { - cout << "Not implemented" << endl; -} - diff --git a/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.hxx b/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.hxx deleted file mode 100644 index 334d6ca753..0000000000 --- a/src/Geom2dGcc/Geom2dGcc_CurveToolGeo.hxx +++ /dev/null @@ -1,126 +0,0 @@ -// Created on: 1992-06-04 -// Created by: Jacques GOUSSARD -// Copyright (c) 1992-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. - -#ifndef _Geom2dGcc_CurveToolGeo_HeaderFile -#define _Geom2dGcc_CurveToolGeo_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -class Adaptor3d_OffsetCurve; -class gp_Lin2d; -class gp_Circ2d; -class gp_Elips2d; -class gp_Parab2d; -class gp_Hypr2d; -class gp_Pnt2d; -class gp_Vec2d; - - - -class Geom2dGcc_CurveToolGeo -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT static GeomAbs_CurveType TheType (const Adaptor3d_OffsetCurve& C); - - //! Returns the Lin2d from gp corresponding to the curve C. - //! This method is called only when TheType returns - //! IntCurve_Lin. - Standard_EXPORT static gp_Lin2d Line (const Adaptor3d_OffsetCurve& C); - - //! Returns the Circ2d from gp corresponding to the curve C. - //! This method is called only when TheType returns - //! IntCurve_Cir. - Standard_EXPORT static gp_Circ2d Circle (const Adaptor3d_OffsetCurve& C); - - //! Returns the Elips2d from gp corresponding to the curve C. - //! This method is called only when TheType returns - //! IntCurve_Eli. - Standard_EXPORT static gp_Elips2d Ellipse (const Adaptor3d_OffsetCurve& C); - - //! Returns the Parab2d from gp corresponding to the curve C. - //! This method is called only when TheType returns - //! IntCurve_Prb. - Standard_EXPORT static gp_Parab2d Parabola (const Adaptor3d_OffsetCurve& C); - - //! Returns the Hypr2d from gp corresponding to the curve C. - //! This method is called only when TheType returns - //! IntCurve_Hpr. - Standard_EXPORT static gp_Hypr2d Hyperbola (const Adaptor3d_OffsetCurve& C); - - Standard_EXPORT static Standard_Real FirstParameter (const Adaptor3d_OffsetCurve& C); - - Standard_EXPORT static Standard_Real LastParameter (const Adaptor3d_OffsetCurve& C); - - Standard_EXPORT static Standard_Real EpsX (const Adaptor3d_OffsetCurve& C, const Standard_Real Tol); - - Standard_EXPORT static Standard_Integer NbSamples (const Adaptor3d_OffsetCurve& C); - - Standard_EXPORT static gp_Pnt2d Value (const Adaptor3d_OffsetCurve& C, const Standard_Real X); - - Standard_EXPORT static void D1 (const Adaptor3d_OffsetCurve& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& T); - - Standard_EXPORT static void D2 (const Adaptor3d_OffsetCurve& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& T, gp_Vec2d& N); - - Standard_EXPORT static Standard_Boolean IsComposite (const Adaptor3d_OffsetCurve& C); - - //! Outputs the number of interval of continuity C1 of - //! the curve - //! used if Type == Composite. - Standard_EXPORT static Standard_Integer GetIntervals (const Adaptor3d_OffsetCurve& C); - - //! Outputs the bounds of interval of index - //! used if Type == Composite. - Standard_EXPORT static void GetInterval (const Adaptor3d_OffsetCurve& C, const Standard_Integer Index, Standard_Real& U1, Standard_Real& U2); - - //! Set the current valid interval of index - //! inside which the computations will be done - //! (used if Type == Composite). - Standard_EXPORT static void SetCurrentInterval (Adaptor3d_OffsetCurve& C, const Standard_Integer Index); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _Geom2dGcc_CurveToolGeo_HeaderFile diff --git a/src/MAT2d/MAT2d_Circuit.cxx b/src/MAT2d/MAT2d_Circuit.cxx index c529e1f256..60287e1481 100644 --- a/src/MAT2d/MAT2d_Circuit.cxx +++ b/src/MAT2d/MAT2d_Circuit.cxx @@ -31,7 +31,7 @@ #endif -#include +#include #include #include #include @@ -273,8 +273,8 @@ Standard_Boolean MAT2d_Circuit::IsSharpCorner(const Handle(Geom2d_Geometry)& Geo Handle(Geom2dAdaptor_HCurve) HC1 = new Geom2dAdaptor_HCurve(C1); Handle(Geom2dAdaptor_HCurve) HC2 = new Geom2dAdaptor_HCurve(C2); - Adaptor3d_OffsetCurve OC1(HC1,D,MilC1,C1->LastParameter()); - Adaptor3d_OffsetCurve OC2(HC2,D,C2->FirstParameter(),MilC2); + Adaptor2d_OffsetCurve OC1(HC1,D,MilC1,C1->LastParameter()); + Adaptor2d_OffsetCurve OC2(HC2,D,C2->FirstParameter(),MilC2); Geom2dInt_GInter Intersect; Intersect.Perform(OC1,OC2,Tol,Tol);