n GeomLib
n GeomProjLib
n GeomTools
+n GeomEvaluator
n Hermit
n IntAna
n IntAna2d
+++ /dev/null
-// 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_HSurfaceOfLinearExtrusion_HeaderFile
-#define _Adaptor3d_HSurfaceOfLinearExtrusion_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#include <Adaptor3d_HSurface.hxx>
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Standard_DomainError;
-class Adaptor3d_SurfaceOfLinearExtrusion;
-class Adaptor3d_Surface;
-
-
-class Adaptor3d_HSurfaceOfLinearExtrusion;
-DEFINE_STANDARD_HANDLE(Adaptor3d_HSurfaceOfLinearExtrusion, Adaptor3d_HSurface)
-
-
-class Adaptor3d_HSurfaceOfLinearExtrusion : public Adaptor3d_HSurface
-{
-
-public:
-
-
- //! Creates an empty GenHSurface.
- Standard_EXPORT Adaptor3d_HSurfaceOfLinearExtrusion();
-
- //! Creates a GenHSurface from a Surface.
- Standard_EXPORT Adaptor3d_HSurfaceOfLinearExtrusion(const Adaptor3d_SurfaceOfLinearExtrusion& S);
-
- //! Sets the field of the GenHSurface.
- Standard_EXPORT void Set (const Adaptor3d_SurfaceOfLinearExtrusion& S);
-
- //! Returns a reference to the Surface inside the HSurface.
- //! This is redefined from HSurface, cannot be inline.
- Standard_EXPORT const Adaptor3d_Surface& Surface() const;
-
- //! Returns the surface used to create the GenHSurface.
- Adaptor3d_SurfaceOfLinearExtrusion& ChangeSurface();
-
-
-
-
- DEFINE_STANDARD_RTTI(Adaptor3d_HSurfaceOfLinearExtrusion,Adaptor3d_HSurface)
-
-protected:
-
-
- Adaptor3d_SurfaceOfLinearExtrusion mySurf;
-
-
-private:
-
-
-
-
-};
-
-#define TheSurface Adaptor3d_SurfaceOfLinearExtrusion
-#define TheSurface_hxx <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#define Adaptor3d_GenHSurface Adaptor3d_HSurfaceOfLinearExtrusion
-#define Adaptor3d_GenHSurface_hxx <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
-#define Handle_Adaptor3d_GenHSurface Handle(Adaptor3d_HSurfaceOfLinearExtrusion)
-
-#include <Adaptor3d_GenHSurface.lxx>
-
-#undef TheSurface
-#undef TheSurface_hxx
-#undef Adaptor3d_GenHSurface
-#undef Adaptor3d_GenHSurface_hxx
-#undef Handle_Adaptor3d_GenHSurface
-
-
-
-
-#endif // _Adaptor3d_HSurfaceOfLinearExtrusion_HeaderFile
+++ /dev/null
-// 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 <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <Standard_OutOfRange.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_DomainError.hxx>
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#include <Adaptor3d_Surface.hxx>
-
-
-
-
-
-
-
-
-
-
-#define TheSurface Adaptor3d_SurfaceOfLinearExtrusion
-#define TheSurface_hxx <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#define Adaptor3d_GenHSurface Adaptor3d_HSurfaceOfLinearExtrusion
-#define Adaptor3d_GenHSurface_hxx <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
-#define Handle_Adaptor3d_GenHSurface Handle(Adaptor3d_HSurfaceOfLinearExtrusion)
-#include <Adaptor3d_GenHSurface.gxx>
-
+++ /dev/null
-// 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_HSurfaceOfRevolution_HeaderFile
-#define _Adaptor3d_HSurfaceOfRevolution_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
-#include <Adaptor3d_HSurface.hxx>
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Standard_DomainError;
-class Adaptor3d_SurfaceOfRevolution;
-class Adaptor3d_Surface;
-
-
-class Adaptor3d_HSurfaceOfRevolution;
-DEFINE_STANDARD_HANDLE(Adaptor3d_HSurfaceOfRevolution, Adaptor3d_HSurface)
-
-
-class Adaptor3d_HSurfaceOfRevolution : public Adaptor3d_HSurface
-{
-
-public:
-
-
- //! Creates an empty GenHSurface.
- Standard_EXPORT Adaptor3d_HSurfaceOfRevolution();
-
- //! Creates a GenHSurface from a Surface.
- Standard_EXPORT Adaptor3d_HSurfaceOfRevolution(const Adaptor3d_SurfaceOfRevolution& S);
-
- //! Sets the field of the GenHSurface.
- Standard_EXPORT void Set (const Adaptor3d_SurfaceOfRevolution& S);
-
- //! Returns a reference to the Surface inside the HSurface.
- //! This is redefined from HSurface, cannot be inline.
- Standard_EXPORT const Adaptor3d_Surface& Surface() const;
-
- //! Returns the surface used to create the GenHSurface.
- Adaptor3d_SurfaceOfRevolution& ChangeSurface();
-
-
-
-
- DEFINE_STANDARD_RTTI(Adaptor3d_HSurfaceOfRevolution,Adaptor3d_HSurface)
-
-protected:
-
-
- Adaptor3d_SurfaceOfRevolution mySurf;
-
-
-private:
-
-
-
-
-};
-
-#define TheSurface Adaptor3d_SurfaceOfRevolution
-#define TheSurface_hxx <Adaptor3d_SurfaceOfRevolution.hxx>
-#define Adaptor3d_GenHSurface Adaptor3d_HSurfaceOfRevolution
-#define Adaptor3d_GenHSurface_hxx <Adaptor3d_HSurfaceOfRevolution.hxx>
-#define Handle_Adaptor3d_GenHSurface Handle(Adaptor3d_HSurfaceOfRevolution)
-
-#include <Adaptor3d_GenHSurface.lxx>
-
-#undef TheSurface
-#undef TheSurface_hxx
-#undef Adaptor3d_GenHSurface
-#undef Adaptor3d_GenHSurface_hxx
-#undef Handle_Adaptor3d_GenHSurface
-
-
-
-
-#endif // _Adaptor3d_HSurfaceOfRevolution_HeaderFile
+++ /dev/null
-// 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 <Adaptor3d_HSurfaceOfRevolution.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <Standard_OutOfRange.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_DomainError.hxx>
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
-#include <Adaptor3d_Surface.hxx>
-
-
-
-
-
-
-
-
-
-
-#define TheSurface Adaptor3d_SurfaceOfRevolution
-#define TheSurface_hxx <Adaptor3d_SurfaceOfRevolution.hxx>
-#define Adaptor3d_GenHSurface Adaptor3d_HSurfaceOfRevolution
-#define Adaptor3d_GenHSurface_hxx <Adaptor3d_HSurfaceOfRevolution.hxx>
-#define Handle_Adaptor3d_GenHSurface Handle(Adaptor3d_HSurfaceOfRevolution)
-#include <Adaptor3d_GenHSurface.gxx>
-
#include <Adaptor3d_HCurve.hxx>
#include <Adaptor3d_HIsoCurve.hxx>
#include <Adaptor3d_HSurface.hxx>
-#include <Adaptor3d_HSurfaceOfRevolution.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#include <BSplCLib.hxx>
#include <BSplSLib.hxx>
+++ /dev/null
-// Created on: 1993-04-21
-// 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.
-
-
-#include <Adaptor3d_HCurve.hxx>
-#include <Adaptor3d_HSurface.hxx>
-#include <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#include <Geom_BezierSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <gp.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Cone.hxx>
-#include <gp_Cylinder.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Sphere.hxx>
-#include <gp_Torus.hxx>
-#include <gp_Vec.hxx>
-#include <Precision.hxx>
-#include <Standard_DomainError.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfLinearExtrusion
-//purpose :
-//=======================================================================
-Adaptor3d_SurfaceOfLinearExtrusion::Adaptor3d_SurfaceOfLinearExtrusion()
-{}
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfLinearExtrusion
-//purpose :
-//=======================================================================
-
-Adaptor3d_SurfaceOfLinearExtrusion::Adaptor3d_SurfaceOfLinearExtrusion
-(const Handle(Adaptor3d_HCurve)& C)
-{
- Load( C);
-}
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfLinearExtrusion
-//purpose :
-//=======================================================================
-
-Adaptor3d_SurfaceOfLinearExtrusion::Adaptor3d_SurfaceOfLinearExtrusion
-(const Handle(Adaptor3d_HCurve)& C,
- const gp_Dir& V)
-{
- Load( C);
- Load( V);
-}
-
-//=======================================================================
-//function : Load
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::Load( const Handle(Adaptor3d_HCurve)& C)
-{
- myBasisCurve = C;
-}
-
-//=======================================================================
-//function : Load
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::Load( const gp_Dir& V)
-{
- myDirection = V;
-}
-
-//=======================================================================
-//function : FirstUParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::FirstUParameter() const
-{
- return myBasisCurve->FirstParameter();
-}
-
-//=======================================================================
-//function : LastUParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::LastUParameter() const
-{
- return myBasisCurve->LastParameter();
-}
-
-//=======================================================================
-//function : FirstVParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::FirstVParameter() const
-{
- return RealFirst();
-}
-
-//=======================================================================
-//function : LastVParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::LastVParameter() const
-{
- return RealLast();
-}
-
-//=======================================================================
-//function : UContinuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape Adaptor3d_SurfaceOfLinearExtrusion::UContinuity() const
-{
- return myBasisCurve->Continuity();
-}
-
-//=======================================================================
-//function : VContinuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape Adaptor3d_SurfaceOfLinearExtrusion::VContinuity() const
-{
- return GeomAbs_CN;
-}
-
-//=======================================================================
-//function : NbUIntervals
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbUIntervals
-(const GeomAbs_Shape S) const
-{
- return myBasisCurve->NbIntervals(S);
-}
-
-//=======================================================================
-//function : NbVIntervals
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbVIntervals
-(const GeomAbs_Shape ) const
-{
- return 1;
-}
-
-//=======================================================================
-//function : UIntervals
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::UIntervals
-(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
-{
- myBasisCurve->Intervals(T,S);
-}
-
-//=======================================================================
-//function : VIntervals
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::VIntervals
-//(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
-(TColStd_Array1OfReal& T, const GeomAbs_Shape ) const
-{
- T(T.Lower()) = FirstVParameter() ;
- T(T.Lower() + 1) = LastVParameter() ;
-}
-
-//=======================================================================
-//function : VTrim
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfLinearExtrusion::VTrim
-(const Standard_Real First ,
- const Standard_Real Last,
- const Standard_Real Tol) const
-{
- Handle(Adaptor3d_HCurve) newBasisCurve =
- myBasisCurve->Trim(First, Last, Tol);
-
- Adaptor3d_SurfaceOfLinearExtrusion * SurfacePtr =
- new Adaptor3d_SurfaceOfLinearExtrusion(newBasisCurve, myDirection) ;
-
- return new Adaptor3d_HSurfaceOfLinearExtrusion(*SurfacePtr);
-}
-
-//=======================================================================
-//function : UTrim
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfLinearExtrusion::UTrim
-//(const Standard_Real First ,
-// const Standard_Real Last,
-// const Standard_Real Tol) const
-(const Standard_Real ,
- const Standard_Real ,
- const Standard_Real ) const
-{
- Adaptor3d_SurfaceOfLinearExtrusion * SurfacePtr =
- new Adaptor3d_SurfaceOfLinearExtrusion(myBasisCurve,myDirection);
-
- return new Adaptor3d_HSurfaceOfLinearExtrusion(*SurfacePtr) ;
-}
-
-//=======================================================================
-//function : IsUClosed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsUClosed() const
-{
- return myBasisCurve->IsClosed();
-}
-
-//=======================================================================
-//function : IsVClosed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsVClosed() const
-{
- return Standard_True;
-}
-
-//=======================================================================
-//function : IsUPeriodic
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsUPeriodic() const
-{
- return myBasisCurve->IsPeriodic();
-}
-
-//=======================================================================
-//function : UPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::UPeriod() const
-{
- return myBasisCurve->Period() ;
-}
-
-//=======================================================================
-//function : IsVPeriodic
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsVPeriodic() const
-{
- return Standard_False;
-}
-
-//=======================================================================
-//function : VPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::VPeriod() const
-{
- Standard_DomainError::Raise("Adaptor3d_SurfaceOfLinearExtrusion::VPeriod");
- return 0.0e0 ;
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-gp_Pnt Adaptor3d_SurfaceOfLinearExtrusion::Value(const Standard_Real U,
- const Standard_Real V)
- const
-{
- gp_Pnt P;
- P = myBasisCurve->Value(U);
- P.Translate( V * gp_Vec(myDirection));
- return P;
-}
-
-//=======================================================================
-//function : D0
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::D0(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P) const
-{
- myBasisCurve->D0(U,P);
- P.Translate( V * gp_Vec(myDirection));
-}
-
-//=======================================================================
-//function : D1
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::D1(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V) const
-{
- myBasisCurve->D1(U,P,D1U);
- D0(U,V,P);
- D1V = gp_Vec(myDirection);
-}
-
-//=======================================================================
-//function : D2
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::D2(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V,
- gp_Vec& D2UV) const
-{
- myBasisCurve->D2(U,P,D1U,D2U);
- D1V = gp_Vec(myDirection);
- D2V.SetCoord( 0., 0., 0.);
- D2UV.SetCoord( 0., 0., 0.);
- D0(U,V,P);
-}
-
-//=======================================================================
-//function : D3
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfLinearExtrusion::D3(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V,
- gp_Vec& D2UV,
- gp_Vec& D3U, gp_Vec& D3V,
- gp_Vec& D3UUV, gp_Vec& D3UVV) const
-{
- myBasisCurve->D3(U,P,D1U,D2U,D3U);
- D1V = gp_Vec(myDirection);
- D2V.SetCoord( 0., 0., 0.);
- D2UV.SetCoord( 0., 0., 0.);
- D3V.SetCoord( 0., 0., 0.);
- D3UUV.SetCoord( 0., 0., 0.);
- D3UVV.SetCoord( 0., 0., 0.);
- D0(U,V,P);
-}
-
-//=======================================================================
-//function : DN
-//purpose :
-//=======================================================================
-
-gp_Vec Adaptor3d_SurfaceOfLinearExtrusion::DN
-(const Standard_Real U,
-// const Standard_Real V,
- const Standard_Real ,
- const Standard_Integer NU,
- const Standard_Integer NV) const
-{
- if ( (NU+NV)<1 || NU<0 || NV<0) {
- Standard_DomainError::Raise("Adaptor3d_SurfaceOfLinearExtrusion::DN");
- return gp_Vec();
- }
- else {
- if (NU == 0 && NV ==1) return gp_Vec( myDirection);
- else if (NV == 0) return myBasisCurve->DN(U,NU);
- else return gp_Vec( 0., 0., 0.);
- }
-}
-
-//=======================================================================
-//function : UResolution
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::UResolution
-(const Standard_Real R3d) const
-{
- return myBasisCurve->Resolution(R3d);
-}
-
-//=======================================================================
-//function : VResolution
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfLinearExtrusion::VResolution
-(const Standard_Real R3d) const
-{
- return R3d;
-}
-
-//=======================================================================
-//function : GetType
-//purpose :
-//=======================================================================
-
-GeomAbs_SurfaceType Adaptor3d_SurfaceOfLinearExtrusion::GetType() const
-{
- switch ( myBasisCurve->GetType()) {
-
- case GeomAbs_Line:
- {
- gp_Dir D = myBasisCurve->Line().Direction();
- if (myDirection.IsParallel( D, Precision::Angular())) {
- return GeomAbs_SurfaceOfExtrusion;
- }
- else {
- return GeomAbs_Plane;
- }
- }
-
- case GeomAbs_Circle:
- {
- gp_Dir D = (myBasisCurve->Circle()).Axis().Direction();
- if ( myDirection.IsParallel( D, Precision::Angular())) {
- return GeomAbs_Cylinder;
- }
- // JAG 10.11.95
- else if (myDirection.IsNormal(D, Precision::Angular())) {
- return GeomAbs_Plane;
- }
- else {
- return GeomAbs_SurfaceOfExtrusion;
- }
- }
- // JAG 10.11.95
-
- case GeomAbs_Ellipse:
- {
- gp_Dir D = (myBasisCurve->Ellipse()).Axis().Direction();
- if (myDirection.IsNormal(D, Precision::Angular())) {
- return GeomAbs_Plane;
- }
- else {
- return GeomAbs_SurfaceOfExtrusion;
- }
- }
-
- case GeomAbs_Parabola:
- {
- gp_Dir D = (myBasisCurve->Parabola()).Axis().Direction();
- if (myDirection.IsNormal(D, Precision::Angular())) {
- return GeomAbs_Plane;
- }
- else {
- return GeomAbs_SurfaceOfExtrusion;
- }
- }
-
- case GeomAbs_Hyperbola:
- {
- gp_Dir D = (myBasisCurve->Hyperbola()).Axis().Direction();
- if (myDirection.IsNormal(D, Precision::Angular())) {
- return GeomAbs_Plane;
- }
- else {
- return GeomAbs_SurfaceOfExtrusion;
- }
- }
-
- default:
- return GeomAbs_SurfaceOfExtrusion;
-
- }
-}
-
-//=======================================================================
-//function : Plane
-//purpose :
-//=======================================================================
-
-gp_Pln Adaptor3d_SurfaceOfLinearExtrusion::Plane() const
-{
- Standard_NoSuchObject_Raise_if (GetType() != GeomAbs_Plane,
- "Adaptor3d_SurfaceOfLinearExtrusion::Plane");
-/*
- gp_Pnt P;
- gp_Vec Ox, Oy;
- D1( 0., 0., P, Ox, Oy);
- gp_Ax3 Ax3(P,gp_Dir(Ox^Oy),gp_Dir(Ox));
- if (gp_Dir(Oy).Dot(Ax3.YDirection())<0.){
- Ax3.YReverse();
- }
- return gp_Pln(Ax3);
-*/
-
- gp_Pnt P;
- gp_Vec D1u, newZ;
- Standard_Real UFirst = myBasisCurve->FirstParameter();
- Standard_Real ULast = myBasisCurve->LastParameter();
- if (Precision::IsNegativeInfinite(UFirst) &&
- Precision::IsPositiveInfinite(ULast)) {
- UFirst = -100.;
- ULast = 100.;
- }
- else if (Precision::IsNegativeInfinite(UFirst)) {
- UFirst = ULast - 200.;
- }
- else if (Precision::IsPositiveInfinite(ULast)) {
- ULast = UFirst + 200.;
- }
- Standard_Real deltau = (ULast-UFirst)/20.;
- for (Standard_Integer i =1; i<=21; i++) {
- Standard_Real prm = UFirst + (i-1)*deltau;
- myBasisCurve->D1(prm,P,D1u);
- newZ = D1u.Normalized().Crossed(myDirection);
- if (newZ.Magnitude() > 1.e-12) break;
- }
- gp_Ax3 Ax3(P,gp_Dir(newZ),gp_Dir(D1u));
- if (myDirection.Dot(Ax3.YDirection())<0.){
- Ax3.YReverse();
- }
- return gp_Pln(Ax3);
-}
-
-
-//=======================================================================
-//function : Cylinder
-//purpose :
-//=======================================================================
-
-gp_Cylinder Adaptor3d_SurfaceOfLinearExtrusion::Cylinder() const
-{
- Standard_NoSuchObject_Raise_if
- (GetType() != GeomAbs_Cylinder,
- "Adaptor3d_SurfaceOfLinearExtrusion::Cylinder");
-
- gp_Circ C = myBasisCurve->Circle() ;
- gp_Ax3 Ax3(C.Position());
- if(myDirection.Dot((C.Axis()).Direction())<0.){
- Ax3.ZReverse();
- }
- return gp_Cylinder(Ax3,C.Radius());
-}
-
-//=======================================================================
-//function : Cone
-//purpose :
-//=======================================================================
-
-gp_Cone Adaptor3d_SurfaceOfLinearExtrusion::Cone() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Cone");
- return gp_Cone();
-}
-
-//=======================================================================
-//function : Sphere
-//purpose :
-//=======================================================================
-
-gp_Sphere Adaptor3d_SurfaceOfLinearExtrusion::Sphere() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Sphere");
- return gp_Sphere();
-}
-
-//=======================================================================
-//function : Torus
-//purpose :
-//=======================================================================
-
-gp_Torus Adaptor3d_SurfaceOfLinearExtrusion::Torus() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Torus");
- return gp_Torus();
-}
-
-
-//=======================================================================
-//function : Axis
-//purpose :
-//=======================================================================
-
-gp_Ax1 Adaptor3d_SurfaceOfLinearExtrusion::AxeOfRevolution() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Axes");
- return gp_Ax1();
-}
-
-//=======================================================================
-//function : UDegree
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::UDegree() const
-{
- return myBasisCurve -> Degree();
-}
-//=======================================================================
-//function : NbUPoles
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbUPoles() const
-{
- return myBasisCurve->NbPoles();
-}
-//=======================================================================
-//function : VDegree
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::VDegree() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::VDegree");
- return 0;
-}
-
-//=======================================================================
-//function : NbVPoles
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbVPoles() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::NbVPoles");
- return 0;
-}
-
-//=======================================================================
-//function : NbUKnots
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbUKnots() const
-{
- Standard_NoSuchObject::Raise
- ("Adaptor3d_SurfaceOfLinearExtrusion::NbUKnots");
- return 0;
-}
-//=======================================================================
-//function : NbVKnots
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfLinearExtrusion::NbVKnots() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::NbVKnots");
- return 0;
-}
-//=======================================================================
-//function : IsURational
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsURational() const
-{
- Standard_NoSuchObject::Raise
- ("Adaptor3d_SurfaceOfLinearExtrusion::IsURational");
- return Standard_False;
-}
-//=======================================================================
-//function : IsVRational
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfLinearExtrusion::IsVRational() const
-{
- Standard_NoSuchObject::Raise
- ("Adaptor3d_SurfaceOfLinearExtrusion::IsVRational");
- return Standard_False;
-}
-//=======================================================================
-//function : Bezier
-//purpose :
-//=======================================================================
-
-
-Handle(Geom_BezierSurface) Adaptor3d_SurfaceOfLinearExtrusion::Bezier() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Axes");
- return Handle(Geom_BezierSurface)() ;
-}
-
-//=======================================================================
-//function : BSpline
-//purpose :
-//=======================================================================
-
-Handle(Geom_BSplineSurface) Adaptor3d_SurfaceOfLinearExtrusion::BSpline() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfLinearExtrusion::Axes");
- return Handle(Geom_BSplineSurface)() ;
-}
-
-//=======================================================================
-//function : Direction
-//purpose :
-//=======================================================================
-
-gp_Dir Adaptor3d_SurfaceOfLinearExtrusion::Direction() const
-{
- return myDirection;
-}
-
-//=======================================================================
-//function : BasisCurve
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HCurve) Adaptor3d_SurfaceOfLinearExtrusion::BasisCurve() const
-{
- return myBasisCurve;
-}
+++ /dev/null
-// Created on: 1993-04-21
-// 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_SurfaceOfLinearExtrusion_HeaderFile
-#define _Adaptor3d_SurfaceOfLinearExtrusion_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <gp_Dir.hxx>
-#include <Adaptor3d_Surface.hxx>
-#include <Standard_Real.hxx>
-#include <GeomAbs_Shape.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <Standard_Boolean.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-class Adaptor3d_HCurve;
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Standard_DomainError;
-class gp_Dir;
-class Adaptor3d_HSurface;
-class gp_Pnt;
-class gp_Vec;
-class gp_Pln;
-class gp_Cylinder;
-class gp_Cone;
-class gp_Sphere;
-class gp_Torus;
-class Geom_BezierSurface;
-class Geom_BSplineSurface;
-class gp_Ax1;
-
-
-//! Generalised cylinder. This surface is obtained by sweeping a curve in a given
-//! direction. The parametrization range for the parameter U is defined
-//! with referenced the curve.
-//! The parametrization range for the parameter V is ]-infinite,+infinite[
-//! The position of the curve gives the origin for the
-//! parameter V.
-//! The continuity of the surface is CN in the V direction.
-class Adaptor3d_SurfaceOfLinearExtrusion : public Adaptor3d_Surface
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- Standard_EXPORT Adaptor3d_SurfaceOfLinearExtrusion();
-
- //! The Curve is loaded.
- Standard_EXPORT Adaptor3d_SurfaceOfLinearExtrusion(const Handle(Adaptor3d_HCurve)& C);
-
- //! Thew Curve and the Direction are loaded.
- Standard_EXPORT Adaptor3d_SurfaceOfLinearExtrusion(const Handle(Adaptor3d_HCurve)& C, const gp_Dir& V);
-
- //! Changes the Curve
- Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
-
- //! Changes the Direction
- Standard_EXPORT void Load (const gp_Dir& V);
-
- Standard_EXPORT Standard_Real FirstUParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real LastUParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real FirstVParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real LastVParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
-
- //! Return CN.
- Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
-
- //! Returns the number of U intervals for continuity
- //! <S>. May be one if UContinuity(me) >= <S>
- Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the number of V intervals for continuity
- //! <S>. May be one if VContinuity(me) >= <S>
- Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the intervals with the requested continuity
- //! in the U direction.
- Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the intervals with the requested continuity
- //! in the V direction.
- Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns a surface trimmed in the U direction
- //! equivalent of <me> between
- //! parameters <First> and <Last>. <Tol> is used to
- //! test for 3d points confusion.
- //! If <First> >= <Last>
- Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
-
- //! Returns a surface trimmed in the V direction between
- //! parameters <First> and <Last>. <Tol> is used to
- //! test for 3d points confusion.
- //! If <First> >= <Last>
- Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
-
- //! Computes the point of parameters U,V on the surface.
- Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
-
- //! Computes the point of parameters U,V on the surface.
- Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
-
- //! Computes the point and the first derivatives on
- //! the surface.
- //! Raised if the continuity of the current
- //! intervals is not C1.
- Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
-
- //! Computes the point, the first and second
- //! derivatives on the surface.
- //! Raised if the continuity of the current
- //! intervals is not C2.
- Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
-
- //! Computes the point, the first, second and third
- //! derivatives on the surface.
- //! Raised if the continuity of the current
- //! intervals is not C3.
- Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
-
- //! Computes the derivative of order Nu in the direction U and Nv
- //! in the direction V at the point P(U, V).
- //! Raised if the current U interval is not not CNu
- //! and the current V interval is not CNv.
- //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
- Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
-
- //! Returns the parametric U resolution corresponding
- //! to the real space resolution <R3d>.
- Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
-
- //! Returns the parametric V resolution corresponding
- //! to the real space resolution <R3d>.
- Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
-
- //! Returns the type of the surface : Plane, Cylinder,
- //! Cone, Sphere, Torus, BezierSurface,
- //! BSplineSurface, SurfaceOfRevolution,
- //! SurfaceOfExtrusion, OtherSurface
- Standard_EXPORT GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer UDegree() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbUPoles() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbUKnots() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Handle(Adaptor3d_HCurve) myBasisCurve;
- gp_Dir myDirection;
-
-
-};
-
-
-
-
-
-
-
-#endif // _Adaptor3d_SurfaceOfLinearExtrusion_HeaderFile
+++ /dev/null
-// Created on: 1993-04-21
-// 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.
-
-
-#include <Adaptor3d_HCurve.hxx>
-#include <Adaptor3d_HSurface.hxx>
-#include <Adaptor3d_HSurfaceOfRevolution.hxx>
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
-#include <ElCLib.hxx>
-#include <Geom_BezierSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Ax3.hxx>
-#include <gp_Cone.hxx>
-#include <gp_Cylinder.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Sphere.hxx>
-#include <gp_Torus.hxx>
-#include <gp_Vec.hxx>
-#include <Precision.hxx>
-#include <Standard_ConstructionError.hxx>
-#include <Standard_DomainError.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfRevolution
-//purpose :
-//=======================================================================
-Adaptor3d_SurfaceOfRevolution::Adaptor3d_SurfaceOfRevolution()
-:myHaveAxis(Standard_False)
-{}
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfRevolution
-//purpose :
-//=======================================================================
-
-Adaptor3d_SurfaceOfRevolution::Adaptor3d_SurfaceOfRevolution
-(const Handle(Adaptor3d_HCurve)& C)
-:myHaveAxis(Standard_False)
-{
- Load( C);
-}
-
-//=======================================================================
-//function : Adaptor3d_SurfaceOfRevolution
-//purpose :
-//=======================================================================
-
-Adaptor3d_SurfaceOfRevolution::Adaptor3d_SurfaceOfRevolution
-(const Handle(Adaptor3d_HCurve)& C,
- const gp_Ax1& V)
-:myHaveAxis(Standard_False)
-{
- Load( C);
- Load( V);
-}
-
-//=======================================================================
-//function : Load
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::Load( const Handle(Adaptor3d_HCurve)& C)
-{
- myBasisCurve = C;
- if ( myHaveAxis) Load(myAxis); // to evaluate the new myAxeRev.
-}
-
-//=======================================================================
-//function : Load
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::Load( const gp_Ax1& V)
-{
- myHaveAxis = Standard_True;
- myAxis = V;
-
- // Eval myAxeRev : axe of revolution ( Determination de Ox).
- gp_Pnt P,Q;
- gp_Pnt O = myAxis.Location();
- gp_Dir Ox;
- gp_Dir Oz = myAxis.Direction();
- Standard_Boolean yrev = Standard_False;
- if (myBasisCurve->GetType() == GeomAbs_Line) {
- if((myBasisCurve->Line().Direction()).Dot(Oz) < 0.){
- yrev = Standard_True;
- Oz.Reverse();
- }
- }
-
- if (myBasisCurve->GetType() == GeomAbs_Circle) {
- Q = P = (myBasisCurve->Circle()).Location();
- }
- else {
- Standard_Real First = myBasisCurve->FirstParameter();
- P = Value( 0., 0.);// ce qui ne veut pas dire grand chose
- if ( GetType() == GeomAbs_Cone) {
- if ( gp_Lin(myAxis).Distance(P) <= Precision::Confusion())
- Q = ElCLib::Value(1.,myBasisCurve->Line());
- else
- Q = P;
- }
- else if (Precision::IsInfinite(First))
- Q = P;
- else
- Q = Value( 0., First);
- }
-
- gp_Dir DZ = myAxis.Direction();
- O.SetXYZ( O.XYZ() + ( gp_Vec(O,P) * DZ) * DZ.XYZ());
- if ( gp_Lin(myAxis).Distance(Q) > Precision::Confusion()) {
- Ox = gp_Dir(Q.XYZ() - O.XYZ());
- }
- else {
- Standard_Real First = myBasisCurve->FirstParameter();
- Standard_Real Last = myBasisCurve->LastParameter();
- Standard_Integer Ratio = 1;
- Standard_Real Dist;
- gp_Pnt PP;
- do {
- PP = myBasisCurve->Value(First+(Last-First)/Ratio);
- Dist = gp_Lin(myAxis).Distance(PP);
- Ratio++;
- }
- while ( Dist < Precision::Confusion() && Ratio < 100);
-
- if ( Ratio >= 100 ) {
- Standard_ConstructionError::Raise
- ("Adaptor3d_SurfaceOfRevolution : Axe and meridian are confused");
- }
- Ox = ( (Oz^gp_Vec(PP.XYZ()-O.XYZ()))^Oz);
- }
-
- myAxeRev = gp_Ax3(O,Oz,Ox);
-
- if (yrev) {
- myAxeRev.YReverse();
- }
- else if (myBasisCurve->GetType() == GeomAbs_Circle) {
- gp_Dir DC = (myBasisCurve->Circle()).Axis().Direction();
- if ((Ox.Crossed(Oz)).Dot(DC) < 0.) myAxeRev.ZReverse();
- }
-}
-
-//=======================================================================
-//function : AxeOfRevolution
-//purpose :
-//=======================================================================
-
-gp_Ax1 Adaptor3d_SurfaceOfRevolution::AxeOfRevolution() const
-{
- return myAxis;
-}
-
-//=======================================================================
-//function : FirstUParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::FirstUParameter() const
-{
- return 0.;
-}
-
-//=======================================================================
-//function : LastUParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::LastUParameter() const
-{
- return 2*M_PI;
-}
-
-//=======================================================================
-//function : FirstVParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::FirstVParameter() const
-{
- return myBasisCurve->FirstParameter();
-}
-
-//=======================================================================
-//function : LastVParameter
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::LastVParameter() const
-{
- return myBasisCurve->LastParameter();
-}
-
-//=======================================================================
-//function : UContinuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape Adaptor3d_SurfaceOfRevolution::UContinuity() const
-{
- return GeomAbs_CN;
-}
-
-//=======================================================================
-//function : VContinuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape Adaptor3d_SurfaceOfRevolution::VContinuity() const
-{
- return myBasisCurve->Continuity();
-}
-
-//=======================================================================
-//function : NbUIntervals
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbUIntervals
-//(const GeomAbs_Shape S) const
-(const GeomAbs_Shape ) const
-{
- return 1;
-}
-
-//=======================================================================
-//function : NbVIntervals
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbVIntervals
-( const GeomAbs_Shape S) const
-{
- return myBasisCurve->NbIntervals(S);
-}
-
-//=======================================================================
-//function : UIntervals
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::UIntervals (TColStd_Array1OfReal& T,
-// const GeomAbs_Shape S) const
- const GeomAbs_Shape ) const
-{
- T(T.Lower() ) = 0.;
- T(T.Lower()+1) = 2*M_PI;
-}
-
-
-//=======================================================================
-//function : VIntervals
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::VIntervals(TColStd_Array1OfReal& T,
- const GeomAbs_Shape S) const
-{
- myBasisCurve->Intervals(T,S);
-}
-
-
-//=======================================================================
-//function : UTrim
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfRevolution::UTrim
-(const Standard_Real
-#ifndef No_Exception
- First
-#endif
- ,const Standard_Real
-#ifndef No_Exception
- Last
-#endif
- ,const Standard_Real
- ) const
-{
-#ifndef No_Exception
- Standard_Real Eps = Precision::PConfusion();
-#endif
- Standard_OutOfRange_Raise_if
- ( Abs(First) > Eps || Abs(Last - 2.*M_PI) > Eps,
- "Adaptor3d_SurfaceOfRevolution : UTrim : Parameters out of range");
-
- Handle(Adaptor3d_HSurfaceOfRevolution) HR =
- new Adaptor3d_HSurfaceOfRevolution(*this);
- return HR;
-}
-
-
-//=======================================================================
-//function : VTrim
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfRevolution::VTrim
-(const Standard_Real First,
- const Standard_Real Last,
- const Standard_Real Tol) const
-{
- Handle(Adaptor3d_HSurfaceOfRevolution) HR =
- new Adaptor3d_HSurfaceOfRevolution(*this);
- Handle(Adaptor3d_HCurve) HC = BasisCurve()->Trim(First,Last,Tol);
- HR->ChangeSurface().
-Load(HC);
- return HR;
-}
-
-
-//=======================================================================
-//function : IsUClosed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsUClosed() const
-{
- return Standard_True;
-}
-
-//=======================================================================
-//function : IsVClosed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsVClosed() const
-{
- return myBasisCurve->IsClosed();
-}
-
-//=======================================================================
-//function : IsUPeriodic
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsUPeriodic() const
-{
- return Standard_True;
-}
-
-//=======================================================================
-//function : UPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::UPeriod() const
-{
- return 2*M_PI;
-}
-
-//=======================================================================
-//function : IsVPeriodic
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsVPeriodic() const
-{
- return myBasisCurve->IsPeriodic();
-}
-
-//=======================================================================
-//function : VPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::VPeriod() const
-{
- return myBasisCurve->Period();
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-gp_Pnt Adaptor3d_SurfaceOfRevolution::Value(const Standard_Real U,
- const Standard_Real V) const
-{
- gp_Pnt P;
- myBasisCurve->D0(V,P);
- P.Rotate( myAxis, U);
- return P;
-}
-
-//=======================================================================
-//function : D0
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::D0(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P) const
-{
- myBasisCurve->D0(V,P);
- P.Rotate( myAxis, U);
-}
-
-//=======================================================================
-//function : D1
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::D1(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P, gp_Vec& D1U,
- gp_Vec& D1V) const
-{
- myBasisCurve->D1(V,P,D1V);
- Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
-
- D0( U,V,P);
- D1V.Rotate( myAxis, U);
- D1U = R*(myAxeRev.YDirection());
- D1U.Rotate( myAxis, U);
-}
-
-//=======================================================================
-//function : D2
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::D2(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P, gp_Vec& D1U,
- gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V,
- gp_Vec& D2UV) const
-{
- myBasisCurve->D2(V,P,D1V,D2V);
-
- gp_Vec D1 = (myAxeRev.YDirection()).Rotated( myAxis, U);
- gp_Vec D2 = (myAxeRev.XDirection()).Rotated( myAxis, U);
-
- Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
- Standard_Real D1R = D1V * myAxeRev.XDirection(); // D1R = dR/dV
- // et R=AP*XDirection
-
- D0( U,V,P);
- D1V.Rotate( myAxis, U);
- D2V.Rotate( myAxis, U);
- D1U = R * D1;
- D2U = -R * D2;
- D2UV = D1R * D1;
-}
-
-//=======================================================================
-//function : D3
-//purpose :
-//=======================================================================
-
-void Adaptor3d_SurfaceOfRevolution::D3(const Standard_Real U,
- const Standard_Real V,
- gp_Pnt& P,gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV,
- gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV,
- gp_Vec& D3UVV) const
-{
- myBasisCurve->D3(V,P,D1V,D2V,D3V);
-
- gp_Vec D1 = (myAxeRev.YDirection()).Rotated( myAxis, U);
- gp_Vec D2 = (myAxeRev.XDirection()).Rotated( myAxis, U);
-
- Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
- Standard_Real D1R = D1V * myAxeRev.XDirection(); // D1R = dR/dV et
- // R=AP*XDirection
- Standard_Real D2R = D2V * myAxeRev.XDirection();
-
- D0( U,V,P);
- D1V.Rotate( myAxis, U);
- D2V.Rotate( myAxis, U);
- D3V.Rotate( myAxis, U);
- D1U = R * D1;
- D2U = -R * D2;
- D3U = -R * D1;
- D2UV = D1R * D1;
- D3UUV = -D1R * D2;
- D3UVV = D2R * D1;
-}
-
-//=======================================================================
-//function : DN
-//purpose :
-//=======================================================================
-
-gp_Vec Adaptor3d_SurfaceOfRevolution::DN(const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer NU,
- const Standard_Integer NV) const
-{
- if ( (NU+NV)<1 || NU<0 || NV<0) {
- Standard_DomainError::Raise("Adaptor3d_SurfaceOfRevolution::DN");
- }
- else {
- gp_Vec DNv = myBasisCurve->DN( V, NV);
- if ( NU == 0) {
- return DNv.Rotated( myAxis, U);
- }
- else {
- Standard_Real DNR = DNv * myAxeRev.XDirection();
- gp_Vec DNu = ( myAxeRev.XDirection()).Rotated( myAxis, U + NU*M_PI/2);
- return ( DNR * DNu);
- }
- }
- // portage WNT
- return gp_Vec();
-}
-
-//=======================================================================
-//function : UResolution
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::UResolution
-(const Standard_Real R3d) const
-{
- return Precision::Parametric(R3d);
-}
-
-//=======================================================================
-//function : VResolution
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor3d_SurfaceOfRevolution::VResolution
-(const Standard_Real R3d) const
-{
- return myBasisCurve->Resolution(R3d);
-}
-
-//=======================================================================
-//function : GetType
-//purpose :
-//=======================================================================
-
-GeomAbs_SurfaceType Adaptor3d_SurfaceOfRevolution::GetType() const
-{
- Standard_Real TolConf, TolAng;
- GeomAbs_SurfaceType bRet;
- //
- bRet=GeomAbs_SurfaceOfRevolution;
- TolConf = Precision::Confusion();
- TolAng = Precision::Angular();
- //
- switch ( myBasisCurve->GetType()) {
- case GeomAbs_Line: {
- gp_Ax1 Axe = myBasisCurve->Line().Position();
-
- if (myAxis.IsParallel(Axe, TolAng)) {
- bRet=GeomAbs_Cylinder;
- return bRet;
- }
- else if (myAxis.IsNormal( Axe, TolAng)) {
- bRet=GeomAbs_Plane;
- return bRet;
- }
- else {
- Standard_Real uf = myBasisCurve->FirstParameter();
- Standard_Real ul = myBasisCurve->LastParameter();
- Standard_Boolean istrim = (!Precision::IsInfinite(uf) &&
- !Precision::IsInfinite(ul));
- if(istrim){
- gp_Pnt pf = myBasisCurve->Value(uf);
- gp_Pnt pl = myBasisCurve->Value(ul);
- Standard_Real len = pf.Distance(pl);
- //on calcule la distance projetee sur l axe.
- gp_Vec vlin(pf,pl);
- gp_Vec vaxe(myAxis.Direction());
- Standard_Real projlen = Abs(vaxe.Dot(vlin));
- Standard_Real aTolConf = len*TolAng;
- if ((len - projlen) <= aTolConf) {
- bRet=GeomAbs_Cylinder;
- return bRet;
- }
- else if (projlen <= aTolConf) {
- bRet=GeomAbs_Plane;
- return bRet;
- }
- }
- gp_Vec V(myAxis.Location(),
- myBasisCurve->Line().Location());
- gp_Vec W(Axe.Direction());
- if (Abs(V.DotCross(myAxis.Direction(),W)) <= TolConf){
- bRet=GeomAbs_Cone;
- return bRet;
- }
- else {
- return bRet;
- }
- }
- }//case GeomAbs_Line:
- //
- case GeomAbs_Circle: {
-
- Standard_Real MajorRadius, aR;
- gp_Lin aLin(myAxis);
- //
- gp_Circ C = myBasisCurve->Circle();
- const gp_Pnt& aLC = C.Location();
- aR=C.Radius();
- //
-
- if (!C.Position().IsCoplanar(myAxis, TolConf, TolAng)) {
- return bRet;
- }
- else if(aLin.Distance(aLC) <= TolConf) {
- bRet=GeomAbs_Sphere;
- return bRet;
- }
- else {
- MajorRadius = aLin.Distance(aLC);
- if(MajorRadius>aR) {
- //modified by NIZNHY-PKV Thu Feb 24 09:46:29 2011f
- Standard_Real aT, aDx, dX;
- gp_Pnt aPx;
- //
- aT=0.;
- aPx=ElCLib::Value(aT, C);
- aDx=aLin.Distance(aPx);
- dX=aDx-MajorRadius-aR;
- if (dX<0.) {
- dX=-dX;
- }
- if (dX<TolConf) {
- bRet=GeomAbs_Torus;
- }
- //bRet=GeomAbs_Torus;
- //return bRet;
- //modified by NIZNHY-PKV Thu Feb 24 09:52:29 2011t
- }
- return bRet;
- }
- }
- //
- default:
- break;
- }
-
- return bRet;
-}
-
-//=======================================================================
-//function : Plane
-//purpose :
-//=======================================================================
-
-gp_Pln Adaptor3d_SurfaceOfRevolution::Plane() const
-{
- Standard_NoSuchObject_Raise_if
- (GetType() != GeomAbs_Plane, "Adaptor3d_SurfaceOfRevolution:Plane");
-
- gp_Ax3 Axe = myAxeRev;
- gp_Pnt P;
-
- // P = Projection du Point Debut de la generatrice sur l axe de rotation.
- P.SetXYZ((myAxis.Location()).XYZ() +
- (Value(0.,0.).XYZ()-(myAxis.Location()).XYZ()).
- Dot((myAxis.Direction()).XYZ())
- *(myAxis.Direction()).XYZ());
- Axe.SetLocation( P);
- //// modified by jgv, 8.01.03 for OCC1226 ////
- if (Axe.XDirection().
- Dot(myBasisCurve->Line().Direction()) >= -Precision::Confusion()) // > 0.
- Axe.XReverse();
- //////////////////////////////////////////////
-
- return gp_Pln( Axe);
-}
-
-//=======================================================================
-//function : Cylinder
-//purpose :
-//=======================================================================
-
-gp_Cylinder Adaptor3d_SurfaceOfRevolution::Cylinder() const
-{
- Standard_NoSuchObject_Raise_if
- (GetType() != GeomAbs_Cylinder, "Adaptor3d_SurfaceOfRevolution::Cylinder");
-
- gp_Pnt P = Value( 0., 0.);
- Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
- return gp_Cylinder( myAxeRev, R);
-}
-
-//=======================================================================
-//function : Cone
-//purpose :
-//=======================================================================
-
-gp_Cone Adaptor3d_SurfaceOfRevolution::Cone() const
-{
- Standard_NoSuchObject_Raise_if
- ( GetType() != GeomAbs_Cone, "Adaptor3d_SurfaceOfRevolution:Cone");
-
- gp_Ax3 Axe = myAxeRev;
- gp_Dir ldir = (myBasisCurve->Line()).Direction();
- Standard_Real Angle = (Axe.Direction()).Angle(ldir);
- gp_Pnt P0 = Value(0., 0.);
- Standard_Real R = (Axe.Location()).Distance(P0);
- if ( R >= Precision::Confusion()) {
- gp_Pnt O = Axe.Location();
- gp_Vec OP0(O,P0);
- Standard_Real t = OP0.Dot(Axe.XDirection());
- t /= ldir.Dot(Axe.XDirection());
- OP0.Add(-t * gp_Vec(ldir));
- if ( OP0.Dot(Axe.Direction()) > 0.) Angle = -Angle;
- }
- return gp_Cone( Axe, Angle, R);
-}
-
-
-//=======================================================================
-//function : Sphere
-//purpose :
-//=======================================================================
-
-gp_Sphere Adaptor3d_SurfaceOfRevolution::Sphere() const
-{
- Standard_NoSuchObject_Raise_if
- ( GetType() != GeomAbs_Sphere, "Adaptor3d_SurfaceOfRevolution:Sphere");
-
- gp_Circ C = myBasisCurve->Circle();
- gp_Ax3 Axe = myAxeRev;
- Axe.SetLocation( C.Location());
- return gp_Sphere( Axe, C.Radius());
-}
-
-
-//=======================================================================
-//function : Torus
-//purpose :
-//=======================================================================
-
-gp_Torus Adaptor3d_SurfaceOfRevolution::Torus() const
-{
- Standard_NoSuchObject_Raise_if
- (GetType() != GeomAbs_Torus, "Adaptor3d_SurfaceOfRevolution:Torus");
-
- gp_Circ C = myBasisCurve->Circle();
- Standard_Real MajorRadius = gp_Lin(myAxis).Distance(C.Location());
- return gp_Torus( myAxeRev, MajorRadius, C.Radius());
-}
-
-//=======================================================================
-//function : UDegree
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::UDegree() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::UDegree");
- return 0;
-}
-
-//=======================================================================
-//function : NbUPoles
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbUPoles() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::NbUPoles");
- return 0;
-}
-
-//=======================================================================
-//function : VDegree
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::VDegree() const
-{
- return myBasisCurve->Degree();
-}
-
-//=======================================================================
-//function : NbVPoles
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbVPoles() const
-{
- return myBasisCurve -> NbPoles();
-}
-
-//=======================================================================
-//function : NbUKnots
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbUKnots() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::NbUKnots");
- return 0;
-}
-
-
-//=======================================================================
-//function : NbVKnots
-//purpose :
-//=======================================================================
-
-Standard_Integer Adaptor3d_SurfaceOfRevolution::NbVKnots() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::NbVKnots");
- return 0;
-}
-
-
-
-//=======================================================================
-//function : IsURational
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsURational() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::IsURational");
- return Standard_False;
-}
-
-//=======================================================================
-//function : IsVRational
-//purpose :
-//=======================================================================
-
-Standard_Boolean Adaptor3d_SurfaceOfRevolution::IsVRational() const
-{
- Standard_NoSuchObject::Raise("Adaptor3d_SurfaceOfRevolution::IsVRational");
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : Bezier
-//purpose :
-//=======================================================================
-
-Handle(Geom_BezierSurface) Adaptor3d_SurfaceOfRevolution::Bezier() const
-{
- Standard_NoSuchObject::Raise("");
- Handle(Geom_BezierSurface) Dummy;
- return Dummy;
-}
-
-
-//=======================================================================
-//function : BSpline
-//purpose :
-//=======================================================================
-
-Handle(Geom_BSplineSurface) Adaptor3d_SurfaceOfRevolution::BSpline() const
-{
- Standard_NoSuchObject::Raise("");
- Handle(Geom_BSplineSurface) Dummy;
- return Dummy;
-}
-
-
-//=======================================================================
-//function : Axis
-//purpose :
-//=======================================================================
-
-gp_Ax3 Adaptor3d_SurfaceOfRevolution::Axis() const
-{
- return myAxeRev;
-}
-
-//=======================================================================
-//function : Direction
-//purpose :
-//=======================================================================
-
-gp_Dir Adaptor3d_SurfaceOfRevolution::Direction() const
-{
- Standard_NoSuchObject::Raise("");
- return gp_Dir();
-}
-
-
-//=======================================================================
-//function : BasisCurve
-//purpose :
-//=======================================================================
-
-Handle(Adaptor3d_HCurve) Adaptor3d_SurfaceOfRevolution::BasisCurve() const
-{
- return myBasisCurve;
-}
+++ /dev/null
-// Created on: 1993-04-21
-// 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_SurfaceOfRevolution_HeaderFile
-#define _Adaptor3d_SurfaceOfRevolution_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <gp_Ax1.hxx>
-#include <Standard_Boolean.hxx>
-#include <gp_Ax3.hxx>
-#include <Adaptor3d_Surface.hxx>
-#include <Standard_Real.hxx>
-#include <GeomAbs_Shape.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-class Adaptor3d_HCurve;
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Standard_DomainError;
-class gp_Ax1;
-class Adaptor3d_HSurface;
-class gp_Pnt;
-class gp_Vec;
-class gp_Pln;
-class gp_Cylinder;
-class gp_Cone;
-class gp_Sphere;
-class gp_Torus;
-class Geom_BezierSurface;
-class Geom_BSplineSurface;
-class gp_Ax3;
-class gp_Dir;
-
-
-//! This class defines a complete surface of revolution.
-//! The surface is obtained by rotating a curve a complete revolution
-//! about an axis. The curve and the axis must be in the same plane.
-//! If the curve and the axis are not in the same plane it is always
-//! possible to be in the previous case after a cylindrical projection
-//! of the curve in a referenced plane.
-//! For a complete surface of revolution the parametric range is
-//! 0 <= U <= 2*PI. --
-//! The parametric range for V is defined with the revolved curve.
-//! The origin of the U parametrization is given by the position
-//! of the revolved curve (reference). The direction of the revolution
-//! axis defines the positive sense of rotation (trigonometric sense)
-//! corresponding to the increasing of the parametric value U.
-//! The derivatives are always defined for the u direction.
-//! For the v direction the definition of the derivatives depends on
-//! the degree of continuity of the referenced curve.
-//! Curve and Axis are coplanar.
-//! Curve doesn't intersect Axis.
-class Adaptor3d_SurfaceOfRevolution : public Adaptor3d_Surface
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- Standard_EXPORT Adaptor3d_SurfaceOfRevolution();
-
- //! The Curve is loaded.
- Standard_EXPORT Adaptor3d_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C);
-
- //! The Curve and the Direction are loaded.
- Standard_EXPORT Adaptor3d_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C, const gp_Ax1& V);
-
- //! Changes the Curve
- Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
-
- //! Changes the Direction
- Standard_EXPORT void Load (const gp_Ax1& V);
-
- Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real FirstUParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real LastUParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real FirstVParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real LastVParameter() const Standard_OVERRIDE;
-
- Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
-
- //! Return CN.
- Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
-
- //! Returns the number of U intervals for continuity
- //! <S>. May be one if UContinuity(me) >= <S>
- Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the number of V intervals for continuity
- //! <S>. May be one if VContinuity(me) >= <S>
- Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the intervals with the requested continuity
- //! in the U direction.
- Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns the intervals with the requested continuity
- //! in the V direction.
- Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
-
- //! Returns a surface trimmed in the U direction
- //! equivalent of <me> between
- //! parameters <First> and <Last>. <Tol> is used to
- //! test for 3d points confusion.
- //! If <First> >= <Last>
- Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
-
- //! Returns a surface trimmed in the V direction between
- //! parameters <First> and <Last>. <Tol> is used to
- //! test for 3d points confusion.
- //! If <First> >= <Last>
- Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
-
- //! Computes the point of parameters U,V on the surface.
- Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
-
- //! Computes the point of parameters U,V on the surface.
- Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
-
- //! Computes the point and the first derivatives on
- //! the surface.
- //! Raised if the continuity of the current
- //! intervals is not C1.
- Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
-
- //! Computes the point, the first and second
- //! derivatives on the surface.
- //! Raised if the continuity of the current
- //! intervals is not C2.
- Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
-
- //! Computes the point, the first, second and third
- //! derivatives on the surface.
- //! Raised if the continuity of the current
- //! intervals is not C3.
- Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
-
- //! Computes the derivative of order Nu
- //! in the direction U and Nv in the direction V
- //! at the point P(U, V).
- //! Raised if the current U interval is not not CNu
- //! and the current V interval is not CNv.
- //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
- Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
-
- //! Returns the parametric U resolution corresponding
- //! to the real space resolution <R3d>.
- Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
-
- //! Returns the parametric V resolution corresponding
- //! to the real space resolution <R3d>.
- Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
-
- //! Returns the type of the surface : Plane, Cylinder,
- //! Cone, Sphere, Torus, BezierSurface,
- //! BSplineSurface, SurfaceOfRevolution,
- //! SurfaceOfExtrusion, OtherSurface
- Standard_EXPORT GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
-
- //! Apex of the Cone = Cone.Position().Location()
- //! ==> ReferenceRadius = 0.
- Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer UDegree() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbUPoles() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbUKnots() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
-
- Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
-
- Standard_EXPORT gp_Ax3 Axis() const;
-
- Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
-
- Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Handle(Adaptor3d_HCurve) myBasisCurve;
- gp_Ax1 myAxis;
- Standard_Boolean myHaveAxis;
- gp_Ax3 myAxeRev;
-
-
-};
-
-
-
-
-
-
-
-#endif // _Adaptor3d_SurfaceOfRevolution_HeaderFile
Adaptor3d_HSurface.cxx
Adaptor3d_HSurface.hxx
Adaptor3d_HSurface.lxx
-Adaptor3d_HSurfaceOfLinearExtrusion.hxx
-Adaptor3d_HSurfaceOfLinearExtrusion_0.cxx
-Adaptor3d_HSurfaceOfRevolution.hxx
-Adaptor3d_HSurfaceOfRevolution_0.cxx
Adaptor3d_HSurfaceTool.cxx
Adaptor3d_HSurfaceTool.hxx
Adaptor3d_HSurfaceTool.lxx
Adaptor3d_IsoCurve.lxx
Adaptor3d_Surface.cxx
Adaptor3d_Surface.hxx
-Adaptor3d_SurfaceOfLinearExtrusion.cxx
-Adaptor3d_SurfaceOfLinearExtrusion.hxx
-Adaptor3d_SurfaceOfRevolution.cxx
-Adaptor3d_SurfaceOfRevolution.hxx
Adaptor3d_SurfacePtr.hxx
Adaptor3d_TopolTool.cxx
Adaptor3d_TopolTool.hxx
// commercial license or contractual agreement.
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
#include <AppParCurves_MultiCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRepFill_ApproxSeewing.hxx>
Handle(Geom_SurfaceOfRevolution)::DownCast(GS);
Handle(GeomAdaptor_HCurve) HC =
new GeomAdaptor_HCurve(GSRev->BasisCurve());
- Adaptor3d_SurfaceOfRevolution ASRev(HC,GAS.AxeOfRevolution());
+ GeomAdaptor_SurfaceOfRevolution ASRev(HC,GAS.AxeOfRevolution());
Axis = ASRev.Axis();
Phase = EvalPhase(Edge,Face,GAS,Axis);
break;
// commercial license or contractual agreement.
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve();
HC->ChangeCurve().Load(C,First,Last);
- Adaptor3d_SurfaceOfRevolution AS(HC,myAxe);
+ GeomAdaptor_SurfaceOfRevolution AS(HC,myAxe);
switch(AS.GetType()){
case GeomAbs_Plane :
{
// commercial license or contractual agreement.
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
if (myCanonize) {
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(C,First,Last);
- Adaptor3d_SurfaceOfLinearExtrusion AS(HC,D);
+ GeomAdaptor_SurfaceOfLinearExtrusion AS(HC,D);
switch(AS.GetType()){
case GeomAbs_Plane :
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Adaptor3d_HCurveOnSurface.hxx>
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
#include <Approx_CurveOnSurface.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
errStat = Draft_EdgeRecomputation;
break; // leave from while
}
- Adaptor3d_SurfaceOfLinearExtrusion SLE(HCur,Direc);
+ GeomAdaptor_SurfaceOfLinearExtrusion SLE(HCur,Direc);
switch(SLE.GetType()){
case GeomAbs_Plane :
#include <gp_Vec.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_Vector.hxx>
-#include <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
+#include <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
static gp_Ax2 GetPosition (const Handle(Adaptor3d_HCurve)& C);
//=============================================================================
Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt& theP,
- const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& theS,
+ const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
const Standard_Real theUmin,
const Standard_Real theUsup,
const Standard_Real theVmin,
//=============================================================================
Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt& theP,
- const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& theS,
+ const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
const Standard_Real theTolU,
const Standard_Real theTolV)
: myuinf(theS->FirstUParameter()),
//purpose :
//=======================================================================
-void Extrema_ExtPExtS::Initialize (const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& theS,
+void Extrema_ExtPExtS::Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
const Standard_Real theUinf,
const Standard_Real theUsup,
const Standard_Real theVinf,
#include <Extrema_POnSurf.hxx>
#include <Standard_Transient.hxx>
class Adaptor3d_HCurve;
-class Adaptor3d_HSurfaceOfLinearExtrusion;
+class GeomAdaptor_HSurfaceOfLinearExtrusion;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Pnt;
//! It calculates all the distances between a point
//! from gp and a Surface.
- Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
//! It calculates all the distances between a point
//! from gp and a Surface.
- Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV);
//! Initializes the fields of the algorithm.
- Standard_EXPORT void Initialize (const Handle(Adaptor3d_HSurfaceOfLinearExtrusion)& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
Standard_EXPORT void Perform (const gp_Pnt& P);
Standard_Real mytolv;
Extrema_FuncExtPS myF;
Handle(Adaptor3d_HCurve) myC;
- Handle(Adaptor3d_HSurfaceOfLinearExtrusion) myS;
+ Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
gp_Vec myDirection;
gp_Ax2 myPosition;
Extrema_GenExtPS myExtPS;
#include <Adaptor3d_HCurve.hxx>
-#include <Adaptor3d_HSurfaceOfRevolution.hxx>
+#include <GeomAdaptor_HSurfaceOfRevolution.hxx>
#include <ElCLib.hxx>
#include <Extrema_ExtPElC.hxx>
#include <Extrema_ExtPRevS.hxx>
#include <Standard_Type.hxx>
#include <StdFail_NotDone.hxx>
-static gp_Ax2 GetPosition (const Adaptor3d_SurfaceOfRevolution& S)//const Handle(Adaptor_HCurve)& C)
+static gp_Ax2 GetPosition (const GeomAdaptor_SurfaceOfRevolution& S)//const Handle(Adaptor_HCurve)& C)
{
Handle(Adaptor3d_HCurve) C = S.BasisCurve();
//purpose :
//=======================================================================
-static Standard_Boolean HasSingularity(const Adaptor3d_SurfaceOfRevolution& S)
+static Standard_Boolean HasSingularity(const GeomAdaptor_SurfaceOfRevolution& S)
{
const Handle(Adaptor3d_HCurve) C = S.BasisCurve();
//=======================================================================
Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt& theP,
- const Handle(Adaptor3d_HSurfaceOfRevolution)& theS,
+ const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
const Standard_Real theUmin,
const Standard_Real theUsup,
const Standard_Real theVmin,
//=======================================================================
Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt& theP,
- const Handle(Adaptor3d_HSurfaceOfRevolution)& theS,
+ const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
const Standard_Real theTolU,
const Standard_Real theTolV)
{
//purpose :
//=======================================================================
-void Extrema_ExtPRevS::Initialize (const Handle(Adaptor3d_HSurfaceOfRevolution)& theS,
+void Extrema_ExtPRevS::Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
const Standard_Real theUmin,
const Standard_Real theUsup,
const Standard_Real theVmin,
#include <Standard_Integer.hxx>
#include <Extrema_POnSurf.hxx>
#include <Standard_Transient.hxx>
-class Adaptor3d_HSurfaceOfRevolution;
+class GeomAdaptor_HSurfaceOfRevolution;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Pnt;
//! It calculates all the distances between a point
//! from gp and a SurfacePtr from Adaptor3d.
- Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(Adaptor3d_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
//! It calculates all the distances between a point
//! from gp and a SurfacePtr from Adaptor3d.
- Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(Adaptor3d_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV);
- Standard_EXPORT void Initialize (const Handle(Adaptor3d_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
+ Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
Standard_EXPORT void Perform (const gp_Pnt& P);
private:
- Handle(Adaptor3d_HSurfaceOfRevolution) myS;
+ Handle(GeomAdaptor_HSurfaceOfRevolution) myS;
Standard_Real myvinf;
Standard_Real myvsup;
Standard_Real mytolv;
//-----------------------------------------------------------------
-#include <Adaptor3d_HSurfaceOfLinearExtrusion.hxx>
-#include <Adaptor3d_HSurfaceOfRevolution.hxx>
+#include <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
+#include <GeomAdaptor_HSurfaceOfRevolution.hxx>
#include <Adaptor3d_Surface.hxx>
#include <ElCLib.hxx>
#include <Extrema_ExtPExtS.hxx>
{
if (myExtPExtS.IsNull())
{
- Handle(Adaptor3d_HSurfaceOfLinearExtrusion) aS (new Adaptor3d_HSurfaceOfLinearExtrusion (
- Adaptor3d_SurfaceOfLinearExtrusion (myS->BasisCurve(), myS->Direction())));
+ Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) aS (new GeomAdaptor_HSurfaceOfLinearExtrusion (
+ GeomAdaptor_SurfaceOfLinearExtrusion (myS->BasisCurve(), myS->Direction())));
myExtPExtS = new Extrema_ExtPExtS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
}
{
if (myExtPRevS.IsNull())
{
- Handle(Adaptor3d_HSurfaceOfRevolution) aS (new Adaptor3d_HSurfaceOfRevolution (
- Adaptor3d_SurfaceOfRevolution (myS->BasisCurve(), myS->AxeOfRevolution())));
+ Handle(GeomAdaptor_HSurfaceOfRevolution) aS (new GeomAdaptor_HSurfaceOfRevolution (
+ GeomAdaptor_SurfaceOfRevolution (myS->BasisCurve(), myS->AxeOfRevolution())));
myExtPRevS = new Extrema_ExtPRevS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
}
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_IsoType.hxx>
#include <GeomAbs_Shape.hxx>
+#include <GeomEvaluator_OffsetSurface.hxx>
#include <gp.hxx>
#include <gp_Dir.hxx>
#include <gp_GTrsf2d.hxx>
static const Standard_Real MyAngularToleranceForG1 = Precision::Angular();
-//=======================================================================
-//function : derivatives
-//purpose :
-//=======================================================================
-
-static void derivatives(Standard_Integer MaxOrder,
- Standard_Integer MinOrder,
- const Standard_Real U,
- const Standard_Real V,
- const Handle(Geom_Surface)& basisSurf,
- const Standard_Integer Nu,
- const Standard_Integer Nv,
- const Standard_Boolean AlongU,
- const Standard_Boolean AlongV,
- const Handle(Geom_BSplineSurface)& L,
- TColgp_Array2OfVec& DerNUV,
- TColgp_Array2OfVec& DerSurf)
-{
- Standard_Integer i,j;
- gp_Pnt P;
- gp_Vec DL1U, DL1V, DL2U , DL2V , DL2UV ,DL3U, DL3UUV, DL3UVV, DL3V;
-
- if (AlongU || AlongV)
- {
- MaxOrder=0;
- TColgp_Array2OfVec DerSurfL(0,MaxOrder+Nu+1,0,MaxOrder+Nv+1);
- switch (MinOrder)
- {
- case 1 :
- L->D1(U, V, P, DL1U, DL1V);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- break;
- case 2 :
- L->D2(U, V, P, DL1U, DL1V, DL2U , DL2V , DL2UV);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- DerSurfL.SetValue(1, 1, DL2UV);
- DerSurfL.SetValue(2, 0, DL2U);
- DerSurfL.SetValue(0, 2, DL2V);
- break;
- case 3 :
- L->D3(U, V, P, DL1U, DL1V, DL2U , DL2V , DL2UV ,DL3U, DL3V ,DL3UUV, DL3UVV);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- DerSurfL.SetValue(1, 1, DL2UV);
- DerSurfL.SetValue(2, 0, DL2U);
- DerSurfL.SetValue(0, 2, DL2V);
- DerSurfL.SetValue(3, 0, DL3U);
- DerSurfL.SetValue(2, 1, DL3UUV);
- DerSurfL.SetValue(1, 2, DL3UVV);
- DerSurfL.SetValue(0, 3, DL3V);
- break;
- default:
- break;
- }
-
- if(Nu <= Nv)
- {
- for(i=0;i<=MaxOrder+1+Nu;i++)
- for(j=i;j<=MaxOrder+Nv+1;j++)
- if(i+j> MinOrder)
- {
- DerSurfL.SetValue(i,j,L->DN(U,V,i,j));
- DerSurf.SetValue(i,j,basisSurf->DN(U,V,i,j));
- if (i!=j && j <= Nu+1)
- {
- DerSurf.SetValue(j,i,basisSurf->DN(U,V,j,i));
- DerSurfL.SetValue(j,i,L->DN(U,V,j,i));
- }
- }
- }
- else
- {
- for(j=0;j<=MaxOrder+1+Nv;j++)
- for(i=j;i<=MaxOrder+Nu+1;i++)
- if(i+j> MinOrder)
- {
- DerSurfL.SetValue(i,j,L->DN(U,V,i,j));
- DerSurf.SetValue(i,j,basisSurf->DN(U,V,i,j));
- if (i!=j && i <= Nv+1)
- {
- DerSurf.SetValue(j,i,basisSurf->DN(U,V,j,i));
- DerSurfL.SetValue(j,i,L->DN(U,V,j,i));
- }
- }
- }
- for(i=0;i<=MaxOrder+Nu;i++)
- for(j=0;j<=MaxOrder+Nv;j++)
- {
- if (AlongU)
- DerNUV.SetValue(i,j,CSLib::DNNUV(i,j,DerSurfL,DerSurf));
- if (AlongV)
- DerNUV.SetValue(i,j,CSLib::DNNUV(i,j,DerSurf,DerSurfL));
- }
-
- }
- else
- {
-
- for(i=0;i<=MaxOrder+Nu+1;i++)
- for(j=i;j<=MaxOrder+Nv+1;j++)
- if(i+j>MinOrder)
- {
-
- DerSurf.SetValue(i,j,basisSurf->DN(U,V,i,j));
- if (i!=j) DerSurf.SetValue(j,i,basisSurf->DN(U,V,j,i));
- }
- for(i=0;i<=MaxOrder+Nu;i++)
- for(j=0;j<=MaxOrder+Nv;j++)
- {
- DerNUV.SetValue(i,j,CSLib::DNNUV(i,j,DerSurf));
- }
- }
-
-}
//=======================================================================
//function : Copy
}
equivSurf = Surface();
- //
- // Tolerance en dur pour l'instant ,mais on devrait la proposer dans le constructeur
- // et la mettre en champ, on pourrait utiliser par exemple pour l'extraction d'iso
- // et aussi pour les singularite. Pour les surfaces osculatrices, on l'utilise pour
- // detecter si une iso est degeneree.
- const Standard_Real Tol = Precision::Confusion(); //0.0001;
- myOscSurf.Init(basisSurf,Tol);
+
+ if (basisSurf->IsKind(STANDARD_TYPE(Geom_BSplineSurface)) ||
+ basisSurf->IsKind(STANDARD_TYPE(Geom_BezierSurface)))
+ {
+ // Tolerance en dur pour l'instant ,mais on devrait la proposer dans le constructeur
+ // et la mettre en champ, on pourrait utiliser par exemple pour l'extraction d'iso
+ // et aussi pour les singularite. Pour les surfaces osculatrices, on l'utilise pour
+ // detecter si une iso est degeneree.
+ const Standard_Real Tol = Precision::Confusion(); //0.0001;
+ myOscSurf = new Geom_OsculatingSurface(basisSurf, Tol);
+ }
+
+ // Surface value calculator
+ if (equivSurf.IsNull())
+ myEvaluator = new GeomEvaluator_OffsetSurface(basisSurf, offsetValue, myOscSurf);
}
//=======================================================================
{
offsetValue = D;
equivSurf = Surface();
+ if (equivSurf.IsNull())
+ {
+ if (myEvaluator.IsNull())
+ myEvaluator = new GeomEvaluator_OffsetSurface(basisSurf, offsetValue, myOscSurf);
+ else
+ myEvaluator->SetOffsetValue(offsetValue);
+ }
}
//=======================================================================
void Geom_OffsetSurface::UReverse ()
{
- basisSurf->UReverse();
+ basisSurf->UReverse();
offsetValue = -offsetValue;
- if(!equivSurf.IsNull()) equivSurf->UReverse();
+ if (!equivSurf.IsNull())
+ equivSurf->UReverse();
+ else
+ myEvaluator->SetOffsetValue(offsetValue);
}
//=======================================================================
{
basisSurf->VReverse();
offsetValue = -offsetValue;
- if(!equivSurf.IsNull()) equivSurf->VReverse();
+ if (!equivSurf.IsNull())
+ equivSurf->VReverse();
+ else
+ myEvaluator->SetOffsetValue(offsetValue);
}
//=======================================================================
void Geom_OffsetSurface::D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const
{
- gp_Vec D1U, D1V;
#ifdef CHECK
if (myBasisSurfContinuity == GeomAbs_C0)
Geom_UndefinedValue::Raise();
#endif
- if (equivSurf.IsNull()){
- basisSurf->D1(U, V, P, D1U, D1V);
- SetD0(U,V,P,D1U,D1V);
- }
+ if (equivSurf.IsNull())
+ myEvaluator->D0(U, V, P);
else
equivSurf->D0(U,V,P);
}
myBasisSurfContinuity == GeomAbs_C1)
Geom_UndefinedDerivative::Raise();
#endif
- if (equivSurf.IsNull())
- {
- gp_Vec d2u, d2v, d2uv;
- basisSurf->D2(U, V, P, D1U, D1V, d2u, d2v, d2uv);
- SetD1(U,V,P,D1U,D1V,d2u,d2v,d2uv);
- }
+ if (equivSurf.IsNull())
+ myEvaluator->D1(U, V, P, D1U, D1V);
else
equivSurf->D1(U,V,P,D1U,D1V);
}
Geom_UndefinedDerivative::Raise();
#endif
if (equivSurf.IsNull())
- {
- gp_Vec d3u, d3uuv, d3uvv, d3v;
- basisSurf->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, d3u, d3v, d3uuv, d3uvv);
- SetD2(U,V,P,D1U,D1V,D2U,D2V,D2UV,d3u,d3v,d3uuv,d3uvv);
- }
+ myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
else
equivSurf->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
}
}
#endif
if (equivSurf.IsNull())
- {
- basisSurf->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
- SetD3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
- }
+ myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
else
equivSurf->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
}
gp_Vec D(0,0,0);
if (equivSurf.IsNull())
- {
- gp_Pnt P;
- gp_Vec D1U,D1V;
- basisSurf->D1 (U, V, P, D1U, D1V);
-
- D = SetDN(U,V,Nu,Nv,D1U,D1V);
- }
+ D = myEvaluator->DN(U, V, Nu, Nv);
else
D = equivSurf->DN(U,V,Nu,Nv);
return D;
}
-//=======================================================================
-//function : D1
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::D1
- (const Standard_Real U, const Standard_Real V,
- gp_Pnt& P, gp_Pnt& Pbasis,
- gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis,
- gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis) const
-{
- const GeomAbs_Shape basisCont = basisSurf->Continuity();
- if (basisCont == GeomAbs_C0 || basisCont == GeomAbs_C1)
- Geom_UndefinedDerivative::Raise();
- basisSurf->D2 (U, V, Pbasis, D1Ubasis, D1Vbasis, D2Ubasis, D2Vbasis, D2UVbasis);
- gp_Vec Ndir = D1Ubasis.Crossed (D1Vbasis);
- const Standard_Real R2 = Ndir.SquareMagnitude();
- const Standard_Real R = Sqrt (R2);
- const Standard_Real R3 = R * R2;
- gp_Vec DUNdir = D2Ubasis.Crossed (D1Vbasis);
- DUNdir.Add (D1Ubasis.Crossed (D2UVbasis));
- gp_Vec DVNdir = D2UVbasis.Crossed (D1Vbasis);
- DVNdir.Add (D1Ubasis.Crossed (D2Vbasis));
- const Standard_Real DRu = Ndir.Dot (DUNdir);
- const Standard_Real DRv = Ndir.Dot (DVNdir);
- if (R3 <= gp::Resolution()) {
- if (R2 <= gp::Resolution())
- Geom_UndefinedDerivative::Raise();
- DUNdir.Multiply(R);
- DUNdir.Subtract (Ndir.Multiplied (DRu/R));
- DUNdir.Multiply (offsetValue/R2);
- D1U = D1Ubasis.Added (DUNdir);
- DVNdir.Multiply(R);
- DVNdir.Subtract (Ndir.Multiplied (DRv/R));
- DVNdir.Multiply (offsetValue/R2);
- D1V = D1Vbasis.Added (DVNdir);
- }
- else {
- DUNdir.Multiply (offsetValue / R);
- DUNdir.Subtract (Ndir.Multiplied (offsetValue*DRu/R3));
- D1U = D1Ubasis.Added (DUNdir);
- DVNdir.Multiply (offsetValue / R);
- DVNdir.Subtract (Ndir.Multiplied (offsetValue*DRv/R3));
- D1V = D1Vbasis.Added (DVNdir);
- }
- Ndir.Multiply (offsetValue/R);
- P.SetXYZ ((Ndir.XYZ()).Added (Pbasis.XYZ()));
-}
-
-//=======================================================================
-//function : D2
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::D2
- (const Standard_Real U, const Standard_Real V,
- gp_Pnt& P, gp_Pnt& Pbasis,
- gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV,
- gp_Vec& D1Ubasis, gp_Vec& D1Vbasis,
- gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis,
- gp_Vec& D3Ubasis, gp_Vec& D3Vbasis, gp_Vec& D3UUVbasis, gp_Vec& D3UVVbasis) const
-{
- const GeomAbs_Shape basisCont = basisSurf->Continuity();
- if (basisCont == GeomAbs_C0 || basisCont == GeomAbs_C1 || basisCont == GeomAbs_C2)
- Geom_UndefinedDerivative::Raise();
- basisSurf->D3 (U, V, P, D1Ubasis, D1Vbasis, D2Ubasis, D2Vbasis, D2UVbasis, D3Ubasis, D3Vbasis, D3UUVbasis, D3UVVbasis);
- gp_Vec Ndir = D1Ubasis.Crossed (D1Vbasis);
- const Standard_Real R2 = Ndir.SquareMagnitude();
- const Standard_Real R = Sqrt (R2);
- const Standard_Real R3 = R2 * R;
- const Standard_Real R4 = R2 * R2;
- const Standard_Real R5 = R3 * R2;
- gp_Vec DUNdir = D2Ubasis.Crossed (D1Vbasis);
- DUNdir.Add (D1Ubasis.Crossed (D2UVbasis));
- gp_Vec DVNdir = D2UVbasis.Crossed (D1Vbasis);
- DVNdir.Add (D1Ubasis.Crossed (D2Vbasis));
- const Standard_Real DRu = Ndir.Dot (DUNdir);
- const Standard_Real DRv = Ndir.Dot (DVNdir);
- gp_Vec D2UNdir = D3Ubasis.Crossed (D1Vbasis);
- D2UNdir.Add (D1Ubasis.Crossed (D3UUVbasis));
- D2UNdir.Add (2.0 * (D2Ubasis.Crossed (D2UVbasis)));
- gp_Vec D2VNdir = D3UVVbasis.Crossed (D1Vbasis);
- D2VNdir.Add (D1Ubasis.Crossed (D3Vbasis));
- D2VNdir.Add (2.0 * (D2UVbasis.Crossed (D2Vbasis)));
- gp_Vec D2UVNdir = D2UVbasis.Crossed (D1Vbasis);
- D2UVNdir.Add (D1Ubasis.Crossed (D3UVVbasis));
- D2UVNdir.Add (D2Ubasis.Crossed (D2Vbasis));
- const Standard_Real D2Ru = Ndir.Dot (D2UNdir) + DUNdir.Dot (DUNdir);
- const Standard_Real D2Rv = Ndir.Dot (D2VNdir) + DVNdir.Dot (DVNdir);
- const Standard_Real D2Ruv = DVNdir.Dot (DUNdir) + Ndir.Dot (D2UVNdir);
-
- if (R5 <= gp::Resolution()) {
- //We try another computation but the stability is not very good
- //dixit ISG.
- if (R4 <= gp::Resolution()) Geom_UndefinedDerivative::Raise();
- // V2 = P" (U) :
- // Standard_Real R4 = R2 * R2;
- D2UNdir.Subtract (DUNdir.Multiplied (2.0 * DRu / R2));
- D2UNdir.Subtract (Ndir.Multiplied (D2Ru/R2));
- D2UNdir.Add (Ndir.Multiplied (3.0 * DRu * DRu / R4));
- D2UNdir.Multiply (offsetValue / R);
- D2U = D2Ubasis.Added (D2UNdir);
- D2VNdir.Subtract (DVNdir.Multiplied (2.0 * DRv / R2));
- D2VNdir.Subtract (Ndir.Multiplied (D2Rv/R2));
- D2VNdir.Add (Ndir.Multiplied (3.0 * DRv * DRv / R4));
- D2VNdir.Multiply (offsetValue / R);
- D2V = D2Vbasis.Added (D2VNdir);
-
- D2UVNdir.Subtract (DUNdir.Multiplied (DRv / R2));
- D2UVNdir.Subtract (DVNdir.Multiplied (DRu / R2));
- D2UVNdir.Subtract (Ndir.Multiplied (D2Ruv / R2));
- D2UVNdir.Add (Ndir.Multiplied (3.0 * DRu * DRv / R4));
- D2UVNdir.Multiply (offsetValue / R);
- D2UV = D2UVbasis.Added (D2UVNdir);
-
- DUNdir.Multiply(R);
- DUNdir.Subtract (Ndir.Multiplied (DRu/R));
- DUNdir.Multiply (offsetValue/R2);
- D1U = D1Ubasis.Added (DUNdir);
- DVNdir.Multiply(R);
- DVNdir.Subtract (Ndir.Multiplied (DRv/R));
- DVNdir.Multiply (offsetValue/R2);
- D1V = D1Vbasis.Added (DVNdir);
- }
- else {
- D2UNdir.Multiply (offsetValue/R);
- D2UNdir.Subtract (DUNdir.Multiplied (2.0 * offsetValue * DRu / R3));
- D2UNdir.Subtract (Ndir.Multiplied (offsetValue * D2Ru / R3));
- D2UNdir.Add (Ndir.Multiplied (offsetValue * 3.0 * DRu * DRu / R5));
- D2U = D2Ubasis.Added (D2UNdir);
-
- D2VNdir.Multiply (offsetValue/R);
- D2VNdir.Subtract (DVNdir.Multiplied (2.0 * offsetValue * DRv / R3));
- D2VNdir.Subtract (Ndir.Multiplied (offsetValue * D2Rv / R3));
- D2VNdir.Add (Ndir.Multiplied (offsetValue * 3.0 * DRv * DRv / R5));
- D2V = D2Vbasis.Added (D2VNdir);
-
- D2UVNdir.Multiply (offsetValue/R);
- D2UVNdir.Subtract (DUNdir.Multiplied (offsetValue * DRv / R3));
- D2UVNdir.Subtract (DVNdir.Multiplied (offsetValue * DRu / R3));
- D2UVNdir.Subtract (Ndir.Multiplied (offsetValue * D2Ruv / R3));
- D2UVNdir.Add (Ndir.Multiplied (3.0 * offsetValue * DRu * DRv / R5));
- D2UV = D2UVbasis.Added (D2UVNdir);
-
- DUNdir.Multiply (offsetValue / R);
- DUNdir.Subtract (Ndir.Multiplied (offsetValue*DRu/R3));
- D1U = D1Ubasis.Added (DUNdir);
- DVNdir.Multiply (offsetValue / R);
- DVNdir.Subtract (Ndir.Multiplied (offsetValue*DRv/R3));
- D1V = D1Vbasis.Added (DVNdir);
- }
- Ndir.Multiply (offsetValue/R);
- P.SetXYZ ((Ndir.XYZ()).Added (Pbasis.XYZ()));
-}
-
-//=======================================================================
-//function : LocalD0
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::LocalD0 (const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- gp_Pnt& P) const
-{
- if (equivSurf.IsNull()) {
- gp_Vec D1U, D1V;
- Handle(Geom_Surface) Basis = basisSurf;
-
- // if Basis is Trimmed we take the basis's basis
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(Basis);
- if (!RTS.IsNull())
- Basis = RTS->BasisSurface();
-
- // BSpline case
- Handle(Geom_BSplineSurface) BSplS =
- Handle(Geom_BSplineSurface)::DownCast(Basis);
- if (!BSplS.IsNull()) {
- gp_Vec D2U,D2V,D2UV, D3U,D3V,D3UUV,D3UVV;
- LocateSides(U,V,USide,VSide,BSplS,1,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD0(U,V,P,D1U,D1V);
- return;
- }
-
- // Extrusion case
- Handle( Geom_SurfaceOfLinearExtrusion) SE =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Basis);
- if (!SE.IsNull()) {
- SE->LocalD1(U,V,USide,P,D1U,D1V);
- SetD0(U,V,P,D1U,D1V);
- return;
- }
-
- // Revolution case
- Handle(Geom_SurfaceOfRevolution) SR =
- Handle(Geom_SurfaceOfRevolution)::DownCast(Basis);
- if (!SR.IsNull()) {
- SR->LocalD1(U,V,VSide,P,D1U,D1V);
- SetD0(U,V,P,D1U,D1V);
- return;
- }
-
- // General cases
- basisSurf->D1(U, V, P, D1U, D1V);
- SetD0(U,V,P,D1U,D1V);
- }
- else
- equivSurf-> D0(U,V,P);
-}
-
-//=======================================================================
-//function : LocalD1
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::LocalD1 (const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V) const
-{
- if (equivSurf.IsNull()) {
- gp_Vec D2U,D2V,D2UV ;
- Handle(Geom_Surface) Basis = basisSurf;
-
- // if Basis is Trimmed we take the basis's basis
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(Basis);
- if (!RTS.IsNull())
- Basis = RTS->BasisSurface();
-
- // BSpline case
- Handle(Geom_BSplineSurface) BSplS =
- Handle(Geom_BSplineSurface)::DownCast(Basis);
- if (!BSplS.IsNull()) {
- gp_Vec D3U,D3V,D3UUV,D3UVV;
- LocateSides(U,V,USide,VSide,BSplS,2,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD1(U,V,P,D1U,D1V,D2U,D2V,D2UV);
- return;
- }
-
- // Extrusion case
- Handle( Geom_SurfaceOfLinearExtrusion) SE =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Basis);
- if (!SE.IsNull()) {
- SE->LocalD2(U,V,USide,P,D1U,D1V,D2U,D2V,D2UV);
- SetD1(U,V,P,D1U,D1V,D2U,D2V,D2UV);
- return;
- }
-
- // Revolution case
- Handle(Geom_SurfaceOfRevolution) SR =
- Handle(Geom_SurfaceOfRevolution)::DownCast(Basis);
- if (!SR.IsNull()) {
- SR->LocalD2(U,V,VSide,P,D1U,D1V,D2U,D2V,D2UV);
- SetD1(U,V,P,D1U,D1V,D2U,D2V,D2UV);
- return;
- }
-
- // General cases
- basisSurf->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
- SetD1(U,V,P,D1U,D1V,D2U,D2V,D2UV);
- }
- else
- equivSurf->D1(U,V,P,D1U,D1V);
-}
-
-//=======================================================================
-//function : LocalD2
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::LocalD2 (const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const
-{
- if (equivSurf.IsNull()) {
- Handle(Geom_Surface) Basis = basisSurf;
- gp_Vec D3U,D3V,D3UUV,D3UVV;
-
- // if Basis is Trimmed we take the basis's basis
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(Basis);
- if (!RTS.IsNull())
- Basis = RTS->BasisSurface();
-
- // BSpline case
- Handle(Geom_BSplineSurface) BSplS =
- Handle(Geom_BSplineSurface)::DownCast(Basis);
- if (!BSplS.IsNull()) {
- LocateSides(U,V,USide,VSide,BSplS,3,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD2(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // Extrusion case
- Handle(Geom_SurfaceOfLinearExtrusion) SE =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Basis);
- if (!SE.IsNull()) {
- SE->LocalD3(U,V,USide,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD2(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // Revolution case
- Handle(Geom_SurfaceOfRevolution) SR =
- Handle(Geom_SurfaceOfRevolution)::DownCast(Basis);
- if (!SR.IsNull()) {
- SR->LocalD3(U,V,VSide,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD2(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // General cases
- basisSurf->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
- SetD2(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- }
- else
- equivSurf->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
-}
-
-//=======================================================================
-//function : LocalD3
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::LocalD3 (const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV,
- gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const
-{
- if (equivSurf.IsNull()) {
- Handle(Geom_Surface) Basis = basisSurf;
-
- // if Basis is Trimmed we take the basis's basis
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(Basis);
- if (!RTS.IsNull())
- Basis = RTS->BasisSurface();
-
- // BSpline case
- Handle(Geom_BSplineSurface) BSplS =
- Handle(Geom_BSplineSurface)::DownCast(Basis);
- if (!BSplS.IsNull()) {
- LocateSides(U,V,USide,VSide,BSplS,3,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // Extrusion case
- Handle(Geom_SurfaceOfLinearExtrusion) SE =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Basis);
- if (!SE.IsNull()) {
- SE->LocalD3(U,V,USide,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // Revolution case
- Handle(Geom_SurfaceOfRevolution) SR =
- Handle(Geom_SurfaceOfRevolution)::DownCast(Basis);
- if (!SR.IsNull()) {
- SR->LocalD3(U,V,VSide,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return;
- }
-
- // General cases
- basisSurf->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- SetD3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- }
- else
- equivSurf->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
-}
-
-//=======================================================================
-//function : LocalDN
-//purpose :
-//=======================================================================
-
-gp_Vec Geom_OffsetSurface::LocalDN (const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- const Standard_Integer Nu, const Standard_Integer Nv) const
-{
- if(equivSurf.IsNull()) {
-
- gp_Vec D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV;
- gp_Pnt P;
- Handle(Geom_Surface) Basis = basisSurf;
-
- // if Basis is Trimmed we make the basis`s basis
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(Basis);
- if (!RTS.IsNull())
- Basis = RTS -> BasisSurface();
-
- //BSpline case
- Handle(Geom_BSplineSurface) BSplS =
- Handle(Geom_BSplineSurface)::DownCast(Basis);
- if(!BSplS.IsNull()) {
- LocateSides(U,V,USide,VSide,BSplS,1,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- return SetDN(U,V,Nu,Nv,D1U,D1V);
- }
-
- //Extrusion case
- Handle( Geom_SurfaceOfLinearExtrusion) SE =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Basis);
- if(!SE.IsNull()) {
- SE->LocalD1(U,V,USide,P,D1U,D1V);
- return SetDN(U,V,Nu,Nv,D1U,D1V);
- }
-
- //Revolution case
- Handle(Geom_SurfaceOfRevolution) SR =
- Handle(Geom_SurfaceOfRevolution)::DownCast(Basis);
- if(!SR.IsNull()) {
- SR->LocalDN(U,V,VSide,Nu,Nv);
- return SetDN(U,V,Nu,Nv,D1U,D1V);
- }
-
- //General cases
- basisSurf->DN(U,V,Nu,Nv);
- return SetDN(U,V,Nu,Nv,D1U,D1V);
- }
- else
- return equivSurf->DN(U,V,Nu,Nv);
-}
-
-//=======================================================================
-//function : LocateSides
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::LocateSides(const Standard_Real U, const Standard_Real V,
- const Standard_Integer USide, const Standard_Integer VSide,
- const Handle(Geom_BSplineSurface)& BSplS,
- const Standard_Integer NDir,
- gp_Pnt& P,
- gp_Vec& D1U,gp_Vec& D1V,
- gp_Vec& D2U,gp_Vec& D2V,gp_Vec& D2UV,
- gp_Vec& D3U,gp_Vec& D3V,gp_Vec& D3UUV,gp_Vec& D3UVV) const
-{
- Standard_Boolean UIsKnot=Standard_False, VIsKnot=Standard_False;
- Standard_Integer Ideb, Ifin, IVdeb, IVfin;
- const Standard_Real ParTol=Precision::PConfusion()/10.;
- BSplS->Geom_BSplineSurface::LocateU(U,ParTol,Ideb, Ifin, Standard_False);
- BSplS->Geom_BSplineSurface::LocateV(V,ParTol,IVdeb,IVfin,Standard_False);
-
- if(Ideb == Ifin ) { //knot
-
- if(USide == 1) {Ifin++; UIsKnot=Standard_True;}
- else if(USide == -1) {Ideb--; UIsKnot=Standard_True;}
- else {Ideb--; Ifin++;} //USide == 0
-
- }
-
- if(Ideb < BSplS->FirstUKnotIndex()) {Ideb = BSplS->FirstUKnotIndex(); Ifin = Ideb + 1;}
-
- if(Ifin > BSplS->LastUKnotIndex()) {Ifin = BSplS->LastUKnotIndex(); Ideb = Ifin - 1;}
-
- if(IVdeb == IVfin ) { //knot
-
- if(VSide == 1) {IVfin++; VIsKnot=Standard_True;}
- else if(VSide == -1) {IVdeb--; VIsKnot=Standard_True;}
- else {IVdeb--; IVfin++;} //VSide == 0
-
- }
-
- if(IVdeb < BSplS->FirstVKnotIndex()) {IVdeb = BSplS->FirstVKnotIndex(); IVfin = IVdeb + 1;}
-
- if(IVfin > BSplS->LastVKnotIndex()) {IVfin = BSplS->LastVKnotIndex(); IVdeb = IVfin - 1;}
-
- if((UIsKnot)||(VIsKnot))
- switch(NDir)
- {
- case 0 : BSplS->Geom_BSplineSurface::LocalD0(U,V,Ideb,Ifin,IVdeb,IVfin,P); break;
- case 1 : BSplS->Geom_BSplineSurface::LocalD1(U,V,Ideb,Ifin,IVdeb,IVfin,P,D1U,D1V); break;
- case 2 : BSplS->Geom_BSplineSurface::LocalD2(U,V,Ideb,Ifin,IVdeb,IVfin,P,D1U,D1V,D2U,D2V,D2UV); break;
- case 3 : BSplS->Geom_BSplineSurface::LocalD3(U,V,Ideb,Ifin,IVdeb,IVfin,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV); break;
- }
- else
- switch(NDir)
- {
- case 0 : basisSurf->D0(U,V,P); break;
- case 1 : basisSurf->D1(U,V,P,D1U,D1V); break;
- case 2 : basisSurf->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV); break;
- case 3 : basisSurf->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV); break;
- }
-}
////*************************************************
////
return equivSurf->UIso(UU);
}
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-void Geom_OffsetSurface::Value
- (const Standard_Real U, const Standard_Real V,
- gp_Pnt& P, gp_Pnt& ,
- gp_Vec& D1Ubasis, gp_Vec& D1Vbasis) const
-{
- if (myBasisSurfContinuity == GeomAbs_C0)
- Geom_UndefinedValue::Raise();
-
- SetD0(U,V,P,D1Ubasis,D1Vbasis);
-}
-
//=======================================================================
//function : VIso
//purpose :
basisSurf->Transform (T);
offsetValue *= T.ScaleFactor();
equivSurf.Nullify();
+ if (myEvaluator.IsNull())
+ myEvaluator = new GeomEvaluator_OffsetSurface(basisSurf, offsetValue, myOscSurf);
+ else
+ myEvaluator->SetOffsetValue(offsetValue);
}
//=======================================================================
Standard_Boolean Geom_OffsetSurface::UOsculatingSurface(const Standard_Real U, const Standard_Real V,
Standard_Boolean& t, Handle(Geom_BSplineSurface)& L) const
{
- return myOscSurf.UOscSurf(U,V,t,L);
+ return !myOscSurf.IsNull() && myOscSurf->UOscSurf(U,V,t,L);
}
//=======================================================================
Standard_Boolean Geom_OffsetSurface::VOsculatingSurface(const Standard_Real U, const Standard_Real V,
Standard_Boolean& t, Handle(Geom_BSplineSurface)& L) const
{
- return myOscSurf.VOscSurf(U,V,t,L);
-}
-
-//=======================================================================
-//function :
-//purpose : private
-//=======================================================================
-
-void Geom_OffsetSurface::SetD0(const Standard_Real U, const Standard_Real V,
- gp_Pnt& P,
- const gp_Vec& D1U, const gp_Vec& D1V) const // First Derivative
-{
- const Standard_Real MagTol=0.000000001;
-
- gp_Vec aNorm = D1U.Crossed(D1V);
- if (aNorm.SquareMagnitude() > MagTol * MagTol)
- {
- // Non singular case. Simple computations.
- aNorm.Normalize();
- P.SetXYZ(P.XYZ() + offsetValue * aNorm.XYZ());
- }
- else
- {
- Standard_Boolean AlongU = Standard_False,
- AlongV = Standard_False;
- Handle(Geom_BSplineSurface) L;
- Standard_Boolean IsOpposite=Standard_False;
- AlongU = UOsculatingSurface(U,V,IsOpposite,L);
- AlongV = VOsculatingSurface(U,V,IsOpposite,L);
- gp_Dir Normal;
- CSLib_NormalStatus NStatus;
- Standard_Integer MaxOrder=3;
- TColgp_Array2OfVec DerNUV(0,MaxOrder,0,MaxOrder);
- TColgp_Array2OfVec DerSurf(0,MaxOrder+1,0,MaxOrder+1);
- Standard_Integer OrderU,OrderV;
- Standard_Real Umin,Umax,Vmin,Vmax;
- Bounds(Umin,Umax,Vmin,Vmax);
- DerSurf.SetValue(1, 0, D1U);
- DerSurf.SetValue(0, 1, D1V);
- derivatives(MaxOrder,1,U,V,basisSurf,0,0,AlongU,AlongV,L,DerNUV,DerSurf);
-
- Standard_Real signe = 1.0;
- if ((AlongV || AlongU) && IsOpposite)
- signe = -1;
-
- CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
- if (NStatus == CSLib_Defined)
- P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
- else
- {
- if (NStatus == CSLib_InfinityOfSolutions &&
- D1U.SquareMagnitude() + D1V.SquareMagnitude() > MagTol * MagTol)
- {
- // Use non-null derivative as normal direction in degenerated case.
- aNorm = D1U.SquareMagnitude() > MagTol * MagTol ? D1U : D1V;
- aNorm.Normalize();
-
- P.SetXYZ(P.XYZ() + offsetValue * signe * aNorm.XYZ());
- return;
- }
- Geom_UndefinedValue::Raise();
- }
- }
-}
-
-//=======================================================================
-//function :
-//purpose : private
-//=======================================================================/
-
-void Geom_OffsetSurface::SetD1(const Standard_Real U, const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V, // First derivative
- const gp_Vec& D2UU, const gp_Vec& D2VV, const gp_Vec& D2UV) const // Second derivative
-{
- const Standard_Real MagTol=0.000000001;
-
- // Check offset side.
- Handle(Geom_BSplineSurface) L;
- Standard_Boolean AlongU = Standard_False,
- AlongV = Standard_False;
- Standard_Boolean IsOpposite=Standard_False;
- AlongU = UOsculatingSurface(U,V,IsOpposite,L);
- AlongV = VOsculatingSurface(U,V,IsOpposite,L);
- Standard_Real signe = 1.0;
- if ((AlongV || AlongU) && IsOpposite)
- signe = -1.0;
-
- Standard_Integer MaxOrder = 0;
- gp_Vec aNorm = D1U.Crossed(D1V);
- if (aNorm.SquareMagnitude() > MagTol * MagTol)
- {
- MaxOrder=0;
-
- if (!AlongV && !AlongU)
- {
- // AlongU or AlongV leads to more complex D1 computations,
- // try to compute D0 and D1 much simpler.
- aNorm.Normalize();
- P.SetXYZ(P.XYZ() + offsetValue * signe * aNorm.XYZ());
-
- gp_Vec aN0(aNorm.XYZ()), aN1U, aN1V;
- Standard_Real aScale = (D1U^D1V).Dot(aN0);
- aN1U.SetX(D2UU.Y() * D1V.Z() + D1U.Y() * D2UV.Z()
- - D2UU.Z() * D1V.Y() - D1U.Z() * D2UV.Y());
- aN1U.SetY((D2UU.X() * D1V.Z() + D1U.X() * D2UV.Z()
- - D2UU.Z() * D1V.X() - D1U.Z() * D2UV.X() ) * -1.0);
- aN1U.SetZ(D2UU.X() * D1V.Y() + D1U.X() * D2UV.Y()
- - D2UU.Y() * D1V.X() - D1U.Y() * D2UV.X());
- Standard_Real aScaleU = aN1U.Dot(aN0);
- aN1U.Subtract(aScaleU * aN0);
- aN1U /= aScale;
-
- aN1V.SetX(D2UV.Y() * D1V.Z() + D2VV.Z() * D1U.Y()
- - D2UV.Z() * D1V.Y() - D2VV.Y() * D1U.Z());
- aN1V.SetY((D2UV.X() * D1V.Z() + D2VV.Z() * D1U.X()
- - D2UV.Z() * D1V.X() - D2VV.X() * D1U.Z()) * -1.0);
- aN1V.SetZ(D2UV.X() * D1V.Y() + D2VV.Y() * D1U.X()
- - D2UV.Y() * D1V.X() - D2VV.X() * D1U.Y());
- Standard_Real aScaleV = aN1V.Dot(aN0);
- aN1V.Subtract(aScaleV * aN0);
- aN1V /= aScale;
-
- D1U += offsetValue * signe * aN1U;
- D1V += offsetValue * signe * aN1V;
-
- return;
- }
- }
- else
- MaxOrder=3;
-
- Standard_Integer OrderU,OrderV;
- TColgp_Array2OfVec DerNUV(0,MaxOrder+1,0,MaxOrder+1);
- TColgp_Array2OfVec DerSurf(0,MaxOrder+2,0,MaxOrder+2);
- Standard_Real Umin,Umax,Vmin,Vmax;
- Bounds(Umin,Umax,Vmin,Vmax);
- DerSurf.SetValue(1, 0, D1U);
- DerSurf.SetValue(0, 1, D1V);
- DerSurf.SetValue(1, 1, D2UV);
- DerSurf.SetValue(2, 0, D2UU);
- DerSurf.SetValue(0, 2, D2VV);
- derivatives(MaxOrder,2,U,V,basisSurf,1,1,AlongU,AlongV,L,DerNUV,DerSurf);
-
- gp_Dir Normal;
- CSLib_NormalStatus NStatus;
- CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
- if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
-
- P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
-
- D1U = DerSurf(1,0)
- + offsetValue * signe * CSLib::DNNormal(1,0,DerNUV,OrderU,OrderV);
- D1V = DerSurf(0,1)
- + offsetValue * signe * CSLib::DNNormal(0,1,DerNUV,OrderU,OrderV);
-}
-
-//=======================================================================
-//function :
-//purpose : private
-//=======================================================================/
-
-void Geom_OffsetSurface::SetD2(const Standard_Real U, const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV,
- const gp_Vec& d3u, const gp_Vec& d3v,
- const gp_Vec& d3uuv, const gp_Vec& d3uvv) const
-{
- const Standard_Real MagTol=0.000000001;
-
- gp_Dir Normal;
- CSLib_NormalStatus NStatus;
- CSLib::Normal (D1U, D1V, MagTol, NStatus, Normal);
-
- const Standard_Integer MaxOrder = (NStatus == CSLib_Defined)? 0 : 3;
- Standard_Integer OrderU,OrderV;
- TColgp_Array2OfVec DerNUV(0,MaxOrder+2,0,MaxOrder+2);
- TColgp_Array2OfVec DerSurf(0,MaxOrder+3,0,MaxOrder+3);
- Standard_Real Umin,Umax,Vmin,Vmax;
- Bounds(Umin,Umax,Vmin,Vmax);
- DerSurf.SetValue(1, 0, D1U);
- DerSurf.SetValue(0, 1, D1V);
- DerSurf.SetValue(1, 1, D2UV);
- DerSurf.SetValue(2, 0, D2U);
- DerSurf.SetValue(0, 2, D2V);
- DerSurf.SetValue(3, 0, d3u);
- DerSurf.SetValue(2, 1, d3uuv);
- DerSurf.SetValue(1, 2, d3uvv);
- DerSurf.SetValue(0, 3, d3v);
- //*********************
-
- Handle(Geom_BSplineSurface) L;
- Standard_Boolean IsOpposite=Standard_False;
- const Standard_Boolean AlongU = UOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Boolean AlongV = VOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Real signe = ((AlongV || AlongU) && IsOpposite)? -1. : 1.;
- derivatives(MaxOrder,3,U,V,basisSurf,2,2,AlongU,AlongV,L,DerNUV,DerSurf);
-
- CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
- if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
-
- P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
-
- D1U = DerSurf(1,0)
- + offsetValue * signe * CSLib::DNNormal(1,0,DerNUV,OrderU,OrderV);
- D1V = DerSurf(0,1)
- + offsetValue * signe * CSLib::DNNormal(0,1,DerNUV,OrderU,OrderV);
-
- D2U = basisSurf->DN(U,V,2,0)
- + signe * offsetValue * CSLib::DNNormal(2,0,DerNUV,OrderU,OrderV);
- D2V = basisSurf->DN(U,V,0,2)
- + signe * offsetValue * CSLib::DNNormal(0,2,DerNUV,OrderU,OrderV);
- D2UV = basisSurf->DN(U,V,1,1)
- + signe * offsetValue * CSLib::DNNormal(1,1,DerNUV,OrderU,OrderV);
-}
-
-//=======================================================================
-//function :
-//purpose : private
-//=======================================================================/
-
-void Geom_OffsetSurface::SetD3(const Standard_Real U, const Standard_Real V,
- gp_Pnt& P,
- gp_Vec& D1U, gp_Vec& D1V,
- gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV,
- gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const
-{
- const Standard_Real MagTol=0.000000001;
-
- gp_Dir Normal;
- CSLib_NormalStatus NStatus;
- CSLib::Normal (D1U, D1V, MagTol, NStatus, Normal);
- const Standard_Integer MaxOrder = (NStatus == CSLib_Defined)? 0 : 3;
- Standard_Integer OrderU,OrderV;
- TColgp_Array2OfVec DerNUV(0,MaxOrder+3,0,MaxOrder+3);
- TColgp_Array2OfVec DerSurf(0,MaxOrder+4,0,MaxOrder+4);
- Standard_Real Umin,Umax,Vmin,Vmax;
- Bounds(Umin,Umax,Vmin,Vmax);
-
- DerSurf.SetValue(1, 0, D1U);
- DerSurf.SetValue(0, 1, D1V);
- DerSurf.SetValue(1, 1, D2UV);
- DerSurf.SetValue(2, 0, D2U);
- DerSurf.SetValue(0, 2, D2V);
- DerSurf.SetValue(3, 0, D3U);
- DerSurf.SetValue(2, 1, D3UUV);
- DerSurf.SetValue(1, 2, D3UVV);
- DerSurf.SetValue(0, 3, D3V);
-
-
- //*********************
- Handle(Geom_BSplineSurface) L;
- Standard_Boolean IsOpposite=Standard_False;
- const Standard_Boolean AlongU = UOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Boolean AlongV = VOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Real signe = ((AlongV || AlongU) && IsOpposite)? -1. : 1.;
- derivatives(MaxOrder,3,U,V,basisSurf,3,3,AlongU,AlongV,L,DerNUV,DerSurf);
-
- CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
- if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
-
- P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
-
- D1U = DerSurf(1,0)
- + offsetValue * signe * CSLib::DNNormal(1,0,DerNUV,OrderU,OrderV);
- D1V = DerSurf(0,1)
- + offsetValue * signe * CSLib::DNNormal(0,1,DerNUV,OrderU,OrderV);
-
- D2U = basisSurf->DN(U,V,2,0)
- + signe * offsetValue * CSLib::DNNormal(2,0,DerNUV,OrderU,OrderV);
- D2V = basisSurf->DN(U,V,0,2)
- + signe * offsetValue * CSLib::DNNormal(0,2,DerNUV,OrderU,OrderV);
- D2UV = basisSurf->DN(U,V,1,1)
- + signe * offsetValue * CSLib::DNNormal(1,1,DerNUV,OrderU,OrderV);
- D3U = basisSurf->DN(U,V,3,0)
- + signe * offsetValue * CSLib::DNNormal(3,0,DerNUV,OrderU,OrderV);
- D3V = basisSurf->DN(U,V,0,3)
- + signe * offsetValue * CSLib::DNNormal(0,3,DerNUV,OrderU,OrderV);
- D3UUV = basisSurf->DN(U,V,2,1)
- + signe * offsetValue * CSLib::DNNormal(2,1,DerNUV,OrderU,OrderV);
- D3UVV = basisSurf->DN(U,V,1,2)
- + signe * offsetValue * CSLib::DNNormal(1,2,DerNUV,OrderU,OrderV);
-}
-
-//=======================================================================
-//function : SetDN
-//purpose :
-//=======================================================================
-
-gp_Vec Geom_OffsetSurface::SetDN ( const Standard_Real U, const Standard_Real V,
- const Standard_Integer Nu, const Standard_Integer Nv,
- const gp_Vec& D1U, const gp_Vec& D1V) const
-{
- const Standard_Real MagTol=0.000000001;
-
- gp_Dir Normal;
- CSLib_NormalStatus NStatus;
- CSLib::Normal (D1U, D1V, MagTol, NStatus, Normal);
- const Standard_Integer MaxOrder = (NStatus == CSLib_Defined)? 0 : 3;
- Standard_Integer OrderU,OrderV;
- TColgp_Array2OfVec DerNUV(0,MaxOrder+Nu,0,MaxOrder+Nu);
- TColgp_Array2OfVec DerSurf(0,MaxOrder+Nu+1,0,MaxOrder+Nv+1);
- Standard_Real Umin,Umax,Vmin,Vmax;
- Bounds(Umin,Umax,Vmin,Vmax);
-
- DerSurf.SetValue(1, 0, D1U);
- DerSurf.SetValue(0, 1, D1V);
-
- //*********************
- Handle(Geom_BSplineSurface) L;
- // Is there any osculatingsurface along U or V;
- Standard_Boolean IsOpposite=Standard_False;
- const Standard_Boolean AlongU = UOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Boolean AlongV = VOsculatingSurface(U,V,IsOpposite,L);
- const Standard_Real signe = ((AlongV || AlongU) && IsOpposite)? -1. : 1.;
- derivatives(MaxOrder,1,U,V,basisSurf,Nu,Nv,AlongU,AlongV,L,DerNUV,DerSurf);
-
- CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
- if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
-
- gp_Vec D = basisSurf->DN(U,V,Nu,Nv)
- + signe * offsetValue * CSLib::DNNormal(Nu,Nv,DerNUV,OrderU,OrderV);
-
- return D;
+ return !myOscSurf.IsNull() && myOscSurf->VOscSurf(U, V, t, L);
}
#include <Geom_Surface.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
+#include <GeomEvaluator_OffsetSurface.hxx>
class Geom_Surface;
class Standard_ConstructionError;
class Standard_RangeError;
//! Note: The basis surface can be an offset surface.
inline const Handle(Geom_Surface) & BasisSurface() const
{ return basisSurf; }
+
+ //! Returns osculating surface if base surface is B-spline or Bezier
+ inline const Handle(Geom_OsculatingSurface)& OsculatingSurface() const
+ { return myOscSurf; }
//! Changes the orientation of this offset surface in the u
//! parametric direction. The bounds of the surface
//! raised if it is not possible to compute a unique offset
//! direction.
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
-
- //! P (U, V) = Pbasis + Offset * Ndir where
- //! Ndir = D1Ubasis ^ D1Vbasis / ||D1Ubasis ^ D1Vbasis|| is
- //! the normal direction of the surface.
- //! If Ndir is undefined this method computes an approched normal
- //! direction using the following limited development :
- //! Ndir = N0 + DNdir/DU + DNdir/DV + Eps with Eps->0 which
- //! requires to compute the second derivatives on the basis surface.
- //! If the normal direction cannot be approximate for this order
- //! of derivation the exception UndefinedValue is raised.
- //!
- //! Raised if the continuity of the basis surface is not C1.
- //! Raised if the order of derivation required to compute the normal
- //! direction is greater than the second order.
- Standard_EXPORT void Value (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis) const;
-
-
- //! Raised if the continuity of the basis surface is not C2.
- Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis, gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis) const;
-
-
- //! Raised if the continuity of the basis surface is not C3.
- //! The following private methods
- //! includes common part of local and global methods
- //! of derivative evaluations.
- Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis, gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis, gp_Vec& D3Ubasis, gp_Vec& D3Vbasis, gp_Vec& D3UUVbasis, gp_Vec& D3UVVbasis) const;
-
- Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P) const;
-
- Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
-
- Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
-
- Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
- Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
//! Applies the transformation T to this offset surface.
//! Note: the basis surface is also modified.
private:
-
- Standard_EXPORT void SetD0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, const gp_Vec& D1U, const gp_Vec& D1V) const;
-
- Standard_EXPORT void SetD1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, const gp_Vec& d2u, const gp_Vec& d2v, const gp_Vec& d2uv) const;
-
- Standard_EXPORT void SetD2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, const gp_Vec& d3u, const gp_Vec& d3v, const gp_Vec& d3uuv, const gp_Vec& d3uvv) const;
-
- Standard_EXPORT void SetD3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
- //! The following functions evaluates the local
- //! derivatives on surface. Useful to manage discontinuities
- //! on the surface.
- //! if Side = 1 -> P = S( U+,V )
- //! if Side = -1 -> P = S( U-,V )
- //! else P is betveen discontinuities
- //! can be evaluated using methods of
- //! global evaluations P = S( U ,V )
- Standard_EXPORT gp_Vec SetDN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv, const gp_Vec& D1U, const gp_Vec& D1V) const;
-
- //! This method locates U,V parameters on basis BSpline surface
- //! and calls LocalDi or Di methods corresponding an order
- //! of derivative and position
- //! of UV-point relatively the surface discontinuities.
- Standard_EXPORT void LocateSides (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, const Handle(Geom_BSplineSurface)& BSplS, const Standard_Integer NDir, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
Handle(Geom_Surface) basisSurf;
Handle(Geom_Surface) equivSurf;
Standard_Real offsetValue;
- Geom_OsculatingSurface myOscSurf;
+ Handle(Geom_OsculatingSurface) myOscSurf;
GeomAbs_Shape myBasisSurfContinuity;
+ Handle(GeomEvaluator_OffsetSurface) myEvaluator;
};
#endif // _Geom_OffsetSurface_HeaderFile
Geom_OsculatingSurface::Geom_OsculatingSurface()
: myAlong(1,4)
{
+ myAlong.Init(Standard_False);
}
//=======================================================================
//function : Geom_OffsetOsculatingSurface
class Geom_BSplineSurface;
+class Geom_OsculatingSurface;
+DEFINE_STANDARD_HANDLE(Geom_OsculatingSurface, MMgt_TShared)
-class Geom_OsculatingSurface
+class Geom_OsculatingSurface : public MMgt_TShared
{
public:
Standard_EXPORT Standard_Boolean VOscSurf (const Standard_Real U, const Standard_Real V, Standard_Boolean& t, Handle(Geom_BSplineSurface)& L) const;
-
+ DEFINE_STANDARD_RTTI(Geom_OsculatingSurface, MMgt_TShared)
protected:
#include <Geom_TrimmedCurve.hxx>
#include <Geom_UndefinedDerivative.hxx>
#include <GeomAbs_CurveType.hxx>
+#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Dir.hxx>
typedef gp_Vec Vec;
typedef gp_XYZ XYZ;
-static void LocateSide(const Standard_Real U,
- const Standard_Integer Side,
- const Handle(Geom_BSplineCurve)& BSplC,
- const Standard_Integer NDir,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D2U,
- gp_Vec& D3U)
-{
- Standard_Integer Ideb, Ifin;
- Standard_Real ParTol=Precision::PConfusion()/2;
- BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
- if(Side == 1)
- {
- if(Ideb<1) Ideb=1;
- if ((Ideb>=Ifin)) Ifin = Ideb+1;
- }else
- if(Side ==-1)
- {
- if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
- if ((Ideb>=Ifin)) Ideb = Ifin-1;
- }
-
- switch(NDir)
- {
- case 0 : BSplC->Geom_BSplineCurve::LocalD0(U,Ideb,Ifin,P); break;
- case 1 : BSplC->Geom_BSplineCurve::LocalD1(U,Ideb,Ifin,P,D1U); break;
- case 2 : BSplC->Geom_BSplineCurve::LocalD2(U,Ideb,Ifin,P,D1U,D2U); break;
- case 3 : BSplC->Geom_BSplineCurve::LocalD3(U,Ideb,Ifin,P,D1U,D2U,D3U);break;
- }
-
-}
-
-static gp_Vec LocateSideN(const Standard_Real U,
- const Standard_Integer Side,
- const Handle(Geom_BSplineCurve)& BSplC,
- const Standard_Integer Nu,
-// const Standard_Integer Nv )
- const Standard_Integer )
-{
- Standard_Integer Ideb, Ifin;
- Standard_Real ParTol=Precision::PConfusion()/2;
- BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
- if(Side == 1)
- {
- if(Ideb<1) Ideb=1;
- if ((Ideb>=Ifin)) Ifin = Ideb+1;
- }else
- if(Side ==-1)
- {
- if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
- if ((Ideb>=Ifin)) Ideb = Ifin-1;
- }
- return BSplC->Geom_BSplineCurve::LocalDN(U,Ideb,Ifin,Nu);
-}
-
//=======================================================================
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
direction = V;
smooth = C->Continuity();
+ myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
}
void Geom_SurfaceOfLinearExtrusion::VReverse () {
- direction.Reverse();
+ direction.Reverse();
+ myEvaluator->SetDirection(direction);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfLinearExtrusion::SetDirection (const Dir& V) {
-
- Handle(Geom_Curve) C;
- direction = V;
- C = basisCurve;
- }
+void Geom_SurfaceOfLinearExtrusion::SetDirection (const Dir& V)
+{
+ direction = V;
+ myEvaluator->SetDirection(direction);
+}
//=======================================================================
smooth = C->Continuity();
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
+ myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U, const Standard_Real V,
- Pnt& P ) const {
-
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (basisCurve->Value (U).XYZ());
- P.SetXYZ(Pxyz);
+void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U,
+ const Standard_Real V,
+ Pnt& P) const
+{
+ myEvaluator->D0(U, V, P);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfLinearExtrusion::D1 ( const Standard_Real U ,
- const Standard_Real V ,
- Pnt& P ,
- Vec& D1U, Vec& D1V) const {
-
- basisCurve->D1 (U, P, D1U);
- D1V = direction;
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
+void Geom_SurfaceOfLinearExtrusion::D1 (const Standard_Real U,
+ const Standard_Real V,
+ Pnt& P,
+ Vec& D1U, Vec& D1V) const
+{
+ myEvaluator->D1(U, V, P, D1U, D1V);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfLinearExtrusion::D2 ( const Standard_Real U ,
- const Standard_Real V ,
- Pnt& P ,
- Vec& D1U, Vec& D1V,
- Vec& D2U, Vec& D2V, Vec& D2UV)
-const {
-
- basisCurve->D2 (U, P, D1U, D2U);
- D1V = direction;
- D2V.SetCoord (0.0, 0.0, 0.0);
- D2UV.SetCoord (0.0, 0.0, 0.0);
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
+void Geom_SurfaceOfLinearExtrusion::D2 (const Standard_Real U,
+ const Standard_Real V,
+ Pnt& P,
+ Vec& D1U, Vec& D1V,
+ Vec& D2U, Vec& D2V, Vec& D2UV) const
+{
+ myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfLinearExtrusion::D3
- ( const Standard_Real U, const Standard_Real V,
- Pnt& P,
- Vec& D1U, Vec& D1V,
- Vec& D2U, Vec& D2V, Vec& D2UV,
- Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const {
-
-
- basisCurve->D3 (U, P, D1U, D2U, D3U);
- D1V = direction;
- D2V.SetCoord (0.0, 0.0, 0.0);
- D3V.SetCoord (0.0, 0.0, 0.0);
- D3UUV.SetCoord (0.0, 0.0, 0.0);
- D3UVV.SetCoord (0.0, 0.0, 0.0);
- D2UV.SetCoord (0.0, 0.0, 0.0);
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
-}
-//=======================================================================
-//function : DN
-//purpose :
-//=======================================================================
-
-Vec Geom_SurfaceOfLinearExtrusion::DN
- ( const Standard_Real U, const Standard_Real ,
- const Standard_Integer Nu, const Standard_Integer Nv) const {
-
- Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv <0, " ");
- if (Nu == 0 && Nv == 1) return Vec (direction);
- else if (Nv == 0) return basisCurve->DN (U, Nu);
- else return Vec (0.0, 0.0, 0.0);
-}
-
-
-//=======================================================================
-//function : LocalD0
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfLinearExtrusion::LocalD0 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer USide,
- gp_Pnt& P ) const
-{
- if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Vec D1U,D2U,D3U;
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(U,USide,BSplC,0,P,D1U,D2U,D3U);
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
- }
- else D0(U,V,P);
-}
-
-//=======================================================================
-//function : LocalD1
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfLinearExtrusion::LocalD1 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer USide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V) const
-{
- if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Vec D2U,D3U;
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(U,USide,BSplC,1,P,D1U,D2U,D3U);
- D1V = direction;
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
- }
- else D1(U,V,P,D1U,D1V);
-}
-
-//=======================================================================
-//function : LocalD2
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfLinearExtrusion::LocalD2 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer USide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V,
- gp_Vec& D2U,
- gp_Vec& D2V,
- gp_Vec& D2UV) const
+void Geom_SurfaceOfLinearExtrusion::D3 (const Standard_Real U,
+ const Standard_Real V,
+ Pnt& P,
+ Vec& D1U, Vec& D1V,
+ Vec& D2U, Vec& D2V, Vec& D2UV,
+ Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV) const
{
- if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Vec D3U;
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(U,USide,BSplC,2,P,D1U,D2U,D3U);
- D1V = direction;
- D2V.SetCoord (0.0, 0.0, 0.0);
- D2UV.SetCoord (0.0, 0.0, 0.0);
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
- }
- else D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
+ myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
}
-//=======================================================================
-//function : LocalD3
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfLinearExtrusion::LocalD3 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer USide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V,
- gp_Vec& D2U,
- gp_Vec& D2V,
- gp_Vec& D2UV,
- gp_Vec& D3U,
- gp_Vec& D3V,
- gp_Vec& D3UUV,
- gp_Vec& D3UVV) const
-{
- if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(U,USide,BSplC,3,P,D1U,D2U,D3U);
- D1V = direction;
- D2V.SetCoord (0.0, 0.0, 0.0);
- D3V.SetCoord (0.0, 0.0, 0.0);
- D3UUV.SetCoord (0.0, 0.0, 0.0);
- D3UVV.SetCoord (0.0, 0.0, 0.0);
- D2UV.SetCoord (0.0, 0.0, 0.0);
- XYZ Pxyz = direction.XYZ();
- Pxyz.Multiply (V);
- Pxyz.Add (P.XYZ());
- P.SetXYZ (Pxyz);
- }
- else D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
-
-}
//=======================================================================
-//function : LocalDN
+//function : DN
//purpose :
//=======================================================================
-gp_Vec Geom_SurfaceOfLinearExtrusion::LocalDN (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer USide,
- const Standard_Integer Nu,
- const Standard_Integer Nv) const
+Vec Geom_SurfaceOfLinearExtrusion::DN (const Standard_Real U,
+ const Standard_Real V,
+ const Standard_Integer Nu,
+ const Standard_Integer Nv) const
{
- Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv <0, " ");
- if (Nu == 0 && Nv == 1) return Vec (direction);
- else if (Nv == 0) {
- if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- return LocateSideN(U,USide,BSplC,Nu,Nv);
- }
- else
- return DN(U,V,Nu,Nv);
- }
- return Vec (0.0, 0.0, 0.0);
+ return myEvaluator->DN(U, V, Nu, Nv);
}
+
//=======================================================================
//function : UIso
//purpose :
direction.Transform (T);
basisCurve->Transform (T);
+ myEvaluator->SetDirection(direction);
}
#include <Standard_Type.hxx>
#include <Geom_SweptSurface.hxx>
+#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
//! direction and CNv in the v direction.
//! Raises RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0.
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
- //! The following functions evaluates the local
- //! derivatives on surface. Useful to manage discontinuities
- //! on the surface.
- //! if Side = 1 -> P = S( U+,V )
- //! if Side = -1 -> P = S( U-,V )
- //! else P is betveen discontinuities
- //! can be evaluated using methods of
- //! global evaluations P = S( U ,V )
- Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P) const;
-
- Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
-
- Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
-
- Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
- Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
+
//! Applies the transformation T to this surface of linear extrusion.
Standard_EXPORT void Transform (const gp_Trsf& T);
private:
-
+ Handle(GeomEvaluator_SurfaceOfExtrusion) myEvaluator;
#include <Geom_Geometry.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_UndefinedDerivative.hxx>
+#include <GeomEvaluator_SurfaceOfRevolution.hxx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
typedef gp_Vec Vec;
typedef gp_XYZ XYZ;
-//=======================================================================
-//function : LocateSide
-//purpose : This method locates U parameter on basis BSpline curve
-// and calls LocalDi methods corresponding an order of
-// derivative and position of the surface side contained
-// the point relatively the curve knots.
-//=======================================================================
-static void LocateSide(const Standard_Real U,
- const Standard_Integer Side,
- const Handle(Geom_BSplineCurve)& BSplC,
- const Standard_Integer NDir,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D2U,
- gp_Vec& D3U)
-{
- Standard_Integer Ideb, Ifin;
- Standard_Real ParTol=Precision::PConfusion()/2;
- BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
- if(Side == 1)
- {
- if(Ideb<1) Ideb=1;
- if ((Ideb>=Ifin)) Ifin = Ideb+1;
- }else
- if(Side ==-1)
- {
- if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
- if ((Ideb>=Ifin)) Ideb = Ifin-1;
- }
-
- switch(NDir) {
- case 0 : BSplC->Geom_BSplineCurve::LocalD0(U,Ideb,Ifin,P); break;
- case 1 : BSplC->Geom_BSplineCurve::LocalD1(U,Ideb,Ifin,P,D1U); break;
- case 2 : BSplC->Geom_BSplineCurve::LocalD2(U,Ideb,Ifin,P,D1U,D2U); break;
- case 3 : BSplC->Geom_BSplineCurve::LocalD3(U,Ideb,Ifin,P,D1U,D2U,D3U); break;
- }
-}
-
-//=======================================================================
-//function : LocateSideN
-//purpose : This method locates U parameter on basis BSpline curve
-// and calls LocalDN method corresponding position of surface side
-// contained the point relatively the curve knots.
-//=======================================================================
-static gp_Vec LocateSideN(const Standard_Real V,
- const Standard_Integer Side,
- const Handle(Geom_BSplineCurve)& BSplC,
- const Standard_Integer Nv )
-{
- Standard_Integer Ideb, Ifin;
- Standard_Real ParTol=Precision::PConfusion()/2;
- BSplC->Geom_BSplineCurve::LocateU(V,ParTol,Ideb,Ifin,Standard_False);
- if(Side == 1)
- {
- if(Ideb<1) Ideb=1;
- if ((Ideb>=Ifin)) Ifin = Ideb+1;
- }else
- if(Side ==-1)
- {
- if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
- if ((Ideb>=Ifin)) Ideb = Ifin-1;
- }
- return BSplC->Geom_BSplineCurve::LocalDN(V,Ideb,Ifin,Nv);
-}
(const Handle(Geom_Curve)& C ,
const Ax1& A1 ) : loc (A1.Location()) {
- basisCurve = Handle(Geom_Curve)::DownCast(C->Copy());
direction = A1.Direction();
- smooth = C->Continuity();
+ SetBasisCurve(C);
}
void Geom_SurfaceOfRevolution::UReverse () {
- direction.Reverse();
+ direction.Reverse();
+ myEvaluator->SetDirection(direction);
}
direction = A1.Direction();
loc = A1.Location();
+ myEvaluator->SetAxis(A1);
}
void Geom_SurfaceOfRevolution::SetDirection (const Dir& V) {
direction = V;
+ myEvaluator->SetDirection(direction);
}
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy());
smooth = C->Continuity();
+ myEvaluator = new GeomEvaluator_SurfaceOfRevolution(basisCurve, direction, loc);
}
void Geom_SurfaceOfRevolution::SetLocation (const Pnt& P) {
loc = P;
+ myEvaluator->SetLocation(loc);
}
//purpose :
//=======================================================================
-void Geom_SurfaceOfRevolution::D0
- (const Standard_Real U, const Standard_Real V, Pnt& P) const {
-
- // C origine sur l'axe de revolution
- // Vdir vecteur unitaire definissant la direction de l'axe de revolution
- // Q(v) point de parametre V sur la courbe de revolution
- // OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^CQ)* Sin(U)
-
-
- Pnt Pc = basisCurve->Value (V); //Q(v)
- XYZ Q = Pc.XYZ(); //Q
- XYZ C = loc.XYZ(); //C
- Q.Subtract(C); //CQ
- XYZ Vdir = direction.XYZ(); //Vdir
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- VcrossCQ.Multiply (Sin(U)); //(Vdir^CQ)*Sin(U)
- XYZ VdotCQ =
- Vdir.Multiplied ((Vdir.Dot(Q))*(1.0 - Cos(U)));//(CQ.Vdir)(1-Cos(U))Vdir
- VdotCQ.Add (VcrossCQ); //addition des composantes
- Q.Multiply (Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ(Q);
+void Geom_SurfaceOfRevolution::D0
+(const Standard_Real U, const Standard_Real V, Pnt& P) const
+{
+ myEvaluator->D0(U, V, P);
}
void Geom_SurfaceOfRevolution::D1
(const Standard_Real U, const Standard_Real V,
Pnt& P,
- Vec& D1U, Vec& D1V ) const {
-
- // C origine sur l'axe de revolution
- // Vdir vecteur unitaire definissant la direction de l'axe de revolution
- // Q(v) point de parametre V sur la courbe de revolution
- // Q'(v) = DQ/DV
- // OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^CQ) * Sin(U)
- // D1U_M(u,v) = - CQ * Sin(U) + (CQ.Vdir)(Sin(U)) * Vdir +
- // (Vdir^CQ) * Cos(U)
- // D1V_M(u,v) = Q' * Cos(U) + (Q'.Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^Q') * Sin(U)
-
- Pnt Pc;
- Vec V1;
- basisCurve->D1 (V, Pc, V1);
- XYZ Q = Pc.XYZ(); //Q
- XYZ DQv = V1.XYZ(); //Q'
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
- XYZ VcrossDQv = Vdir.Crossed (DQv); //(Vdir^Q')
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotDQv = Vdir.Multiplied (Vdir.Dot(DQv)); //(Vdir.Q')Vdir
-
- VcrossDQv.Multiply (Sin(U));
- VdotDQv.Multiply (1.0 - Cos(U));
- VdotDQv.Add (VcrossDQv);
- DQv.Multiply (Cos(U));
- DQv.Add (VdotDQv);
- D1V.SetXYZ (DQv);
-
- XYZ DQu = Q.Multiplied (-Sin(U));
- DQu.Add (VcrossCQ.Multiplied (Cos(U)));
- DQu.Add (VdotCQ.Multiplied (Sin(U)));
- D1U.SetXYZ (DQu);
-
- Q.Multiply (Cos(U));
- Q.Add (C);
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- P.SetXYZ (Q);
- }
+ Vec& D1U, Vec& D1V ) const
+{
+ myEvaluator->D1(U, V, P, D1U, D1V);
+}
//=======================================================================
//function : D2
(const Standard_Real U, const Standard_Real V,
Pnt& P,
Vec& D1U, Vec& D1V,
- Vec& D2U, Vec& D2V, Vec& D2UV ) const {
-
-
- // C origine sur l'axe de revolution
- // V vecteur unitaire definissant la direction de l'axe de revolution
- // Q(v) point de parametre V sur la courbe de revolution
- // Q'(v) = D1Q/DV
- // Q"(v) = D2Q/DV
- // OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^CQ) * Sin(U)
- // D1U_M(u,v) = - CQ * Sin(U) + (CQ.Vdir)(Sin(U)) * Vdir +
- // (Vdir^CQ) * Cos(U)
- // D1V_M(u,v) = Q' * Cos(U) + (Q'.Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^Q') * Sin(U)
- // D2U_M(u,v) = -CQ * Cos(U) + (CQ.Vdir)(Cos(U)) * Vdir +
- // (Vdir^CQ) * -(Sin(U))
- // D2V_M(u,v) = Q" * Cos(U) + (Q".Vdir)(1-Cos(U)) * Vdir +
- // (Vdir^Q") * Sin(U)
- // D2UV_M(u,v)= -Q' * Sin(U) + (Q'.Vdir)(Sin(U)) * Vdir +
- // (Vdir^Q') * Cos(U)
-
-
- Pnt Pc;
- Vec V1 , V2;
- basisCurve->D2 (V, Pc, V1, V2);
- XYZ Q = Pc.XYZ(); //Q
- XYZ D1Qv = V1.XYZ(); //Q'
- XYZ D2Qv = V2.XYZ(); //Q"
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
- XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
- XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
- XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
-
-
- XYZ D2Quv = D1Qv.Multiplied(-Sin(U));
- D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
- D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
- D2UV.SetXYZ (D2Quv);
-
- D1Qv.Multiply (Cos(U));
- VcrossD1Qv.Multiply (Sin(U));
- VdotD1Qv.Multiply (1.0 - Cos(U));
- D1Qv.Add (VcrossD1Qv);
- D1Qv.Add (VdotD1Qv);
- D1V.SetXYZ (D1Qv);
-
- VcrossD2Qv.Multiply (Sin(U));
- VdotD2Qv.Multiply (1.0 - Cos(U));
- VdotD2Qv.Add (VcrossD2Qv);
- D2Qv.Multiply (Cos(U));
- D2Qv.Add (VdotD2Qv);
- D2V.SetXYZ (D2Qv);
-
- XYZ D1Qu = Q.Multiplied (-Sin(U));
- D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
- D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
- D1U.SetXYZ (D1Qu);
-
- Q.Multiply (Cos(U));
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- XYZ D2Qu = Q.Multiplied(-1.0);
- D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
- D2U.SetXYZ (D2Qu);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ (Q);
+ Vec& D2U, Vec& D2V, Vec& D2UV ) const
+{
+ myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
}
Pnt& P,
Vec& D1U, Vec& D1V,
Vec& D2U, Vec& D2V, Vec& D2UV,
- Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const {
-
- // C origine sur l'axe de revolution
- // Vdir vecteur unitaire definissant la direction de l'axe de revolution
- // Q(v) point de parametre V sur la courbe de revolution
- // Q'(v) = D1Q/DV
- // Q"(v) = D2Q/DV
- // OM (u,v) = OC + CQ * Cos(u) + (CQ.Vdir)(1-Cos(u)) * Vdir +
- // (Vdir^CQ) * Sin(u)
- // D1U_M(u,v) = - CQ * Sin(u) + (CQ.Vdir)(Sin(u)) * Vdir +
- // (Vdir^CQ) * Cos(u)
- // D2U_M(u,v) = -CQ * Cos(u) + (CQ.Vdir)(Cos(u)) * Vdir +
- // (Vdir^CQ) * -Sin(u)
- // D2UV_M(u,v)= -Q' * Sin(u) + (Q'.Vdir)(Sin(u)) * Vdir +
- // (Vdir^Q') * Cos(u)
- // D3UUV_M(u,v) = -Q' * Cos(u) + (Q'.Vdir)(Cos(u)) * Vdir +
- // (Vdir^Q') * -Sin(u)
- // D3U_M(u,v) = CQ * Sin(u) + (CQ.Vdir)(-Sin(u)) * Vdir +
- // (Vdir^CQ) * -Cos(u)
- // D1V_M(u,v) = Q' * Cos(u) + (Q'.Vdir)(1-Cos(u)) * Vdir +
- // (Vdir^Q') * Sin(u)
- // D2V_M(u,v) = Q" * Cos(u) + (Q".Vdir)(1-Cos(u)) * Vdir +
- // (Vdir^Q") * Sin(u)
- // D3UVV_M(u,v) = -Q" * Sin(u) + (Q".Vdir)(Sin(u)) * Vdir +
- // (Vdir^Q") * Cos(u)
- // D3V_M(u,v) = Q'''* Cos(u) + (Q'''.Vdir)(1-Cos(u)) * Vdir +
- // (Vdir^Q''') * Sin(u)
-
-
- Pnt Pc;
- Vec V1 , V2, V3;
- basisCurve->D3 (V, Pc, V1, V2, V3);
- XYZ Q = Pc.XYZ(); //Q
- XYZ D1Qv = V1.XYZ(); //Q'
- XYZ D2Qv = V2.XYZ(); //Q"
- XYZ D3Qv = V3.XYZ(); //Q'''
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
- XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
- XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
- XYZ VcrossD3Qv = Vdir.Crossed (D3Qv); //(Vdir^Q''')
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
- XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
- XYZ VdotD3Qv = Vdir.Multiplied (Vdir.Dot(D3Qv)); //(Vdir.Q''')Vdir
-
- XYZ D3Quuv = D1Qv.Multiplied (-Cos(U));
- D3Quuv.Add (VcrossD1Qv.Multiplied (-Sin(U)));
- D3Quuv.Add (VdotD1Qv.Multiplied (Cos(U)));
- D3UUV.SetXYZ (D3Quuv);
-
- XYZ D2Quv = D1Qv.Multiplied (-Sin(U));
- D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
- D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
- D2UV.SetXYZ (D2Quv);
-
- D1Qv.Multiply (Cos(U));
- VcrossD1Qv.Multiply (Sin(U));
- VdotD1Qv.Multiply (1.0 - Cos(U));
- D1Qv.Add (VcrossD1Qv);
- D1Qv.Add (VdotD1Qv);
- D1V.SetXYZ (D1Qv);
-
- XYZ D3Qvvu = D2Qv.Multiplied (-Sin(U));
- D3Qvvu.Add (VcrossD2Qv.Multiplied (Cos(U)));
- D3Qvvu.Add (VdotD2Qv.Multiplied (Sin(U)));
- D3UVV.SetXYZ (D3Qvvu);
-
- VcrossD2Qv.Multiply (Sin(U));
- VdotD2Qv.Multiply (1.0 - Cos(U));
- VdotD2Qv.Add (VcrossD2Qv);
- D2Qv.Multiply (Cos(U));
- D2Qv.Add (VdotD2Qv);
- D2V.SetXYZ (D2Qv);
-
- VcrossD3Qv.Multiply (Sin(U));
- VdotD3Qv.Multiply (1.0 - Cos(U));
- VdotD3Qv.Add (VcrossD2Qv);
- D3Qv.Multiply (Cos(U));
- D3Qv.Add (VdotD3Qv);
- D3V.SetXYZ (D3Qv);
-
- XYZ D1Qu = Q.Multiplied (- Sin(U));
- D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
- XYZ D3Qu = D1Qu.Multiplied (-1.0);
- D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
- D3Qu.Add (VdotCQ.Multiplied (-Sin(U)));
- D1U.SetXYZ (D1Qu);
- D3U.SetXYZ (D3Qu);
-
- Q.Multiply (Cos(U));
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- XYZ D2Qu = Q.Multiplied(-1.0);
- D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
- D2U.SetXYZ (D2Qu);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ (Q);
+ Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const
+{
+ myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
}
//=======================================================================
Vec Geom_SurfaceOfRevolution::DN (const Standard_Real U , const Standard_Real V,
- const Standard_Integer Nu, const Standard_Integer Nv) const {
-
- Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv < 0, " ");
- if (Nu == 0) {
- XYZ Vn = (basisCurve->DN (V, Nv)).XYZ();
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
- VDot.Multiply (1-Cos(U));
- XYZ VCross = Vdir.Crossed (Vn);
- VCross.Multiply (Sin(U));
- Vn.Multiply (Cos(U));
- Vn.Add (VDot);
- Vn.Add (VCross);
- return Vec (Vn);
- }
- else if (Nv == 0) {
- XYZ CQ = (basisCurve->Value (V)).XYZ() - loc.XYZ();
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (CQ.Dot (Vdir));
- XYZ VCross = Vdir.Crossed (CQ);
- if ((Nu + 6) % 4 == 0) {
- CQ.Multiply (-Cos (U));
- VDot.Multiply (Cos(U));
- VCross.Multiply (-Sin(U));
- }
- else if ((Nu + 5) % 4 == 0) {
- CQ.Multiply (Sin (U));
- VDot.Multiply (-Sin(U));
- VCross.Multiply (-Cos(U));
- }
- else if ((Nu+3) % 4 == 0) {
- CQ.Multiply (-Sin (U));
- VDot.Multiply (+Sin(U));
- VCross.Multiply (Cos(U));
- }
- else if (Nu+4 % 4 == 0) {
- CQ.Multiply (Cos (U));
- VDot.Multiply (-Cos(U));
- VCross.Multiply (Sin(U));
- }
- CQ.Add (VDot);
- CQ.Add (VCross);
- return Vec (CQ);
- }
- else {
- XYZ Vn = (basisCurve->DN (V, Nv)).XYZ();
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
- XYZ VCross = Vdir.Crossed (Vn);
- if ((Nu + 6) % 4 == 0) {
- Vn.Multiply (-Cos (U));
- VDot.Multiply (Cos(U));
- VCross.Multiply (-Sin(U));
- }
- else if ((Nu + 5) % 4 == 0) {
- Vn.Multiply (Sin (U));
- VDot.Multiply (-Sin(U));
- VCross.Multiply (-Cos(U));
- }
- else if ((Nu+3) % 4 == 0) {
- Vn.Multiply (-Sin (U));
- VDot.Multiply (+Sin(U));
- VCross.Multiply (Cos(U));
- }
- else if (Nu+4 % 4 == 0) {
- Vn.Multiply (Cos (U));
- VDot.Multiply (-Cos(U));
- VCross.Multiply (Sin(U));
- }
- Vn.Add (VDot);
- Vn.Add (VCross);
- return Vec (Vn);
- }
-}
-
-//=======================================================================
-//function : LocalD0
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfRevolution::LocalD0 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer VSide,
- gp_Pnt& P ) const
-{
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- gp_Vec D1V,D2V,D3V;
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(V,VSide,BSplC,0,P,D1V,D2V,D3V);
- XYZ Q = P.XYZ(); //Q
- XYZ C = loc.XYZ(); //C
- Q.Subtract(C); //CQ
- XYZ Vdir = direction.XYZ(); //Vdir
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- VcrossCQ.Multiply (Sin(U)); //(Vdir^CQ)*Sin(U)
- XYZ VdotCQ =
- Vdir.Multiplied ((Vdir.Dot(Q))*(1.0 - Cos(U)));//(CQ.Vdir)(1-Cos(U))Vdir
- VdotCQ.Add (VcrossCQ); //addition des composantes
- Q.Multiply (Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ(Q);
- }
- else D0(U,V,P);
-}
-
-//=======================================================================
-//function : LocalD1
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfRevolution::LocalD1 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V) const
-{
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- Vec D2V,D3V;
- Vec V1;
- LocateSide(V,VSide,BSplC,1,P,V1,D2V,D3V);
- XYZ Q = P.XYZ(); //Q
- XYZ DQv = V1.XYZ(); //Q'
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
-
- XYZ VcrossDQv = Vdir.Crossed (DQv); //(Vdir^Q')
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotDQv = Vdir.Multiplied (Vdir.Dot(DQv)); //(Vdir.Q')Vdir
-
- VcrossDQv.Multiply (Sin(U));
- VdotDQv.Multiply (1.0 - Cos(U));
- VdotDQv.Add (VcrossDQv);
- DQv.Multiply (Cos(U));
- DQv.Add (VdotDQv);
- D1V.SetXYZ (DQv);
-
- XYZ DQu = Q.Multiplied (-Sin(U));
- DQu.Add (VcrossCQ.Multiplied (Cos(U)));
- DQu.Add (VdotCQ.Multiplied (Sin(U)));
- D1U.SetXYZ (DQu);
-
- Q.Multiply (Cos(U));
- Q.Add (C);
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- P.SetXYZ (Q);
- }else
- D1(U,V,P,D1U,D1V);
-}
-
-//=======================================================================
-//function : LocalD2
-//purpose :
-//=======================================================================
-
-void Geom_SurfaceOfRevolution::LocalD2 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V,
- gp_Vec& D2U,
- gp_Vec& D2V,
- gp_Vec& D2UV) const
+ const Standard_Integer Nu, const Standard_Integer Nv) const
{
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- Vec d3v;
- LocateSide(V,VSide,BSplC,2,P,D1V,D2V,d3v);
- XYZ Q = P.XYZ(); //Q
- XYZ D1Qv = D1V.XYZ(); //Q'
- XYZ D2Qv = D2V.XYZ(); //Q"
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
-
- XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
- XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
- XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
-
-
- XYZ D2Quv = D1Qv.Multiplied(-Sin(U));
- D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
- D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
- D2UV.SetXYZ (D2Quv);
-
- D1Qv.Multiply (Cos(U));
- VcrossD1Qv.Multiply (Sin(U));
- VdotD1Qv.Multiply (1.0 - Cos(U));
- D1Qv.Add (VcrossD1Qv);
- D1Qv.Add (VdotD1Qv);
- D1V.SetXYZ (D1Qv);
-
- VcrossD2Qv.Multiply (Sin(U));
- VdotD2Qv.Multiply (1.0 - Cos(U));
- VdotD2Qv.Add (VcrossD2Qv);
- D2Qv.Multiply (Cos(U));
- D2Qv.Add (VdotD2Qv);
- D2V.SetXYZ (D2Qv);
-
- XYZ D1Qu = Q.Multiplied (-Sin(U));
- D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
- D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
- D1U.SetXYZ (D1Qu);
-
- Q.Multiply (Cos(U));
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- XYZ D2Qu = Q.Multiplied(-1.0);
- D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
- D2U.SetXYZ (D2Qu);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ (Q);
- }
- else
- D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
+ return myEvaluator->DN(U, V, Nu, Nv);
}
-//=======================================================================
-//function : LocalD3
-//purpose :
-//=======================================================================
-void Geom_SurfaceOfRevolution::LocalD3 (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer VSide,
- gp_Pnt& P,
- gp_Vec& D1U,
- gp_Vec& D1V,
- gp_Vec& D2U,
- gp_Vec& D2V,
- gp_Vec& D2UV,
- gp_Vec& D3U,
- gp_Vec& D3V,
- gp_Vec& D3UUV,
- gp_Vec& D3UVV) const
-{
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
-
- LocateSide(V,VSide,BSplC,3,P,D1V,D2V,D3V);
- XYZ Q = P.XYZ(); //Q
- XYZ D1Qv = D1V.XYZ(); //Q'
- XYZ D2Qv = D2V.XYZ(); //Q"
- XYZ D3Qv = D3V.XYZ(); //Q'''
- XYZ C = loc.XYZ(); //C
- XYZ Vdir = direction.XYZ(); //Vdir
- Q.Subtract(C); //CQ
- XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
- // If the point is placed on the axis of revolution then derivatives on U are undefined.
- // Manually set them to zero.
- if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
- VcrossCQ.SetCoord(0.0, 0.0, 0.0);
-
- XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
- XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
- XYZ VcrossD3Qv = Vdir.Crossed (D3Qv); //(Vdir^Q''')
- XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
- XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
- XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
- XYZ VdotD3Qv = Vdir.Multiplied (Vdir.Dot(D3Qv)); //(Vdir.Q''')Vdir
-
- XYZ D3Quuv = D1Qv.Multiplied (-Cos(U));
- D3Quuv.Add (VcrossD1Qv.Multiplied (-Sin(U)));
- D3Quuv.Add (VdotD1Qv.Multiplied (Cos(U)));
- D3UUV.SetXYZ (D3Quuv);
-
- XYZ D2Quv = D1Qv.Multiplied (-Sin(U));
- D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
- D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
- D2UV.SetXYZ (D2Quv);
-
- D1Qv.Multiply (Cos(U));
- VcrossD1Qv.Multiply (Sin(U));
- VdotD1Qv.Multiply (1.0 - Cos(U));
- D1Qv.Add (VcrossD1Qv);
- D1Qv.Add (VdotD1Qv);
- D1V.SetXYZ (D1Qv);
-
- XYZ D3Qvvu = D2Qv.Multiplied (-Sin(U));
- D3Qvvu.Add (VcrossD2Qv.Multiplied (Cos(U)));
- D3Qvvu.Add (VdotD2Qv.Multiplied (Sin(U)));
- D3UVV.SetXYZ (D3Qvvu);
-
- VcrossD2Qv.Multiply (Sin(U));
- VdotD2Qv.Multiply (1.0 - Cos(U));
- VdotD2Qv.Add (VcrossD2Qv);
- D2Qv.Multiply (Cos(U));
- D2Qv.Add (VdotD2Qv);
- D2V.SetXYZ (D2Qv);
-
- VcrossD3Qv.Multiply (Sin(U));
- VdotD3Qv.Multiply (1.0 - Cos(U));
- VdotD3Qv.Add (VcrossD2Qv);
- D3Qv.Multiply (Cos(U));
- D3Qv.Add (VdotD3Qv);
- D3V.SetXYZ (D3Qv);
-
- XYZ D1Qu = Q.Multiplied (- Sin(U));
- D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
- XYZ D3Qu = D1Qu.Multiplied (-1.0);
- D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
- D3Qu.Add (VdotCQ.Multiplied (-Sin(U)));
- D1U.SetXYZ (D1Qu);
- D3U.SetXYZ (D3Qu);
-
- Q.Multiply (Cos(U));
- VcrossCQ.Multiply (Sin(U));
- Q.Add (VcrossCQ);
- XYZ D2Qu = Q.Multiplied(-1.0);
- D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
- D2U.SetXYZ (D2Qu);
- VdotCQ.Multiply (1.0-Cos(U));
- Q.Add (VdotCQ);
- Q.Add (C);
- P.SetXYZ (Q);
- }
- else
- D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
-}
-//=======================================================================
-//function : LocalDN
-//purpose :
-//=======================================================================
-
-gp_Vec Geom_SurfaceOfRevolution::LocalDN (const Standard_Real U,
- const Standard_Real V,
- const Standard_Integer VSide,
- const Standard_Integer Nu,
- const Standard_Integer Nv) const
-{
- Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv < 0, " ");
- XYZ Vn, CQ;
- if (Nu == 0) {
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- Vn = LocateSideN(V,VSide,BSplC,Nv).XYZ();
- }else
- return DN(U,V,Nu,Nv);
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
- VDot.Multiply (1-Cos(U));
- XYZ VCross = Vdir.Crossed (Vn);
- VCross.Multiply (Sin(U));
- Vn.Multiply (Cos(U));
- Vn.Add (VDot);
- Vn.Add (VCross);
- return Vec (Vn);
- }
-
- else if (Nv == 0) {
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- CQ = LocateSideN(V,VSide,BSplC,Nv).XYZ() - loc.XYZ();
- }else
- return DN(U,V,Nu,Nv);
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (CQ.Dot (Vdir));
- XYZ VCross = Vdir.Crossed (CQ);
- if ((Nu + 6) % 4 == 0) {
- CQ.Multiply (-Cos (U));
- VDot.Multiply (Cos(U));
- VCross.Multiply (-Sin(U));
- }
- else if ((Nu + 5) % 4 == 0) {
- CQ.Multiply (Sin (U));
- VDot.Multiply (-Sin(U));
- VCross.Multiply (-Cos(U));
- }
- else if ((Nu+3) % 4 == 0) {
- CQ.Multiply (-Sin (U));
- VDot.Multiply (+Sin(U));
- VCross.Multiply (Cos(U));
- }
- else if (Nu+4 % 4 == 0) {
- CQ.Multiply (Cos (U));
- VDot.Multiply (-Cos(U));
- VCross.Multiply (Sin(U));
- }
- CQ.Add (VDot);
- CQ.Add (VCross);
- return Vec (CQ);
- }
-
- else {
- if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
- {
- Handle( Geom_BSplineCurve) BSplC;
- BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
- Vn = LocateSideN(V,VSide,BSplC,Nv).XYZ();
- }else
- return DN(U,V,Nu,Nv);
- XYZ Vdir = direction.XYZ();
- XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
- XYZ VCross = Vdir.Crossed (Vn);
- if ((Nu + 6) % 4 == 0) {
- Vn.Multiply (-Cos (U));
- VDot.Multiply (Cos(U));
- VCross.Multiply (-Sin(U));
- }
- else if ((Nu + 5) % 4 == 0) {
- Vn.Multiply (Sin (U));
- VDot.Multiply (-Sin(U));
- VCross.Multiply (-Cos(U));
- }
- else if ((Nu+3) % 4 == 0) {
- Vn.Multiply (-Sin (U));
- VDot.Multiply (+Sin(U));
- VCross.Multiply (Cos(U));
- }
- else if (Nu+4 % 4 == 0) {
- Vn.Multiply (Cos (U));
- VDot.Multiply (-Cos(U));
- VCross.Multiply (Sin(U));
- }
- Vn.Add (VDot);
- Vn.Add (VCross);
- return Vec (Vn);
- }
-}
//=======================================================================
//function : ReferencePlane
direction.Transform (T);
basisCurve->Transform (T);
if(T.ScaleFactor()*T.HVectorialPart().Determinant() < 0.) UReverse();
+ myEvaluator->SetDirection(direction);
+ myEvaluator->SetLocation(loc);
}
//=======================================================================
#include <gp_Pnt.hxx>
#include <Geom_SweptSurface.hxx>
+#include <GeomEvaluator_SurfaceOfRevolution.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
//! The direction of this axis gives the sense of rotation.
//! V is the parameter of the revolved curve.
Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
-
//! Computes the current point and the first derivatives
//! in the directions U and V.
//! Raised if the continuity of the surface is not C1.
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
-
//! Computes the current point, the first and the second derivatives
//! in the directions U and V.
//! Raised if the continuity of the surface is not C2.
Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
-
//! Computes the current point, the first,the second and the third
//! derivatives in the directions U and V.
//! Raised if the continuity of the surface is not C3.
Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
//! Computes the derivative of order Nu in the direction u and
//! Nv in the direction v.
//! can be evaluated using methods of
//! global evaluations P = S( U ,V )
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
- Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P) const;
-
- Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
-
- Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
-
- Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
-
- Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer Nu, const Standard_Integer Nv) const;
-
+
//! Applies the transformation T to this surface of revolution.
Standard_EXPORT void Transform (const gp_Trsf& T);
Standard_EXPORT Handle(Geom_Geometry) Copy() const;
-
-
DEFINE_STANDARD_RTTI(Geom_SurfaceOfRevolution,Geom_SweptSurface)
-protected:
-
-
-
-
private:
-
-
+ Handle(GeomEvaluator_SurfaceOfRevolution) myEvaluator;
gp_Pnt loc;
-
-
};
-
-
-
-
-
-
#endif // _Geom_SurfaceOfRevolution_HeaderFile
GeomAdaptor_HSurface.cxx
GeomAdaptor_HSurface.hxx
GeomAdaptor_HSurface.lxx
+GeomAdaptor_HSurfaceOfLinearExtrusion_0.cxx
+GeomAdaptor_HSurfaceOfLinearExtrusion.hxx
+GeomAdaptor_HSurfaceOfRevolution_0.cxx
+GeomAdaptor_HSurfaceOfRevolution.hxx
GeomAdaptor_Surface.cxx
GeomAdaptor_Surface.hxx
GeomAdaptor_Surface.lxx
+GeomAdaptor_SurfaceOfLinearExtrusion.cxx
+GeomAdaptor_SurfaceOfLinearExtrusion.hxx
+GeomAdaptor_SurfaceOfRevolution.cxx
+GeomAdaptor_SurfaceOfRevolution.hxx
--- /dev/null
+// 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 _GeomAdaptor_HSurfaceOfLinearExtrusion_HeaderFile
+#define _GeomAdaptor_HSurfaceOfLinearExtrusion_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+#include <Adaptor3d_HSurface.hxx>
+class Standard_OutOfRange;
+class Standard_NoSuchObject;
+class Standard_DomainError;
+class GeomAdaptor_SurfaceOfLinearExtrusion;
+class Adaptor3d_Surface;
+
+
+class GeomAdaptor_HSurfaceOfLinearExtrusion;
+DEFINE_STANDARD_HANDLE(GeomAdaptor_HSurfaceOfLinearExtrusion, Adaptor3d_HSurface)
+
+
+class GeomAdaptor_HSurfaceOfLinearExtrusion : public Adaptor3d_HSurface
+{
+
+public:
+
+
+ //! Creates an empty GenHSurface.
+ Standard_EXPORT GeomAdaptor_HSurfaceOfLinearExtrusion();
+
+ //! Creates a GenHSurface from a Surface.
+ Standard_EXPORT GeomAdaptor_HSurfaceOfLinearExtrusion(const GeomAdaptor_SurfaceOfLinearExtrusion& S);
+
+ //! Sets the field of the GenHSurface.
+ Standard_EXPORT void Set (const GeomAdaptor_SurfaceOfLinearExtrusion& S);
+
+ //! Returns a reference to the Surface inside the HSurface.
+ //! This is redefined from HSurface, cannot be inline.
+ Standard_EXPORT const Adaptor3d_Surface& Surface() const;
+
+ //! Returns the surface used to create the GenHSurface.
+ GeomAdaptor_SurfaceOfLinearExtrusion& ChangeSurface();
+
+
+
+
+ DEFINE_STANDARD_RTTI(GeomAdaptor_HSurfaceOfLinearExtrusion,Adaptor3d_HSurface)
+
+protected:
+
+
+ GeomAdaptor_SurfaceOfLinearExtrusion mySurf;
+
+
+private:
+
+
+
+
+};
+
+#define TheSurface GeomAdaptor_SurfaceOfLinearExtrusion
+#define TheSurface_hxx <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+#define Adaptor3d_GenHSurface GeomAdaptor_HSurfaceOfLinearExtrusion
+#define Adaptor3d_GenHSurface_hxx <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
+#define Handle_Adaptor3d_GenHSurface Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)
+
+#include <Adaptor3d_GenHSurface.lxx>
+
+#undef TheSurface
+#undef TheSurface_hxx
+#undef Adaptor3d_GenHSurface
+#undef Adaptor3d_GenHSurface_hxx
+#undef Handle_Adaptor3d_GenHSurface
+
+
+
+
+#endif // _GeomAdaptor_HSurfaceOfLinearExtrusion_HeaderFile
--- /dev/null
+// 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 <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
+
+#include <Standard_Type.hxx>
+
+#include <Standard_OutOfRange.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_DomainError.hxx>
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+#include <Adaptor3d_Surface.hxx>
+
+
+
+#define TheSurface GeomAdaptor_SurfaceOfLinearExtrusion
+#define TheSurface_hxx <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+#define Adaptor3d_GenHSurface GeomAdaptor_HSurfaceOfLinearExtrusion
+#define Adaptor3d_GenHSurface_hxx <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
+#define Handle_Adaptor3d_GenHSurface Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)
+#include <Adaptor3d_GenHSurface.gxx>
+
--- /dev/null
+// 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 _GeomAdaptor_HSurfaceOfRevolution_HeaderFile
+#define _GeomAdaptor_HSurfaceOfRevolution_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
+#include <Adaptor3d_HSurface.hxx>
+class Standard_OutOfRange;
+class Standard_NoSuchObject;
+class Standard_DomainError;
+class GeomAdaptor_SurfaceOfRevolution;
+class Adaptor3d_Surface;
+
+
+class GeomAdaptor_HSurfaceOfRevolution;
+DEFINE_STANDARD_HANDLE(GeomAdaptor_HSurfaceOfRevolution, Adaptor3d_HSurface)
+
+
+class GeomAdaptor_HSurfaceOfRevolution : public Adaptor3d_HSurface
+{
+
+public:
+
+
+ //! Creates an empty GenHSurface.
+ Standard_EXPORT GeomAdaptor_HSurfaceOfRevolution();
+
+ //! Creates a GenHSurface from a Surface.
+ Standard_EXPORT GeomAdaptor_HSurfaceOfRevolution(const GeomAdaptor_SurfaceOfRevolution& S);
+
+ //! Sets the field of the GenHSurface.
+ Standard_EXPORT void Set (const GeomAdaptor_SurfaceOfRevolution& S);
+
+ //! Returns a reference to the Surface inside the HSurface.
+ //! This is redefined from HSurface, cannot be inline.
+ Standard_EXPORT const Adaptor3d_Surface& Surface() const;
+
+ //! Returns the surface used to create the GenHSurface.
+ GeomAdaptor_SurfaceOfRevolution& ChangeSurface();
+
+
+
+
+ DEFINE_STANDARD_RTTI(GeomAdaptor_HSurfaceOfRevolution,Adaptor3d_HSurface)
+
+protected:
+
+
+ GeomAdaptor_SurfaceOfRevolution mySurf;
+
+
+private:
+
+
+
+
+};
+
+#define TheSurface GeomAdaptor_SurfaceOfRevolution
+#define TheSurface_hxx <GeomAdaptor_SurfaceOfRevolution.hxx>
+#define Adaptor3d_GenHSurface GeomAdaptor_HSurfaceOfRevolution
+#define Adaptor3d_GenHSurface_hxx <GeomAdaptor_HSurfaceOfRevolution.hxx>
+#define Handle_Adaptor3d_GenHSurface Handle(GeomAdaptor_HSurfaceOfRevolution)
+
+#include <Adaptor3d_GenHSurface.lxx>
+
+#undef TheSurface
+#undef TheSurface_hxx
+#undef Adaptor3d_GenHSurface
+#undef Adaptor3d_GenHSurface_hxx
+#undef Handle_Adaptor3d_GenHSurface
+
+
+
+
+#endif // _GeomAdaptor_HSurfaceOfRevolution_HeaderFile
--- /dev/null
+// 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 <GeomAdaptor_HSurfaceOfRevolution.hxx>
+
+#include <Standard_Type.hxx>
+
+#include <Standard_OutOfRange.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_DomainError.hxx>
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
+#include <Adaptor3d_Surface.hxx>
+
+
+
+#define TheSurface GeomAdaptor_SurfaceOfRevolution
+#define TheSurface_hxx <GeomAdaptor_SurfaceOfRevolution.hxx>
+#define Adaptor3d_GenHSurface GeomAdaptor_HSurfaceOfRevolution
+#define Adaptor3d_GenHSurface_hxx <GeomAdaptor_HSurfaceOfRevolution.hxx>
+#define Handle_Adaptor3d_GenHSurface Handle(GeomAdaptor_HSurfaceOfRevolution)
+#include <Adaptor3d_GenHSurface.gxx>
+
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
+#include <GeomEvaluator_OffsetSurface.hxx>
+#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
+#include <GeomEvaluator_SurfaceOfRevolution.hxx>
#include <gp_Ax1.hxx>
#include <gp_Circ.hxx>
#include <gp_Cone.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfInteger.hxx>
-//#include <GeomConvert_BSplineSurfaceKnotSplitting.hxx>
-#define myBspl Handle(Geom_BSplineSurface)::DownCast (mySurface)
-#define myExtSurf Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)
-#define myRevSurf Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)
-#define myOffSurf Handle(Geom_OffsetSurface)::DownCast (mySurface)
-
//=======================================================================
//function : LocalContinuity
//purpose :
if ( mySurface != S) {
mySurface = S;
-
+ mySurfaceCache = Handle(BSplSLib_Cache)();
+ myNestedEvaluator = Handle(GeomEvaluator_Surface)();
+
const Handle(Standard_Type)& TheType = S->DynamicType();
if ( TheType == STANDARD_TYPE(Geom_BezierSurface))
mySurfaceType = GeomAbs_BezierSurface;
mySurfaceType = GeomAbs_Sphere;
else if ( TheType == STANDARD_TYPE(Geom_ToroidalSurface))
mySurfaceType = GeomAbs_Torus;
- else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution))
+ else if (TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution))
+ {
mySurfaceType = GeomAbs_SurfaceOfRevolution;
- else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
+ Handle(Geom_SurfaceOfRevolution) myRevSurf =
+ Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
+ // Create nested adaptor for base curve
+ Handle(Geom_Curve) aBaseCurve = myRevSurf->BasisCurve();
+ Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+ // Create corresponding evaluator
+ myNestedEvaluator = new GeomEvaluator_SurfaceOfRevolution(
+ Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor),
+ myRevSurf->Direction(), myRevSurf->Location());
+ }
+ else if (TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
+ {
mySurfaceType = GeomAbs_SurfaceOfExtrusion;
+ Handle(Geom_SurfaceOfLinearExtrusion) myExtSurf =
+ Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
+ // Create nested adaptor for base curve
+ Handle(Geom_Curve) aBaseCurve = myExtSurf->BasisCurve();
+ Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+ // Create corresponding evaluator
+ myNestedEvaluator = new GeomEvaluator_SurfaceOfExtrusion(
+ Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor), myExtSurf->Direction());
+ }
else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
mySurfaceType = GeomAbs_BSplineSurface;
- myBspl = Handle(Geom_BSplineSurface)::DownCast (mySurface);
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
// Create cache for B-spline
- mySurfaceCache = new BSplSLib_Cache(
+ mySurfaceCache = new BSplSLib_Cache(
myBspl->UDegree(), myBspl->IsUPeriodic(), myBspl->UKnotSequence(),
myBspl->VDegree(), myBspl->IsVPeriodic(), myBspl->VKnotSequence(),
myBspl->Poles(), myBspl->Weights());
}
- else if ( TheType == STANDARD_TYPE(Geom_OffsetSurface))
+ else if (TheType == STANDARD_TYPE(Geom_OffsetSurface))
+ {
mySurfaceType = GeomAbs_OffsetSurface;
+ Handle(Geom_OffsetSurface) myOffSurf = Handle(Geom_OffsetSurface)::DownCast(mySurface);
+ // Create nested adaptor for base surface
+ Handle(Geom_Surface) aBaseSurf = myOffSurf->BasisSurface();
+ Handle(GeomAdaptor_HSurface) aBaseAdaptor =
+ new GeomAdaptor_HSurface(aBaseSurf, myUFirst, myULast, myVFirst, myVLast, myTolU, myTolV);
+ myNestedEvaluator = new GeomEvaluator_OffsetSurface(
+ aBaseAdaptor, myOffSurf->Offset(), myOffSurf->OsculatingSurface());
+ }
else
mySurfaceType = GeomAbs_OtherSurface;
}
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
const Standard_Integer N = myBspl->NbUKnots();
TColStd_Array1OfReal TK(1,N);
TColStd_Array1OfInteger TM(1,N);
}
case GeomAbs_SurfaceOfExtrusion:
{
- GeomAdaptor_Curve GC
- (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast);
+ Handle(Geom_SurfaceOfLinearExtrusion) myExtSurf =
+ Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
+ GeomAdaptor_Curve GC(myExtSurf->BasisCurve(), myUFirst, myULast);
return GC.Continuity();
}
case GeomAbs_OtherSurface:
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
const Standard_Integer N = myBspl->NbVKnots();
TColStd_Array1OfReal TK(1,N);
TColStd_Array1OfInteger TM(1,N);
}
case GeomAbs_SurfaceOfRevolution:
{
- GeomAdaptor_Curve GC
- (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast);
+ Handle(Geom_SurfaceOfRevolution) myRevSurf =
+ Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
+ GeomAdaptor_Curve GC(myRevSurf->BasisCurve(), myVFirst, myVLast);
return GC.Continuity();
}
case GeomAbs_OtherSurface:
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
GeomAdaptor_Curve myBasisCurve
(myBspl->VIso(myBspl->VKnot(myBspl->FirstVKnotIndex())),myUFirst,myULast);
return myBasisCurve.NbIntervals(S);
}
case GeomAbs_SurfaceOfExtrusion:
{
- GeomAdaptor_Curve myBasisCurve
- (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast);
- if (myBasisCurve.GetType() == GeomAbs_BSplineCurve)
+ Handle(Geom_SurfaceOfLinearExtrusion) myExtSurf =
+ Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
+ GeomAdaptor_Curve myBasisCurve(myExtSurf->BasisCurve(), myUFirst, myULast);
+ if (myBasisCurve.GetType() == GeomAbs_BSplineCurve)
return myBasisCurve.NbIntervals(S);
break;
}
case GeomAbs_C3:
case GeomAbs_CN: break;
}
- GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface());
+ Handle(Geom_OffsetSurface) myOffSurf = Handle(Geom_OffsetSurface)::DownCast(mySurface);
+ GeomAdaptor_Surface Sur(myOffSurf->BasisSurface());
return Sur.NbUIntervals(BaseS);
}
case GeomAbs_Plane:
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
GeomAdaptor_Curve myBasisCurve
(myBspl->UIso(myBspl->UKnot(myBspl->FirstUKnotIndex())),myVFirst,myVLast);
return myBasisCurve.NbIntervals(S);
}
- case GeomAbs_SurfaceOfRevolution:
+ case GeomAbs_SurfaceOfRevolution:
{
- GeomAdaptor_Curve myBasisCurve
- (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast);
- if (myBasisCurve.GetType() == GeomAbs_BSplineCurve)
+ Handle(Geom_SurfaceOfRevolution) myRevSurf =
+ Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
+ GeomAdaptor_Curve myBasisCurve(myRevSurf->BasisCurve(), myVFirst, myVLast);
+ if (myBasisCurve.GetType() == GeomAbs_BSplineCurve)
return myBasisCurve.NbIntervals(S);
break;
}
- case GeomAbs_OffsetSurface:
+ case GeomAbs_OffsetSurface:
{
GeomAbs_Shape BaseS = GeomAbs_CN;
switch(S)
case GeomAbs_C3:
case GeomAbs_CN: break;
}
- GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface());
+ Handle(Geom_OffsetSurface) myOffSurf = Handle(Geom_OffsetSurface)::DownCast(mySurface);
+ GeomAdaptor_Surface Sur(myOffSurf->BasisSurface());
return Sur.NbVIntervals(BaseS);
- }
+ }
case GeomAbs_Plane:
case GeomAbs_Cylinder:
case GeomAbs_Cone:
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
GeomAdaptor_Curve myBasisCurve
(myBspl->VIso(myBspl->VKnot(myBspl->FirstVKnotIndex())),myUFirst,myULast);
myNbUIntervals = myBasisCurve.NbIntervals(S);
myBasisCurve.Intervals(T,S);
break;
}
- case GeomAbs_SurfaceOfExtrusion:
+ case GeomAbs_SurfaceOfExtrusion:
{
GeomAdaptor_Curve myBasisCurve
(Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast);
}
break;
}
- case GeomAbs_OffsetSurface:
+ case GeomAbs_OffsetSurface:
{
GeomAbs_Shape BaseS = GeomAbs_CN;
switch(S)
case GeomAbs_C3:
case GeomAbs_CN: break;
}
- GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface());
+ Handle(Geom_OffsetSurface) myOffSurf = Handle(Geom_OffsetSurface)::DownCast(mySurface);
+ GeomAdaptor_Surface Sur(myOffSurf->BasisSurface());
myNbUIntervals = Sur.NbUIntervals(BaseS);
Sur.UIntervals(T, BaseS);
}
{
case GeomAbs_BSplineSurface:
{
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
GeomAdaptor_Curve myBasisCurve
(myBspl->UIso(myBspl->UKnot(myBspl->FirstUKnotIndex())),myVFirst,myVLast);
myNbVIntervals = myBasisCurve.NbIntervals(S);
myBasisCurve.Intervals(T,S);
break;
}
- case GeomAbs_SurfaceOfRevolution:
+ case GeomAbs_SurfaceOfRevolution:
{
- GeomAdaptor_Curve myBasisCurve
- (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast);
+ Handle(Geom_SurfaceOfRevolution) myRevSurf =
+ Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
+ GeomAdaptor_Curve myBasisCurve(myRevSurf->BasisCurve(), myVFirst, myVLast);
if (myBasisCurve.GetType() == GeomAbs_BSplineCurve)
{
myNbVIntervals = myBasisCurve.NbIntervals(S);
}
break;
}
- case GeomAbs_OffsetSurface:
+ case GeomAbs_OffsetSurface:
{
GeomAbs_Shape BaseS = GeomAbs_CN;
switch(S)
case GeomAbs_C3:
case GeomAbs_CN: break;
}
- GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface());
+ Handle(Geom_OffsetSurface) myOffSurf = Handle(Geom_OffsetSurface)::DownCast(mySurface);
+ GeomAdaptor_Surface Sur(myOffSurf->BasisSurface());
myNbVIntervals = Sur.NbVIntervals(BaseS);
Sur.VIntervals(T, BaseS);
}
void GeomAdaptor_Surface::RebuildCache(const Standard_Real theU,
const Standard_Real theV) const
{
- mySurfaceCache->BuildCache(theU, theV,
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ mySurfaceCache->BuildCache(theU, theV,
myBspl->UDegree(), myBspl->IsUPeriodic(), myBspl->UKnotSequence(),
myBspl->VDegree(), myBspl->IsVPeriodic(), myBspl->VKnotSequence(),
myBspl->Poles(), myBspl->Weights());
gp_Pnt GeomAdaptor_Surface::Value(const Standard_Real U,
const Standard_Real V) const
{
- if (mySurfaceType == GeomAbs_BSplineSurface && !mySurfaceCache.IsNull())
- {
- if (!mySurfaceCache->IsCacheValid(U, V))
- RebuildCache(U, V);
- gp_Pnt P;
- mySurfaceCache->D0(U, V, P);
- return P;
- }
-
- return mySurface->Value(U,V);
+ gp_Pnt aValue;
+ D0(U, V, aValue);
+ return aValue;
}
//=======================================================================
void GeomAdaptor_Surface::D0(const Standard_Real U,
const Standard_Real V, gp_Pnt& P) const
{
- if (mySurfaceType == GeomAbs_BSplineSurface && !mySurfaceCache.IsNull())
+ switch (mySurfaceType)
{
- if (!mySurfaceCache->IsCacheValid(U, V))
- RebuildCache(U, V);
- mySurfaceCache->D0(U, V, P);
- return;
- }
+ case GeomAbs_BSplineSurface:
+ if (!mySurfaceCache.IsNull())
+ {
+ if (!mySurfaceCache->IsCacheValid(U, V))
+ RebuildCache(U, V);
+ mySurfaceCache->D0(U, V, P);
+ }
+ else
+ mySurface->D0(U, V, P);
+ break;
- mySurface->D0(U,V,P);
+ case GeomAbs_OffsetSurface:
+ case GeomAbs_SurfaceOfExtrusion:
+ case GeomAbs_SurfaceOfRevolution:
+ Standard_NoSuchObject_Raise_if(myNestedEvaluator.IsNull(),
+ "GeomAdaptor_Surface::D0: evaluator is not initialized");
+ myNestedEvaluator->D0(U, V, P);
+ break;
+
+ default:
+ mySurface->D0(U, V, P);
+ }
}
else if (Abs(V-myVLast) <= myTolV) {VSide= -1; v = myVLast;}
switch(mySurfaceType) {
- case GeomAbs_BSplineSurface:
- if ((USide != 0 || VSide != 0) &&
+ case GeomAbs_BSplineSurface: {
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ if ((USide != 0 || VSide != 0) &&
IfUVBound(u, v, Ideb, Ifin, IVdeb, IVfin, USide, VSide))
myBspl->LocalD1(u, v, Ideb, Ifin, IVdeb, IVfin, P, D1U, D1V);
else if (!mySurfaceCache.IsNull())
else
myBspl->D1(u, v, P, D1U, D1V);
break;
+ }
case GeomAbs_SurfaceOfExtrusion:
- if (USide==0)
- myExtSurf->D1(u, v, P, D1U, D1V);
- else
- myExtSurf->LocalD1(u, v, USide, P, D1U, D1V);
- break;
-
case GeomAbs_SurfaceOfRevolution:
- if (VSide==0)
- myRevSurf->D1(u, v, P, D1U, D1V);
- else
- myRevSurf->LocalD1(u, v, VSide, P, D1U, D1V);
- break;
-
case GeomAbs_OffsetSurface:
- if (USide==0 && VSide==0)
- myOffSurf->D1(u, v, P, D1U, D1V);
- else
- myOffSurf->LocalD1(u, v, USide, VSide, P, D1U, D1V);
+ Standard_NoSuchObject_Raise_if(myNestedEvaluator.IsNull(),
+ "GeomAdaptor_Surface::D1: evaluator is not initialized");
+ myNestedEvaluator->D1(u, v, P, D1U, D1V);
break;
+
default:
mySurface->D1(u, v, P, D1U, D1V);
}
else if (Abs(V-myVLast) <= myTolV) {VSide= -1; v = myVLast;}
switch(mySurfaceType) {
- case GeomAbs_BSplineSurface:
- if((USide != 0 || VSide != 0) &&
- IfUVBound(u, v, Ideb, Ifin, IVdeb, IVfin, USide, VSide))
+ case GeomAbs_BSplineSurface: {
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ if ((USide != 0 || VSide != 0) &&
+ IfUVBound(u, v, Ideb, Ifin, IVdeb, IVfin, USide, VSide))
myBspl->LocalD2(u, v, Ideb, Ifin, IVdeb, IVfin, P, D1U, D1V, D2U, D2V, D2UV);
else if (!mySurfaceCache.IsNull())
{
RebuildCache(U, V);
mySurfaceCache->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
}
- else myBspl->D2(u,v,P,D1U,D1V,D2U,D2V,D2UV);
+ else myBspl->D2(u, v, P, D1U, D1V, D2U, D2V, D2UV);
break;
+ }
- case GeomAbs_SurfaceOfExtrusion :
-
- if(USide==0) myExtSurf->D2(u,v,P,D1U,D1V,D2U,D2V,D2UV);
- else myExtSurf->LocalD2(u,v,USide,P,D1U,D1V,D2U,D2V,D2UV);
- break;
-
- case GeomAbs_SurfaceOfRevolution :
-
- if(VSide==0) myRevSurf->D2 (u, v, P,D1U,D1V,D2U,D2V,D2UV );
- else myRevSurf->LocalD2 (u, v, VSide, P,D1U,D1V,D2U,D2V,D2UV );
+ case GeomAbs_SurfaceOfExtrusion:
+ case GeomAbs_SurfaceOfRevolution:
+ case GeomAbs_OffsetSurface :
+ Standard_NoSuchObject_Raise_if(myNestedEvaluator.IsNull(),
+ "GeomAdaptor_Surface::D2: evaluator is not initialized");
+ myNestedEvaluator->D2(u, v, P, D1U, D1V, D2U, D2V, D2UV);
break;
- case GeomAbs_OffsetSurface :
- {
- if((USide==0)&&(VSide==0)) myOffSurf->D2 (u, v,P,D1U,D1V,D2U,D2V,D2UV );
- else myOffSurf->LocalD2 (u, v, USide, VSide ,P,D1U,D1V,D2U,D2V,D2UV );
- break;
- }
- default : { mySurface->D2(u,v,P,D1U,D1V,D2U,D2V,D2UV);
+ default: { mySurface->D2(u, v, P, D1U, D1V, D2U, D2V, D2UV);
break;}
}
}
else if (Abs(V-myVLast) <= myTolV) {VSide= -1; v = myVLast;}
switch(mySurfaceType) {
- case GeomAbs_BSplineSurface:
-
- if((USide==0)&&(VSide==0))
- myBspl->D3(u,v,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- else {
- if(IfUVBound(u,v,Ideb,Ifin,IVdeb,IVfin,USide,VSide))
- myBspl-> LocalD3 (u, v, Ideb, Ifin,IVdeb ,IVfin ,
- P ,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- else
- myBspl->D3(u,v,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- }
- break;
-
- case GeomAbs_SurfaceOfExtrusion :
-
- if(USide==0) myExtSurf->D3(u,v,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
- else myExtSurf->LocalD3(u,v,USide,P,D1U,D1V,D2U,D2V,D2UV,
- D3U,D3V,D3UUV,D3UVV);
- break;
-
- case GeomAbs_SurfaceOfRevolution :
-
- if(VSide==0) myRevSurf->D3 (u, v, P ,D1U,D1V,D2U,D2V,D2UV,
- D3U,D3V,D3UUV,D3UVV);
- else myRevSurf->LocalD3 (u, v, VSide, P,D1U,D1V,D2U,D2V,D2UV,
- D3U,D3V,D3UUV,D3UVV );
- break;
-
- case GeomAbs_OffsetSurface :
- {
- if((USide==0)&&(VSide==0)) myOffSurf->D3 (u, v,P ,D1U,D1V,D2U,D2V,D2UV,
- D3U,D3V,D3UUV,D3UVV);
- else myOffSurf->LocalD3 (u, v, USide, VSide ,P ,D1U,D1V,D2U,D2V,D2UV,
- D3U,D3V,D3UUV,D3UVV);
- break;
+ case GeomAbs_BSplineSurface: {
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ if ((USide == 0) && (VSide == 0))
+ myBspl->D3(u, v, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
+ else {
+ if (IfUVBound(u, v, Ideb, Ifin, IVdeb, IVfin, USide, VSide))
+ myBspl->LocalD3(u, v, Ideb, Ifin, IVdeb, IVfin,
+ P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
+ else
+ myBspl->D3(u, v, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
}
- default : { mySurface->D3(u,v,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
+ break;
+ }
+
+ case GeomAbs_SurfaceOfExtrusion:
+ case GeomAbs_SurfaceOfRevolution:
+ case GeomAbs_OffsetSurface:
+ Standard_NoSuchObject_Raise_if(myNestedEvaluator.IsNull(),
+ "GeomAdaptor_Surface::D3: evaluator is not initialized");
+ myNestedEvaluator->D3(u, v, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
+ break;
+
+ default : { mySurface->D3(u,v,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
break;}
}
}
switch(mySurfaceType)
{
- case GeomAbs_BSplineSurface:
-
- if((USide==0)&&(VSide==0)) return myBspl->DN(u,v,Nu,Nv);
+ case GeomAbs_BSplineSurface: {
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ if ((USide == 0) && (VSide == 0))
+ return myBspl->DN(u, v, Nu, Nv);
else {
- if(IfUVBound(u,v,Ideb,Ifin,IVdeb,IVfin,USide,VSide))
- return myBspl->LocalDN (u, v, Ideb, Ifin,IVdeb ,IVfin ,Nu,Nv );
+ if (IfUVBound(u, v, Ideb, Ifin, IVdeb, IVfin, USide, VSide))
+ return myBspl->LocalDN(u, v, Ideb, Ifin, IVdeb, IVfin, Nu, Nv);
else
- return myBspl->DN(u,v,Nu,Nv);
+ return myBspl->DN(u, v, Nu, Nv);
}
-
+ }
+
case GeomAbs_SurfaceOfExtrusion:
-
- if(USide==0) return myExtSurf-> DN (u, v,Nu,Nv );
- else return myExtSurf->LocalDN (u, v, USide,Nu,Nv );
-
case GeomAbs_SurfaceOfRevolution:
-
- if(VSide==0) return myRevSurf->DN (u, v, Nu, Nv );
- else return myRevSurf->LocalDN (u, v,VSide, Nu, Nv );
-
case GeomAbs_OffsetSurface:
-
- if((USide==0)&&(VSide==0)) return myOffSurf->DN (u, v, Nu, Nv );
- else return myOffSurf->LocalDN (u, v, USide, VSide, Nu, Nv );
+ Standard_NoSuchObject_Raise_if(myNestedEvaluator.IsNull(),
+ "GeomAdaptor_Surface::DN: evaluator is not initialized");
+ return myNestedEvaluator->DN(u, v, Nu, Nv);
case GeomAbs_Plane:
case GeomAbs_Cylinder:
const Standard_Integer VSide) const
{
Standard_Integer Ideb,Ifin;
- Standard_Integer anUFKIndx = myBspl->FirstUKnotIndex(),
+ Handle(Geom_BSplineSurface) myBspl = Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ Standard_Integer anUFKIndx = myBspl->FirstUKnotIndex(),
anULKIndx = myBspl->LastUKnotIndex(),
aVFKIndx = myBspl->FirstVKnotIndex(), aVLKIndx = myBspl->LastVKnotIndex();
myBspl->LocateU(U, PosTol, Ideb, Ifin, Standard_False);
#include <Standard_Integer.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Standard_Boolean.hxx>
+#include <GeomEvaluator_Surface.hxx>
class Geom_Surface;
class Standard_NoSuchObject;
class Standard_OutOfRange;
Handle(Geom_Surface) mySurface;
- GeomAbs_SurfaceType mySurfaceType;
Standard_Real myUFirst;
Standard_Real myULast;
Standard_Real myVFirst;
Standard_Real myVLast;
Standard_Real myTolU;
Standard_Real myTolV;
- Handle(BSplSLib_Cache) mySurfaceCache;
-
+ Handle(BSplSLib_Cache) mySurfaceCache; ///< Cached data for B-spline surface
+protected:
+ GeomAbs_SurfaceType mySurfaceType;
+ Handle(GeomEvaluator_Surface) myNestedEvaluator; ///< Calculates values of nested complex surfaces (offset surface, surface of extrusion or revolution)
};
//=======================================================================
inline GeomAdaptor_Surface::GeomAdaptor_Surface()
- : mySurfaceType(GeomAbs_OtherSurface),
- myUFirst(0.),
+ : myUFirst(0.),
myULast(0.),
myVFirst(0.),
myVLast (0.),
myTolU(0.),
- myTolV(0.)
+ myTolV(0.),
+ mySurfaceType(GeomAbs_OtherSurface)
{
}
--- /dev/null
+// Created on: 1993-04-21
+// 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.
+
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+
+#include <Adaptor3d_HCurve.hxx>
+#include <GeomAdaptor_HSurfaceOfLinearExtrusion.hxx>
+#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfLinearExtrusion
+//purpose :
+//=======================================================================
+GeomAdaptor_SurfaceOfLinearExtrusion::GeomAdaptor_SurfaceOfLinearExtrusion()
+ : myHaveDir(Standard_False)
+{}
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfLinearExtrusion
+//purpose :
+//=======================================================================
+
+GeomAdaptor_SurfaceOfLinearExtrusion::GeomAdaptor_SurfaceOfLinearExtrusion
+(const Handle(Adaptor3d_HCurve)& C)
+ : myHaveDir(Standard_False)
+{
+ Load(C);
+}
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfLinearExtrusion
+//purpose :
+//=======================================================================
+
+GeomAdaptor_SurfaceOfLinearExtrusion::GeomAdaptor_SurfaceOfLinearExtrusion
+(const Handle(Adaptor3d_HCurve)& C,
+ const gp_Dir& V)
+ : myHaveDir(Standard_False)
+{
+ Load(C);
+ Load(V);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfLinearExtrusion::Load(const Handle(Adaptor3d_HCurve)& C)
+{
+ myBasisCurve = C;
+ if (myHaveDir)
+ Load(myDirection);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfLinearExtrusion::Load(const gp_Dir& V)
+{
+ myHaveDir = Standard_True;
+ myDirection = V;
+
+ mySurfaceType = GeomAbs_SurfaceOfExtrusion;
+ myNestedEvaluator = new GeomEvaluator_SurfaceOfExtrusion(myBasisCurve, myDirection);
+}
+
+//=======================================================================
+//function : FirstUParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::FirstUParameter() const
+{
+ return myBasisCurve->FirstParameter();
+}
+
+//=======================================================================
+//function : LastUParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::LastUParameter() const
+{
+ return myBasisCurve->LastParameter();
+}
+
+//=======================================================================
+//function : FirstVParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::FirstVParameter() const
+{
+ return RealFirst();
+}
+
+//=======================================================================
+//function : LastVParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::LastVParameter() const
+{
+ return RealLast();
+}
+
+//=======================================================================
+//function : UContinuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape GeomAdaptor_SurfaceOfLinearExtrusion::UContinuity() const
+{
+ return myBasisCurve->Continuity();
+}
+
+//=======================================================================
+//function : VContinuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape GeomAdaptor_SurfaceOfLinearExtrusion::VContinuity() const
+{
+ return GeomAbs_CN;
+}
+
+//=======================================================================
+//function : NbUIntervals
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfLinearExtrusion::NbUIntervals
+(const GeomAbs_Shape S) const
+{
+ return myBasisCurve->NbIntervals(S);
+}
+
+//=======================================================================
+//function : NbVIntervals
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfLinearExtrusion::NbVIntervals
+(const GeomAbs_Shape ) const
+{
+ return 1;
+}
+
+//=======================================================================
+//function : UIntervals
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfLinearExtrusion::UIntervals
+(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
+{
+ myBasisCurve->Intervals(T,S);
+}
+
+//=======================================================================
+//function : VIntervals
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfLinearExtrusion::VIntervals
+(TColStd_Array1OfReal& T, const GeomAbs_Shape ) const
+{
+ T(T.Lower()) = FirstVParameter() ;
+ T(T.Lower() + 1) = LastVParameter() ;
+}
+
+//=======================================================================
+//function : VTrim
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HSurface) GeomAdaptor_SurfaceOfLinearExtrusion::VTrim
+(const Standard_Real First,
+ const Standard_Real Last,
+ const Standard_Real Tol) const
+{
+ Handle(Adaptor3d_HCurve) HC = BasisCurve()->Trim(First,Last,Tol);
+ Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) HR = new GeomAdaptor_HSurfaceOfLinearExtrusion(
+ GeomAdaptor_SurfaceOfLinearExtrusion(HC, myDirection));
+ return HR;
+}
+
+//=======================================================================
+//function : UTrim
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HSurface) GeomAdaptor_SurfaceOfLinearExtrusion::UTrim
+(const Standard_Real ,
+ const Standard_Real ,
+ const Standard_Real ) const
+{
+ Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) HR = new GeomAdaptor_HSurfaceOfLinearExtrusion(
+ GeomAdaptor_SurfaceOfLinearExtrusion(myBasisCurve, myDirection));
+ return HR;
+}
+
+//=======================================================================
+//function : IsUClosed
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsUClosed() const
+{
+ return myBasisCurve->IsClosed();
+}
+
+//=======================================================================
+//function : IsVClosed
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsVClosed() const
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : IsUPeriodic
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsUPeriodic() const
+{
+ return myBasisCurve->IsPeriodic();
+}
+
+//=======================================================================
+//function : UPeriod
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::UPeriod() const
+{
+ return myBasisCurve->Period() ;
+}
+
+//=======================================================================
+//function : IsVPeriodic
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsVPeriodic() const
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : VPeriod
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod() const
+{
+ Standard_DomainError::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod");
+ return 0.0e0 ;
+}
+
+//=======================================================================
+//function : UResolution
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::UResolution
+(const Standard_Real R3d) const
+{
+ return myBasisCurve->Resolution(R3d);
+}
+
+//=======================================================================
+//function : VResolution
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::VResolution
+(const Standard_Real R3d) const
+{
+ return R3d;
+}
+
+//=======================================================================
+//function : GetType
+//purpose :
+//=======================================================================
+
+GeomAbs_SurfaceType GeomAdaptor_SurfaceOfLinearExtrusion::GetType() const
+{
+ switch ( myBasisCurve->GetType()) {
+
+ case GeomAbs_Line:
+ {
+ gp_Dir D = myBasisCurve->Line().Direction();
+ if (!myDirection.IsParallel( D, Precision::Angular()))
+ return GeomAbs_Plane;
+ break;
+ }
+
+ case GeomAbs_Circle:
+ {
+ gp_Dir D = (myBasisCurve->Circle()).Axis().Direction();
+ if ( myDirection.IsParallel( D, Precision::Angular()))
+ return GeomAbs_Cylinder;
+ else if (myDirection.IsNormal(D, Precision::Angular()))
+ return GeomAbs_Plane;
+ break;
+ }
+
+ case GeomAbs_Ellipse:
+ {
+ gp_Dir D = (myBasisCurve->Ellipse()).Axis().Direction();
+ if (myDirection.IsNormal(D, Precision::Angular()))
+ return GeomAbs_Plane;
+ break;
+ }
+
+ case GeomAbs_Parabola:
+ {
+ gp_Dir D = (myBasisCurve->Parabola()).Axis().Direction();
+ if (myDirection.IsNormal(D, Precision::Angular()))
+ return GeomAbs_Plane;
+ break;
+ }
+
+ case GeomAbs_Hyperbola:
+ {
+ gp_Dir D = (myBasisCurve->Hyperbola()).Axis().Direction();
+ if (myDirection.IsNormal(D, Precision::Angular()))
+ return GeomAbs_Plane;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return GeomAbs_SurfaceOfExtrusion;
+}
+
+//=======================================================================
+//function : Plane
+//purpose :
+//=======================================================================
+
+gp_Pln GeomAdaptor_SurfaceOfLinearExtrusion::Plane() const
+{
+ Standard_NoSuchObject_Raise_if (GetType() != GeomAbs_Plane,
+ "GeomAdaptor_SurfaceOfLinearExtrusion::Plane");
+
+ gp_Pnt P;
+ gp_Vec D1u, newZ;
+ Standard_Real UFirst = myBasisCurve->FirstParameter();
+ Standard_Real ULast = myBasisCurve->LastParameter();
+ if (Precision::IsNegativeInfinite(UFirst) &&
+ Precision::IsPositiveInfinite(ULast)) {
+ UFirst = -100.;
+ ULast = 100.;
+ }
+ else if (Precision::IsNegativeInfinite(UFirst)) {
+ UFirst = ULast - 200.;
+ }
+ else if (Precision::IsPositiveInfinite(ULast)) {
+ ULast = UFirst + 200.;
+ }
+ Standard_Real deltau = (ULast-UFirst)/20.;
+ for (Standard_Integer i =1; i<=21; i++) {
+ Standard_Real prm = UFirst + (i-1)*deltau;
+ myBasisCurve->D1(prm,P,D1u);
+ newZ = D1u.Normalized().Crossed(myDirection);
+ if (newZ.Magnitude() > 1.e-12) break;
+ }
+ gp_Ax3 Ax3(P,gp_Dir(newZ),gp_Dir(D1u));
+ if (myDirection.Dot(Ax3.YDirection())<0.){
+ Ax3.YReverse();
+ }
+ return gp_Pln(Ax3);
+}
+
+
+//=======================================================================
+//function : Cylinder
+//purpose :
+//=======================================================================
+
+gp_Cylinder GeomAdaptor_SurfaceOfLinearExtrusion::Cylinder() const
+{
+ Standard_NoSuchObject_Raise_if
+ (GetType() != GeomAbs_Cylinder,
+ "GeomAdaptor_SurfaceOfLinearExtrusion::Cylinder");
+
+ gp_Circ C = myBasisCurve->Circle() ;
+ gp_Ax3 Ax3(C.Position());
+ if(myDirection.Dot((C.Axis()).Direction())<0.){
+ Ax3.ZReverse();
+ }
+ return gp_Cylinder(Ax3,C.Radius());
+}
+
+//=======================================================================
+//function : Cone
+//purpose :
+//=======================================================================
+
+gp_Cone GeomAdaptor_SurfaceOfLinearExtrusion::Cone() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::Cone");
+ return gp_Cone();
+}
+
+//=======================================================================
+//function : Sphere
+//purpose :
+//=======================================================================
+
+gp_Sphere GeomAdaptor_SurfaceOfLinearExtrusion::Sphere() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::Sphere");
+ return gp_Sphere();
+}
+
+//=======================================================================
+//function : Torus
+//purpose :
+//=======================================================================
+
+gp_Torus GeomAdaptor_SurfaceOfLinearExtrusion::Torus() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::Torus");
+ return gp_Torus();
+}
+
+
+//=======================================================================
+//function : Axis
+//purpose :
+//=======================================================================
+
+gp_Ax1 GeomAdaptor_SurfaceOfLinearExtrusion::AxeOfRevolution() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::Axes");
+ return gp_Ax1();
+}
+
+//=======================================================================
+//function : UDegree
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfLinearExtrusion::UDegree() const
+{
+ return myBasisCurve->Degree();
+}
+//=======================================================================
+//function : NbUPoles
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfLinearExtrusion::NbUPoles() const
+{
+ return myBasisCurve->NbPoles();
+}
+
+//=======================================================================
+//function : IsURational
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsURational() const
+{
+ Standard_NoSuchObject::Raise
+ ("GeomAdaptor_SurfaceOfLinearExtrusion::IsURational");
+ return Standard_False;
+}
+//=======================================================================
+//function : IsVRational
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsVRational() const
+{
+ Standard_NoSuchObject::Raise
+ ("GeomAdaptor_SurfaceOfLinearExtrusion::IsVRational");
+ return Standard_False;
+}
+//=======================================================================
+//function : Bezier
+//purpose :
+//=======================================================================
+
+
+Handle(Geom_BezierSurface) GeomAdaptor_SurfaceOfLinearExtrusion::Bezier() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::Bezier");
+ return Handle(Geom_BezierSurface)() ;
+}
+
+//=======================================================================
+//function : BSpline
+//purpose :
+//=======================================================================
+
+Handle(Geom_BSplineSurface) GeomAdaptor_SurfaceOfLinearExtrusion::BSpline() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfLinearExtrusion::BSpline");
+ return Handle(Geom_BSplineSurface)() ;
+}
+
+//=======================================================================
+//function : Direction
+//purpose :
+//=======================================================================
+
+gp_Dir GeomAdaptor_SurfaceOfLinearExtrusion::Direction() const
+{
+ return myDirection;
+}
+
+//=======================================================================
+//function : BasisCurve
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HCurve) GeomAdaptor_SurfaceOfLinearExtrusion::BasisCurve() const
+{
+ return myBasisCurve;
+}
--- /dev/null
+// Created on: 1993-04-21
+// 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 _GeomAdaptor_SurfaceOfLinearExtrusion_HeaderFile
+#define _GeomAdaptor_SurfaceOfLinearExtrusion_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <gp_Dir.hxx>
+#include <GeomAdaptor_Surface.hxx>
+
+class Adaptor3d_HCurve;
+class Standard_OutOfRange;
+class Standard_NoSuchObject;
+class Standard_DomainError;
+class gp_Dir;
+class Adaptor3d_HSurface;
+class gp_Pnt;
+class gp_Vec;
+class gp_Pln;
+class gp_Cylinder;
+class gp_Cone;
+class gp_Sphere;
+class gp_Torus;
+class Geom_BezierSurface;
+class Geom_BSplineSurface;
+class gp_Ax1;
+
+
+//! Generalised cylinder. This surface is obtained by sweeping a curve in a given
+//! direction. The parametrization range for the parameter U is defined
+//! with referenced the curve.
+//! The parametrization range for the parameter V is ]-infinite,+infinite[
+//! The position of the curve gives the origin for the
+//! parameter V.
+//! The continuity of the surface is CN in the V direction.
+class GeomAdaptor_SurfaceOfLinearExtrusion : public GeomAdaptor_Surface
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ Standard_EXPORT GeomAdaptor_SurfaceOfLinearExtrusion();
+
+ //! The Curve is loaded.
+ Standard_EXPORT GeomAdaptor_SurfaceOfLinearExtrusion(const Handle(Adaptor3d_HCurve)& C);
+
+ //! Thew Curve and the Direction are loaded.
+ Standard_EXPORT GeomAdaptor_SurfaceOfLinearExtrusion(const Handle(Adaptor3d_HCurve)& C, const gp_Dir& V);
+
+ //! Changes the Curve
+ Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
+
+ //! Changes the Direction
+ Standard_EXPORT void Load (const gp_Dir& V);
+
+ Standard_EXPORT Standard_Real FirstUParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real LastUParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real FirstVParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real LastVParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
+
+ //! Return CN.
+ Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
+
+ //! Returns the number of U intervals for continuity
+ //! <S>. May be one if UContinuity(me) >= <S>
+ Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the number of V intervals for continuity
+ //! <S>. May be one if VContinuity(me) >= <S>
+ Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the intervals with the requested continuity
+ //! in the U direction.
+ Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the intervals with the requested continuity
+ //! in the V direction.
+ Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns a surface trimmed in the U direction
+ //! equivalent of <me> between
+ //! parameters <First> and <Last>. <Tol> is used to
+ //! test for 3d points confusion.
+ //! If <First> >= <Last>
+ Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
+
+ //! Returns a surface trimmed in the V direction between
+ //! parameters <First> and <Last>. <Tol> is used to
+ //! test for 3d points confusion.
+ //! If <First> >= <Last>
+ Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
+
+ //! Returns the parametric U resolution corresponding
+ //! to the real space resolution <R3d>.
+ Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
+
+ //! Returns the parametric V resolution corresponding
+ //! to the real space resolution <R3d>.
+ Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
+
+ //! Returns the type of the surface : Plane, Cylinder,
+ //! Cone, Sphere, Torus, BezierSurface,
+ //! BSplineSurface, SurfaceOfRevolution,
+ //! SurfaceOfExtrusion, OtherSurface
+ Standard_EXPORT GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Integer UDegree() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Integer NbUPoles() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
+
+ Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
+
+ Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
+
+ Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
+
+
+
+
+protected:
+
+
+
+
+
+private:
+ Handle(Adaptor3d_HCurve) myBasisCurve; ///< extruded curve
+ gp_Dir myDirection; ///< direction of extrusion
+ Standard_Boolean myHaveDir; ///< whether the direction of extrusion is initialized
+};
+
+
+
+
+
+
+
+#endif // _GeomAdaptor_SurfaceOfLinearExtrusion_HeaderFile
--- /dev/null
+// Created on: 1993-04-21
+// 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.
+
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
+
+#include <Adaptor3d_HCurve.hxx>
+#include <ElCLib.hxx>
+#include <GeomAdaptor_HSurfaceOfRevolution.hxx>
+#include <GeomEvaluator_SurfaceOfRevolution.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfRevolution
+//purpose :
+//=======================================================================
+GeomAdaptor_SurfaceOfRevolution::GeomAdaptor_SurfaceOfRevolution()
+ : myHaveAxis(Standard_False)
+{}
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfRevolution
+//purpose :
+//=======================================================================
+
+GeomAdaptor_SurfaceOfRevolution::GeomAdaptor_SurfaceOfRevolution(
+ const Handle(Adaptor3d_HCurve)& C)
+ : myHaveAxis(Standard_False)
+{
+ Load(C);
+}
+
+//=======================================================================
+//function : GeomAdaptor_SurfaceOfRevolution
+//purpose :
+//=======================================================================
+
+GeomAdaptor_SurfaceOfRevolution::GeomAdaptor_SurfaceOfRevolution(
+ const Handle(Adaptor3d_HCurve)& C,
+ const gp_Ax1& V)
+ : myHaveAxis(Standard_False)
+{
+ Load(C);
+ Load(V);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfRevolution::Load(const Handle(Adaptor3d_HCurve)& C)
+{
+ myBasisCurve = C;
+ if (myHaveAxis)
+ Load(myAxis); // to evaluate the new myAxeRev.
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfRevolution::Load(const gp_Ax1& V)
+{
+ myHaveAxis = Standard_True;
+ myAxis = V;
+
+ mySurfaceType = GeomAbs_SurfaceOfRevolution;
+ myNestedEvaluator = new GeomEvaluator_SurfaceOfRevolution(myBasisCurve,
+ myAxis.Direction(), myAxis.Location());
+
+ // Eval myAxeRev : axe of revolution ( Determination de Ox).
+ gp_Pnt P,Q;
+ gp_Pnt O = myAxis.Location();
+ gp_Dir Ox;
+ gp_Dir Oz = myAxis.Direction();
+ Standard_Boolean yrev = Standard_False;
+ if (myBasisCurve->GetType() == GeomAbs_Line) {
+ if((myBasisCurve->Line().Direction()).Dot(Oz) < 0.){
+ yrev = Standard_True;
+ Oz.Reverse();
+ }
+ }
+
+ if (myBasisCurve->GetType() == GeomAbs_Circle) {
+ Q = P = (myBasisCurve->Circle()).Location();
+ }
+ else {
+ Standard_Real First = myBasisCurve->FirstParameter();
+ P = Value( 0., 0.);// ce qui ne veut pas dire grand chose
+ if ( GetType() == GeomAbs_Cone) {
+ if ( gp_Lin(myAxis).Distance(P) <= Precision::Confusion())
+ Q = ElCLib::Value(1.,myBasisCurve->Line());
+ else
+ Q = P;
+ }
+ else if (Precision::IsInfinite(First))
+ Q = P;
+ else
+ Q = Value( 0., First);
+ }
+
+ gp_Dir DZ = myAxis.Direction();
+ O.SetXYZ( O.XYZ() + ( gp_Vec(O,P) * DZ) * DZ.XYZ());
+ if ( gp_Lin(myAxis).Distance(Q) > Precision::Confusion()) {
+ Ox = gp_Dir(Q.XYZ() - O.XYZ());
+ }
+ else {
+ Standard_Real First = myBasisCurve->FirstParameter();
+ Standard_Real Last = myBasisCurve->LastParameter();
+ Standard_Integer Ratio = 1;
+ Standard_Real Dist;
+ gp_Pnt PP;
+ do {
+ PP = myBasisCurve->Value(First+(Last-First)/Ratio);
+ Dist = gp_Lin(myAxis).Distance(PP);
+ Ratio++;
+ }
+ while ( Dist < Precision::Confusion() && Ratio < 100);
+
+ if ( Ratio >= 100 ) {
+ Standard_ConstructionError::Raise("Adaptor3d_SurfaceOfRevolution : Axe and meridian are confused");
+ }
+ Ox = ( (Oz^gp_Vec(PP.XYZ()-O.XYZ()))^Oz);
+ }
+
+ myAxeRev = gp_Ax3(O,Oz,Ox);
+
+ if (yrev) {
+ myAxeRev.YReverse();
+ }
+ else if (myBasisCurve->GetType() == GeomAbs_Circle) {
+ gp_Dir DC = (myBasisCurve->Circle()).Axis().Direction();
+ if ((Ox.Crossed(Oz)).Dot(DC) < 0.) myAxeRev.ZReverse();
+ }
+}
+
+//=======================================================================
+//function : AxeOfRevolution
+//purpose :
+//=======================================================================
+
+gp_Ax1 GeomAdaptor_SurfaceOfRevolution::AxeOfRevolution() const
+{
+ return myAxis;
+}
+
+//=======================================================================
+//function : FirstUParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::FirstUParameter() const
+{
+ return 0.;
+}
+
+//=======================================================================
+//function : LastUParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::LastUParameter() const
+{
+ return 2*M_PI;
+}
+
+//=======================================================================
+//function : FirstVParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::FirstVParameter() const
+{
+ return myBasisCurve->FirstParameter();
+}
+
+//=======================================================================
+//function : LastVParameter
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::LastVParameter() const
+{
+ return myBasisCurve->LastParameter();
+}
+
+//=======================================================================
+//function : UContinuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape GeomAdaptor_SurfaceOfRevolution::UContinuity() const
+{
+ return GeomAbs_CN;
+}
+
+//=======================================================================
+//function : VContinuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape GeomAdaptor_SurfaceOfRevolution::VContinuity() const
+{
+ return myBasisCurve->Continuity();
+}
+
+//=======================================================================
+//function : NbUIntervals
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfRevolution::NbUIntervals(const GeomAbs_Shape ) const
+{
+ return 1;
+}
+
+//=======================================================================
+//function : NbVIntervals
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfRevolution::NbVIntervals(const GeomAbs_Shape S) const
+{
+ return myBasisCurve->NbIntervals(S);
+}
+
+//=======================================================================
+//function : UIntervals
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfRevolution::UIntervals(TColStd_Array1OfReal& T,
+ const GeomAbs_Shape ) const
+{
+ T(T.Lower() ) = 0.;
+ T(T.Lower()+1) = 2*M_PI;
+}
+
+
+//=======================================================================
+//function : VIntervals
+//purpose :
+//=======================================================================
+
+void GeomAdaptor_SurfaceOfRevolution::VIntervals(TColStd_Array1OfReal& T,
+ const GeomAbs_Shape S) const
+{
+ myBasisCurve->Intervals(T,S);
+}
+
+
+//=======================================================================
+//function : UTrim
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HSurface) GeomAdaptor_SurfaceOfRevolution::UTrim
+(const Standard_Real
+#ifndef No_Exception
+ First
+#endif
+ ,const Standard_Real
+#ifndef No_Exception
+ Last
+#endif
+ ,const Standard_Real
+ ) const
+{
+#ifndef No_Exception
+ Standard_Real Eps = Precision::PConfusion();
+#endif
+ Standard_OutOfRange_Raise_if
+ ( Abs(First) > Eps || Abs(Last - 2.*M_PI) > Eps,
+ "GeomAdaptor_SurfaceOfRevolution : UTrim : Parameters out of range");
+
+ Handle(GeomAdaptor_HSurfaceOfRevolution) HR = new GeomAdaptor_HSurfaceOfRevolution(
+ GeomAdaptor_SurfaceOfRevolution(myBasisCurve, myAxis));
+ return HR;
+}
+
+
+//=======================================================================
+//function : VTrim
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HSurface) GeomAdaptor_SurfaceOfRevolution::VTrim
+(const Standard_Real First,
+ const Standard_Real Last,
+ const Standard_Real Tol) const
+{
+ Handle(Adaptor3d_HCurve) HC = BasisCurve()->Trim(First,Last,Tol);
+ Handle(GeomAdaptor_HSurfaceOfRevolution) HR = new GeomAdaptor_HSurfaceOfRevolution(
+ GeomAdaptor_SurfaceOfRevolution(HC, myAxis));
+ return HR;
+}
+
+
+//=======================================================================
+//function : IsUClosed
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsUClosed() const
+{
+ return Standard_True;
+}
+
+//=======================================================================
+//function : IsVClosed
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsVClosed() const
+{
+ return myBasisCurve->IsClosed();
+}
+
+//=======================================================================
+//function : IsUPeriodic
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsUPeriodic() const
+{
+ return Standard_True;
+}
+
+//=======================================================================
+//function : UPeriod
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::UPeriod() const
+{
+ return 2*M_PI;
+}
+
+//=======================================================================
+//function : IsVPeriodic
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsVPeriodic() const
+{
+ return myBasisCurve->IsPeriodic();
+}
+
+//=======================================================================
+//function : VPeriod
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::VPeriod() const
+{
+ return myBasisCurve->Period();
+}
+
+//=======================================================================
+//function : UResolution
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::UResolution
+(const Standard_Real R3d) const
+{
+ return Precision::Parametric(R3d);
+}
+
+//=======================================================================
+//function : VResolution
+//purpose :
+//=======================================================================
+
+Standard_Real GeomAdaptor_SurfaceOfRevolution::VResolution
+(const Standard_Real R3d) const
+{
+ return myBasisCurve->Resolution(R3d);
+}
+
+//=======================================================================
+//function : GetType
+//purpose :
+//=======================================================================
+
+GeomAbs_SurfaceType GeomAdaptor_SurfaceOfRevolution::GetType() const
+{
+ Standard_Real TolConf = Precision::Confusion();
+ Standard_Real TolAng = Precision::Angular();
+
+ switch (myBasisCurve->GetType()) {
+ case GeomAbs_Line: {
+ gp_Ax1 Axe = myBasisCurve->Line().Position();
+
+ if (myAxis.IsParallel(Axe, TolAng))
+ return GeomAbs_Cylinder;
+ else if (myAxis.IsNormal(Axe, TolAng))
+ return GeomAbs_Plane;
+ else
+ {
+ Standard_Real uf = myBasisCurve->FirstParameter();
+ Standard_Real ul = myBasisCurve->LastParameter();
+ Standard_Boolean istrim = (!Precision::IsInfinite(uf) &&
+ !Precision::IsInfinite(ul));
+ if(istrim)
+ {
+ gp_Pnt pf = myBasisCurve->Value(uf);
+ gp_Pnt pl = myBasisCurve->Value(ul);
+ Standard_Real len = pf.Distance(pl);
+ //on calcule la distance projetee sur l axe.
+ gp_Vec vlin(pf,pl);
+ gp_Vec vaxe(myAxis.Direction());
+ Standard_Real projlen = Abs(vaxe.Dot(vlin));
+ Standard_Real aTolConf = len*TolAng;
+ if ((len - projlen) <= aTolConf)
+ return GeomAbs_Cylinder;
+ else if (projlen <= aTolConf)
+ return GeomAbs_Plane;
+ }
+ gp_Vec V(myAxis.Location(), myBasisCurve->Line().Location());
+ gp_Vec W(Axe.Direction());
+ if (Abs(V.DotCross(myAxis.Direction(), W)) <= TolConf)
+ return GeomAbs_Cone;
+ }
+ break;
+ }//case GeomAbs_Line:
+ //
+ case GeomAbs_Circle: {
+ Standard_Real MajorRadius, aR;
+ gp_Lin aLin(myAxis);
+ //
+ gp_Circ C = myBasisCurve->Circle();
+ const gp_Pnt& aLC = C.Location();
+ aR=C.Radius();
+ //
+
+ if (!C.Position().IsCoplanar(myAxis, TolConf, TolAng))
+ return GeomAbs_SurfaceOfRevolution;
+ else if(aLin.Distance(aLC) <= TolConf)
+ return GeomAbs_Sphere;
+ else
+ {
+ MajorRadius = aLin.Distance(aLC);
+ if(MajorRadius > aR)
+ {
+ Standard_Real aT = 0., aDx, dX;
+ gp_Pnt aPx;
+
+ aPx = ElCLib::Value(aT, C);
+ aDx = aLin.Distance(aPx);
+ dX = aDx - MajorRadius - aR;
+ if (dX < 0.)
+ dX = -dX;
+ if (dX < TolConf)
+ return GeomAbs_Torus;
+ }
+ }
+ break;
+ }
+ //
+ default:
+ break;
+ }
+
+ return GeomAbs_SurfaceOfRevolution;
+}
+
+//=======================================================================
+//function : Plane
+//purpose :
+//=======================================================================
+
+gp_Pln GeomAdaptor_SurfaceOfRevolution::Plane() const
+{
+ Standard_NoSuchObject_Raise_if
+ (GetType() != GeomAbs_Plane, "GeomAdaptor_SurfaceOfRevolution:Plane");
+
+ gp_Ax3 Axe = myAxeRev;
+ gp_Pnt aPonCurve = Value(0., 0.);
+ Standard_Real aDot = (aPonCurve.XYZ() - myAxis.Location().XYZ()).Dot(myAxis.Direction().XYZ());
+
+ gp_Pnt P(myAxis.Location().XYZ() + aDot * myAxis.Direction().XYZ());
+ Axe.SetLocation(P);
+ if (Axe.XDirection().Dot(myBasisCurve->Line().Direction()) >= -Precision::Confusion())
+ Axe.XReverse();
+
+ return gp_Pln( Axe);
+}
+
+//=======================================================================
+//function : Cylinder
+//purpose :
+//=======================================================================
+
+gp_Cylinder GeomAdaptor_SurfaceOfRevolution::Cylinder() const
+{
+ Standard_NoSuchObject_Raise_if
+ (GetType() != GeomAbs_Cylinder, "GeomAdaptor_SurfaceOfRevolution::Cylinder");
+
+ gp_Pnt P = Value(0., 0.);
+ Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
+ return gp_Cylinder(myAxeRev, R);
+}
+
+//=======================================================================
+//function : Cone
+//purpose :
+//=======================================================================
+
+gp_Cone GeomAdaptor_SurfaceOfRevolution::Cone() const
+{
+ Standard_NoSuchObject_Raise_if
+ ( GetType() != GeomAbs_Cone, "GeomAdaptor_SurfaceOfRevolution:Cone");
+
+ gp_Ax3 Axe = myAxeRev;
+ gp_Dir ldir = (myBasisCurve->Line()).Direction();
+ Standard_Real Angle = (Axe.Direction()).Angle(ldir);
+ gp_Pnt P0 = Value(0., 0.);
+ Standard_Real R = (Axe.Location()).Distance(P0);
+ if ( R >= Precision::Confusion()) {
+ gp_Pnt O = Axe.Location();
+ gp_Vec OP0(O,P0);
+ Standard_Real t = OP0.Dot(Axe.XDirection());
+ t /= ldir.Dot(Axe.XDirection());
+ OP0.Add(-t * gp_Vec(ldir));
+ if ( OP0.Dot(Axe.Direction()) > 0.) Angle = -Angle;
+ }
+ return gp_Cone( Axe, Angle, R);
+}
+
+
+//=======================================================================
+//function : Sphere
+//purpose :
+//=======================================================================
+
+gp_Sphere GeomAdaptor_SurfaceOfRevolution::Sphere() const
+{
+ Standard_NoSuchObject_Raise_if
+ ( GetType() != GeomAbs_Sphere, "GeomAdaptor_SurfaceOfRevolution:Sphere");
+
+ gp_Circ C = myBasisCurve->Circle();
+ gp_Ax3 Axe = myAxeRev;
+ Axe.SetLocation(C.Location());
+ return gp_Sphere(Axe, C.Radius());
+}
+
+
+//=======================================================================
+//function : Torus
+//purpose :
+//=======================================================================
+
+gp_Torus GeomAdaptor_SurfaceOfRevolution::Torus() const
+{
+ Standard_NoSuchObject_Raise_if
+ (GetType() != GeomAbs_Torus, "GeomAdaptor_SurfaceOfRevolution:Torus");
+
+ gp_Circ C = myBasisCurve->Circle();
+ Standard_Real MajorRadius = gp_Lin(myAxis).Distance(C.Location());
+ return gp_Torus(myAxeRev, MajorRadius, C.Radius());
+}
+
+//=======================================================================
+//function : VDegree
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfRevolution::VDegree() const
+{
+ return myBasisCurve->Degree();
+}
+
+//=======================================================================
+//function : NbVPoles
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfRevolution::NbVPoles() const
+{
+ return myBasisCurve->NbPoles();
+}
+
+//=======================================================================
+//function : NbVKnots
+//purpose :
+//=======================================================================
+
+Standard_Integer GeomAdaptor_SurfaceOfRevolution::NbVKnots() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfRevolution::NbVKnots");
+ return 0;
+}
+
+
+
+//=======================================================================
+//function : IsURational
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsURational() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfRevolution::IsURational");
+ return Standard_False;
+}
+
+//=======================================================================
+//function : IsVRational
+//purpose :
+//=======================================================================
+
+Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsVRational() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfRevolution::IsVRational");
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : Bezier
+//purpose :
+//=======================================================================
+
+Handle(Geom_BezierSurface) GeomAdaptor_SurfaceOfRevolution::Bezier() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfRevolution::Bezier");
+ return Handle(Geom_BezierSurface)();
+}
+
+
+//=======================================================================
+//function : BSpline
+//purpose :
+//=======================================================================
+
+Handle(Geom_BSplineSurface) GeomAdaptor_SurfaceOfRevolution::BSpline() const
+{
+ Standard_NoSuchObject::Raise("GeomAdaptor_SurfaceOfRevolution::BSpline");
+ return Handle(Geom_BSplineSurface)();
+}
+
+//=======================================================================
+//function : Axis
+//purpose :
+//=======================================================================
+
+const gp_Ax3& GeomAdaptor_SurfaceOfRevolution::Axis() const
+{
+ return myAxeRev;
+}
+
+//=======================================================================
+//function : BasisCurve
+//purpose :
+//=======================================================================
+
+Handle(Adaptor3d_HCurve) GeomAdaptor_SurfaceOfRevolution::BasisCurve() const
+{
+ return myBasisCurve;
+}
--- /dev/null
+// Created on: 1993-04-21
+// 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 _GeomAdaptor_SurfaceOfRevolution_HeaderFile
+#define _GeomAdaptor_SurfaceOfRevolution_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <gp_Ax1.hxx>
+#include <gp_Ax3.hxx>
+#include <GeomAdaptor_Surface.hxx>
+
+class Adaptor3d_HCurve;
+class Standard_OutOfRange;
+class Standard_NoSuchObject;
+class Standard_DomainError;
+class gp_Ax1;
+class Adaptor3d_HSurface;
+class gp_Pnt;
+class gp_Vec;
+class gp_Pln;
+class gp_Cylinder;
+class gp_Cone;
+class gp_Sphere;
+class gp_Torus;
+class Geom_BezierSurface;
+class Geom_BSplineSurface;
+class gp_Ax3;
+class gp_Dir;
+
+
+//! This class defines a complete surface of revolution.
+//! The surface is obtained by rotating a curve a complete revolution
+//! about an axis. The curve and the axis must be in the same plane.
+//! If the curve and the axis are not in the same plane it is always
+//! possible to be in the previous case after a cylindrical projection
+//! of the curve in a referenced plane.
+//! For a complete surface of revolution the parametric range is
+//! 0 <= U <= 2*PI. --
+//! The parametric range for V is defined with the revolved curve.
+//! The origin of the U parametrization is given by the position
+//! of the revolved curve (reference). The direction of the revolution
+//! axis defines the positive sense of rotation (trigonometric sense)
+//! corresponding to the increasing of the parametric value U.
+//! The derivatives are always defined for the u direction.
+//! For the v direction the definition of the derivatives depends on
+//! the degree of continuity of the referenced curve.
+class GeomAdaptor_SurfaceOfRevolution : public GeomAdaptor_Surface
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ Standard_EXPORT GeomAdaptor_SurfaceOfRevolution();
+
+ //! The Curve is loaded.
+ Standard_EXPORT GeomAdaptor_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C);
+
+ //! The Curve and the Direction are loaded.
+ Standard_EXPORT GeomAdaptor_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C, const gp_Ax1& V);
+
+ //! Changes the Curve
+ Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
+
+ //! Changes the Direction
+ Standard_EXPORT void Load (const gp_Ax1& V);
+
+ Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real FirstUParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real LastUParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real FirstVParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real LastVParameter() const Standard_OVERRIDE;
+
+ Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
+
+ //! Return CN.
+ Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
+
+ //! Returns the number of U intervals for continuity
+ //! <S>. May be one if UContinuity(me) >= <S>
+ Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the number of V intervals for continuity
+ //! <S>. May be one if VContinuity(me) >= <S>
+ Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the intervals with the requested continuity
+ //! in the U direction.
+ Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns the intervals with the requested continuity
+ //! in the V direction.
+ Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
+
+ //! Returns a surface trimmed in the U direction
+ //! equivalent of <me> between
+ //! parameters <First> and <Last>. <Tol> is used to
+ //! test for 3d points confusion.
+ //! If <First> >= <Last>
+ Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
+
+ //! Returns a surface trimmed in the V direction between
+ //! parameters <First> and <Last>. <Tol> is used to
+ //! test for 3d points confusion.
+ //! If <First> >= <Last>
+ Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
+
+ //! Returns the parametric U resolution corresponding
+ //! to the real space resolution <R3d>.
+ Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
+
+ //! Returns the parametric V resolution corresponding
+ //! to the real space resolution <R3d>.
+ Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
+
+ //! Returns the type of the surface : Plane, Cylinder,
+ //! Cone, Sphere, Torus, BezierSurface,
+ //! BSplineSurface, SurfaceOfRevolution,
+ //! SurfaceOfExtrusion, OtherSurface
+ Standard_EXPORT GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
+
+ //! Apex of the Cone = Cone.Position().Location()
+ //! ==> ReferenceRadius = 0.
+ Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
+
+ Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
+
+ Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
+
+ Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
+
+ Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
+
+ Standard_EXPORT const gp_Ax3& Axis() const;
+
+ Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
+
+
+
+
+protected:
+
+
+
+
+
+private:
+ Handle(Adaptor3d_HCurve) myBasisCurve; ///< revolved curve
+ gp_Ax1 myAxis; ///< axis of revolution
+ Standard_Boolean myHaveAxis; ///< whether axis of revolution is initialized
+ gp_Ax3 myAxeRev; ///< auxiliary trihedron according to the curve position
+};
+
+
+
+
+
+
+
+#endif // _GeomAdaptor_SurfaceOfRevolution_HeaderFile
--- /dev/null
+GeomEvaluator_OffsetSurface.cxx
+GeomEvaluator_OffsetSurface.hxx
+GeomEvaluator_Surface.hxx
+GeomEvaluator_SurfaceOfExtrusion.cxx
+GeomEvaluator_SurfaceOfExtrusion.hxx
+GeomEvaluator_SurfaceOfRevolution.cxx
+GeomEvaluator_SurfaceOfRevolution.hxx
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 <GeomEvaluator_OffsetSurface.hxx>
+
+#include <GeomAdaptor_HSurface.hxx>
+#include <CSLib.hxx>
+#include <CSLib_NormalStatus.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_UndefinedValue.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+#include <gp_Vec.hxx>
+#include <Standard_RangeError.hxx>
+
+
+template<class SurfOrAdapt>
+static void derivatives(Standard_Integer theMaxOrder,
+ Standard_Integer theMinOrder,
+ const Standard_Real theU,
+ const Standard_Real theV,
+ const SurfOrAdapt& theBasisSurf,
+ const Standard_Integer theNU,
+ const Standard_Integer theNV,
+ const Standard_Boolean theAlongU,
+ const Standard_Boolean theAlongV,
+ const Handle(Geom_BSplineSurface)& theL,
+ TColgp_Array2OfVec& theDerNUV,
+ TColgp_Array2OfVec& theDerSurf);
+
+
+
+GeomEvaluator_OffsetSurface::GeomEvaluator_OffsetSurface(
+ const Handle(Geom_Surface)& theBase,
+ const Standard_Real theOffset,
+ const Handle(Geom_OsculatingSurface)& theOscSurf)
+ : GeomEvaluator_Surface(),
+ myBaseSurf(theBase),
+ myOffset(theOffset),
+ myOscSurf(theOscSurf)
+{
+ if (!myOscSurf.IsNull())
+ return; // osculating surface already exists
+
+ // Create osculating surface for B-spline and Besier surfaces only
+ if (myBaseSurf->IsKind(STANDARD_TYPE(Geom_BSplineSurface)) ||
+ myBaseSurf->IsKind(STANDARD_TYPE(Geom_BezierSurface)))
+ myOscSurf = new Geom_OsculatingSurface(myBaseSurf, Precision::Confusion());
+}
+
+GeomEvaluator_OffsetSurface::GeomEvaluator_OffsetSurface(
+ const Handle(GeomAdaptor_HSurface)& theBase,
+ const Standard_Real theOffset,
+ const Handle(Geom_OsculatingSurface)& theOscSurf)
+ : GeomEvaluator_Surface(),
+ myBaseAdaptor(theBase),
+ myOffset(theOffset)
+{
+ if (theOscSurf.IsNull())
+ return; // osculating surface already exists
+
+ // Create osculating surface for B-spline and Besier surfaces only
+ Handle(Geom_Surface) aBSurf;
+ if (myBaseAdaptor->GetType() == GeomAbs_BSplineSurface)
+ aBSurf = myBaseAdaptor->BSpline();
+ else if (myBaseAdaptor->GetType() == GeomAbs_BezierSurface)
+ aBSurf = myBaseAdaptor->Bezier();
+ if (!aBSurf.IsNull())
+ {
+ myBaseSurf = aBSurf;
+ myOscSurf = new Geom_OsculatingSurface(aBSurf, Precision::Confusion());
+ }
+}
+
+void GeomEvaluator_OffsetSurface::D0(
+ const Standard_Real theU, const Standard_Real theV, gp_Pnt& theValue) const
+{
+ gp_Vec aD1U, aD1V;
+ BaseD1(theU, theV, theValue, aD1U, aD1V);
+ CalculateD0(theU, theV, theValue, aD1U, aD1V);
+}
+
+void GeomEvaluator_OffsetSurface::D1(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
+{
+ gp_Vec aD2U, aD2V, aD2UV;
+ BaseD2(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
+ CalculateD1(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
+}
+
+void GeomEvaluator_OffsetSurface::D2(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
+{
+ gp_Vec aD3U, aD3V, aD3UUV, aD3UVV;
+ BaseD3(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
+ CalculateD2(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
+}
+
+void GeomEvaluator_OffsetSurface::D3(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
+{
+ BaseD3(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
+ CalculateD3(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
+}
+
+gp_Vec GeomEvaluator_OffsetSurface::DN(
+ const Standard_Real theU, const Standard_Real theV,
+ const Standard_Integer theDerU, const Standard_Integer theDerV) const
+{
+ Standard_RangeError_Raise_if(theDerU < 0, "GeomEvaluator_OffsetSurface::DN(): theDerU < 0");
+ Standard_RangeError_Raise_if(theDerV < 0, "GeomEvaluator_OffsetSurface::DN(): theDerV < 0");
+ Standard_RangeError_Raise_if(theDerU + theDerV < 1,
+ "GeomEvaluator_OffsetSurface::DN(): theDerU + theDerV < 1");
+
+ gp_Pnt aP;
+ gp_Vec aD1U, aD1V;
+ BaseD1(theU, theV, aP, aD1U, aD1V);
+ return CalculateDN(theU, theV, theDerU, theDerV, aD1U, aD1V);
+}
+
+
+void GeomEvaluator_OffsetSurface::BaseD0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D0(theU, theV, theValue);
+ else
+ myBaseSurf->D0(theU, theV, theValue);
+}
+
+void GeomEvaluator_OffsetSurface::BaseD1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D1(theU, theV, theValue, theD1U, theD1V);
+ else
+ myBaseSurf->D1(theU, theV, theValue, theD1U, theD1V);
+}
+
+void GeomEvaluator_OffsetSurface::BaseD2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D2(theU, theV, theValue, theD1U, theD1V, theD2U, theD2V, theD2UV);
+ else
+ myBaseSurf->D2(theU, theV, theValue, theD1U, theD1V, theD2U, theD2V, theD2UV);
+}
+
+void GeomEvaluator_OffsetSurface::BaseD3(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D3(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
+ else
+ myBaseSurf->D3(theU, theV, theValue, theD1U, theD1V,
+ theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
+}
+
+
+void GeomEvaluator_OffsetSurface::CalculateD0(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue,
+ const gp_Vec& theD1U, const gp_Vec& theD1V) const
+{
+ const Standard_Real MagTol = 1.e-9;
+
+ // Normalize derivatives before normal calculation because it gives more stable result.
+ // There will be normalized only derivatives greater than 1.0 to avoid differences in last significant digit
+ gp_Vec aD1U(theD1U);
+ gp_Vec aD1V(theD1V);
+ Standard_Real aD1UNorm2 = aD1U.SquareMagnitude();
+ Standard_Real aD1VNorm2 = aD1V.SquareMagnitude();
+ if (aD1UNorm2 > 1.0)
+ aD1U /= Sqrt(aD1UNorm2);
+ if (aD1VNorm2 > 1.0)
+ aD1V /= Sqrt(aD1VNorm2);
+
+ gp_Vec aNorm = aD1U.Crossed(aD1V);
+ if (aNorm.SquareMagnitude() > MagTol * MagTol)
+ {
+ // Non singular case. Simple computations.
+ aNorm.Normalize();
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aNorm.XYZ());
+ }
+ else
+ {
+ const Standard_Integer MaxOrder = 3;
+
+ Handle(Geom_BSplineSurface) L;
+ Standard_Boolean isOpposite = Standard_False;
+ Standard_Boolean AlongU = Standard_False;
+ Standard_Boolean AlongV = Standard_False;
+ if (!myOscSurf.IsNull())
+ {
+ AlongU = myOscSurf->UOscSurf(theU, theV, isOpposite, L);
+ AlongV = myOscSurf->VOscSurf(theU, theV, isOpposite, L);
+ }
+ const Standard_Real aSign = ((AlongV || AlongU) && isOpposite) ? -1. : 1.;
+
+ TColgp_Array2OfVec DerNUV(0, MaxOrder, 0, MaxOrder);
+ TColgp_Array2OfVec DerSurf(0, MaxOrder + 1, 0, MaxOrder + 1);
+ Standard_Integer OrderU, OrderV;
+ Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0;
+ Bounds(Umin, Umax, Vmin, Vmax);
+
+ DerSurf.SetValue(1, 0, theD1U);
+ DerSurf.SetValue(0, 1, theD1V);
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 1, theU, theV, myBaseSurf, 0, 0, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 1, theU, theV, myBaseAdaptor, 0, 0, AlongU, AlongV, L, DerNUV, DerSurf);
+
+ gp_Dir Normal;
+ CSLib_NormalStatus NStatus;
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax,
+ NStatus, Normal, OrderU, OrderV);
+ if (NStatus == CSLib_InfinityOfSolutions)
+ {
+ // Replace zero derivative and try to calculate normal
+ gp_Vec aNewDU = theD1U;
+ gp_Vec aNewDV = theD1V;
+ if (ReplaceDerivative(theU, theV, aNewDU, aNewDV, MagTol * MagTol))
+ CSLib::Normal(aNewDU, aNewDV, MagTol, NStatus, Normal);
+ }
+
+ if (NStatus != CSLib_Defined)
+ Geom_UndefinedValue::Raise(
+ "GeomEvaluator_OffsetSurface::CalculateD0(): Unable to calculate normal");
+
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aSign * Normal.XYZ());
+ }
+}
+
+void GeomEvaluator_OffsetSurface::CalculateD1(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ const gp_Vec& theD2U, const gp_Vec& theD2V, const gp_Vec& theD2UV) const
+{
+ const Standard_Real MagTol = 1.e-9;
+
+ // Check offset side.
+ Handle(Geom_BSplineSurface) L;
+ Standard_Boolean isOpposite = Standard_False;
+ Standard_Boolean AlongU = Standard_False;
+ Standard_Boolean AlongV = Standard_False;
+ if (!myOscSurf.IsNull())
+ {
+ AlongU = myOscSurf->UOscSurf(theU, theV, isOpposite, L);
+ AlongV = myOscSurf->VOscSurf(theU, theV, isOpposite, L);
+ }
+ const Standard_Real aSign = ((AlongV || AlongU) && isOpposite) ? -1. : 1.;
+
+ // Normalize derivatives before normal calculation because it gives more stable result.
+ // There will be normalized only derivatives greater than 1.0 to avoid differences in last significant digit
+ gp_Vec aD1U(theD1U);
+ gp_Vec aD1V(theD1V);
+ Standard_Real aD1UNorm2 = aD1U.SquareMagnitude();
+ Standard_Real aD1VNorm2 = aD1V.SquareMagnitude();
+ if (aD1UNorm2 > 1.0)
+ aD1U /= Sqrt(aD1UNorm2);
+ if (aD1VNorm2 > 1.0)
+ aD1V /= Sqrt(aD1VNorm2);
+
+ Standard_Integer MaxOrder = 0;
+ gp_Vec aNorm = aD1U.Crossed(aD1V);
+ if (aNorm.SquareMagnitude() > MagTol * MagTol)
+ {
+ if (!AlongV && !AlongU)
+ {
+ // AlongU or AlongV leads to more complex D1 computation
+ // Try to compute D0 and D1 much simpler
+ aNorm.Normalize();
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aSign * aNorm.XYZ());
+
+ gp_Vec aN0(aNorm.XYZ()), aN1U, aN1V;
+ Standard_Real aScale = (theD1U^theD1V).Dot(aN0);
+ aN1U.SetX(theD2U.Y() * theD1V.Z() + theD1U.Y() * theD2UV.Z()
+ - theD2U.Z() * theD1V.Y() - theD1U.Z() * theD2UV.Y());
+ aN1U.SetY((theD2U.X() * theD1V.Z() + theD1U.X() * theD2UV.Z()
+ - theD2U.Z() * theD1V.X() - theD1U.Z() * theD2UV.X()) * -1.0);
+ aN1U.SetZ(theD2U.X() * theD1V.Y() + theD1U.X() * theD2UV.Y()
+ - theD2U.Y() * theD1V.X() - theD1U.Y() * theD2UV.X());
+ Standard_Real aScaleU = aN1U.Dot(aN0);
+ aN1U.Subtract(aScaleU * aN0);
+ aN1U /= aScale;
+
+ aN1V.SetX(theD2UV.Y() * theD1V.Z() + theD2V.Z() * theD1U.Y()
+ - theD2UV.Z() * theD1V.Y() - theD2V.Y() * theD1U.Z());
+ aN1V.SetY((theD2UV.X() * theD1V.Z() + theD2V.Z() * theD1U.X()
+ - theD2UV.Z() * theD1V.X() - theD2V.X() * theD1U.Z()) * -1.0);
+ aN1V.SetZ(theD2UV.X() * theD1V.Y() + theD2V.Y() * theD1U.X()
+ - theD2UV.Y() * theD1V.X() - theD2V.X() * theD1U.Y());
+ Standard_Real aScaleV = aN1V.Dot(aN0);
+ aN1V.Subtract(aScaleV * aN0);
+ aN1V /= aScale;
+
+ theD1U += myOffset * aSign * aN1U;
+ theD1V += myOffset * aSign * aN1V;
+
+ return;
+ }
+ }
+ else
+ MaxOrder = 3;
+
+ Standard_Integer OrderU, OrderV;
+ TColgp_Array2OfVec DerNUV(0, MaxOrder + 1, 0, MaxOrder + 1);
+ TColgp_Array2OfVec DerSurf(0, MaxOrder + 2, 0, MaxOrder + 2);
+ Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0;
+ Bounds(Umin, Umax, Vmin, Vmax);
+
+ DerSurf.SetValue(1, 0, theD1U);
+ DerSurf.SetValue(0, 1, theD1V);
+ DerSurf.SetValue(1, 1, theD2UV);
+ DerSurf.SetValue(2, 0, theD2U);
+ DerSurf.SetValue(0, 2, theD2V);
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 2, theU, theV, myBaseSurf, 1, 1, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 2, theU, theV, myBaseAdaptor, 1, 1, AlongU, AlongV, L, DerNUV, DerSurf);
+
+ gp_Dir Normal;
+ CSLib_NormalStatus NStatus;
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax, NStatus, Normal, OrderU, OrderV);
+ if (NStatus == CSLib_InfinityOfSolutions)
+ {
+ gp_Vec aNewDU = theD1U;
+ gp_Vec aNewDV = theD1V;
+ // Replace zero derivative and try to calculate normal
+ if (ReplaceDerivative(theU, theV, aNewDU, aNewDV, MagTol * MagTol))
+ {
+ DerSurf.SetValue(1, 0, aNewDU);
+ DerSurf.SetValue(0, 1, aNewDV);
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 2, theU, theV, myBaseSurf, 1, 1, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 2, theU, theV, myBaseAdaptor, 1, 1, AlongU, AlongV, L, DerNUV, DerSurf);
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax,
+ NStatus, Normal, OrderU, OrderV);
+ }
+ }
+
+ if (NStatus != CSLib_Defined)
+ Geom_UndefinedValue::Raise(
+ "GeomEvaluator_OffsetSurface::CalculateD1(): Unable to calculate normal");
+
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aSign * Normal.XYZ());
+
+ theD1U = DerSurf(1, 0) + myOffset * aSign * CSLib::DNNormal(1, 0, DerNUV, OrderU, OrderV);
+ theD1V = DerSurf(0, 1) + myOffset * aSign * CSLib::DNNormal(0, 1, DerNUV, OrderU, OrderV);
+}
+
+void GeomEvaluator_OffsetSurface::CalculateD2(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ const gp_Vec& theD3U, const gp_Vec& theD3V, const gp_Vec& theD3UUV, const gp_Vec& theD3UVV) const
+{
+ const Standard_Real MagTol = 1.e-9;
+
+ gp_Dir Normal;
+ CSLib_NormalStatus NStatus;
+ CSLib::Normal(theD1U, theD1V, MagTol, NStatus, Normal);
+
+ const Standard_Integer MaxOrder = (NStatus == CSLib_Defined) ? 0 : 3;
+ Standard_Integer OrderU, OrderV;
+ TColgp_Array2OfVec DerNUV(0, MaxOrder + 2, 0, MaxOrder + 2);
+ TColgp_Array2OfVec DerSurf(0, MaxOrder + 3, 0, MaxOrder + 3);
+
+ Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0;
+ Bounds(Umin, Umax, Vmin, Vmax);
+
+ DerSurf.SetValue(1, 0, theD1U);
+ DerSurf.SetValue(0, 1, theD1V);
+ DerSurf.SetValue(1, 1, theD2UV);
+ DerSurf.SetValue(2, 0, theD2U);
+ DerSurf.SetValue(0, 2, theD2V);
+ DerSurf.SetValue(3, 0, theD3U);
+ DerSurf.SetValue(2, 1, theD3UUV);
+ DerSurf.SetValue(1, 2, theD3UVV);
+ DerSurf.SetValue(0, 3, theD3V);
+ //*********************
+
+ Handle(Geom_BSplineSurface) L;
+ Standard_Boolean isOpposite = Standard_False;
+ Standard_Boolean AlongU = Standard_False;
+ Standard_Boolean AlongV = Standard_False;
+ if (!myOscSurf.IsNull())
+ {
+ AlongU = myOscSurf->UOscSurf(theU, theV, isOpposite, L);
+ AlongV = myOscSurf->VOscSurf(theU, theV, isOpposite, L);
+ }
+ const Standard_Real aSign = ((AlongV || AlongU) && isOpposite) ? -1. : 1.;
+
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 3, theU, theV, myBaseSurf, 2, 2, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 3, theU, theV, myBaseAdaptor, 2, 2, AlongU, AlongV, L, DerNUV, DerSurf);
+
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax,
+ NStatus, Normal, OrderU, OrderV);
+ if (NStatus != CSLib_Defined)
+ Geom_UndefinedValue::Raise(
+ "GeomEvaluator_OffsetSurface::CalculateD2(): Unable to calculate normal");
+
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aSign * Normal.XYZ());
+
+ theD1U = DerSurf(1, 0) + myOffset * aSign * CSLib::DNNormal(1, 0, DerNUV, OrderU, OrderV);
+ theD1V = DerSurf(0, 1) + myOffset * aSign * CSLib::DNNormal(0, 1, DerNUV, OrderU, OrderV);
+
+ if (!myBaseSurf.IsNull())
+ {
+ theD2U = myBaseSurf->DN(theU, theV, 2, 0);
+ theD2V = myBaseSurf->DN(theU, theV, 0, 2);
+ theD2UV = myBaseSurf->DN(theU, theV, 1, 1);
+ }
+ else
+ {
+ theD2U = myBaseAdaptor->DN(theU, theV, 2, 0);
+ theD2V = myBaseAdaptor->DN(theU, theV, 0, 2);
+ theD2UV = myBaseAdaptor->DN(theU, theV, 1, 1);
+ }
+
+ theD2U += aSign * myOffset * CSLib::DNNormal(2, 0, DerNUV, OrderU, OrderV);
+ theD2V += aSign * myOffset * CSLib::DNNormal(0, 2, DerNUV, OrderU, OrderV);
+ theD2UV += aSign * myOffset * CSLib::DNNormal(1, 1, DerNUV, OrderU, OrderV);
+}
+
+void GeomEvaluator_OffsetSurface::CalculateD3(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
+{
+ const Standard_Real MagTol = 1.e-9;
+
+ gp_Dir Normal;
+ CSLib_NormalStatus NStatus;
+ CSLib::Normal(theD1U, theD1V, MagTol, NStatus, Normal);
+ const Standard_Integer MaxOrder = (NStatus == CSLib_Defined) ? 0 : 3;
+ Standard_Integer OrderU, OrderV;
+ TColgp_Array2OfVec DerNUV(0, MaxOrder + 3, 0, MaxOrder + 3);
+ TColgp_Array2OfVec DerSurf(0, MaxOrder + 4, 0, MaxOrder + 4);
+ Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0;
+ Bounds(Umin, Umax, Vmin, Vmax);
+
+ DerSurf.SetValue(1, 0, theD1U);
+ DerSurf.SetValue(0, 1, theD1V);
+ DerSurf.SetValue(1, 1, theD2UV);
+ DerSurf.SetValue(2, 0, theD2U);
+ DerSurf.SetValue(0, 2, theD2V);
+ DerSurf.SetValue(3, 0, theD3U);
+ DerSurf.SetValue(2, 1, theD3UUV);
+ DerSurf.SetValue(1, 2, theD3UVV);
+ DerSurf.SetValue(0, 3, theD3V);
+
+
+ //*********************
+ Handle(Geom_BSplineSurface) L;
+ Standard_Boolean isOpposite = Standard_False;
+ Standard_Boolean AlongU = Standard_False;
+ Standard_Boolean AlongV = Standard_False;
+ if (!myOscSurf.IsNull())
+ {
+ AlongU = myOscSurf->UOscSurf(theU, theV, isOpposite, L);
+ AlongV = myOscSurf->VOscSurf(theU, theV, isOpposite, L);
+ }
+ const Standard_Real aSign = ((AlongV || AlongU) && isOpposite) ? -1. : 1.;
+
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 3, theU, theV, myBaseSurf, 3, 3, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 3, theU, theV, myBaseAdaptor, 3, 3, AlongU, AlongV, L, DerNUV, DerSurf);
+
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax,
+ NStatus, Normal, OrderU, OrderV);
+ if (NStatus != CSLib_Defined)
+ Geom_UndefinedValue::Raise(
+ "GeomEvaluator_OffsetSurface::CalculateD3(): Unable to calculate normal");
+
+ theValue.SetXYZ(theValue.XYZ() + myOffset * aSign * Normal.XYZ());
+
+ theD1U = DerSurf(1, 0) + myOffset * aSign * CSLib::DNNormal(1, 0, DerNUV, OrderU, OrderV);
+ theD1V = DerSurf(0, 1) + myOffset * aSign * CSLib::DNNormal(0, 1, DerNUV, OrderU, OrderV);
+
+ if (!myBaseSurf.IsNull())
+ {
+ theD2U = myBaseSurf->DN(theU, theV, 2, 0);
+ theD2V = myBaseSurf->DN(theU, theV, 0, 2);
+ theD2UV = myBaseSurf->DN(theU, theV, 1, 1);
+ theD3U = myBaseSurf->DN(theU, theV, 3, 0);
+ theD3V = myBaseSurf->DN(theU, theV, 0, 3);
+ theD3UUV = myBaseSurf->DN(theU, theV, 2, 1);
+ theD3UVV = myBaseSurf->DN(theU, theV, 1, 2);
+ }
+ else
+ {
+ theD2U = myBaseAdaptor->DN(theU, theV, 2, 0);
+ theD2V = myBaseAdaptor->DN(theU, theV, 0, 2);
+ theD2UV = myBaseAdaptor->DN(theU, theV, 1, 1);
+ theD3U = myBaseAdaptor->DN(theU, theV, 3, 0);
+ theD3V = myBaseAdaptor->DN(theU, theV, 0, 3);
+ theD3UUV = myBaseAdaptor->DN(theU, theV, 2, 1);
+ theD3UVV = myBaseAdaptor->DN(theU, theV, 1, 2);
+ }
+
+ theD2U += aSign * myOffset * CSLib::DNNormal(2, 0, DerNUV, OrderU, OrderV);
+ theD2V += aSign * myOffset * CSLib::DNNormal(0, 2, DerNUV, OrderU, OrderV);
+ theD2UV += aSign * myOffset * CSLib::DNNormal(1, 1, DerNUV, OrderU, OrderV);
+ theD3U += aSign * myOffset * CSLib::DNNormal(3, 0, DerNUV, OrderU, OrderV);
+ theD3V += aSign * myOffset * CSLib::DNNormal(0, 3, DerNUV, OrderU, OrderV);
+ theD3UUV += aSign * myOffset * CSLib::DNNormal(2, 1, DerNUV, OrderU, OrderV);
+ theD3UVV += aSign * myOffset * CSLib::DNNormal(1, 2, DerNUV, OrderU, OrderV);
+}
+
+gp_Vec GeomEvaluator_OffsetSurface::CalculateDN(
+ const Standard_Real theU, const Standard_Real theV,
+ const Standard_Integer theNu, const Standard_Integer theNv,
+ const gp_Vec& theD1U, const gp_Vec& theD1V) const
+{
+ const Standard_Real MagTol = 1.e-9;
+
+ gp_Dir Normal;
+ CSLib_NormalStatus NStatus;
+ CSLib::Normal(theD1U, theD1V, MagTol, NStatus, Normal);
+ const Standard_Integer MaxOrder = (NStatus == CSLib_Defined) ? 0 : 3;
+ Standard_Integer OrderU, OrderV;
+ TColgp_Array2OfVec DerNUV(0, MaxOrder + theNu, 0, MaxOrder + theNu);
+ TColgp_Array2OfVec DerSurf(0, MaxOrder + theNu + 1, 0, MaxOrder + theNv + 1);
+
+ Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0;
+ Bounds(Umin, Umax, Vmin, Vmax);
+
+ DerSurf.SetValue(1, 0, theD1U);
+ DerSurf.SetValue(0, 1, theD1V);
+
+ //*********************
+ Handle(Geom_BSplineSurface) L;
+ // Is there any osculatingsurface along U or V;
+ Standard_Boolean isOpposite = Standard_False;
+ Standard_Boolean AlongU = Standard_False;
+ Standard_Boolean AlongV = Standard_False;
+ if (!myOscSurf.IsNull())
+ {
+ AlongU = myOscSurf->UOscSurf(theU, theV, isOpposite, L);
+ AlongV = myOscSurf->VOscSurf(theU, theV, isOpposite, L);
+ }
+ const Standard_Real aSign = ((AlongV || AlongU) && isOpposite) ? -1. : 1.;
+
+ if (!myBaseSurf.IsNull())
+ derivatives(MaxOrder, 1, theU, theV, myBaseSurf, theNu, theNv, AlongU, AlongV, L, DerNUV, DerSurf);
+ else
+ derivatives(MaxOrder, 1, theU, theV, myBaseAdaptor, theNu, theNv, AlongU, AlongV, L, DerNUV, DerSurf);
+
+ CSLib::Normal(MaxOrder, DerNUV, MagTol, theU, theV, Umin, Umax, Vmin, Vmax,
+ NStatus, Normal, OrderU, OrderV);
+ if (NStatus != CSLib_Defined)
+ Geom_UndefinedValue::Raise(
+ "GeomEvaluator_OffsetSurface::CalculateDN(): Unable to calculate normal");
+
+ gp_Vec D;
+ if (!myBaseSurf.IsNull())
+ D = myBaseSurf->DN(theU, theV, theNu, theNv);
+ else
+ D = myBaseAdaptor->DN(theU, theV, theNu, theNv);
+
+ D += aSign * myOffset * CSLib::DNNormal(theNu, theNv, DerNUV, OrderU, OrderV);
+ return D;
+}
+
+
+void GeomEvaluator_OffsetSurface::Bounds(Standard_Real& theUMin, Standard_Real& theUMax,
+ Standard_Real& theVMin, Standard_Real& theVMax) const
+{
+ if (!myBaseSurf.IsNull())
+ myBaseSurf->Bounds(theUMin, theUMax, theVMin, theVMax);
+ else
+ {
+ theUMin = myBaseAdaptor->FirstUParameter();
+ theUMax = myBaseAdaptor->LastUParameter();
+ theVMin = myBaseAdaptor->FirstVParameter();
+ theVMax = myBaseAdaptor->LastVParameter();
+ }
+}
+
+
+Standard_Boolean GeomEvaluator_OffsetSurface::ReplaceDerivative(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Vec& theDU, gp_Vec& theDV,
+ const Standard_Real theSquareTol) const
+{
+ Standard_Boolean isReplaceDU = theDU.SquareMagnitude() < theSquareTol;
+ Standard_Boolean isReplaceDV = theDV.SquareMagnitude() < theSquareTol;
+ Standard_Boolean isReplaced = Standard_False;
+ if (isReplaceDU ^ isReplaceDV)
+ {
+ Standard_Real aU = theU;
+ Standard_Real aV = theV;
+ Standard_Real aUMin = 0, aUMax = 0, aVMin = 0, aVMax = 0;
+ Bounds(aUMin, aUMax, aVMin, aVMax);
+
+ // Calculate step along non-zero derivative
+ Standard_Real aStep;
+ Handle(Adaptor3d_HSurface) aSurfAdapt;
+ if (!myBaseAdaptor.IsNull())
+ aSurfAdapt = myBaseAdaptor;
+ else
+ aSurfAdapt = new GeomAdaptor_HSurface(myBaseSurf);
+ if (isReplaceDV)
+ {
+ aStep = Precision::Confusion() * theDU.Magnitude();
+ if (aStep > aUMax - aUMin)
+ aStep = (aUMax - aUMin) / 100.;
+ }
+ else
+ {
+ aStep = Precision::Confusion() * theDV.Magnitude();
+ if (aStep > aVMax - aVMin)
+ aStep = (aVMax - aVMin) / 100.;
+ }
+
+ gp_Pnt aP;
+ gp_Vec aDU, aDV;
+ // Step away from currect parametric coordinates and calculate derivatives once again.
+ // Replace zero derivative by the obtained.
+ for (Standard_Real aStepSign = -1.0; aStepSign <= 1.0 && !isReplaced; aStepSign += 2.0)
+ {
+ if (isReplaceDV)
+ {
+ aU = theU + aStepSign * aStep;
+ if (aU < aUMin || aU > aUMax)
+ continue;
+ }
+ else
+ {
+ aV = theV + aStepSign * aStep;
+ if (aV < aVMin || aV > aVMax)
+ continue;
+ }
+
+ BaseD1(aU, aV, aP, aDU, aDV);
+
+ if (isReplaceDU && aDU.SquareMagnitude() > theSquareTol)
+ {
+ theDU = aDU;
+ isReplaced = Standard_True;
+ }
+ if (isReplaceDV && aDV.SquareMagnitude() > theSquareTol)
+ {
+ theDV = aDV;
+ isReplaced = Standard_True;
+ }
+ }
+ }
+ return isReplaced;
+}
+
+
+
+
+
+// ===================== Auxiliary functions ===================================
+template<class SurfOrAdapt>
+void derivatives(Standard_Integer theMaxOrder,
+ Standard_Integer theMinOrder,
+ const Standard_Real theU,
+ const Standard_Real theV,
+ const SurfOrAdapt& theBasisSurf,
+ const Standard_Integer theNU,
+ const Standard_Integer theNV,
+ const Standard_Boolean theAlongU,
+ const Standard_Boolean theAlongV,
+ const Handle(Geom_BSplineSurface)& theL,
+ TColgp_Array2OfVec& theDerNUV,
+ TColgp_Array2OfVec& theDerSurf)
+{
+ Standard_Integer i, j;
+ gp_Pnt P;
+ gp_Vec DL1U, DL1V, DL2U, DL2V, DL2UV, DL3U, DL3UUV, DL3UVV, DL3V;
+
+ if (theAlongU || theAlongV)
+ {
+ theMaxOrder = 0;
+ TColgp_Array2OfVec DerSurfL(0, theMaxOrder + theNU + 1, 0, theMaxOrder + theNV + 1);
+ switch (theMinOrder)
+ {
+ case 1:
+ theL->D1(theU, theV, P, DL1U, DL1V);
+ DerSurfL.SetValue(1, 0, DL1U);
+ DerSurfL.SetValue(0, 1, DL1V);
+ break;
+ case 2:
+ theL->D2(theU, theV, P, DL1U, DL1V, DL2U, DL2V, DL2UV);
+ DerSurfL.SetValue(1, 0, DL1U);
+ DerSurfL.SetValue(0, 1, DL1V);
+ DerSurfL.SetValue(1, 1, DL2UV);
+ DerSurfL.SetValue(2, 0, DL2U);
+ DerSurfL.SetValue(0, 2, DL2V);
+ break;
+ case 3:
+ theL->D3(theU, theV, P, DL1U, DL1V, DL2U, DL2V, DL2UV, DL3U, DL3V, DL3UUV, DL3UVV);
+ DerSurfL.SetValue(1, 0, DL1U);
+ DerSurfL.SetValue(0, 1, DL1V);
+ DerSurfL.SetValue(1, 1, DL2UV);
+ DerSurfL.SetValue(2, 0, DL2U);
+ DerSurfL.SetValue(0, 2, DL2V);
+ DerSurfL.SetValue(3, 0, DL3U);
+ DerSurfL.SetValue(2, 1, DL3UUV);
+ DerSurfL.SetValue(1, 2, DL3UVV);
+ DerSurfL.SetValue(0, 3, DL3V);
+ break;
+ default:
+ break;
+ }
+
+ if (theNU <= theNV)
+ {
+ for (i = 0; i <= theMaxOrder + 1 + theNU; i++)
+ for (j = i; j <= theMaxOrder + theNV + 1; j++)
+ if (i + j > theMinOrder)
+ {
+ DerSurfL.SetValue(i, j, theL->DN(theU, theV, i, j));
+ theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
+ if (i != j && j <= theNU + 1)
+ {
+ theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
+ DerSurfL.SetValue(j, i, theL->DN(theU, theV, j, i));
+ }
+ }
+ }
+ else
+ {
+ for (j = 0; j <= theMaxOrder + 1 + theNV; j++)
+ for (i = j; i <= theMaxOrder + theNU + 1; i++)
+ if (i + j > theMinOrder)
+ {
+ DerSurfL.SetValue(i, j, theL->DN(theU, theV, i, j));
+ theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
+ if (i != j && i <= theNV + 1)
+ {
+ theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
+ DerSurfL.SetValue(j, i, theL->DN(theU, theV, j, i));
+ }
+ }
+ }
+ for (i = 0; i <= theMaxOrder + theNU; i++)
+ for (j = 0; j <= theMaxOrder + theNV; j++)
+ {
+ if (theAlongU)
+ theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, DerSurfL, theDerSurf));
+ if (theAlongV)
+ theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, theDerSurf, DerSurfL));
+ }
+ }
+ else
+ {
+ for (i = 0; i <= theMaxOrder + theNU+ 1; i++)
+ for (j = i; j <= theMaxOrder + theNV + 1; j++)
+ if (i + j > theMinOrder)
+ {
+ theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
+ if (i != j)
+ theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
+ }
+ for (i = 0; i <= theMaxOrder + theNU; i++)
+ for (j = 0; j <= theMaxOrder + theNV; j++)
+ theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, theDerSurf));
+ }
+}
+
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 _GeomEvaluator_OffsetSurface_HeaderFile
+#define _GeomEvaluator_OffsetSurface_HeaderFile
+
+#include <GeomEvaluator_Surface.hxx>
+
+#include <Geom_OsculatingSurface.hxx>
+#include <Geom_Surface.hxx>
+
+class GeomAdaptor_HSurface;
+
+//! Allows to calculate values and derivatives for offset surfaces
+class GeomEvaluator_OffsetSurface : public GeomEvaluator_Surface
+{
+public:
+ //! Initialize evaluator by surface
+ Standard_EXPORT GeomEvaluator_OffsetSurface(
+ const Handle(Geom_Surface)& theBase,
+ const Standard_Real theOffset,
+ const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
+ //! Initialize evaluator by surface adaptor
+ Standard_EXPORT GeomEvaluator_OffsetSurface(
+ const Handle(GeomAdaptor_HSurface)& theBase,
+ const Standard_Real theOffset,
+ const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
+
+ //! Change the offset value
+ void SetOffsetValue(Standard_Real theOffset)
+ { myOffset = theOffset; }
+
+ //! Value of surface
+ Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const Standard_OVERRIDE;
+ //! Value and first derivatives of surface
+ Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
+ //! Value, first and second derivatives of surface
+ Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
+ //! Value, first, second and third derivatives of surface
+ Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V,
+ gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
+ //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
+ //!
+ //! Raises if N < 1 or theDerU < 0 or theDerV < 0
+ Standard_EXPORT gp_Vec DN(const Standard_Real theU,
+ const Standard_Real theV,
+ const Standard_Integer theDerU,
+ const Standard_Integer theDerV) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTI(GeomEvaluator_OffsetSurface, GeomEvaluator_Surface)
+
+private:
+ //! Returns bounds of a base surface
+ void Bounds(Standard_Real& theUMin, Standard_Real& theUMax,
+ Standard_Real& theVMin, Standard_Real& theVMax) const;
+
+ //! Recalculate D1 values of base surface into D0 value of offset surface
+ void CalculateD0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue,
+ const gp_Vec& theD1U, const gp_Vec& theD1V) const;
+ //! Recalculate D2 values of base surface into D1 values of offset surface
+ void CalculateD1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ const gp_Vec& theD2U, const gp_Vec& theD2V, const gp_Vec& theD2UV) const;
+ //! Recalculate D3 values of base surface into D2 values of offset surface
+ void CalculateD2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ const gp_Vec& theD3U, const gp_Vec& theD3V,
+ const gp_Vec& theD3UUV, const gp_Vec& theD3UVV) const;
+ //! Recalculate D3 values of base surface into D3 values of offset surface
+ void CalculateD3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
+ //! Calculate DN of offset surface based on derivatives of base surface
+ gp_Vec CalculateDN(const Standard_Real theU, const Standard_Real theV,
+ const Standard_Integer theNu, const Standard_Integer theNv,
+ const gp_Vec& theD1U, const gp_Vec& theD1V) const;
+
+ //! Calculate value of base surface/adaptor
+ void BaseD0(const Standard_Real theU, const Standard_Real theV, gp_Pnt& theValue) const;
+ //! Calculate value and first derivatives of base surface/adaptor
+ void BaseD1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const;
+ //! Calculate value, first and second derivatives of base surface/adaptor
+ void BaseD2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const;
+ //! Calculate value, first, second and third derivatives of base surface/adaptor
+ void BaseD3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
+
+ //! Replace zero derivative by the corresponding derivative in a near point.
+ //! Return true, if the derivative was replaced.
+ Standard_Boolean ReplaceDerivative(const Standard_Real theU, const Standard_Real theV,
+ gp_Vec& theDU, gp_Vec& theDV,
+ const Standard_Real theSquareTol) const;
+
+private:
+ Handle(Geom_Surface) myBaseSurf;
+ Handle(GeomAdaptor_HSurface) myBaseAdaptor;
+
+ Standard_Real myOffset; ///< offset value
+ Handle(Geom_OsculatingSurface) myOscSurf; ///< auxiliary osculating surface
+};
+
+DEFINE_STANDARD_HANDLE(GeomEvaluator_OffsetSurface, GeomEvaluator_Surface)
+
+
+#endif // _GeomEvaluator_OffsetSurface_HeaderFile
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 _GeomEvaluator_Surface_HeaderFile
+#define _GeomEvaluator_Surface_HeaderFile
+
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+
+class gp_Pnt;
+class gp_Vec;
+
+//! Interface for calculation of values and derivatives for different kinds of surfaces.
+//! Works both with adaptors and surfaces.
+class GeomEvaluator_Surface : public Standard_Transient
+{
+public:
+ GeomEvaluator_Surface() {}
+
+ //! Value of surface
+ virtual void D0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const = 0;
+ //! Value and first derivatives of surface
+ virtual void D1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const = 0;
+ //! Value, first and second derivatives of surface
+ virtual void D2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const = 0;
+ //! Value, first, second and third derivatives of surface
+ virtual void D3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const = 0;
+ //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
+ //!
+ //! Raises if N < 1 or theDerU < 0 or theDerV < 0
+ virtual gp_Vec DN(const Standard_Real theU, const Standard_Real theV,
+ const Standard_Integer theDerU, const Standard_Integer theDerV) const = 0;
+
+ DEFINE_STANDARD_RTTI(GeomEvaluator_Surface, Standard_Transient)
+};
+
+DEFINE_STANDARD_HANDLE(GeomEvaluator_Surface, Standard_Transient)
+
+
+#endif // _GeomEvaluator_Surface_HeaderFile
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 <GeomEvaluator_SurfaceOfExtrusion.hxx>
+
+#include <GeomAdaptor_HCurve.hxx>
+
+GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
+ const Handle(Geom_Curve)& theBase, const gp_Dir& theExtrusionDir)
+ : GeomEvaluator_Surface(),
+ myBaseCurve(theBase),
+ myDirection(theExtrusionDir)
+{
+}
+
+GeomEvaluator_SurfaceOfExtrusion::GeomEvaluator_SurfaceOfExtrusion(
+ const Handle(Adaptor3d_HCurve)& theBase, const gp_Dir& theExtrusionDir)
+ : GeomEvaluator_Surface(),
+ myBaseAdaptor(theBase),
+ myDirection(theExtrusionDir)
+{
+}
+
+void GeomEvaluator_SurfaceOfExtrusion::D0(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D0(theU, theValue);
+ else
+ myBaseCurve->D0(theU, theValue);
+
+ Shift(theV, theValue);
+}
+
+void GeomEvaluator_SurfaceOfExtrusion::D1(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D1(theU, theValue, theD1U);
+ else
+ myBaseCurve->D1(theU, theValue, theD1U);
+
+ theD1V = myDirection;
+ Shift(theV, theValue);
+}
+
+void GeomEvaluator_SurfaceOfExtrusion::D2(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D2(theU, theValue, theD1U, theD2U);
+ else
+ myBaseCurve->D2(theU, theValue, theD1U, theD2U);
+
+ theD1V = myDirection;
+ theD2V.SetCoord(0.0, 0.0, 0.0);
+ theD2UV.SetCoord(0.0, 0.0, 0.0);
+
+ Shift(theV, theValue);
+}
+
+void GeomEvaluator_SurfaceOfExtrusion::D3(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D3(theU, theValue, theD1U, theD2U, theD3U);
+ else
+ myBaseCurve->D3(theU, theValue, theD1U, theD2U, theD3U);
+
+ theD1V = myDirection;
+ theD2V.SetCoord(0.0, 0.0, 0.0);
+ theD2UV.SetCoord(0.0, 0.0, 0.0);
+ theD3V.SetCoord(0.0, 0.0, 0.0);
+ theD3UUV.SetCoord(0.0, 0.0, 0.0);
+ theD3UVV.SetCoord(0.0, 0.0, 0.0);
+
+ Shift(theV, theValue);
+}
+
+gp_Vec GeomEvaluator_SurfaceOfExtrusion::DN(
+ const Standard_Real theU, const Standard_Real ,
+ const Standard_Integer theDerU, const Standard_Integer theDerV) const
+{
+ Standard_RangeError_Raise_if(theDerU < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU < 0");
+ Standard_RangeError_Raise_if(theDerV < 0, "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerV < 0");
+ Standard_RangeError_Raise_if(theDerU + theDerV < 1,
+ "GeomEvaluator_SurfaceOfExtrusion::DN(): theDerU + theDerV < 1");
+
+ gp_Vec aResult(0.0, 0.0, 0.0);
+ if (theDerV == 0)
+ {
+ if (!myBaseAdaptor.IsNull())
+ aResult = myBaseAdaptor->DN(theU, theDerU);
+ else
+ aResult = myBaseCurve->DN(theU, theDerU);
+ }
+ else if (theDerU == 0 && theDerV == 1)
+ aResult = gp_Vec(myDirection);
+ return aResult;
+}
+
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
+#define _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
+
+#include <GeomEvaluator_Surface.hxx>
+
+#include <Geom_Curve.hxx>
+#include <gp_Dir.hxx>
+
+class Adaptor3d_HCurve;
+
+//! Allows to calculate values and derivatives for surfaces of linear extrusion
+class GeomEvaluator_SurfaceOfExtrusion : public GeomEvaluator_Surface
+{
+public:
+ //! Initialize evaluator by surface
+ Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Geom_Curve)& theBase,
+ const gp_Dir& theExtrusionDir);
+ //! Initialize evaluator by surface adaptor
+ Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Adaptor3d_HCurve)& theBase,
+ const gp_Dir& theExtrusionDir);
+
+ ///! Changes the direction of extrusion
+ void SetDirection(const gp_Dir& theDirection)
+ { myDirection = theDirection; }
+
+ //! Value of surface
+ Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const Standard_OVERRIDE;
+ //! Value and first derivatives of surface
+ Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
+ //! Value, first and second derivatives of surface
+ Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
+ //! Value, first, second and third derivatives of surface
+ Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V,
+ gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
+ //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
+ //!
+ //! Raises if N < 1 or theDerU < 0 or theDerV < 0
+ Standard_EXPORT gp_Vec DN(const Standard_Real theU,
+ const Standard_Real theV,
+ const Standard_Integer theDerU,
+ const Standard_Integer theDerV) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTI(GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_Surface)
+
+private:
+ //! Shift the point along direction to the given distance (theShift)
+ void Shift(const Standard_Real theShift, gp_Pnt& thePoint) const
+ {
+ thePoint.ChangeCoord() += myDirection.XYZ() * theShift;
+ }
+
+private:
+ Handle(Geom_Curve) myBaseCurve;
+ Handle(Adaptor3d_HCurve) myBaseAdaptor;
+
+ gp_Dir myDirection;
+};
+
+DEFINE_STANDARD_HANDLE(GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_Surface)
+
+
+#endif // _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 <GeomEvaluator_SurfaceOfRevolution.hxx>
+
+#include <Adaptor3d_HCurve.hxx>
+#include <gp_Trsf.hxx>
+
+GeomEvaluator_SurfaceOfRevolution::GeomEvaluator_SurfaceOfRevolution(
+ const Handle(Geom_Curve)& theBase,
+ const gp_Dir& theRevolDir,
+ const gp_Pnt& theRevolLoc)
+ : GeomEvaluator_Surface(),
+ myBaseCurve(theBase),
+ myRotAxis(theRevolLoc, theRevolDir)
+{
+}
+
+GeomEvaluator_SurfaceOfRevolution::GeomEvaluator_SurfaceOfRevolution(
+ const Handle(Adaptor3d_HCurve)& theBase,
+ const gp_Dir& theRevolDir,
+ const gp_Pnt& theRevolLoc)
+ : GeomEvaluator_Surface(),
+ myBaseAdaptor(theBase),
+ myRotAxis(theRevolLoc, theRevolDir)
+{
+}
+
+void GeomEvaluator_SurfaceOfRevolution::D0(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D0(theV, theValue);
+ else
+ myBaseCurve->D0(theV, theValue);
+
+ gp_Trsf aRotation;
+ aRotation.SetRotation(myRotAxis, theU);
+ theValue.Transform(aRotation);
+}
+
+void GeomEvaluator_SurfaceOfRevolution::D1(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D1(theV, theValue, theD1V);
+ else
+ myBaseCurve->D1(theV, theValue, theD1V);
+
+ // vector from center of rotation to the point on rotated curve
+ gp_XYZ aCQ = theValue.XYZ() - myRotAxis.Location().XYZ();
+ theD1U = gp_Vec(myRotAxis.Direction().XYZ().Crossed(aCQ));
+ // If the point is placed on the axis of revolution then derivatives on U are undefined.
+ // Manually set them to zero.
+ if (theD1U.SquareMagnitude() < Precision::SquareConfusion())
+ theD1U.SetCoord(0.0, 0.0, 0.0);
+
+ gp_Trsf aRotation;
+ aRotation.SetRotation(myRotAxis, theU);
+ theValue.Transform(aRotation);
+ theD1U.Transform(aRotation);
+ theD1V.Transform(aRotation);
+}
+
+void GeomEvaluator_SurfaceOfRevolution::D2(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D2(theV, theValue, theD1V, theD2V);
+ else
+ myBaseCurve->D2(theV, theValue, theD1V, theD2V);
+
+ // vector from center of rotation to the point on rotated curve
+ gp_XYZ aCQ = theValue.XYZ() - myRotAxis.Location().XYZ();
+ const gp_XYZ& aDir = myRotAxis.Direction().XYZ();
+ theD1U = gp_Vec(aDir.Crossed(aCQ));
+ // If the point is placed on the axis of revolution then derivatives on U are undefined.
+ // Manually set them to zero.
+ if (theD1U.SquareMagnitude() < Precision::SquareConfusion())
+ theD1U.SetCoord(0.0, 0.0, 0.0);
+ theD2U = gp_Vec(aDir.Dot(aCQ) * aDir - aCQ);
+ theD2UV = gp_Vec(aDir.Crossed(theD1V.XYZ()));
+
+ gp_Trsf aRotation;
+ aRotation.SetRotation(myRotAxis, theU);
+ theValue.Transform(aRotation);
+ theD1U.Transform(aRotation);
+ theD1V.Transform(aRotation);
+ theD2U.Transform(aRotation);
+ theD2V.Transform(aRotation);
+ theD2UV.Transform(aRotation);
+}
+
+void GeomEvaluator_SurfaceOfRevolution::D3(
+ const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const
+{
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D3(theV, theValue, theD1V, theD2V, theD3V);
+ else
+ myBaseCurve->D3(theV, theValue, theD1V, theD2V, theD3V);
+
+ // vector from center of rotation to the point on rotated curve
+ gp_XYZ aCQ = theValue.XYZ() - myRotAxis.Location().XYZ();
+ const gp_XYZ& aDir = myRotAxis.Direction().XYZ();
+ theD1U = gp_Vec(aDir.Crossed(aCQ));
+ // If the point is placed on the axis of revolution then derivatives on U are undefined.
+ // Manually set them to zero.
+ if (theD1U.SquareMagnitude() < Precision::SquareConfusion())
+ theD1U.SetCoord(0.0, 0.0, 0.0);
+ theD2U = gp_Vec(aDir.Dot(aCQ) * aDir - aCQ);
+ theD2UV = gp_Vec(aDir.Crossed(theD1V.XYZ()));
+ theD3U = -theD1U;
+ theD3UUV = gp_Vec(aDir.Dot(theD1V.XYZ()) * aDir - theD1V.XYZ());
+ theD3UVV = gp_Vec(aDir.Crossed(theD2V.XYZ()));
+
+ gp_Trsf aRotation;
+ aRotation.SetRotation(myRotAxis, theU);
+ theValue.Transform(aRotation);
+ theD1U.Transform(aRotation);
+ theD1V.Transform(aRotation);
+ theD2U.Transform(aRotation);
+ theD2V.Transform(aRotation);
+ theD2UV.Transform(aRotation);
+ theD3U.Transform(aRotation);
+ theD3V.Transform(aRotation);
+ theD3UUV.Transform(aRotation);
+ theD3UVV.Transform(aRotation);
+}
+
+gp_Vec GeomEvaluator_SurfaceOfRevolution::DN(
+ const Standard_Real theU, const Standard_Real theV,
+ const Standard_Integer theDerU, const Standard_Integer theDerV) const
+{
+ Standard_RangeError_Raise_if(theDerU < 0, "GeomEvaluator_SurfaceOfRevolution::DN(): theDerU < 0");
+ Standard_RangeError_Raise_if(theDerV < 0, "GeomEvaluator_SurfaceOfRevolution::DN(): theDerV < 0");
+ Standard_RangeError_Raise_if(theDerU + theDerV < 1,
+ "GeomEvaluator_SurfaceOfRevolution::DN(): theDerU + theDerV < 1");
+
+ gp_Trsf aRotation;
+ aRotation.SetRotation(myRotAxis, theU);
+
+ gp_Pnt aP;
+ gp_Vec aDV;
+ gp_Vec aResult;
+ if (theDerU == 0)
+ {
+ if (!myBaseAdaptor.IsNull())
+ aResult = myBaseAdaptor->DN(theV, theDerV);
+ else
+ aResult = myBaseCurve->DN(theV, theDerV);
+ }
+ else
+ {
+ if (theDerV == 0)
+ {
+ if (!myBaseAdaptor.IsNull())
+ myBaseAdaptor->D0(theV, aP);
+ else
+ myBaseCurve->D0(theV, aP);
+ aDV = gp_Vec(aP.XYZ() - myRotAxis.Location().XYZ());
+ }
+ else
+ {
+ if (!myBaseAdaptor.IsNull())
+ aDV = myBaseAdaptor->DN(theV, theDerV);
+ else
+ aDV = myBaseCurve->DN(theV, theDerV);
+ }
+
+ const gp_XYZ& aDir = myRotAxis.Direction().XYZ();
+ if (theDerU % 4 == 1)
+ aResult = gp_Vec(aDir.Crossed(aDV.XYZ()));
+ else if (theDerU % 4 == 2)
+ aResult = gp_Vec(aDir.Dot(aDV.XYZ()) * aDir - aDV.XYZ());
+ else if (theDerU % 4 == 3)
+ aResult = gp_Vec(aDir.Crossed(aDV.XYZ())) * (-1.0);
+ else
+ aResult = gp_Vec(aDV.XYZ() - aDir.Dot(aDV.XYZ()) * aDir);
+ }
+
+ aResult.Transform(aRotation);
+ return aResult;
+}
+
--- /dev/null
+// Created on: 2015-09-21
+// Copyright (c) 2015 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 _GeomEvaluator_SurfaceOfRevolution_HeaderFile
+#define _GeomEvaluator_SurfaceOfRevolution_HeaderFile
+
+#include <GeomEvaluator_Surface.hxx>
+
+#include <Geom_Curve.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Ax1.hxx>
+
+class Adaptor3d_HCurve;
+
+//! Allows to calculate values and derivatives for surfaces of revolution
+class GeomEvaluator_SurfaceOfRevolution : public GeomEvaluator_Surface
+{
+public:
+ //! Initialize evaluator by revolved curve, the axis of revolution and the location
+ Standard_EXPORT GeomEvaluator_SurfaceOfRevolution(const Handle(Geom_Curve)& theBase,
+ const gp_Dir& theRevolDir,
+ const gp_Pnt& theRevolLoc);
+ //! Initialize evaluator by adaptor of the revolved curve, the axis of revolution and the location
+ Standard_EXPORT GeomEvaluator_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& theBase,
+ const gp_Dir& theRevolDir,
+ const gp_Pnt& theRevolLoc);
+
+ //! Change direction of the axis of revolution
+ void SetDirection(const gp_Dir& theDirection)
+ { myRotAxis.SetDirection(theDirection); }
+
+ //! Change location of the axis of revolution
+ void SetLocation(const gp_Pnt& theLocation)
+ { myRotAxis.SetLocation(theLocation); }
+
+ //! Change the axis of revolution
+ void SetAxis(const gp_Ax1& theAxis)
+ { myRotAxis = theAxis; }
+
+ //! Value of surface
+ Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue) const Standard_OVERRIDE;
+ //! Value and first derivatives of surface
+ Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
+ //! Value, first and second derivatives of surface
+ Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
+ //! Value, first, second and third derivatives of surface
+ Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
+ gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
+ gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
+ gp_Vec& theD3U, gp_Vec& theD3V,
+ gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
+ //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
+ //!
+ //! Raises if N < 1 or theDerU < 0 or theDerV < 0
+ Standard_EXPORT gp_Vec DN(const Standard_Real theU,
+ const Standard_Real theV,
+ const Standard_Integer theDerU,
+ const Standard_Integer theDerV) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTI(GeomEvaluator_SurfaceOfRevolution, GeomEvaluator_Surface)
+
+private:
+ Handle(Geom_Curve) myBaseCurve;
+ Handle(Adaptor3d_HCurve) myBaseAdaptor;
+ gp_Ax1 myRotAxis;
+};
+
+DEFINE_STANDARD_HANDLE(GeomEvaluator_SurfaceOfRevolution, GeomEvaluator_Surface)
+
+
+#endif // _GeomEvaluator_SurfaceOfRevolution_HeaderFile
#include <Adaptor3d_HCurve.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <Adaptor3d_Surface.hxx>
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
#include <ElCLib.hxx>
#include <Extrema_ExtCS.hxx>
#include <Extrema_POnSurf.hxx>
// commercial license or contractual agreement.
-#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
-#include <Adaptor3d_SurfaceOfRevolution.hxx>
+#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
+#include <GeomAdaptor_SurfaceOfRevolution.hxx>
#include <BRep_Builder.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
gp_Ax1 ax1 = SR->Axis();
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve();
HC->ChangeCurve().Load(bc,bc->FirstParameter(),bc->LastParameter());
- Adaptor3d_SurfaceOfRevolution AS(HC,ax1);
+ GeomAdaptor_SurfaceOfRevolution AS(HC,ax1);
switch(AS.GetType()){
// skl 18.12.2003 - plane not used, problems in PRO14665.igs
//case GeomAbs_Plane : {
gp_Dir dir = SLE->Direction();
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve();
HC->ChangeCurve().Load(bc,bc->FirstParameter(),bc->LastParameter());
- Adaptor3d_SurfaceOfLinearExtrusion AS(HC,dir);
+ GeomAdaptor_SurfaceOfLinearExtrusion AS(HC,dir);
switch(AS.GetType()){
// skl 18.12.2003 - plane not used, problems in ims013.igs
//case GeomAbs_Plane : {
Adaptor3d
LProp3d
TopAbs
+ GeomEvaluator
)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
Adaptor3d
LProp3d
TopAbs
+GeomEvaluator
-puts "TODO OCC25925 ALL: ERROR. offsetperform operation not done."
-puts "TODO OCC25925 ALL: Faulty OCC5805 : result is not Closed shape"
-puts "TODO OCC25925 ALL: Tcl Exception: Error : command \\\"nbshapes result\\\" gives an empty result"
-puts "TODO OCC25925 ALL: TEST INCOMPLETE"
+puts "TODO OCC25925 ALL: Faulty shapes in variables faulty_1 to"
puts "============"
puts "OCC5805"
}
-checknbshapes result -vertex 2 -edge 3 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 0 -shape 13
+checknbshapes result -vertex 4 -edge 5 -wire 5 -face 5 -shell 2 -solid 1 -compsolid 0 -compound 0 -shape 22
-set square 495.635
+set square 358.795
set 2dviewer 0
regexp {point p_1 +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $log full x1 y1 z1
- set expected_x1 39.0504
- set expected_y1 -12.8696
- set expected_z1 82.6099
+ set expected_x1 43.1172
+ set expected_y1 -17.16
+ set expected_z1 82.6048
checkreal "x1" ${x1} ${expected_x1} ${tol_abs} ${tol_rel}
checkreal "y1" ${y1} ${expected_y1} ${tol_abs} ${tol_rel}
regexp {point p_2 +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $log full x2 y2 z2
- set expected_x2 43.1172
- set expected_y2 -17.16
- set expected_z2 82.6048
+ set expected_x2 39.0504
+ set expected_y2 -12.8696
+ set expected_z2 82.6099
checkreal "x2" ${x2} ${expected_x2} ${tol_abs} ${tol_rel}
checkreal "y2" ${y2} ${expected_y2} ${tol_abs} ${tol_rel}
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: LABELS : Faulty"
-
set filename BUC60035.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 5 ) Warnings = 82 ( 767 ) Summary = 82 ( 772 )
+TPSTAT : Faulties = 0 ( 5 ) Warnings = 86 ( 799 ) Summary = 86 ( 804 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 208 ( 208 ) Summary = 7763 ( 7763 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 208 ( 208 ) FreeWire = 0 ( 0 ) FreeEdge = 6 ( 6 ) SharedEdge = 3665 ( 3665 )
-TOLERANCE : MaxTol = 0.1393674657 ( 0.1393674657 ) AvgTol = 0.003094049943 ( 0.003079317701 )
+TOLERANCE : MaxTol = 0.1393674657 ( 0.1393674657 ) AvgTol = 0.003094503403 ( 0.003090745167 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 214 ( 3725 ) N2Labels = 0 ( 0 ) TotalLabels = 215 ( 3726 ) NameLabels = 215 ( 330 ) ColorLabels = 214 ( 3725 ) LayerLabels = 209 ( 3720 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 5 ( 5 )
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: LABELS : Faulty"
-
set filename support_bobine.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 2 ( 34 ) Summary = 2 ( 34 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 2 ( 36 ) Summary = 2 ( 36 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 123 ( 123 ) Summary = 3349 ( 3349 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 123 ( 123 ) FreeWire = 7 ( 7 ) FreeEdge = 571 ( 571 ) SharedEdge = 1263 ( 1263 )
-TOLERANCE : MaxTol = 0.01306151266 ( 0.01306151266 ) AvgTol = 4.724224752e-005 ( 4.790122037e-005 )
+TOLERANCE : MaxTol = 0.01306151266 ( 0.01306151266 ) AvgTol = 4.924673849e-05 ( 4.96935472e-05 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 675 ( 1417 ) N2Labels = 0 ( 0 ) TotalLabels = 676 ( 1418 ) NameLabels = 676 ( 745 ) ColorLabels = 675 ( 1417 ) LayerLabels = 584 ( 1236 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 2 ( 2 )
puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO CR23096 ALL: COLORS : Faulty"
-
set filename 919-001-T02-04-CP-VL.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 101 ( 1433 ) Summary = 101 ( 1433 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 101 ( 1430 ) Summary = 101 ( 1430 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 899 ( 899 ) Summary = 24030 ( 24038 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 899 ( 899 ) FreeWire = 366 ( 366 ) FreeEdge = 3783 ( 3783 ) SharedEdge = 9384 ( 9388 )
-TOLERANCE : MaxTol = 0.3151652209 ( 0.3151652209 ) AvgTol = 0.0007056494899 ( 0.0007458034854 )
+TOLERANCE : MaxTol = 0.3151652209 ( 0.3151652209 ) AvgTol = 0.0007056492227 ( 0.0007458035864 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 3581 ( 9530 ) N2Labels = 0 ( 0 ) TotalLabels = 3582 ( 9531 ) NameLabels = 3582 ( 4454 ) ColorLabels = 3581 ( 9530 ) LayerLabels = 3581 ( 9530 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 1 ( 2 )
puts "TODO CR23096 ALL: TPSTAT : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty"
-
set filename BUC50003.igs
set ref_data {
DATA : Faulties = 1 ( 0 ) Warnings = 0 ( 0 ) Summary = 1 ( 0 )
-TPSTAT : Faulties = 2 ( 0 ) Warnings = 18 ( 320 ) Summary = 20 ( 320 )
+TPSTAT : Faulties = 2 ( 0 ) Warnings = 21 ( 329 ) Summary = 23 ( 329 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 135 ( 135 ) Summary = 2223 ( 2223 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 135 ( 135 ) FreeWire = 0 ( 0 ) FreeEdge = 3 ( 3 ) SharedEdge = 974 ( 974 )
-TOLERANCE : MaxTol = 0.9794163281 ( 12.54323842 ) AvgTol = 0.02080508938 ( 0.1727731057 )
+TOLERANCE : MaxTol = 1.202431555 ( 12.54323842 ) AvgTol = 0.0237733737 ( 0.1727731055 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 138 ( 1033 ) N2Labels = 0 ( 0 ) TotalLabels = 139 ( 1034 ) NameLabels = 139 ( 205 ) ColorLabels = 138 ( 1033 ) LayerLabels = 138 ( 1033 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 4 ( 4 )
puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO CR23096 ALL: LAYERS : Faulty"
-
set filename BUC50048.igs
set ref_data {
-DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 1 ( 290 ) Summary = 1 ( 290 )
+DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 2 ) Summary = 0 ( 2 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 2 ( 314 ) Summary = 2 ( 314 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 328 ( 328 ) Summary = 8546 ( 8546 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 328 ( 328 ) FreeWire = 53 ( 53 ) FreeEdge = 1431 ( 1431 ) SharedEdge = 3217 ( 3217 )
-TOLERANCE : MaxTol = 0.4274072109 ( 0.4274072101 ) AvgTol = 0.001821024602 ( 0.001852637256 )
+TOLERANCE : MaxTol = 0.4274072109 ( 0.4274072101 ) AvgTol = 0.001825084327 ( 0.001863351234 )
LABELS : N0Labels = 10 ( 10 ) N1Labels = 1565 ( 2865 ) N2Labels = 0 ( 0 ) TotalLabels = 1575 ( 2875 ) NameLabels = 1575 ( 1851 ) ColorLabels = 1570 ( 2870 ) LayerLabels = 1570 ( 2870 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 8 ( 8 )
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
+puts "TODO CR23096 ALL: NBSHAPES : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO CR23096 ALL: COLORS : Faulty"
-puts "TODO CR23096 ALL: NBSHAPES : Faulty"
-puts "TODO CR25013 ALL: Error : 1 differences with reference data found"
-set LinuxDiff 2
-set LinuxFaulties {NBSHAPES}
set filename CTS18547.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 49 ) Warnings = 41 ( 1012 ) Summary = 41 ( 1061 )
-CHECKSHAPE : Wires = 1 ( 1 ) Faces = 1 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 49 ) Warnings = 45 ( 1060 ) Summary = 45 ( 1109 )
+CHECKSHAPE : Wires = 1 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 539 ( 539 ) Summary = 12798 ( 12800 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 539 ( 539 ) FreeWire = 19 ( 21 ) FreeEdge = 1864 ( 1864 ) SharedEdge = 4957 ( 4957 )
-TOLERANCE : MaxTol = 0.7510769849 ( 0.7510769849 ) AvgTol = 0.006853010548 ( 0.007168795519 )
+TOLERANCE : MaxTol = 0.7510769849 ( 0.7510769849 ) AvgTol = 0.006912539764 ( 0.007275546898 )
LABELS : N0Labels = 65 ( 65 ) N1Labels = 2112 ( 4443 ) N2Labels = 0 ( 0 ) TotalLabels = 2177 ( 4508 ) NameLabels = 2177 ( 2778 ) ColorLabels = 2123 ( 4458 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 3 ( 4 )
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO CR23096 ALL: COLORS : Faulty"
-puts "TODO 0025623 ALL: CHECKSHAPE : Faulty"
-
set filename PRO19800.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 1 ) Summary = 0 ( 1 )
-CHECKSHAPE : Wires = 1 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1 ( 1 ) Summary = 13 ( 11 )
-STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1 ( 1 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 6 ( 5 )
-TOLERANCE : MaxTol = 0.04476902169 ( 0.04476636368 ) AvgTol = 0.02402039477 ( 0.02401933664 )
+CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
+NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1 ( 1 ) Summary = 11 ( 11 )
+STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1 ( 1 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 5 ( 5 )
+TOLERANCE : MaxTol = 0.04476896343 ( 0.04476636368 ) AvgTol = 0.02404075037 ( 0.02403970427 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 5 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 6 ) NameLabels = 1 ( 1 ) ColorLabels = 1 ( 6 ) LayerLabels = 1 ( 6 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 1 ( 2 )
puts "TODO CR23096 ALL: STATSHAPE : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty"
-set LinuxDiff 1
set filename 919-004-T03-04-CP-VL.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 2 ) Warnings = 312 ( 2188 ) Summary = 312 ( 2190 )
+TPSTAT : Faulties = 0 ( 2 ) Warnings = 310 ( 2179 ) Summary = 310 ( 2181 )
CHECKSHAPE : Wires = 0 ( 3 ) Faces = 0 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1457 ( 1455 ) Summary = 38832 ( 38834 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1457 ( 1455 ) FreeWire = 516 ( 528 ) FreeEdge = 6208 ( 6208 ) SharedEdge = 15307 ( 15304 )
-TOLERANCE : MaxTol = 0.3053256329 ( 0.4653265763 ) AvgTol = 0.0008083573819 ( 0.0008563940583 )
+TOLERANCE : MaxTol = 0.3053256329 ( 0.4653265763 ) AvgTol = 0.0008083725785 ( 0.0008564007398 )
LABELS : N0Labels = 5 ( 5 ) N1Labels = 5689 ( 14639 ) N2Labels = 0 ( 0 ) TotalLabels = 5694 ( 14644 ) NameLabels = 5694 ( 7040 ) ColorLabels = 5689 ( 14643 ) LayerLabels = 5689 ( 14643 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 2 ( 2 )
puts "TODO CR23096 ALL: TPSTAT : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty"
-
set filename sabena.igs
set ref_data {
DATA : Faulties = 14 ( 0 ) Warnings = 0 ( 0 ) Summary = 14 ( 0 )
-TPSTAT : Faulties = 28 ( 16 ) Warnings = 44 ( 2964 ) Summary = 72 ( 2980 )
+TPSTAT : Faulties = 28 ( 16 ) Warnings = 44 ( 3039 ) Summary = 72 ( 3055 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 2639 ( 2634 ) Summary = 64362 ( 64317 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 2639 ( 2639 ) FreeWire = 1027 ( 1027 ) FreeEdge = 10489 ( 10489 ) SharedEdge = 24209 ( 24190 )
-TOLERANCE : MaxTol = 0.05705560511 ( 0.05705560511 ) AvgTol = 0.0002545958154 ( 0.0002529561285 )
+TOLERANCE : MaxTol = 0.05705560511 ( 0.05705560511 ) AvgTol = 0.0002632718893 ( 0.0002620014373 )
LABELS : N0Labels = 54 ( 54 ) N1Labels = 10590 ( 27260 ) N2Labels = 0 ( 0 ) TotalLabels = 10644 ( 27314 ) NameLabels = 10644 ( 13414 ) ColorLabels = 10590 ( 27312 ) LayerLabels = 7 ( 18 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 8 ( 8 )
puts "TODO CR23096 ALL: COLORS : Faulty"
puts "TODO CR23096 ALL: LAYERS : Faulty"
-
set filename BUC40132.igs
set ref_data {
DATA : Faulties = 6 ( 0 ) Warnings = 0 ( 0 ) Summary = 6 ( 0 )
-TPSTAT : Faulties = 12 ( 238 ) Warnings = 473 ( 2623 ) Summary = 485 ( 2861 )
+TPSTAT : Faulties = 12 ( 238 ) Warnings = 473 ( 2625 ) Summary = 485 ( 2863 )
CHECKSHAPE : Wires = 4 ( 4 ) Faces = 4 ( 4 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1346 ( 1345 ) Summary = 22215 ( 22296 )
-STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1346 ( 1345 ) FreeWire = 96 ( 170 ) FreeEdge = 1061 ( 1061 ) SharedEdge = 9271 ( 9280 )
-TOLERANCE : MaxTol = 0.8099726869 ( 1.367966665 ) AvgTol = 0.008043971398 ( 0.008388581449 )
-LABELS : N0Labels = 27 ( 27 ) N1Labels = 2100 ( 6250 ) N2Labels = 0 ( 0 ) TotalLabels = 2127 ( 6277 ) NameLabels = 2127 ( 2596 ) ColorLabels = 2114 ( 6276 ) LayerLabels = 2114 ( 6276 )
+NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1346 ( 1345 ) Summary = 22215 ( 22294 )
+STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1346 ( 1345 ) FreeWire = 96 ( 170 ) FreeEdge = 1061 ( 1061 ) SharedEdge = 9271 ( 9278 )
+TOLERANCE : MaxTol = 0.8099726869 ( 1.367966665 ) AvgTol = 0.008043732418 ( 0.008389831342 )
+LABELS : N0Labels = 27 ( 27 ) N1Labels = 2100 ( 6248 ) N2Labels = 0 ( 0 ) TotalLabels = 2127 ( 6275 ) NameLabels = 2127 ( 2596 ) ColorLabels = 2114 ( 6274 ) LayerLabels = 2114 ( 6274 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 11 ( 12 )
COLORS : Colors = BLUE1 CYAN1 CYAN2 DARKGOLDENROD GREEN MAGENTA1 PALEVIOLETRED1 RED TURQUOISE2 WHITE YELLOW ( BLUE1 CYAN1 CYAN2 DARKGOLDENROD GRAY53 GREEN MAGENTA1 PALEVIOLETRED1 RED TURQUOISE2 WHITE YELLOW )
# !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
-puts "TODO CR23096 ALL: TOLERANCE : Faulty"
-
-set LinuxDiff 2
set filename BUC61004.stp
set ref_data {
-DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 24851 ) Summary = 0 ( 24851 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 5 ( 43 ) Summary = 5 ( 43 )
-CHECKSHAPE : Wires = 1 ( 0 ) Faces = 1 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
+CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 2523 ( 2523 ) Summary = 16185 ( 16185 )
STATSHAPE : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 2523 ( 2523 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 6806 ( 6806 )
-TOLERANCE : MaxTol = 9.829787663 ( 7.812889886 ) AvgTol = 0.01764242132 ( 0.01681498017 )
+TOLERANCE : MaxTol = 7.812811758 ( 7.812811758 ) AvgTol = 0.01607232204 ( 0.01607241853 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 0 ( 0 )