mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0024002: Overall code and build procedure refactoring -- automatic
Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl": - WOK-generated header files from inc and sources from drv are moved to src - CDL files removed - All packages are converted to nocdlpack
This commit is contained in:
12
src/ShapeConstruct/FILES
Normal file
12
src/ShapeConstruct/FILES
Normal file
@@ -0,0 +1,12 @@
|
||||
ShapeConstruct.cxx
|
||||
ShapeConstruct.hxx
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d.cxx
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d.hxx
|
||||
ShapeConstruct_CompBezierCurvesToBSplineCurve.cxx
|
||||
ShapeConstruct_CompBezierCurvesToBSplineCurve.hxx
|
||||
ShapeConstruct_Curve.cxx
|
||||
ShapeConstruct_Curve.hxx
|
||||
ShapeConstruct_MakeTriangulation.cxx
|
||||
ShapeConstruct_MakeTriangulation.hxx
|
||||
ShapeConstruct_ProjectCurveOnSurface.cxx
|
||||
ShapeConstruct_ProjectCurveOnSurface.hxx
|
@@ -1,125 +0,0 @@
|
||||
-- Created on: 1998-07-14
|
||||
-- Created by: data exchange team
|
||||
-- Copyright (c) 1998-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.
|
||||
|
||||
package ShapeConstruct
|
||||
|
||||
---Purpose: This package provides new algorithms for constructing
|
||||
-- new geometrical objects and topological shapes. It
|
||||
-- complements and extends algorithms available in Open
|
||||
-- CASCADE topological and geometrical toolkist.
|
||||
-- The functionality provided by this package are the
|
||||
-- following:
|
||||
-- projecting curves on surface,
|
||||
-- adjusting curve to have given start and end points. P
|
||||
uses
|
||||
gp,
|
||||
Geom,
|
||||
GeomAbs,
|
||||
Geom2d,
|
||||
TColgp,
|
||||
TColStd,
|
||||
ShapeExtend,
|
||||
ShapeAnalysis,
|
||||
Convert,
|
||||
BRepBuilderAPI,
|
||||
TopoDS,
|
||||
TopAbs,
|
||||
TopTools
|
||||
|
||||
is
|
||||
|
||||
class Curve;
|
||||
|
||||
class ProjectCurveOnSurface;
|
||||
|
||||
---WARNING: The following two classes are just a copy of those from GEOMLITE
|
||||
-- They must be removed as soon as bug in them is fixed
|
||||
|
||||
class CompBezierCurvesToBSplineCurve;
|
||||
|
||||
class CompBezierCurves2dToBSplineCurve2d;
|
||||
|
||||
class MakeTriangulation;
|
||||
---Purpose: Tool for wire triangulation
|
||||
|
||||
ConvertCurveToBSpline(C3D : Curve from Geom;
|
||||
First : Real;
|
||||
Last : Real;
|
||||
Tol3d : Real; -- this and following parameters are used only if approximator have to be used.
|
||||
Continuity : Shape from GeomAbs;
|
||||
MaxSegments: Integer;
|
||||
MaxDegree : Integer)
|
||||
returns BSplineCurve from Geom;
|
||||
|
||||
ConvertCurveToBSpline(C2D : Curve from Geom2d;
|
||||
First : Real;
|
||||
Last : Real;
|
||||
Tol2d : Real; -- this and following parameters are used only if approximator have to be used.
|
||||
Continuity : Shape from GeomAbs;
|
||||
MaxSegments: Integer;
|
||||
MaxDegree : Integer)
|
||||
returns BSplineCurve from Geom2d;
|
||||
|
||||
ConvertSurfaceToBSpline(surf : Surface from Geom;
|
||||
UF,UL,VF,VL: Real;
|
||||
Tol3d : Real; -- this and following parameters are used only if approximator have to be used.
|
||||
Continuity : Shape from GeomAbs;
|
||||
MaxSegments: Integer;
|
||||
MaxDegree : Integer)
|
||||
returns BSplineSurface from Geom;
|
||||
|
||||
JoinPCurves(theEdges : HSequenceOfShape from TopTools;
|
||||
theFace : Face from TopoDS;
|
||||
theEdge : in out Edge from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: join pcurves of the <theEdge> on the <theFace>
|
||||
-- try to use pcurves from originas edges <theEdges>
|
||||
-- Returns false if cannot join pcurves
|
||||
|
||||
JoinCurves(c3d1,ac3d2 : Curve from Geom;
|
||||
Orient1, Orient2 : Orientation from TopAbs;
|
||||
first1,last1,first2,last2 : in out Real;
|
||||
c3dOut : out Curve from Geom;
|
||||
isRev1,isRev2 : out Boolean) returns Boolean;
|
||||
|
||||
--- Purpose:Method for joininig curves 3D.
|
||||
-- Parameters : c3d1,ac3d2 - initial curves
|
||||
-- Orient1, Orient2 - initial edges orientations.
|
||||
-- first1,last1,first2,last2 - parameters for trimming curves
|
||||
-- (re-calculate with account of orientation edges)
|
||||
-- c3dOut - result curve
|
||||
-- isRev1,isRev2 - out parameters indicative on possible errors.
|
||||
-- Return value : True - if curves were joined successfully,
|
||||
-- else - False.
|
||||
|
||||
JoinCurves(c2d1,ac2d2 : Curve from Geom2d;
|
||||
Orient1, Orient2 : Orientation from TopAbs;
|
||||
first1,last1,first2,last2 : in out Real;
|
||||
c2dOut : out Curve from Geom2d;
|
||||
isRev1,isRev2 : out Boolean;
|
||||
isError : Boolean = Standard_False) returns Boolean;
|
||||
|
||||
--- Purpose:Method for joininig curves 3D.
|
||||
-- Parameters : c3d1,ac3d2 - initial curves
|
||||
-- Orient1, Orient2 - initial edges orientations.
|
||||
-- first1,last1,first2,last2 - parameters for trimming curves
|
||||
-- (re-calculate with account of orientation edges)
|
||||
-- c3dOut - result curve
|
||||
-- isRev1,isRev2 - out parameters indicative on possible errors.
|
||||
-- isError - input parameter indicative possible errors due to that one from edges have one vertex
|
||||
-- Return value : True - if curves were joined successfully,
|
||||
-- else - False.
|
||||
end ShapeConstruct;
|
@@ -14,50 +14,55 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <ShapeConstruct.ixx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Conic.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dConvert_ApproxCurve.hxx>
|
||||
#include <Geom2dConvert.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom2dConvert_ApproxCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_ElementarySurface.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <ShapeConstruct_Curve.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAPI.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <GeomAPI.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <ShapeConstruct.hxx>
|
||||
#include <ShapeConstruct_Curve.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_ElementarySurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertCurveToBSpline
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_BSplineCurve) ShapeConstruct::ConvertCurveToBSpline(const Handle(Geom_Curve)& C3D,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
|
123
src/ShapeConstruct/ShapeConstruct.hxx
Normal file
123
src/ShapeConstruct/ShapeConstruct.hxx
Normal file
@@ -0,0 +1,123 @@
|
||||
// Created on: 1998-07-14
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 1998-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 _ShapeConstruct_HeaderFile
|
||||
#define _ShapeConstruct_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
class Geom_BSplineCurve;
|
||||
class Geom_Curve;
|
||||
class Geom2d_BSplineCurve;
|
||||
class Geom2d_Curve;
|
||||
class Geom_BSplineSurface;
|
||||
class Geom_Surface;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Edge;
|
||||
class ShapeConstruct_Curve;
|
||||
class ShapeConstruct_ProjectCurveOnSurface;
|
||||
class ShapeConstruct_CompBezierCurvesToBSplineCurve;
|
||||
class ShapeConstruct_CompBezierCurves2dToBSplineCurve2d;
|
||||
class ShapeConstruct_MakeTriangulation;
|
||||
|
||||
|
||||
//! This package provides new algorithms for constructing
|
||||
//! new geometrical objects and topological shapes. It
|
||||
//! complements and extends algorithms available in Open
|
||||
//! CASCADE topological and geometrical toolkist.
|
||||
//! The functionality provided by this package are the
|
||||
//! following:
|
||||
//! projecting curves on surface,
|
||||
//! adjusting curve to have given start and end points. P
|
||||
class ShapeConstruct
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Tool for wire triangulation
|
||||
Standard_EXPORT static Handle(Geom_BSplineCurve) ConvertCurveToBSpline (const Handle(Geom_Curve)& C3D, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const GeomAbs_Shape Continuity, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) ConvertCurveToBSpline (const Handle(Geom2d_Curve)& C2D, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol2d, const GeomAbs_Shape Continuity, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) ConvertSurfaceToBSpline (const Handle(Geom_Surface)& surf, const Standard_Real UF, const Standard_Real UL, const Standard_Real VF, const Standard_Real VL, const Standard_Real Tol3d, const GeomAbs_Shape Continuity, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
//! join pcurves of the <theEdge> on the <theFace>
|
||||
//! try to use pcurves from originas edges <theEdges>
|
||||
//! Returns false if cannot join pcurves
|
||||
Standard_EXPORT static Standard_Boolean JoinPCurves (const Handle(TopTools_HSequenceOfShape)& theEdges, const TopoDS_Face& theFace, TopoDS_Edge& theEdge);
|
||||
|
||||
//! Method for joininig curves 3D.
|
||||
//! Parameters : c3d1,ac3d2 - initial curves
|
||||
//! Orient1, Orient2 - initial edges orientations.
|
||||
//! first1,last1,first2,last2 - parameters for trimming curves
|
||||
//! (re-calculate with account of orientation edges)
|
||||
//! c3dOut - result curve
|
||||
//! isRev1,isRev2 - out parameters indicative on possible errors.
|
||||
//! Return value : True - if curves were joined successfully,
|
||||
//! else - False.
|
||||
Standard_EXPORT static Standard_Boolean JoinCurves (const Handle(Geom_Curve)& c3d1, const Handle(Geom_Curve)& ac3d2, const TopAbs_Orientation Orient1, const TopAbs_Orientation Orient2, Standard_Real& first1, Standard_Real& last1, Standard_Real& first2, Standard_Real& last2, Handle(Geom_Curve)& c3dOut, Standard_Boolean& isRev1, Standard_Boolean& isRev2);
|
||||
|
||||
//! Method for joininig curves 3D.
|
||||
//! Parameters : c3d1,ac3d2 - initial curves
|
||||
//! Orient1, Orient2 - initial edges orientations.
|
||||
//! first1,last1,first2,last2 - parameters for trimming curves
|
||||
//! (re-calculate with account of orientation edges)
|
||||
//! c3dOut - result curve
|
||||
//! isRev1,isRev2 - out parameters indicative on possible errors.
|
||||
//! isError - input parameter indicative possible errors due to that one from edges have one vertex
|
||||
//! Return value : True - if curves were joined successfully,
|
||||
//! else - False.
|
||||
Standard_EXPORT static Standard_Boolean JoinCurves (const Handle(Geom2d_Curve)& c2d1, const Handle(Geom2d_Curve)& ac2d2, const TopAbs_Orientation Orient1, const TopAbs_Orientation Orient2, Standard_Real& first1, Standard_Real& last1, Standard_Real& first2, Standard_Real& last2, Handle(Geom2d_Curve)& c2dOut, Standard_Boolean& isRev1, Standard_Boolean& isRev2, const Standard_Boolean isError = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class ShapeConstruct_Curve;
|
||||
friend class ShapeConstruct_ProjectCurveOnSurface;
|
||||
friend class ShapeConstruct_CompBezierCurvesToBSplineCurve;
|
||||
friend class ShapeConstruct_CompBezierCurves2dToBSplineCurve2d;
|
||||
friend class ShapeConstruct_MakeTriangulation;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_HeaderFile
|
@@ -1,83 +0,0 @@
|
||||
-- Created on: 1993-11-09
|
||||
-- Created by: Modelistation
|
||||
-- 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.
|
||||
|
||||
class CompBezierCurves2dToBSplineCurve2d from ShapeConstruct
|
||||
|
||||
---Purpose: Converts a list of connecting Bezier Curves 2d to a
|
||||
-- BSplineCurve 2d.
|
||||
-- if possible, the continuity of the BSpline will be
|
||||
-- increased to more than C0.
|
||||
|
||||
|
||||
uses
|
||||
SequenceOfReal from TColStd,
|
||||
SequenceOfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfPnt2d from TColgp,
|
||||
SequenceOfPnt2d from TColgp,
|
||||
SequenceOfArray1OfPoles2d from Convert
|
||||
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- Don't forget to use the method Perform before accessing the Result.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
is
|
||||
Create( AngularTolerance : Real = 1.0e-4 )
|
||||
returns CompBezierCurves2dToBSplineCurve2d from ShapeConstruct;
|
||||
|
||||
AddCurve( me : in out;
|
||||
Poles : Array1OfPnt2d from TColgp)
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out)
|
||||
---Purpose: Computes the algorithm.
|
||||
is static;
|
||||
|
||||
|
||||
Degree(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
NbPoles(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Poles(me; Poles : in out Array1OfPnt2d from TColgp)
|
||||
is static;
|
||||
|
||||
NbKnots(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
KnotsAndMults(me;
|
||||
Knots : in out Array1OfReal from TColStd;
|
||||
Mults : in out Array1OfInteger from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
mySequence : SequenceOfArray1OfPoles2d from Convert;
|
||||
CurvePoles : SequenceOfPnt2d from TColgp;
|
||||
CurveKnots : SequenceOfReal from TColStd;
|
||||
KnotsMultiplicities : SequenceOfInteger from TColStd;
|
||||
myDegree : Integer from Standard;
|
||||
myAngular : Real from Standard;
|
||||
myDone : Boolean from Standard;
|
||||
|
||||
end CompBezierCurves2dToBSplineCurve2d;
|
@@ -19,22 +19,20 @@
|
||||
// cf BUG PRO4481)
|
||||
//rln 20.06.99 work-around
|
||||
|
||||
#include <ShapeConstruct_CompBezierCurves2dToBSplineCurve2d.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeConstruct_CompBezierCurves2dToBSplineCurve2d.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeConstruct_CompBezierCurves2dToBSplineCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d::
|
||||
ShapeConstruct_CompBezierCurves2dToBSplineCurve2d(
|
||||
const Standard_Real AngularTolerance) :
|
||||
|
@@ -0,0 +1,95 @@
|
||||
// Created on: 1993-11-09
|
||||
// Created by: Modelistation
|
||||
// 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 _ShapeConstruct_CompBezierCurves2dToBSplineCurve2d_HeaderFile
|
||||
#define _ShapeConstruct_CompBezierCurves2dToBSplineCurve2d_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Convert_SequenceOfArray1OfPoles2d.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
class Standard_ConstructionError;
|
||||
|
||||
|
||||
//! Converts a list of connecting Bezier Curves 2d to a
|
||||
//! BSplineCurve 2d.
|
||||
//! if possible, the continuity of the BSpline will be
|
||||
//! increased to more than C0.
|
||||
class ShapeConstruct_CompBezierCurves2dToBSplineCurve2d
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT ShapeConstruct_CompBezierCurves2dToBSplineCurve2d(const Standard_Real AngularTolerance = 1.0e-4);
|
||||
|
||||
Standard_EXPORT void AddCurve (const TColgp_Array1OfPnt2d& Poles);
|
||||
|
||||
//! Computes the algorithm.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
Standard_EXPORT Standard_Integer Degree() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbPoles() const;
|
||||
|
||||
Standard_EXPORT void Poles (TColgp_Array1OfPnt2d& Poles) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbKnots() const;
|
||||
|
||||
Standard_EXPORT void KnotsAndMults (TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Convert_SequenceOfArray1OfPoles2d mySequence;
|
||||
TColgp_SequenceOfPnt2d CurvePoles;
|
||||
TColStd_SequenceOfReal CurveKnots;
|
||||
TColStd_SequenceOfInteger KnotsMultiplicities;
|
||||
Standard_Integer myDegree;
|
||||
Standard_Real myAngular;
|
||||
Standard_Boolean myDone;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_CompBezierCurves2dToBSplineCurve2d_HeaderFile
|
@@ -1,81 +0,0 @@
|
||||
-- Created on: 1993-10-20
|
||||
-- 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.
|
||||
|
||||
class CompBezierCurvesToBSplineCurve from ShapeConstruct
|
||||
|
||||
---Purpose: Converts a list of connecting Bezier Curves to a
|
||||
-- BSplineCurve.
|
||||
-- if possible, the continuity of the BSpline will be
|
||||
-- increased to more than C0.
|
||||
|
||||
uses
|
||||
Array1OfReal from TColStd,
|
||||
SequenceOfReal from TColStd,
|
||||
SequenceOfInteger from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfPnt from TColgp,
|
||||
SequenceOfPnt from TColgp,
|
||||
SequenceOfArray1OfPoles from Convert
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- Don't forget to use the method Perform before accessing the Result.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create ( AngularTolerance : Real = 1.0e-4 )
|
||||
returns CompBezierCurvesToBSplineCurve from ShapeConstruct;
|
||||
|
||||
AddCurve( me : in out;
|
||||
Poles : Array1OfPnt from TColgp)
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out)
|
||||
---Purpose: Computes the algorithm.
|
||||
is static;
|
||||
|
||||
|
||||
Degree(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
NbPoles(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Poles(me; Poles : in out Array1OfPnt from TColgp)
|
||||
is static;
|
||||
|
||||
NbKnots(me) returns Integer from Standard
|
||||
is static;
|
||||
|
||||
KnotsAndMults(me;
|
||||
Knots : in out Array1OfReal from TColStd;
|
||||
Mults : in out Array1OfInteger from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
mySequence : SequenceOfArray1OfPoles from Convert;
|
||||
CurvePoles : SequenceOfPnt from TColgp;
|
||||
CurveKnots : SequenceOfReal from TColStd;
|
||||
KnotsMultiplicities : SequenceOfInteger from TColStd;
|
||||
myDegree : Integer from Standard;
|
||||
myAngular : Real from Standard;
|
||||
myDone : Boolean from Standard;
|
||||
|
||||
end CompBezierCurvesToBSplineCurve;
|
@@ -19,23 +19,20 @@
|
||||
// cf BUG PRO4481)
|
||||
//rln 20.06.99 work-around
|
||||
|
||||
#include <ShapeConstruct_CompBezierCurvesToBSplineCurve.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeConstruct_CompBezierCurvesToBSplineCurve.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeConstruct_CompBezierCurvesToBSplineCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
ShapeConstruct_CompBezierCurvesToBSplineCurve::
|
||||
ShapeConstruct_CompBezierCurvesToBSplineCurve(
|
||||
const Standard_Real AngularTolerance) :
|
||||
|
@@ -0,0 +1,95 @@
|
||||
// Created on: 1993-10-20
|
||||
// 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 _ShapeConstruct_CompBezierCurvesToBSplineCurve_HeaderFile
|
||||
#define _ShapeConstruct_CompBezierCurvesToBSplineCurve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Convert_SequenceOfArray1OfPoles.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
class Standard_ConstructionError;
|
||||
|
||||
|
||||
//! Converts a list of connecting Bezier Curves to a
|
||||
//! BSplineCurve.
|
||||
//! if possible, the continuity of the BSpline will be
|
||||
//! increased to more than C0.
|
||||
class ShapeConstruct_CompBezierCurvesToBSplineCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT ShapeConstruct_CompBezierCurvesToBSplineCurve(const Standard_Real AngularTolerance = 1.0e-4);
|
||||
|
||||
Standard_EXPORT void AddCurve (const TColgp_Array1OfPnt& Poles);
|
||||
|
||||
//! Computes the algorithm.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
Standard_EXPORT Standard_Integer Degree() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbPoles() const;
|
||||
|
||||
Standard_EXPORT void Poles (TColgp_Array1OfPnt& Poles) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbKnots() const;
|
||||
|
||||
Standard_EXPORT void KnotsAndMults (TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Convert_SequenceOfArray1OfPoles mySequence;
|
||||
TColgp_SequenceOfPnt CurvePoles;
|
||||
TColStd_SequenceOfReal CurveKnots;
|
||||
TColStd_SequenceOfInteger KnotsMultiplicities;
|
||||
Standard_Integer myDegree;
|
||||
Standard_Real myAngular;
|
||||
Standard_Boolean myDone;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_CompBezierCurvesToBSplineCurve_HeaderFile
|
@@ -1,98 +0,0 @@
|
||||
-- Created on: 1998-07-14
|
||||
-- Created by: data exchange team
|
||||
-- Copyright (c) 1998-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.
|
||||
|
||||
class Curve from ShapeConstruct
|
||||
|
||||
---Purpose: Adjusts curve to have start and end points at the given
|
||||
-- points (currently works on lines and B-Splines only)
|
||||
|
||||
uses
|
||||
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
Curve from Geom,
|
||||
Curve from Geom2d,
|
||||
BSplineCurve from Geom,
|
||||
BSplineCurve from Geom2d,
|
||||
HArray1OfReal from TColStd,
|
||||
Array1OfReal from TColStd
|
||||
|
||||
is
|
||||
|
||||
AdjustCurve (me; C3D: Curve from Geom;
|
||||
P1, P2: Pnt from gp;
|
||||
take1, take2: Boolean = Standard_True)
|
||||
returns Boolean;
|
||||
---Purpose : Modifies a curve in order to make its bounds confused with
|
||||
-- given points.
|
||||
-- Works only on lines and B-Splines, returns True in this case,
|
||||
-- else returns False.
|
||||
-- For line considers both bounding points, for B-Splines only
|
||||
-- specified.
|
||||
--
|
||||
-- Warning : Does not check if curve should be reversed
|
||||
|
||||
AdjustCurveSegment (me; C3D: Curve from Geom;
|
||||
P1, P2: Pnt from gp;
|
||||
U1, U2: Real)
|
||||
returns Boolean;
|
||||
---Purpose : Modifies a curve in order to make its bounds confused with
|
||||
-- given points.
|
||||
-- Works only on lines and B-Splines.
|
||||
--
|
||||
-- For lines works as previous method, B-Splines are segmented
|
||||
-- at the given values and then are adjusted to the points.
|
||||
|
||||
AdjustCurve2d (me; C2D: Curve from Geom2d;
|
||||
P1, P2: Pnt2d from gp;
|
||||
take1, take2: Boolean = Standard_True)
|
||||
returns Boolean;
|
||||
---Purpose : Modifies a curve in order to make its bounds confused with
|
||||
-- given points.
|
||||
-- Works only on lines and B-Splines, returns True in this case,
|
||||
-- else returns False.
|
||||
--
|
||||
-- For line considers both bounding points, for B-Splines only
|
||||
-- specified.
|
||||
--
|
||||
-- Warning : Does not check if curve should be reversed
|
||||
|
||||
ConvertToBSpline (me; C: Curve from Geom; first, last: Real; prec: Real)
|
||||
returns BSplineCurve from Geom;
|
||||
---Purpose: Converts a curve of any type (only part from first to last)
|
||||
-- to bspline. The method of conversion depends on the type
|
||||
-- of original curve:
|
||||
-- BSpline -> C.Segment(first,last)
|
||||
-- Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
|
||||
-- Conic and Other -> Approx_Curve3d(C[first,last],prec,C1,9,1000)
|
||||
|
||||
ConvertToBSpline (me; C: Curve from Geom2d; first, last: Real; prec: Real)
|
||||
returns BSplineCurve from Geom2d;
|
||||
---Purpose: Converts a curve of any type (only part from first to last)
|
||||
-- to bspline. The method of conversion depends on the type
|
||||
-- of original curve:
|
||||
-- BSpline -> C.Segment(first,last)
|
||||
-- Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
|
||||
-- Conic and Other -> Approx_Curve2d(C[first,last],prec,C1,9,1000)
|
||||
|
||||
FixKnots (myclass; knots: in out HArray1OfReal from TColStd) returns Boolean;
|
||||
FixKnots (myclass; knots: in out Array1OfReal from TColStd) returns Boolean;
|
||||
---Purpose: Fix bspline knots to ensure that there is enough
|
||||
-- gap between neighbouring values
|
||||
-- Returns True if something fixed (by shifting knot)
|
||||
|
||||
|
||||
end Curve;
|
@@ -11,43 +11,39 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <ShapeConstruct_Curve.ixx>
|
||||
|
||||
#include <Approx_Curve2d.hxx>
|
||||
#include <Approx_Curve3d.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Geom2dConvert.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeConstruct_Curve.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <Approx_Curve3d.hxx>
|
||||
|
||||
#include <Geom2dConvert.hxx>
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Approx_Curve2d.hxx>
|
||||
|
||||
//sln 29.12.2001 OCC90 : Method FixKnots was added
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeConstruct_Curve::AdjustCurve(const Handle(Geom_Curve)& C3D,const gp_Pnt& P1,const gp_Pnt& P2,const Standard_Boolean take1,const Standard_Boolean take2) const
|
||||
{
|
||||
if (!take1 && !take2) return Standard_True;
|
||||
|
120
src/ShapeConstruct/ShapeConstruct_Curve.hxx
Normal file
120
src/ShapeConstruct/ShapeConstruct_Curve.hxx
Normal file
@@ -0,0 +1,120 @@
|
||||
// Created on: 1998-07-14
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 1998-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 _ShapeConstruct_Curve_HeaderFile
|
||||
#define _ShapeConstruct_Curve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
class Geom_Curve;
|
||||
class gp_Pnt;
|
||||
class Geom2d_Curve;
|
||||
class gp_Pnt2d;
|
||||
class Geom_BSplineCurve;
|
||||
class Geom2d_BSplineCurve;
|
||||
|
||||
|
||||
//! Adjusts curve to have start and end points at the given
|
||||
//! points (currently works on lines and B-Splines only)
|
||||
class ShapeConstruct_Curve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Modifies a curve in order to make its bounds confused with
|
||||
//! given points.
|
||||
//! Works only on lines and B-Splines, returns True in this case,
|
||||
//! else returns False.
|
||||
//! For line considers both bounding points, for B-Splines only
|
||||
//! specified.
|
||||
//!
|
||||
//! Warning : Does not check if curve should be reversed
|
||||
Standard_EXPORT Standard_Boolean AdjustCurve (const Handle(Geom_Curve)& C3D, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Boolean take1 = Standard_True, const Standard_Boolean take2 = Standard_True) const;
|
||||
|
||||
//! Modifies a curve in order to make its bounds confused with
|
||||
//! given points.
|
||||
//! Works only on lines and B-Splines.
|
||||
//!
|
||||
//! For lines works as previous method, B-Splines are segmented
|
||||
//! at the given values and then are adjusted to the points.
|
||||
Standard_EXPORT Standard_Boolean AdjustCurveSegment (const Handle(Geom_Curve)& C3D, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real U1, const Standard_Real U2) const;
|
||||
|
||||
//! Modifies a curve in order to make its bounds confused with
|
||||
//! given points.
|
||||
//! Works only on lines and B-Splines, returns True in this case,
|
||||
//! else returns False.
|
||||
//!
|
||||
//! For line considers both bounding points, for B-Splines only
|
||||
//! specified.
|
||||
//!
|
||||
//! Warning : Does not check if curve should be reversed
|
||||
Standard_EXPORT Standard_Boolean AdjustCurve2d (const Handle(Geom2d_Curve)& C2D, const gp_Pnt2d& P1, const gp_Pnt2d& P2, const Standard_Boolean take1 = Standard_True, const Standard_Boolean take2 = Standard_True) const;
|
||||
|
||||
//! Converts a curve of any type (only part from first to last)
|
||||
//! to bspline. The method of conversion depends on the type
|
||||
//! of original curve:
|
||||
//! BSpline -> C.Segment(first,last)
|
||||
//! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
|
||||
//! Conic and Other -> Approx_Curve3d(C[first,last],prec,C1,9,1000)
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) ConvertToBSpline (const Handle(Geom_Curve)& C, const Standard_Real first, const Standard_Real last, const Standard_Real prec) const;
|
||||
|
||||
//! Converts a curve of any type (only part from first to last)
|
||||
//! to bspline. The method of conversion depends on the type
|
||||
//! of original curve:
|
||||
//! BSpline -> C.Segment(first,last)
|
||||
//! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
|
||||
//! Conic and Other -> Approx_Curve2d(C[first,last],prec,C1,9,1000)
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) ConvertToBSpline (const Handle(Geom2d_Curve)& C, const Standard_Real first, const Standard_Real last, const Standard_Real prec) const;
|
||||
|
||||
Standard_EXPORT static Standard_Boolean FixKnots (Handle(TColStd_HArray1OfReal)& knots);
|
||||
|
||||
//! Fix bspline knots to ensure that there is enough
|
||||
//! gap between neighbouring values
|
||||
//! Returns True if something fixed (by shifting knot)
|
||||
Standard_EXPORT static Standard_Boolean FixKnots (TColStd_Array1OfReal& knots);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_Curve_HeaderFile
|
@@ -1,47 +0,0 @@
|
||||
-- Created on: 1999-12-20
|
||||
-- Created by: data exchange team
|
||||
-- Copyright (c) 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.
|
||||
|
||||
class MakeTriangulation from ShapeConstruct inherits MakeShape from BRepBuilderAPI
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
|
||||
Array1OfPnt from TColgp,
|
||||
Wire from TopoDS
|
||||
|
||||
is
|
||||
|
||||
Create (pnts : Array1OfPnt from TColgp; prec : Real = 0.0)
|
||||
returns MakeTriangulation from ShapeConstruct;
|
||||
|
||||
Create (wire : Wire from TopoDS; prec : Real = 0.0)
|
||||
returns MakeTriangulation from ShapeConstruct;
|
||||
|
||||
Build (me : in out) is redefined;
|
||||
|
||||
IsDone (me) returns Boolean is redefined;
|
||||
|
||||
Triangulate (me : in out; wire : Wire from TopoDS) is private;
|
||||
|
||||
AddFacet (me : in out; wire : Wire from TopoDS) is private;
|
||||
|
||||
fields
|
||||
|
||||
myPrecision : Real from Standard;
|
||||
myWire : Wire from TopoDS;
|
||||
|
||||
end MakeTriangulation;
|
@@ -11,38 +11,35 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <ShapeConstruct_MakeTriangulation.ixx>
|
||||
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <ShapeAnalysis_Wire.hxx>
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
|
||||
#include <ShapeConstruct_MakeTriangulation.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRightContour (static)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IsRightContour (const TColgp_SequenceOfPnt& pts, const Standard_Real prec)
|
||||
{
|
||||
Standard_Integer len = pts.Length();
|
||||
|
77
src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx
Normal file
77
src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx
Normal file
@@ -0,0 +1,77 @@
|
||||
// Created on: 1999-12-20
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 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 _ShapeConstruct_MakeTriangulation_HeaderFile
|
||||
#define _ShapeConstruct_MakeTriangulation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class TopoDS_Wire;
|
||||
|
||||
|
||||
|
||||
class ShapeConstruct_MakeTriangulation : public BRepBuilderAPI_MakeShape
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT ShapeConstruct_MakeTriangulation(const TColgp_Array1OfPnt& pnts, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT ShapeConstruct_MakeTriangulation(const TopoDS_Wire& wire, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Triangulate (const TopoDS_Wire& wire);
|
||||
|
||||
Standard_EXPORT void AddFacet (const TopoDS_Wire& wire);
|
||||
|
||||
|
||||
Standard_Real myPrecision;
|
||||
TopoDS_Wire myWire;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_MakeTriangulation_HeaderFile
|
@@ -1,240 +0,0 @@
|
||||
-- Created on: 1998-07-14
|
||||
-- Created by: data exchange team
|
||||
-- Copyright (c) 1998-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.
|
||||
|
||||
-- szv#4 S4163
|
||||
|
||||
class ProjectCurveOnSurface from ShapeConstruct inherits TShared from MMgt
|
||||
|
||||
---Purpose: This tool provides a method for computing pcurve by projecting
|
||||
-- 3d curve onto a surface.
|
||||
-- Projection is done by 23 or more points (this number is changed
|
||||
-- for B-Splines according to the following rule:
|
||||
-- the total number of the points is not less than number of spans *
|
||||
-- (degree + 1);
|
||||
-- it is increased recursively starting with 23 and is added with 22
|
||||
-- until the condition is fulfilled).
|
||||
-- Isoparametric cases (if curve corresponds to U=const or V=const on
|
||||
-- the surface) are recognized with the given precision.
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
Curve from Geom2d,
|
||||
Curve from Geom,
|
||||
Surface from Geom,
|
||||
Array1OfPnt from TColgp,
|
||||
HArray1OfPnt from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
HArray1OfPnt2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
Surface from ShapeAnalysis,
|
||||
Status from ShapeExtend,
|
||||
Shape from GeomAbs
|
||||
|
||||
is
|
||||
|
||||
Create returns ProjectCurveOnSurface from ShapeConstruct;
|
||||
---Purpose: Empty constructor.
|
||||
|
||||
Init (me: mutable; surf: Surface from Geom; preci: Real) is virtual;
|
||||
---Purpose: Initializes the object with all necessary parameters,
|
||||
-- i.e. surface and precision
|
||||
|
||||
Init (me : mutable; surf: Surface from ShapeAnalysis; preci : Real) is virtual;
|
||||
---Purpose: Initializes the object with all necessary parameters,
|
||||
-- i.e. surface and precision
|
||||
|
||||
SetSurface (me: mutable; surf: Surface from Geom);
|
||||
---Purpose: Loads a surface (in the form of Geom_Surface) to project on
|
||||
|
||||
SetSurface (me : mutable; surf: Surface from ShapeAnalysis);
|
||||
---Purpose: Loads a surface (in the form of ShapeAnalysis_Surface) to project on
|
||||
|
||||
SetPrecision (me : mutable; preci : Real);
|
||||
---Purpose : Sets value for current precision
|
||||
|
||||
BuildCurveMode (me : mutable) returns Boolean;
|
||||
---Purpose : Returns (modifiable) the build-curve-3d mode, by default False
|
||||
-- If True, if the projected curve has been recomputed by
|
||||
-- interpolation, the 3d curve is also rebuild by interpolation
|
||||
---C++ : return &
|
||||
|
||||
AdjustOverDegenMode (me : mutable) returns Integer; -- szv#4:S4163:12Mar99 was Boolean
|
||||
---Purpose : Returns (modifiable) the flag specifying to which side of
|
||||
-- parametrical space adjust part of pcurve which lies on seam.
|
||||
-- This is required in very rare case when 3d curve which is
|
||||
-- to be projected goes partly along the seam on the closed
|
||||
-- surface with singularity (e.g. sphere), goes through the
|
||||
-- degenerated point and paerly lies on internal area of surface.
|
||||
--
|
||||
-- If this flag is True, the seam part of such curve will be
|
||||
-- adjusted to the left side of parametric space (on sphere U=0),
|
||||
-- else to the right side (on sphere U=2*PI)
|
||||
-- Default value is True
|
||||
---Level: Advanced
|
||||
---C++ : return &
|
||||
|
||||
Status (me; Status: Status from ShapeExtend) returns Boolean;
|
||||
---Purpose: Returns the status of last Peform
|
||||
|
||||
Perform (me: mutable; c3d : in out Curve from Geom;
|
||||
First, Last: Real;
|
||||
c2d : out Curve from Geom2d;
|
||||
continuity : Shape from GeomAbs = GeomAbs_C1;
|
||||
maxdeg : Integer = 12;
|
||||
nbinterval : Integer = -1 )
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Computes the projection of 3d curve onto a surface using the
|
||||
-- specialized algorithm. Returns False if projector fails,
|
||||
-- otherwise, if pcurve computed successfully, returns True.
|
||||
-- The continuity, maxdeg and nbinterval are parameters of call
|
||||
-- to Approx_CurveOnSurface. If nbinterval is equal to -1
|
||||
-- (default), this value is computed depending on source 3d curve
|
||||
-- and surface. The output curve 2D is guaranteed to be same-parameter
|
||||
-- with input curve 3D on the interval [First, Last]. If the output curve
|
||||
-- lies on a direct line the infinite line is returned, in the case
|
||||
-- same-parameter condition is satisfied.
|
||||
---Status:
|
||||
-- FAIL1 if the standard projector fails (no result)
|
||||
-- FAIL2 if the standard projector raises an exception
|
||||
-- FAIL3 if the standard projector cuts the pcurve
|
||||
-- DONE1 if pcurve was computed successfully
|
||||
|
||||
PerformByProjLib(me: mutable; c3d : in out Curve from Geom;
|
||||
First, Last: Real;
|
||||
c2d : out Curve from Geom2d;
|
||||
continuity : Shape from GeomAbs = GeomAbs_C1;
|
||||
maxdeg : Integer = 12;
|
||||
nbinterval : Integer = -1)
|
||||
returns Boolean;
|
||||
---Purpose: Computes the projection of 3d curve onto a surface using the
|
||||
-- standard algorithm from ProjLib. Returns False if standard
|
||||
-- projector fails or raises an exception or cuts the curve by
|
||||
-- parametrical bounds of the surface. Else, if pcurve computed
|
||||
-- successfully, returns True.
|
||||
-- The continuity, maxdeg and nbinterval are parameters of call
|
||||
-- to Approx_CurveOnSurface. If nbinterval is equal to -1
|
||||
-- (default), this value is computed depending on source 3d curve
|
||||
-- and surface.
|
||||
---Status:
|
||||
-- FAIL1 if the standard projector fails (no result)
|
||||
-- FAIL2 if the standard projector raises an exception
|
||||
-- FAIL3 if the standard projector cuts the pcurve
|
||||
-- DONE1 if pcurve was computed successfully
|
||||
|
||||
PerformAdvanced(me: mutable; c3d : in out Curve from Geom;
|
||||
First, Last: Real;
|
||||
c2d : out Curve from Geom2d)
|
||||
returns Boolean;
|
||||
---Purpose: Computes the projection of 3d curve onto a surface using
|
||||
-- either standard projector (method PerformByProjLib()) or
|
||||
-- internal one (method Perform()). The selection is done by
|
||||
-- analyzing the surface and 3d curve and is aimed to filter
|
||||
-- the cases potentially dangerous for the standard projector.
|
||||
-- If the standard projector fails, internal one is used.
|
||||
---Status:
|
||||
-- FAIL1 if no surface loaded,
|
||||
-- FAIL2 if standard projected has failed,
|
||||
-- FAIL3 if internal projected failed
|
||||
-- DONE1 if c2d was built analytically,
|
||||
-- DONE2 if c2d was approximied by internal projector,
|
||||
-- DONE3 if c3d was rebuilt (see BuildCurveMode)
|
||||
-- DONE4 if seam part of pcurve was adjusted to one side of
|
||||
-- parametric space according to flag AdjustOverDegenMode
|
||||
-- DONE5 if c2d was computed by PerformByProjLib()
|
||||
|
||||
---Level: Private
|
||||
|
||||
ProjectAnalytic (me; c3d: Curve from Geom)
|
||||
returns Curve from Geom2d is private;
|
||||
|
||||
ApproxPCurve (me: mutable; nbrPnt : Integer;
|
||||
points : Array1OfPnt from TColgp;
|
||||
params : Array1OfReal from TColStd;
|
||||
points2d: out Array1OfPnt2d from TColgp;
|
||||
c2d : out Curve from Geom2d)
|
||||
returns Boolean is private;
|
||||
|
||||
InterpolatePCurve (me; nbrPnt : Integer;
|
||||
points2d: in out HArray1OfPnt2d from TColgp;
|
||||
params : in out HArray1OfReal from TColStd;
|
||||
orig : Curve from Geom)
|
||||
returns Curve from Geom2d is private;
|
||||
|
||||
ApproximatePCurve (me; nbrPnt : Integer;
|
||||
points2d: in out HArray1OfPnt2d from TColgp;
|
||||
params : in out HArray1OfReal from TColStd;
|
||||
orig : Curve from Geom)
|
||||
returns Curve from Geom2d is private;
|
||||
|
||||
InterpolateCurve3d (me; nbrPnt: Integer;
|
||||
points: in out HArray1OfPnt from TColgp;
|
||||
params: in out HArray1OfReal from TColStd;
|
||||
orig : Curve from Geom)
|
||||
returns Curve from Geom is private;
|
||||
|
||||
CheckPoints (me; points: in out HArray1OfPnt from TColgp;
|
||||
params: in out HArray1OfReal from TColStd;
|
||||
preci : in out Real)
|
||||
is private;
|
||||
|
||||
CheckPoints2d (me; points: in out HArray1OfPnt2d from TColgp;
|
||||
params: in out HArray1OfReal from TColStd;
|
||||
preci : in out Real)
|
||||
is private;
|
||||
|
||||
IsAnIsoparametric (me; nbrPnt : Integer;
|
||||
points : Array1OfPnt from TColgp;
|
||||
params : Array1OfReal from TColStd;
|
||||
isoTypeU : out Boolean;
|
||||
p1OnIso : out Boolean;
|
||||
valueP1 : out Pnt2d from gp;
|
||||
p2OnIso : out Boolean;
|
||||
valueP2 : out Pnt2d from gp;
|
||||
isoPar2d3d: out Boolean;
|
||||
cIso : out Curve from Geom;
|
||||
t1, t2 : out Real;
|
||||
pout : out Array1OfReal from TColStd)
|
||||
returns Boolean is private;
|
||||
|
||||
getLine(me ; points : Array1OfPnt from TColgp;
|
||||
params : Array1OfReal from TColStd;
|
||||
points2d: out Array1OfPnt2d from TColgp;
|
||||
theTol : Real;
|
||||
IsRecompute: in out Boolean) returns Curve from Geom2d is protected;
|
||||
---Purpose: Try to approximate 3D curve by Geom2d_Line
|
||||
-- or Geom2d_BsplineCurve with degree 1 with specified tolerance.
|
||||
-- points - points obtained from 3d curve.
|
||||
-- params - parameters corresponding points on 3d curves
|
||||
-- points2d - 2d points lies on line in parametric space
|
||||
-- theTol - tolerance used for compare initial points 3d and
|
||||
-- 3d points obtained from line lying in parameric space of surface
|
||||
|
||||
fields
|
||||
|
||||
mySurf : Surface from ShapeAnalysis is protected;
|
||||
myPreci : Real is protected;
|
||||
myBuild : Boolean is protected;
|
||||
myStatus: Integer is protected;
|
||||
-- myAdjustOverDegen: Boolean; --//:c0 abv: cases when curve goes over sphere pole
|
||||
myAdjustOverDegen: Integer is protected; -- szv#4:S4163:12Mar99 was Boolean -- smh#14 - never used in open version
|
||||
|
||||
myNbCashe: Integer is protected;
|
||||
myCashe3d: Pnt from gp [2] is protected;
|
||||
myCashe2d: Pnt2d from gp [2] is protected;
|
||||
|
||||
end ProjectCurveOnSurface;
|
@@ -28,52 +28,52 @@
|
||||
//szv#4 S4163
|
||||
//:s5 abv 22.04.99 Adding debug printouts in catch {} blocks
|
||||
//#1 svv 11.01.00 Porting on DEC
|
||||
#include <ShapeConstruct_ProjectCurveOnSurface.ixx>
|
||||
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
#include <GeomAPI_PointsToBSpline.hxx>
|
||||
#include <Geom2dAPI_Interpolate.hxx>
|
||||
#include <GeomAPI_Interpolate.hxx>
|
||||
#include <Geom2dAdaptor.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Approx_CurveOnSurface.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2dAdaptor.hxx>
|
||||
#include <Geom2dAPI_Interpolate.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
#include <ShapeExtend.hxx>
|
||||
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomAPI_Interpolate.hxx>
|
||||
#include <GeomAPI_PointsToBSpline.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ProjLib_CompProjectedCurve.hxx>
|
||||
#include <ProjLib_HCompProjectedCurve.hxx>
|
||||
#include <Approx_CurveOnSurface.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
|
||||
#include <ShapeExtend.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#define NCONTROL 23
|
||||
|
||||
//=======================================================================
|
||||
|
191
src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.hxx
Normal file
191
src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.hxx
Normal file
@@ -0,0 +1,191 @@
|
||||
// Created on: 1998-07-14
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 1998-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 _ShapeConstruct_ProjectCurveOnSurface_HeaderFile
|
||||
#define _ShapeConstruct_ProjectCurveOnSurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <ShapeExtend_Status.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
class ShapeAnalysis_Surface;
|
||||
class Geom_Surface;
|
||||
class Geom_Curve;
|
||||
class Geom2d_Curve;
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
||||
class ShapeConstruct_ProjectCurveOnSurface;
|
||||
DEFINE_STANDARD_HANDLE(ShapeConstruct_ProjectCurveOnSurface, MMgt_TShared)
|
||||
|
||||
//! This tool provides a method for computing pcurve by projecting
|
||||
//! 3d curve onto a surface.
|
||||
//! Projection is done by 23 or more points (this number is changed
|
||||
//! for B-Splines according to the following rule:
|
||||
//! the total number of the points is not less than number of spans *
|
||||
//! (degree + 1);
|
||||
//! it is increased recursively starting with 23 and is added with 22
|
||||
//! until the condition is fulfilled).
|
||||
//! Isoparametric cases (if curve corresponds to U=const or V=const on
|
||||
//! the surface) are recognized with the given precision.
|
||||
class ShapeConstruct_ProjectCurveOnSurface : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT ShapeConstruct_ProjectCurveOnSurface();
|
||||
|
||||
//! Initializes the object with all necessary parameters,
|
||||
//! i.e. surface and precision
|
||||
Standard_EXPORT virtual void Init (const Handle(Geom_Surface)& surf, const Standard_Real preci);
|
||||
|
||||
//! Initializes the object with all necessary parameters,
|
||||
//! i.e. surface and precision
|
||||
Standard_EXPORT virtual void Init (const Handle(ShapeAnalysis_Surface)& surf, const Standard_Real preci);
|
||||
|
||||
//! Loads a surface (in the form of Geom_Surface) to project on
|
||||
Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surf);
|
||||
|
||||
//! Loads a surface (in the form of ShapeAnalysis_Surface) to project on
|
||||
Standard_EXPORT void SetSurface (const Handle(ShapeAnalysis_Surface)& surf);
|
||||
|
||||
//! Sets value for current precision
|
||||
Standard_EXPORT void SetPrecision (const Standard_Real preci);
|
||||
|
||||
//! Returns (modifiable) the build-curve-3d mode, by default False
|
||||
//! If True, if the projected curve has been recomputed by
|
||||
//! interpolation, the 3d curve is also rebuild by interpolation
|
||||
Standard_EXPORT Standard_Boolean& BuildCurveMode();
|
||||
|
||||
//! Returns (modifiable) the flag specifying to which side of
|
||||
//! parametrical space adjust part of pcurve which lies on seam.
|
||||
//! This is required in very rare case when 3d curve which is
|
||||
//! to be projected goes partly along the seam on the closed
|
||||
//! surface with singularity (e.g. sphere), goes through the
|
||||
//! degenerated point and paerly lies on internal area of surface.
|
||||
//!
|
||||
//! If this flag is True, the seam part of such curve will be
|
||||
//! adjusted to the left side of parametric space (on sphere U=0),
|
||||
//! else to the right side (on sphere U=2*PI)
|
||||
//! Default value is True
|
||||
Standard_EXPORT Standard_Integer& AdjustOverDegenMode();
|
||||
|
||||
//! Returns the status of last Peform
|
||||
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status Status) const;
|
||||
|
||||
//! Computes the projection of 3d curve onto a surface using the
|
||||
//! specialized algorithm. Returns False if projector fails,
|
||||
//! otherwise, if pcurve computed successfully, returns True.
|
||||
//! The continuity, maxdeg and nbinterval are parameters of call
|
||||
//! to Approx_CurveOnSurface. If nbinterval is equal to -1
|
||||
//! (default), this value is computed depending on source 3d curve
|
||||
//! and surface. The output curve 2D is guaranteed to be same-parameter
|
||||
//! with input curve 3D on the interval [First, Last]. If the output curve
|
||||
//! lies on a direct line the infinite line is returned, in the case
|
||||
//! same-parameter condition is satisfied.
|
||||
Standard_EXPORT virtual Standard_Boolean Perform (Handle(Geom_Curve)& c3d, const Standard_Real First, const Standard_Real Last, Handle(Geom2d_Curve)& c2d, const GeomAbs_Shape continuity = GeomAbs_C1, const Standard_Integer maxdeg = 12, const Standard_Integer nbinterval = -1);
|
||||
|
||||
//! Computes the projection of 3d curve onto a surface using the
|
||||
//! standard algorithm from ProjLib. Returns False if standard
|
||||
//! projector fails or raises an exception or cuts the curve by
|
||||
//! parametrical bounds of the surface. Else, if pcurve computed
|
||||
//! successfully, returns True.
|
||||
//! The continuity, maxdeg and nbinterval are parameters of call
|
||||
//! to Approx_CurveOnSurface. If nbinterval is equal to -1
|
||||
//! (default), this value is computed depending on source 3d curve
|
||||
//! and surface.
|
||||
Standard_EXPORT Standard_Boolean PerformByProjLib (Handle(Geom_Curve)& c3d, const Standard_Real First, const Standard_Real Last, Handle(Geom2d_Curve)& c2d, const GeomAbs_Shape continuity = GeomAbs_C1, const Standard_Integer maxdeg = 12, const Standard_Integer nbinterval = -1);
|
||||
|
||||
//! Computes the projection of 3d curve onto a surface using
|
||||
//! either standard projector (method PerformByProjLib()) or
|
||||
//! internal one (method Perform()). The selection is done by
|
||||
//! analyzing the surface and 3d curve and is aimed to filter
|
||||
//! the cases potentially dangerous for the standard projector.
|
||||
//! If the standard projector fails, internal one is used.
|
||||
Standard_EXPORT Standard_Boolean PerformAdvanced (Handle(Geom_Curve)& c3d, const Standard_Real First, const Standard_Real Last, Handle(Geom2d_Curve)& c2d);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(ShapeConstruct_ProjectCurveOnSurface,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Try to approximate 3D curve by Geom2d_Line
|
||||
//! or Geom2d_BsplineCurve with degree 1 with specified tolerance.
|
||||
//! points - points obtained from 3d curve.
|
||||
//! params - parameters corresponding points on 3d curves
|
||||
//! points2d - 2d points lies on line in parametric space
|
||||
//! theTol - tolerance used for compare initial points 3d and
|
||||
//! 3d points obtained from line lying in parameric space of surface
|
||||
Standard_EXPORT Handle(Geom2d_Curve) getLine (const TColgp_Array1OfPnt& points, const TColStd_Array1OfReal& params, TColgp_Array1OfPnt2d& points2d, const Standard_Real theTol, Standard_Boolean& IsRecompute) const;
|
||||
|
||||
Handle(ShapeAnalysis_Surface) mySurf;
|
||||
Standard_Real myPreci;
|
||||
Standard_Boolean myBuild;
|
||||
Standard_Integer myStatus;
|
||||
Standard_Integer myAdjustOverDegen;
|
||||
Standard_Integer myNbCashe;
|
||||
gp_Pnt myCashe3d[2];
|
||||
gp_Pnt2d myCashe2d[2];
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) ProjectAnalytic (const Handle(Geom_Curve)& c3d) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean ApproxPCurve (const Standard_Integer nbrPnt, const TColgp_Array1OfPnt& points, const TColStd_Array1OfReal& params, TColgp_Array1OfPnt2d& points2d, Handle(Geom2d_Curve)& c2d);
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) InterpolatePCurve (const Standard_Integer nbrPnt, Handle(TColgp_HArray1OfPnt2d)& points2d, Handle(TColStd_HArray1OfReal)& params, const Handle(Geom_Curve)& orig) const;
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) ApproximatePCurve (const Standard_Integer nbrPnt, Handle(TColgp_HArray1OfPnt2d)& points2d, Handle(TColStd_HArray1OfReal)& params, const Handle(Geom_Curve)& orig) const;
|
||||
|
||||
Standard_EXPORT Handle(Geom_Curve) InterpolateCurve3d (const Standard_Integer nbrPnt, Handle(TColgp_HArray1OfPnt)& points, Handle(TColStd_HArray1OfReal)& params, const Handle(Geom_Curve)& orig) const;
|
||||
|
||||
Standard_EXPORT void CheckPoints (Handle(TColgp_HArray1OfPnt)& points, Handle(TColStd_HArray1OfReal)& params, Standard_Real& preci) const;
|
||||
|
||||
Standard_EXPORT void CheckPoints2d (Handle(TColgp_HArray1OfPnt2d)& points, Handle(TColStd_HArray1OfReal)& params, Standard_Real& preci) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsAnIsoparametric (const Standard_Integer nbrPnt, const TColgp_Array1OfPnt& points, const TColStd_Array1OfReal& params, Standard_Boolean& isoTypeU, Standard_Boolean& p1OnIso, gp_Pnt2d& valueP1, Standard_Boolean& p2OnIso, gp_Pnt2d& valueP2, Standard_Boolean& isoPar2d3d, Handle(Geom_Curve)& cIso, Standard_Real& t1, Standard_Real& t2, TColStd_Array1OfReal& pout) const;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeConstruct_ProjectCurveOnSurface_HeaderFile
|
Reference in New Issue
Block a user