mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +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:
@@ -1,2 +1,20 @@
|
||||
GeomConvert.cxx
|
||||
GeomConvert.hxx
|
||||
GeomConvert_1.cxx
|
||||
|
||||
GeomConvert_ApproxCurve.cxx
|
||||
GeomConvert_ApproxCurve.hxx
|
||||
GeomConvert_ApproxSurface.cxx
|
||||
GeomConvert_ApproxSurface.hxx
|
||||
GeomConvert_BSplineCurveKnotSplitting.cxx
|
||||
GeomConvert_BSplineCurveKnotSplitting.hxx
|
||||
GeomConvert_BSplineCurveToBezierCurve.cxx
|
||||
GeomConvert_BSplineCurveToBezierCurve.hxx
|
||||
GeomConvert_BSplineSurfaceKnotSplitting.cxx
|
||||
GeomConvert_BSplineSurfaceKnotSplitting.hxx
|
||||
GeomConvert_BSplineSurfaceToBezierSurface.cxx
|
||||
GeomConvert_BSplineSurfaceToBezierSurface.hxx
|
||||
GeomConvert_CompBezierSurfacesToBSplineSurface.cxx
|
||||
GeomConvert_CompBezierSurfacesToBSplineSurface.hxx
|
||||
GeomConvert_CompBezierSurfacesToBSplineSurface.lxx
|
||||
GeomConvert_CompCurveToBSplineCurve.cxx
|
||||
GeomConvert_CompCurveToBSplineCurve.hxx
|
||||
|
@@ -1,413 +0,0 @@
|
||||
-- Created on: 1991-10-03
|
||||
-- Created by: JeanClaude VAUTHIER
|
||||
-- Copyright (c) 1991-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.
|
||||
|
||||
-- Modified : 07/10/97 : JPI/RBV/SMN : traitement des courbes offset
|
||||
-- et surfaces offset par approximation
|
||||
|
||||
|
||||
package GeomConvert
|
||||
|
||||
--- Purpose : The GeomConvert package provides some global functions as follows
|
||||
-- - converting classical Geom curves into BSpline curves,
|
||||
-- - segmenting BSpline curves, particularly at knots
|
||||
-- values: this function may be used in conjunction with the
|
||||
-- GeomConvert_BSplineCurveKnotSplitting
|
||||
-- class to segment a BSpline curve into arcs which
|
||||
-- comply with required continuity levels,
|
||||
-- - converting classical Geom surfaces into BSpline surfaces, and
|
||||
-- - segmenting BSpline surfaces, particularly at
|
||||
-- knots values: this function may be used in conjunction with the
|
||||
-- GeomConvert_BSplineSurfaceKnotSplitting
|
||||
-- class to segment a BSpline surface into patches
|
||||
-- which comply with required continuity levels.
|
||||
-- All geometric entities used in this package are bounded.
|
||||
--
|
||||
-- References :
|
||||
-- . Generating the Bezier Points of B-spline curves and surfaces
|
||||
-- (Wolfgang Bohm) CAGD volume 13 number 6 november 1981
|
||||
-- . On NURBS: A Survey (Leslie Piegl) IEEE Computer Graphics and
|
||||
-- Application January 1991
|
||||
-- . Curve and surface construction using rational B-splines
|
||||
-- (Leslie Piegl and Wayne Tiller) CAD Volume 19 number 9 november
|
||||
-- 1987
|
||||
-- . A survey of curve and surface methods in CAGD (Wolfgang BOHM)
|
||||
-- CAGD 1 1984
|
||||
|
||||
|
||||
uses Standard,
|
||||
TColStd,
|
||||
TColGeom,
|
||||
TColgp,
|
||||
GeomAbs,
|
||||
gp,
|
||||
Geom,
|
||||
Geom2d,
|
||||
Convert,
|
||||
AdvApp2Var,
|
||||
Adaptor3d
|
||||
|
||||
|
||||
is
|
||||
|
||||
class BSplineCurveKnotSplitting;
|
||||
|
||||
class BSplineSurfaceKnotSplitting;
|
||||
|
||||
class BSplineCurveToBezierCurve;
|
||||
|
||||
class CompCurveToBSplineCurve;
|
||||
|
||||
class BSplineSurfaceToBezierSurface;
|
||||
|
||||
class CompBezierSurfacesToBSplineSurface;
|
||||
|
||||
class ApproxSurface;
|
||||
|
||||
class ApproxCurve;
|
||||
---Purpose: Convert a curve from Geom by an approximation method
|
||||
--
|
||||
SplitBSplineCurve (C : BSplineCurve from Geom;
|
||||
FromK1, ToK2 : Integer;
|
||||
SameOrientation : Boolean = Standard_True)
|
||||
returns BSplineCurve from Geom
|
||||
--- Purpose :
|
||||
-- This method computes the arc of B-spline curve between the two
|
||||
-- knots FromK1 and ToK2. If C is periodic the arc has the same
|
||||
-- orientation as C if SameOrientation = Standard_True.
|
||||
-- If C is not periodic SameOrientation is not used for the
|
||||
-- computation and C is oriented from the knot fromK1 to the knot toK2.
|
||||
-- We just keep the local definition of C between the knots
|
||||
-- FromK1 and ToK2. The returned B-spline curve has its first
|
||||
-- and last knots with a multiplicity equal to degree + 1, where
|
||||
-- degree is the polynomial degree of C.
|
||||
-- The indexes of the knots FromK1 and ToK2 doesn't include the
|
||||
-- repetition of multiple knots in their definition.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose : Raised if FromK1 = ToK2
|
||||
-- Raised if FromK1 or ToK2 are out of the bounds
|
||||
-- [FirstUKnotIndex, LastUKnotIndex]
|
||||
|
||||
|
||||
|
||||
SplitBSplineCurve (C : BSplineCurve from Geom;
|
||||
FromU1, ToU2 : Real;
|
||||
ParametricTolerance : Real;
|
||||
SameOrientation : Boolean = Standard_True)
|
||||
returns BSplineCurve from Geom
|
||||
--- Purpose :
|
||||
-- This function computes the segment of B-spline curve between the
|
||||
-- parametric values FromU1, ToU2.
|
||||
-- If C is periodic the arc has the same orientation as C if
|
||||
-- SameOrientation = True.
|
||||
-- If C is not periodic SameOrientation is not used for the
|
||||
-- computation and C is oriented fromU1 toU2.
|
||||
-- If U1 and U2 and two parametric values we consider that
|
||||
-- U1 = U2 if Abs (U1 - U2) <= ParametricTolerance and
|
||||
-- ParametricTolerance must be greater or equal to Resolution
|
||||
-- from package gp.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose :
|
||||
-- Raised if FromU1 or ToU2 are out of the parametric bounds of the
|
||||
-- curve (The tolerance criterion is ParametricTolerance).
|
||||
-- Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
||||
-- Raised if ParametricTolerance < Resolution from gp.
|
||||
|
||||
|
||||
|
||||
SplitBSplineSurface (S : BSplineSurface from Geom;
|
||||
FromUK1, ToUK2, FromVK1, ToVK2 : Integer;
|
||||
SameUOrientation : Boolean = Standard_True;
|
||||
SameVOrientation : Boolean = Standard_True)
|
||||
returns BSplineSurface from Geom
|
||||
--- Purpose :
|
||||
-- Computes the B-spline surface patche between the knots values
|
||||
-- FromUK1, ToUK2, FromVK1, ToVK2.
|
||||
-- If S is periodic in one direction the patche has the same
|
||||
-- orientation as S in this direction if the flag is true in this
|
||||
-- direction (SameUOrientation, SameVOrientation).
|
||||
-- If S is not periodic SameUOrientation and SameVOrientation are not
|
||||
-- used for the computation and S is oriented FromUK1 ToUK2 and
|
||||
-- FromVK1 ToVK2.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose : Raised if
|
||||
-- FromUK1 = ToUK2 or FromVK1 = ToVK2
|
||||
-- FromUK1 or ToUK2 are out of the bounds
|
||||
-- [FirstUKnotIndex, LastUKnotIndex]
|
||||
-- FromVK1 or ToVK2 are out of the bounds
|
||||
-- [FirstVKnotIndex, LastVKnotIndex]
|
||||
|
||||
|
||||
|
||||
SplitBSplineSurface (S : BSplineSurface from Geom;
|
||||
FromK1, ToK2 : Integer;
|
||||
USplit : Boolean;
|
||||
SameOrientation : Boolean = Standard_True)
|
||||
returns BSplineSurface from Geom
|
||||
--- Purpose :
|
||||
-- This method splits a B-spline surface patche between the
|
||||
-- knots values FromK1, ToK2 in one direction.
|
||||
-- If USplit = True then the splitting direction is the U parametric
|
||||
-- direction else it is the V parametric direction.
|
||||
-- If S is periodic in the considered direction the patche has the
|
||||
-- same orientation as S in this direction if SameOrientation is True
|
||||
-- If S is not periodic in this direction SameOrientation is not used
|
||||
-- for the computation and S is oriented FromK1 ToK2.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose : Raised if FromK1 = ToK2 or if
|
||||
-- FromK1 or ToK2 are out of the bounds
|
||||
-- [FirstUKnotIndex, LastUKnotIndex] in the
|
||||
-- considered parametric direction.
|
||||
|
||||
|
||||
SplitBSplineSurface (S : BSplineSurface from Geom;
|
||||
FromU1, ToU2, FromV1, ToV2 : Real;
|
||||
ParametricTolerance : Real;
|
||||
SameUOrientation : Boolean = Standard_True;
|
||||
SameVOrientation : Boolean = Standard_True)
|
||||
returns BSplineSurface from Geom
|
||||
--- Purpose :
|
||||
-- This method computes the B-spline surface patche between the
|
||||
-- parametric values FromU1, ToU2, FromV1, ToV2.
|
||||
-- If S is periodic in one direction the patche has the same
|
||||
-- orientation as S in this direction if the flag is True in this
|
||||
-- direction (SameUOrientation, SameVOrientation).
|
||||
-- If S is not periodic SameUOrientation and SameVOrientation are not
|
||||
-- used for the computation and S is oriented FromU1 ToU2 and
|
||||
-- FromV1 ToV2.
|
||||
-- If U1 and U2 and two parametric values we consider that U1 = U2 if
|
||||
-- Abs (U1 - U2) <= ParametricTolerance and ParametricTolerance must
|
||||
-- be greater or equal to Resolution from package gp.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose :
|
||||
-- Raised if FromU1 or ToU2 or FromV1 or ToU2 are out of the
|
||||
-- parametric bounds of the surface (the tolerance criterion is
|
||||
-- ParametricTolerance).
|
||||
-- Raised if Abs (FromU1 - ToU2) <= ParametricTolerance or
|
||||
-- Abs (FromV1 - ToV2) <= ParametricTolerance.
|
||||
-- Raised if ParametricTolerance < Resolution.
|
||||
|
||||
|
||||
|
||||
SplitBSplineSurface (S : BSplineSurface from Geom;
|
||||
FromParam1, ToParam2 : Real;
|
||||
USplit : Boolean;
|
||||
ParametricTolerance : Real;
|
||||
SameOrientation : Boolean = Standard_True)
|
||||
returns BSplineSurface from Geom
|
||||
--- Purpose :
|
||||
-- This method splits the B-spline surface S in one direction
|
||||
-- between the parametric values FromParam1, ToParam2.
|
||||
-- If USplit = True then the Splitting direction is the U parametric
|
||||
-- direction else it is the V parametric direction.
|
||||
-- If S is periodic in the considered direction the patche has
|
||||
-- the same orientation as S in this direction if SameOrientation
|
||||
-- is true.
|
||||
-- If S is not periodic in the considered direction SameOrientation
|
||||
-- is not used for the computation and S is oriented FromParam1
|
||||
-- ToParam2.
|
||||
-- If U1 and U2 and two parametric values we consider that U1 = U2
|
||||
-- if Abs (U1 - U2) <= ParametricTolerance and ParametricTolerance
|
||||
-- must be greater or equal to Resolution from package gp.
|
||||
raises DomainError from Standard;
|
||||
--- Purpose :
|
||||
-- Raises if FromParam1 or ToParam2 are out of the parametric bounds
|
||||
-- of the surface in the considered direction.
|
||||
-- Raises if Abs (FromParam1 - ToParam2) <= ParametricTolerance.
|
||||
|
||||
|
||||
CurveToBSplineCurve (C : Curve from Geom ;
|
||||
Parameterisation : ParameterisationType from Convert
|
||||
= Convert_TgtThetaOver2)
|
||||
returns BSplineCurve from Geom
|
||||
--- Purpose : This function converts a non infinite curve from
|
||||
-- Geom into a B-spline curve. C must be an ellipse or a
|
||||
-- circle or a trimmed conic or a trimmed line or a Bezier
|
||||
-- curve or a trimmed Bezier curve or a BSpline curve or a
|
||||
-- trimmed BSpline curve or an OffsetCurve. The returned B-spline is
|
||||
-- not periodic except if C is a Circle or an Ellipse. If
|
||||
-- the Parameterisation is QuasiAngular than the returned
|
||||
-- curve is NOT periodic in case a periodic Geom_Circle or
|
||||
-- Geom_Ellipse. For TgtThetaOver2_1 and TgtThetaOver2_2 the
|
||||
-- method raises an exception in case of a periodic
|
||||
-- Geom_Circle or a Geom_Ellipse ParameterisationType applies
|
||||
-- only if the curve is a Circle or an ellipse :
|
||||
-- TgtThetaOver2, -- TgtThetaOver2_1, -- TgtThetaOver2_2, --
|
||||
-- TgtThetaOver2_3, -- TgtThetaOver2_4,
|
||||
--
|
||||
-- Purpose: this is the classical rational parameterisation
|
||||
-- 2
|
||||
-- 1 - t
|
||||
-- cos(theta) = ------
|
||||
-- 2
|
||||
-- 1 + t
|
||||
--
|
||||
-- 2t
|
||||
-- sin(theta) = ------
|
||||
-- 2
|
||||
-- 1 + t
|
||||
--
|
||||
-- t = tan (theta/2)
|
||||
--
|
||||
-- with TgtThetaOver2 the routine will compute the number of spans
|
||||
-- using the rule num_spans = [ (ULast - UFirst) / 1.2 ] + 1
|
||||
-- with TgtThetaOver2_N, N spans will be forced: an error will
|
||||
-- be raized if (ULast - UFirst) >= PI and N = 1,
|
||||
-- ULast - UFirst >= 2 PI and N = 2
|
||||
--
|
||||
-- QuasiAngular,
|
||||
-- here t is a rational function that approximates
|
||||
-- theta ----> tan(theta/2).
|
||||
-- Neverthless the composing with above function yields exact
|
||||
-- functions whose square sum up to 1
|
||||
-- RationalC1 ;
|
||||
-- t is replaced by a polynomial function of u so as to grant
|
||||
-- C1 contiuity across knots.
|
||||
-- Exceptions
|
||||
-- Standard_DomainError:
|
||||
-- - if the curve C is infinite, or
|
||||
-- - if C is a (complete) circle or ellipse, and Parameterisation is equal to
|
||||
-- Convert_TgtThetaOver2_1 or Convert_TgtThetaOver2_2.
|
||||
-- Standard_ConstructionError:
|
||||
-- - if C is a (complete) circle or ellipse, and if Parameterisation is not equal to
|
||||
-- Convert_TgtThetaOver2, Convert_RationalC1,
|
||||
-- Convert_QuasiAngular (the curve is converted
|
||||
-- in these three cases) or to Convert_TgtThetaOver2_1 or
|
||||
-- Convert_TgtThetaOver2_2 (another exception is raised in these two cases).
|
||||
-- - if C is a trimmed circle or ellipse, if Parameterisation is equal to
|
||||
-- Convert_TgtThetaOver2_1 and if U2 - U1 > 0.9999 * Pi, where U1 and U2 are
|
||||
-- respectively the first and the last parameters of the
|
||||
-- trimmed curve (this method of parameterization
|
||||
-- cannot be used to convert a half-circle or a half-ellipse, for example), or
|
||||
-- - if C is a trimmed circle or ellipse, if
|
||||
-- Parameterisation is equal to Convert_TgtThetaOver2_2 and U2 - U1 >
|
||||
-- 1.9999 * Pi where U1 and U2 are
|
||||
-- respectively the first and the last parameters of the
|
||||
-- trimmed curve (this method of parameterization
|
||||
-- cannot be used to convert a quasi-complete circle or ellipse).
|
||||
raises DomainError,
|
||||
ConstructionError;
|
||||
|
||||
SurfaceToBSplineSurface (S : Surface from Geom)
|
||||
returns BSplineSurface from Geom
|
||||
--- Purpose :
|
||||
-- This algorithm converts a non infinite surface from Geom
|
||||
-- into a B-spline surface.
|
||||
-- S must be a trimmed plane or a trimmed cylinder or a trimmed cone
|
||||
-- or a trimmed sphere or a trimmed torus or a sphere or a torus or
|
||||
-- a Bezier surface of a trimmed Bezier surface or a trimmed swept
|
||||
-- surface with a corresponding basis curve which can be turned into
|
||||
-- a B-spline curve (see the method CurveToBSplineCurve).
|
||||
-- Raises DomainError if the type of the surface is not previously defined.
|
||||
raises DomainError;
|
||||
|
||||
ConcatG1(ArrayOfCurves : in out Array1OfBSplineCurve from TColGeom;
|
||||
ArrayOfToler : in Array1OfReal from TColStd;
|
||||
ArrayOfConcatenated : out HArray1OfBSplineCurve from TColGeom;
|
||||
ClosedG1Flag : in Boolean from Standard ;
|
||||
ClosedTolerance : in Real from Standard) ;
|
||||
|
||||
--- Purpose : This Method concatenates G1 the ArrayOfCurves as far
|
||||
-- as it is possible.
|
||||
-- ArrayOfCurves[0..N-1]
|
||||
-- ArrayOfToler contains the biggest tolerance of the two
|
||||
-- points shared by two consecutives curves.
|
||||
-- Its dimension: [0..N-2]
|
||||
-- ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
-- In this case ClosedG1 contains the biggest tolerance
|
||||
-- of the two points which are at the closure.
|
||||
-- Otherwise its value is 0.0
|
||||
|
||||
|
||||
ConcatC1(ArrayOfCurves : in out Array1OfBSplineCurve from TColGeom;
|
||||
ArrayOfToler : in Array1OfReal from TColStd;
|
||||
ArrayOfIndices : out HArray1OfInteger from TColStd;
|
||||
ArrayOfConcatenated : out HArray1OfBSplineCurve from TColGeom;
|
||||
ClosedG1Flag : in Boolean from Standard ;
|
||||
ClosedTolerance : in Real from Standard) ;
|
||||
|
||||
--- Purpose : This Method concatenates C1 the ArrayOfCurves as far
|
||||
-- as it is possible.
|
||||
-- ArrayOfCurves[0..N-1]
|
||||
-- ArrayOfToler contains the biggest tolerance of the two
|
||||
-- points shared by two consecutives curves.
|
||||
-- Its dimension: [0..N-2]
|
||||
-- ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
-- In this case ClosedG1 contains the biggest tolerance
|
||||
-- of the two points which are at the closure.
|
||||
-- Otherwise its value is 0.0
|
||||
|
||||
ConcatC1(ArrayOfCurves : in out Array1OfBSplineCurve from TColGeom;
|
||||
ArrayOfToler : in Array1OfReal from TColStd;
|
||||
ArrayOfIndices : out HArray1OfInteger from TColStd;
|
||||
ArrayOfConcatenated : out HArray1OfBSplineCurve from TColGeom;
|
||||
ClosedG1Flag : in Boolean from Standard ;
|
||||
ClosedTolerance : in Real from Standard ;
|
||||
AngularTolerance : in Real from Standard) ;
|
||||
|
||||
--- Purpose : This Method concatenates C1 the ArrayOfCurves as far
|
||||
-- as it is possible.
|
||||
-- ArrayOfCurves[0..N-1]
|
||||
-- ArrayOfToler contains the biggest tolerance of the two
|
||||
-- points shared by two consecutives curves.
|
||||
-- Its dimension: [0..N-2]
|
||||
-- ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
-- In this case ClosedG1 contains the biggest tolerance
|
||||
-- of the two points which are at the closure.
|
||||
-- Otherwise its value is 0.0
|
||||
--
|
||||
|
||||
C0BSplineToC1BSplineCurve(BS : in out BSplineCurve from Geom;
|
||||
tolerance : in Real from Standard;
|
||||
AngularTolerance: in Real = 1.0e-7);
|
||||
---Purpose : This Method reduces as far as it is possible the
|
||||
-- multiplicities of the knots of the BSpline BS.(keeping the
|
||||
-- geometry). It returns a new BSpline which could still be C0.
|
||||
-- tolerance is a geometrical tolerance.
|
||||
-- The Angular toleranceis in radians and mesures the angle of
|
||||
-- the tangents on the left and on the right to decide if the
|
||||
-- curve is G1 or not at a given point
|
||||
|
||||
|
||||
C0BSplineToArrayOfC1BSplineCurve(BS : in BSplineCurve from Geom;
|
||||
tabBS : out HArray1OfBSplineCurve from TColGeom;
|
||||
tolerance : in Real from Standard);
|
||||
--- Purpose : This Method reduces as far as it is possible the
|
||||
-- multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||
-- It returns an array of BSpline C1. tolerance is a geometrical tolerance.
|
||||
|
||||
C0BSplineToArrayOfC1BSplineCurve(BS : in BSplineCurve from Geom;
|
||||
tabBS : out HArray1OfBSplineCurve from TColGeom;
|
||||
AngularTolerance : in Real from Standard ;
|
||||
tolerance : in Real from Standard);
|
||||
--- Purpose :This Method reduces as far as it is possible the
|
||||
-- multiplicities of the knots of the BSpline BS.(keeping the
|
||||
-- geometry). It returns an array of BSpline C1. tolerance is a
|
||||
-- geometrical tolerance : it allows for the maximum deformation
|
||||
-- The Angular tolerance is in radians and mesures the angle of
|
||||
-- the tangents on the left and on the right to decide if the curve
|
||||
-- is C1 or not at a given point
|
||||
|
||||
end GeomConvert;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -16,72 +16,61 @@
|
||||
// Passage sur C1 Aout 1992 et ajout transformation Bezier->BSpline + Debug
|
||||
// Modif JCV correction bug le 2/08/1993
|
||||
|
||||
#include <GeomConvert.ixx>
|
||||
|
||||
#include <BSplCLib.hxx>
|
||||
#include <Convert_ConicToBSplineCurve.hxx>
|
||||
#include <Convert_CircleToBSplineCurve.hxx>
|
||||
#include <Convert_ConicToBSplineCurve.hxx>
|
||||
#include <Convert_EllipseToBSplineCurve.hxx>
|
||||
#include <Convert_HyperbolaToBSplineCurve.hxx>
|
||||
#include <Convert_ParabolaToBSplineCurve.hxx>
|
||||
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_Geometry.hxx>
|
||||
#include <Geom_Hyperbola.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <Geom_Parabola.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <GeomLProp.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <GeomLProp.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_Hyperbola.hxx>
|
||||
#include <Geom_Parabola.hxx>
|
||||
#include <Geom_Geometry.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfBoolean.hxx>
|
||||
#include <Hermit.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <TColGeom_Array1OfCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColGeom_Array1OfCurve.hxx>
|
||||
|
||||
#include <Hermit.hxx>
|
||||
|
||||
#include <PLib.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <TColStd_Array1OfBoolean.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BSplineCurveBuilder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Handle(Geom_BSplineCurve) BSplineCurveBuilder
|
||||
(const Handle(Geom_Conic)& TheConic,
|
||||
const Convert_ConicToBSplineCurve& Convert)
|
||||
|
355
src/GeomConvert/GeomConvert.hxx
Normal file
355
src/GeomConvert/GeomConvert.hxx
Normal file
@@ -0,0 +1,355 @@
|
||||
// Created on: 1991-10-03
|
||||
// Created by: JeanClaude VAUTHIER
|
||||
// Copyright (c) 1991-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 _GeomConvert_HeaderFile
|
||||
#define _GeomConvert_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Convert_ParameterisationType.hxx>
|
||||
#include <TColGeom_Array1OfBSplineCurve.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColGeom_HArray1OfBSplineCurve.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
class Geom_BSplineCurve;
|
||||
class Geom_BSplineSurface;
|
||||
class Geom_Curve;
|
||||
class Geom_Surface;
|
||||
class GeomConvert_BSplineCurveKnotSplitting;
|
||||
class GeomConvert_BSplineSurfaceKnotSplitting;
|
||||
class GeomConvert_BSplineCurveToBezierCurve;
|
||||
class GeomConvert_CompCurveToBSplineCurve;
|
||||
class GeomConvert_BSplineSurfaceToBezierSurface;
|
||||
class GeomConvert_CompBezierSurfacesToBSplineSurface;
|
||||
class GeomConvert_ApproxSurface;
|
||||
class GeomConvert_ApproxCurve;
|
||||
|
||||
|
||||
//! The GeomConvert package provides some global functions as follows
|
||||
//! - converting classical Geom curves into BSpline curves,
|
||||
//! - segmenting BSpline curves, particularly at knots
|
||||
//! values: this function may be used in conjunction with the
|
||||
//! GeomConvert_BSplineCurveKnotSplitting
|
||||
//! class to segment a BSpline curve into arcs which
|
||||
//! comply with required continuity levels,
|
||||
//! - converting classical Geom surfaces into BSpline surfaces, and
|
||||
//! - segmenting BSpline surfaces, particularly at
|
||||
//! knots values: this function may be used in conjunction with the
|
||||
//! GeomConvert_BSplineSurfaceKnotSplitting
|
||||
//! class to segment a BSpline surface into patches
|
||||
//! which comply with required continuity levels.
|
||||
//! All geometric entities used in this package are bounded.
|
||||
//!
|
||||
//! References :
|
||||
//! . Generating the Bezier Points of B-spline curves and surfaces
|
||||
//! (Wolfgang Bohm) CAGD volume 13 number 6 november 1981
|
||||
//! . On NURBS: A Survey (Leslie Piegl) IEEE Computer Graphics and
|
||||
//! Application January 1991
|
||||
//! . Curve and surface construction using rational B-splines
|
||||
//! (Leslie Piegl and Wayne Tiller) CAD Volume 19 number 9 november
|
||||
//! 1987
|
||||
//! . A survey of curve and surface methods in CAGD (Wolfgang BOHM)
|
||||
//! CAGD 1 1984
|
||||
class GeomConvert
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Convert a curve from Geom by an approximation method
|
||||
//!
|
||||
//! This method computes the arc of B-spline curve between the two
|
||||
//! knots FromK1 and ToK2. If C is periodic the arc has the same
|
||||
//! orientation as C if SameOrientation = Standard_True.
|
||||
//! If C is not periodic SameOrientation is not used for the
|
||||
//! computation and C is oriented from the knot fromK1 to the knot toK2.
|
||||
//! We just keep the local definition of C between the knots
|
||||
//! FromK1 and ToK2. The returned B-spline curve has its first
|
||||
//! and last knots with a multiplicity equal to degree + 1, where
|
||||
//! degree is the polynomial degree of C.
|
||||
//! The indexes of the knots FromK1 and ToK2 doesn't include the
|
||||
//! repetition of multiple knots in their definition.
|
||||
//! Raised if FromK1 = ToK2
|
||||
//! Raised if FromK1 or ToK2 are out of the bounds
|
||||
//! [FirstUKnotIndex, LastUKnotIndex]
|
||||
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Boolean SameOrientation = Standard_True);
|
||||
|
||||
|
||||
//! This function computes the segment of B-spline curve between the
|
||||
//! parametric values FromU1, ToU2.
|
||||
//! If C is periodic the arc has the same orientation as C if
|
||||
//! SameOrientation = True.
|
||||
//! If C is not periodic SameOrientation is not used for the
|
||||
//! computation and C is oriented fromU1 toU2.
|
||||
//! If U1 and U2 and two parametric values we consider that
|
||||
//! U1 = U2 if Abs (U1 - U2) <= ParametricTolerance and
|
||||
//! ParametricTolerance must be greater or equal to Resolution
|
||||
//! from package gp.
|
||||
//!
|
||||
//! Raised if FromU1 or ToU2 are out of the parametric bounds of the
|
||||
//! curve (The tolerance criterion is ParametricTolerance).
|
||||
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
||||
//! Raised if ParametricTolerance < Resolution from gp.
|
||||
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C, const Standard_Real FromU1, const Standard_Real ToU2, const Standard_Real ParametricTolerance, const Standard_Boolean SameOrientation = Standard_True);
|
||||
|
||||
|
||||
//! Computes the B-spline surface patche between the knots values
|
||||
//! FromUK1, ToUK2, FromVK1, ToVK2.
|
||||
//! If S is periodic in one direction the patche has the same
|
||||
//! orientation as S in this direction if the flag is true in this
|
||||
//! direction (SameUOrientation, SameVOrientation).
|
||||
//! If S is not periodic SameUOrientation and SameVOrientation are not
|
||||
//! used for the computation and S is oriented FromUK1 ToUK2 and
|
||||
//! FromVK1 ToVK2.
|
||||
//! Raised if
|
||||
//! FromUK1 = ToUK2 or FromVK1 = ToVK2
|
||||
//! FromUK1 or ToUK2 are out of the bounds
|
||||
//! [FirstUKnotIndex, LastUKnotIndex]
|
||||
//! FromVK1 or ToVK2 are out of the bounds
|
||||
//! [FirstVKnotIndex, LastVKnotIndex]
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, const Standard_Boolean SameUOrientation = Standard_True, const Standard_Boolean SameVOrientation = Standard_True);
|
||||
|
||||
|
||||
//! This method splits a B-spline surface patche between the
|
||||
//! knots values FromK1, ToK2 in one direction.
|
||||
//! If USplit = True then the splitting direction is the U parametric
|
||||
//! direction else it is the V parametric direction.
|
||||
//! If S is periodic in the considered direction the patche has the
|
||||
//! same orientation as S in this direction if SameOrientation is True
|
||||
//! If S is not periodic in this direction SameOrientation is not used
|
||||
//! for the computation and S is oriented FromK1 ToK2.
|
||||
//! Raised if FromK1 = ToK2 or if
|
||||
//! FromK1 or ToK2 are out of the bounds
|
||||
//! [FirstUKnotIndex, LastUKnotIndex] in the
|
||||
//! considered parametric direction.
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Boolean USplit, const Standard_Boolean SameOrientation = Standard_True);
|
||||
|
||||
|
||||
//! This method computes the B-spline surface patche between the
|
||||
//! parametric values FromU1, ToU2, FromV1, ToV2.
|
||||
//! If S is periodic in one direction the patche has the same
|
||||
//! orientation as S in this direction if the flag is True in this
|
||||
//! direction (SameUOrientation, SameVOrientation).
|
||||
//! If S is not periodic SameUOrientation and SameVOrientation are not
|
||||
//! used for the computation and S is oriented FromU1 ToU2 and
|
||||
//! FromV1 ToV2.
|
||||
//! If U1 and U2 and two parametric values we consider that U1 = U2 if
|
||||
//! Abs (U1 - U2) <= ParametricTolerance and ParametricTolerance must
|
||||
//! be greater or equal to Resolution from package gp.
|
||||
//!
|
||||
//! Raised if FromU1 or ToU2 or FromV1 or ToU2 are out of the
|
||||
//! parametric bounds of the surface (the tolerance criterion is
|
||||
//! ParametricTolerance).
|
||||
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance or
|
||||
//! Abs (FromV1 - ToV2) <= ParametricTolerance.
|
||||
//! Raised if ParametricTolerance < Resolution.
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Real FromU1, const Standard_Real ToU2, const Standard_Real FromV1, const Standard_Real ToV2, const Standard_Real ParametricTolerance, const Standard_Boolean SameUOrientation = Standard_True, const Standard_Boolean SameVOrientation = Standard_True);
|
||||
|
||||
|
||||
//! This method splits the B-spline surface S in one direction
|
||||
//! between the parametric values FromParam1, ToParam2.
|
||||
//! If USplit = True then the Splitting direction is the U parametric
|
||||
//! direction else it is the V parametric direction.
|
||||
//! If S is periodic in the considered direction the patche has
|
||||
//! the same orientation as S in this direction if SameOrientation
|
||||
//! is true.
|
||||
//! If S is not periodic in the considered direction SameOrientation
|
||||
//! is not used for the computation and S is oriented FromParam1
|
||||
//! ToParam2.
|
||||
//! If U1 and U2 and two parametric values we consider that U1 = U2
|
||||
//! if Abs (U1 - U2) <= ParametricTolerance and ParametricTolerance
|
||||
//! must be greater or equal to Resolution from package gp.
|
||||
//!
|
||||
//! Raises if FromParam1 or ToParam2 are out of the parametric bounds
|
||||
//! of the surface in the considered direction.
|
||||
//! Raises if Abs (FromParam1 - ToParam2) <= ParametricTolerance.
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Real FromParam1, const Standard_Real ToParam2, const Standard_Boolean USplit, const Standard_Real ParametricTolerance, const Standard_Boolean SameOrientation = Standard_True);
|
||||
|
||||
//! This function converts a non infinite curve from
|
||||
//! Geom into a B-spline curve. C must be an ellipse or a
|
||||
//! circle or a trimmed conic or a trimmed line or a Bezier
|
||||
//! curve or a trimmed Bezier curve or a BSpline curve or a
|
||||
//! trimmed BSpline curve or an OffsetCurve. The returned B-spline is
|
||||
//! not periodic except if C is a Circle or an Ellipse. If
|
||||
//! the Parameterisation is QuasiAngular than the returned
|
||||
//! curve is NOT periodic in case a periodic Geom_Circle or
|
||||
//! Geom_Ellipse. For TgtThetaOver2_1 and TgtThetaOver2_2 the
|
||||
//! method raises an exception in case of a periodic
|
||||
//! Geom_Circle or a Geom_Ellipse ParameterisationType applies
|
||||
//! only if the curve is a Circle or an ellipse :
|
||||
//! TgtThetaOver2, -- TgtThetaOver2_1, -- TgtThetaOver2_2, --
|
||||
//! TgtThetaOver2_3, -- TgtThetaOver2_4,
|
||||
//!
|
||||
//! Purpose: this is the classical rational parameterisation
|
||||
//! 2
|
||||
//! 1 - t
|
||||
//! cos(theta) = ------
|
||||
//! 2
|
||||
//! 1 + t
|
||||
//!
|
||||
//! 2t
|
||||
//! sin(theta) = ------
|
||||
//! 2
|
||||
//! 1 + t
|
||||
//!
|
||||
//! t = tan (theta/2)
|
||||
//!
|
||||
//! with TgtThetaOver2 the routine will compute the number of spans
|
||||
//! using the rule num_spans = [ (ULast - UFirst) / 1.2 ] + 1
|
||||
//! with TgtThetaOver2_N, N spans will be forced: an error will
|
||||
//! be raized if (ULast - UFirst) >= PI and N = 1,
|
||||
//! ULast - UFirst >= 2 PI and N = 2
|
||||
//!
|
||||
//! QuasiAngular,
|
||||
//! here t is a rational function that approximates
|
||||
//! theta ----> tan(theta/2).
|
||||
//! Neverthless the composing with above function yields exact
|
||||
//! functions whose square sum up to 1
|
||||
//! RationalC1 ;
|
||||
//! t is replaced by a polynomial function of u so as to grant
|
||||
//! C1 contiuity across knots.
|
||||
//! Exceptions
|
||||
//! Standard_DomainError:
|
||||
//! - if the curve C is infinite, or
|
||||
//! - if C is a (complete) circle or ellipse, and Parameterisation is equal to
|
||||
//! Convert_TgtThetaOver2_1 or Convert_TgtThetaOver2_2.
|
||||
//! Standard_ConstructionError:
|
||||
//! - if C is a (complete) circle or ellipse, and if Parameterisation is not equal to
|
||||
//! Convert_TgtThetaOver2, Convert_RationalC1,
|
||||
//! Convert_QuasiAngular (the curve is converted
|
||||
//! in these three cases) or to Convert_TgtThetaOver2_1 or
|
||||
//! Convert_TgtThetaOver2_2 (another exception is raised in these two cases).
|
||||
//! - if C is a trimmed circle or ellipse, if Parameterisation is equal to
|
||||
//! Convert_TgtThetaOver2_1 and if U2 - U1 > 0.9999 * Pi, where U1 and U2 are
|
||||
//! respectively the first and the last parameters of the
|
||||
//! trimmed curve (this method of parameterization
|
||||
//! cannot be used to convert a half-circle or a half-ellipse, for example), or
|
||||
//! - if C is a trimmed circle or ellipse, if
|
||||
//! Parameterisation is equal to Convert_TgtThetaOver2_2 and U2 - U1 >
|
||||
//! 1.9999 * Pi where U1 and U2 are
|
||||
//! respectively the first and the last parameters of the
|
||||
//! trimmed curve (this method of parameterization
|
||||
//! cannot be used to convert a quasi-complete circle or ellipse).
|
||||
Standard_EXPORT static Handle(Geom_BSplineCurve) CurveToBSplineCurve (const Handle(Geom_Curve)& C, const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
||||
|
||||
|
||||
//! This algorithm converts a non infinite surface from Geom
|
||||
//! into a B-spline surface.
|
||||
//! S must be a trimmed plane or a trimmed cylinder or a trimmed cone
|
||||
//! or a trimmed sphere or a trimmed torus or a sphere or a torus or
|
||||
//! a Bezier surface of a trimmed Bezier surface or a trimmed swept
|
||||
//! surface with a corresponding basis curve which can be turned into
|
||||
//! a B-spline curve (see the method CurveToBSplineCurve).
|
||||
//! Raises DomainError if the type of the surface is not previously defined.
|
||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SurfaceToBSplineSurface (const Handle(Geom_Surface)& S);
|
||||
|
||||
//! This Method concatenates G1 the ArrayOfCurves as far
|
||||
//! as it is possible.
|
||||
//! ArrayOfCurves[0..N-1]
|
||||
//! ArrayOfToler contains the biggest tolerance of the two
|
||||
//! points shared by two consecutives curves.
|
||||
//! Its dimension: [0..N-2]
|
||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
//! In this case ClosedG1 contains the biggest tolerance
|
||||
//! of the two points which are at the closure.
|
||||
//! Otherwise its value is 0.0
|
||||
Standard_EXPORT static void ConcatG1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance);
|
||||
|
||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||
//! as it is possible.
|
||||
//! ArrayOfCurves[0..N-1]
|
||||
//! ArrayOfToler contains the biggest tolerance of the two
|
||||
//! points shared by two consecutives curves.
|
||||
//! Its dimension: [0..N-2]
|
||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
//! In this case ClosedG1 contains the biggest tolerance
|
||||
//! of the two points which are at the closure.
|
||||
//! Otherwise its value is 0.0
|
||||
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance);
|
||||
|
||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||
//! as it is possible.
|
||||
//! ArrayOfCurves[0..N-1]
|
||||
//! ArrayOfToler contains the biggest tolerance of the two
|
||||
//! points shared by two consecutives curves.
|
||||
//! Its dimension: [0..N-2]
|
||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
||||
//! In this case ClosedG1 contains the biggest tolerance
|
||||
//! of the two points which are at the closure.
|
||||
//! Otherwise its value is 0.0
|
||||
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance, const Standard_Real AngularTolerance);
|
||||
|
||||
//! This Method reduces as far as it is possible the
|
||||
//! multiplicities of the knots of the BSpline BS.(keeping the
|
||||
//! geometry). It returns a new BSpline which could still be C0.
|
||||
//! tolerance is a geometrical tolerance.
|
||||
//! The Angular toleranceis in radians and mesures the angle of
|
||||
//! the tangents on the left and on the right to decide if the
|
||||
//! curve is G1 or not at a given point
|
||||
Standard_EXPORT static void C0BSplineToC1BSplineCurve (Handle(Geom_BSplineCurve)& BS, const Standard_Real tolerance, const Standard_Real AngularTolerance = 1.0e-7);
|
||||
|
||||
//! This Method reduces as far as it is possible the
|
||||
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||
//! It returns an array of BSpline C1. tolerance is a geometrical tolerance.
|
||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS, Handle(TColGeom_HArray1OfBSplineCurve)& tabBS, const Standard_Real tolerance);
|
||||
|
||||
//! This Method reduces as far as it is possible the
|
||||
//! multiplicities of the knots of the BSpline BS.(keeping the
|
||||
//! geometry). It returns an array of BSpline C1. tolerance is a
|
||||
//! geometrical tolerance : it allows for the maximum deformation
|
||||
//! The Angular tolerance is in radians and mesures the angle of
|
||||
//! the tangents on the left and on the right to decide if the curve
|
||||
//! is C1 or not at a given point
|
||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS, Handle(TColGeom_HArray1OfBSplineCurve)& tabBS, const Standard_Real AngularTolerance, const Standard_Real tolerance);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class GeomConvert_BSplineCurveKnotSplitting;
|
||||
friend class GeomConvert_BSplineSurfaceKnotSplitting;
|
||||
friend class GeomConvert_BSplineCurveToBezierCurve;
|
||||
friend class GeomConvert_CompCurveToBSplineCurve;
|
||||
friend class GeomConvert_BSplineSurfaceToBezierSurface;
|
||||
friend class GeomConvert_CompBezierSurfacesToBSplineSurface;
|
||||
friend class GeomConvert_ApproxSurface;
|
||||
friend class GeomConvert_ApproxCurve;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_HeaderFile
|
@@ -16,57 +16,50 @@
|
||||
//Passage sur C1 Aout 1992 et ajout transformation Bezier->BSpline
|
||||
//Modif JCV correction bug le 02/08/1993
|
||||
|
||||
|
||||
#include <GeomConvert.ixx>
|
||||
|
||||
|
||||
#include <BSplCLib.hxx>
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <Convert_ElementarySurfaceToBSplineSurface.hxx>
|
||||
#include <Convert_ConeToBSplineSurface.hxx>
|
||||
#include <Convert_CylinderToBSplineSurface.hxx>
|
||||
#include <Convert_ElementarySurfaceToBSplineSurface.hxx>
|
||||
#include <Convert_SphereToBSplineSurface.hxx>
|
||||
#include <Convert_TorusToBSplineSurface.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_Geometry.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfInteger.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
typedef Geom_Surface Surface;
|
||||
typedef Geom_BSplineSurface BSplineSurface;
|
||||
|
@@ -1,95 +0,0 @@
|
||||
-- Created on: 1997-09-11
|
||||
-- Created by: Roman BORISOV
|
||||
-- Copyright (c) 1997-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 ApproxCurve from GeomConvert
|
||||
---Purpose: A framework to convert a 3D curve to a 3D BSpline.
|
||||
-- This is done by approximation to a BSpline curve within a given tolerance.
|
||||
|
||||
uses
|
||||
Curve from Geom,
|
||||
BSplineCurve from Geom,
|
||||
HCurve from Adaptor3d,
|
||||
Shape from GeomAbs,
|
||||
OutOfRange from Standard
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (Curve: Curve from Geom;
|
||||
Tol3d: Real;
|
||||
Order: Shape from GeomAbs;
|
||||
MaxSegments: Integer;
|
||||
MaxDegree: Integer) returns ApproxCurve;
|
||||
---Purpose: Constructs a curve approximation framework defined by -
|
||||
-- - the conic Curve,
|
||||
-- - the tolerance value Tol3d,
|
||||
-- - the degree of continuity Order,
|
||||
-- - the maximum number of segments
|
||||
-- MaxSegments allowed in the resulting BSpline curve, and
|
||||
-- - the highest degree MaxDeg which the
|
||||
-- polynomial defining the BSpline curve may have.
|
||||
|
||||
Create (Curve: HCurve from Adaptor3d;
|
||||
Tol3d: Real;
|
||||
Order: Shape from GeomAbs;
|
||||
MaxSegments: Integer;
|
||||
MaxDegree: Integer) returns ApproxCurve;
|
||||
---Purpose: Constructs a curve approximation framework defined by -
|
||||
-- - the Curve,
|
||||
-- - the tolerance value Tol3d,
|
||||
-- - the degree of continuity Order,
|
||||
-- - the maximum number of segments
|
||||
-- MaxSegments allowed in the resulting BSpline curve, and
|
||||
-- - the highest degree MaxDeg which the
|
||||
-- polynomial defining the BSpline curve may have.
|
||||
|
||||
Curve(me) returns BSplineCurve from Geom;
|
||||
--- Purpose: Returns the BSpline curve resulting from the approximation algorithm.
|
||||
|
||||
IsDone(me) returns Boolean from Standard;
|
||||
---Purpose: returns Standard_True if the approximation has
|
||||
-- been done within requiered tolerance
|
||||
|
||||
HasResult(me) returns Boolean;
|
||||
---Purpose: Returns Standard_True if the approximation did come out
|
||||
-- with a result that is not NECESSARELY within the required tolerance
|
||||
|
||||
MaxError(me) returns Real from Standard;
|
||||
---Purpose: Returns the greatest distance between a point on the
|
||||
-- source conic and the BSpline curve resulting from the
|
||||
-- approximation. (>0 when an approximation
|
||||
-- has been done, 0 if no approximation)
|
||||
|
||||
Dump(me; o: in out OStream);
|
||||
---Purpose: Print on the stream o information about the object
|
||||
|
||||
Approximate(me: in out;
|
||||
theCurve: HCurve from Adaptor3d;
|
||||
theTol3d: Real;
|
||||
theOrder: Shape from GeomAbs;
|
||||
theMaxSegments: Integer;
|
||||
theMaxDegree: Integer) is private;
|
||||
---Purpose: Converts a curve to B-spline
|
||||
|
||||
fields
|
||||
myIsDone : Boolean from Standard;
|
||||
myHasResult : Boolean from Standard;
|
||||
myBSplCurve : BSplineCurve from Geom;
|
||||
myMaxError : Real from Standard;
|
||||
|
||||
end ApproxCurve;
|
@@ -14,21 +14,26 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GeomConvert_ApproxCurve.ixx>
|
||||
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GeomConvert_ApproxCurve_Eval
|
||||
//purpose: evaluator class for approximation
|
||||
//=======================================================================
|
||||
|
||||
class GeomConvert_ApproxCurve_Eval : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
|
115
src/GeomConvert/GeomConvert_ApproxCurve.hxx
Normal file
115
src/GeomConvert/GeomConvert_ApproxCurve.hxx
Normal file
@@ -0,0 +1,115 @@
|
||||
// Created on: 1997-09-11
|
||||
// Created by: Roman BORISOV
|
||||
// Copyright (c) 1997-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 _GeomConvert_ApproxCurve_HeaderFile
|
||||
#define _GeomConvert_ApproxCurve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Geom_BSplineCurve;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_ConstructionError;
|
||||
class Geom_Curve;
|
||||
class Adaptor3d_HCurve;
|
||||
|
||||
|
||||
//! A framework to convert a 3D curve to a 3D BSpline.
|
||||
//! This is done by approximation to a BSpline curve within a given tolerance.
|
||||
class GeomConvert_ApproxCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs a curve approximation framework defined by -
|
||||
//! - the conic Curve,
|
||||
//! - the tolerance value Tol3d,
|
||||
//! - the degree of continuity Order,
|
||||
//! - the maximum number of segments
|
||||
//! MaxSegments allowed in the resulting BSpline curve, and
|
||||
//! - the highest degree MaxDeg which the
|
||||
//! polynomial defining the BSpline curve may have.
|
||||
Standard_EXPORT GeomConvert_ApproxCurve(const Handle(Geom_Curve)& Curve, const Standard_Real Tol3d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
//! Constructs a curve approximation framework defined by -
|
||||
//! - the Curve,
|
||||
//! - the tolerance value Tol3d,
|
||||
//! - the degree of continuity Order,
|
||||
//! - the maximum number of segments
|
||||
//! MaxSegments allowed in the resulting BSpline curve, and
|
||||
//! - the highest degree MaxDeg which the
|
||||
//! polynomial defining the BSpline curve may have.
|
||||
Standard_EXPORT GeomConvert_ApproxCurve(const Handle(Adaptor3d_HCurve)& Curve, const Standard_Real Tol3d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
//! Returns the BSpline curve resulting from the approximation algorithm.
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const;
|
||||
|
||||
//! returns Standard_True if the approximation has
|
||||
//! been done within requiered tolerance
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! Returns Standard_True if the approximation did come out
|
||||
//! with a result that is not NECESSARELY within the required tolerance
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
//! Returns the greatest distance between a point on the
|
||||
//! source conic and the BSpline curve resulting from the
|
||||
//! approximation. (>0 when an approximation
|
||||
//! has been done, 0 if no approximation)
|
||||
Standard_EXPORT Standard_Real MaxError() const;
|
||||
|
||||
//! Print on the stream o information about the object
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Converts a curve to B-spline
|
||||
Standard_EXPORT void Approximate (const Handle(Adaptor3d_HCurve)& theCurve, const Standard_Real theTol3d, const GeomAbs_Shape theOrder, const Standard_Integer theMaxSegments, const Standard_Integer theMaxDegree);
|
||||
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Handle(Geom_BSplineCurve) myBSplCurve;
|
||||
Standard_Real myMaxError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_ApproxCurve_HeaderFile
|
@@ -1,117 +0,0 @@
|
||||
-- Created on: 1997-08-26
|
||||
-- Created by: Stepan MISHIN
|
||||
-- Copyright (c) 1997-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 ApproxSurface from GeomConvert
|
||||
|
||||
---Purpose: A framework to convert a surface to a BSpline
|
||||
-- surface. This is done by approximation to a BSpline
|
||||
-- surface within a given tolerance.
|
||||
|
||||
uses
|
||||
|
||||
Pnt from gp,
|
||||
Surface from Geom,
|
||||
OffsetSurface from Geom,
|
||||
BSplineSurface from Geom,
|
||||
HSurface from Adaptor3d,
|
||||
Shape from GeomAbs,
|
||||
ApproxAFunc2Var from AdvApp2Var,
|
||||
OutOfRange from Standard
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Surf: Surface from Geom;
|
||||
Tol3d: Real;
|
||||
UContinuity : Shape from GeomAbs;
|
||||
VContinuity : Shape from GeomAbs;
|
||||
MaxDegU : Integer;
|
||||
MaxDegV : Integer;
|
||||
MaxSegments: Integer;
|
||||
PrecisCode : Integer) returns ApproxSurface ;
|
||||
---Purpose: Constructs a surface approximation framework defined by
|
||||
-- - the conic Surf
|
||||
-- - the tolerance value Tol3d
|
||||
-- - the degree of continuity UContinuity, VContinuity
|
||||
-- in the directions of the U and V parameters
|
||||
-- - the highest degree MaxDegU, MaxDegV which
|
||||
-- the polynomial defining the BSpline curve may
|
||||
-- have in the directions of the U and V parameters
|
||||
-- - the maximum number of segments MaxSegments
|
||||
-- allowed in the resulting BSpline curve
|
||||
-- - the index of precision PrecisCode.
|
||||
|
||||
Create(Surf: HSurface from Adaptor3d;
|
||||
Tol3d: Real;
|
||||
UContinuity: Shape from GeomAbs;
|
||||
VContinuity: Shape from GeomAbs;
|
||||
MaxDegU: Integer;
|
||||
MaxDegV: Integer;
|
||||
MaxSegments: Integer;
|
||||
PrecisCode : Integer) returns ApproxSurface ;
|
||||
---Purpose: Constructs a surface approximation framework defined by
|
||||
-- - the Surf
|
||||
-- - the tolerance value Tol3d
|
||||
-- - the degree of continuity UContinuity, VContinuity
|
||||
-- in the directions of the U and V parameters
|
||||
-- - the highest degree MaxDegU, MaxDegV which
|
||||
-- the polynomial defining the BSpline curve may
|
||||
-- have in the directions of the U and V parameters
|
||||
-- - the maximum number of segments MaxSegments
|
||||
-- allowed in the resulting BSpline curve
|
||||
-- - the index of precision PrecisCode.
|
||||
|
||||
|
||||
Surface(me) returns BSplineSurface from Geom;
|
||||
---Purpose: Returns the BSpline surface resulting from the approximation algorithm.
|
||||
|
||||
|
||||
IsDone(me) returns Boolean from Standard;
|
||||
--- Purpose: Returns Standard_True if the approximation has be done
|
||||
|
||||
HasResult(me) returns Boolean;
|
||||
--- Purpose: Returns true if the approximation did come out with a result that
|
||||
-- is not NECESSARILY within the required tolerance or a result
|
||||
-- that is not recognized with the wished continuities.
|
||||
|
||||
MaxError(me) returns Real from Standard;
|
||||
--- Purpose: Returns the greatest distance between a point on the
|
||||
-- source conic surface and the BSpline surface
|
||||
-- resulting from the approximation (>0 when an approximation
|
||||
-- has been done, 0 if no approximation )
|
||||
|
||||
Dump(me ; o : in out OStream);
|
||||
---Purpose: Prints on the stream o informations on the current state of the object.
|
||||
|
||||
Approximate(me: in out;
|
||||
theSurf: HSurface from Adaptor3d;
|
||||
theTol3d: Real;
|
||||
theUContinuity: Shape from GeomAbs;
|
||||
theVContinuity: Shape from GeomAbs;
|
||||
theMaxDegU: Integer;
|
||||
theMaxDegV: Integer;
|
||||
theMaxSegments: Integer;
|
||||
thePrecisCode : Integer) is private;
|
||||
---Purpose: Converts a surface to B-spline
|
||||
|
||||
fields
|
||||
|
||||
myIsDone : Boolean from Standard;
|
||||
myHasResult: Boolean from Standard;
|
||||
myBSplSurf : BSplineSurface from Geom;
|
||||
myMaxError : Real from Standard;
|
||||
end;
|
@@ -12,15 +12,19 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GeomConvert_ApproxSurface.ixx>
|
||||
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <AdvApp2Var_ApproxAFunc2Var.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
|
||||
class GeomConvert_ApproxSurface_Eval : public AdvApp2Var_EvaluatorFunc2Var
|
||||
{
|
||||
|
121
src/GeomConvert/GeomConvert_ApproxSurface.hxx
Normal file
121
src/GeomConvert/GeomConvert_ApproxSurface.hxx
Normal file
@@ -0,0 +1,121 @@
|
||||
// Created on: 1997-08-26
|
||||
// Created by: Stepan MISHIN
|
||||
// Copyright (c) 1997-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 _GeomConvert_ApproxSurface_HeaderFile
|
||||
#define _GeomConvert_ApproxSurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class Geom_BSplineSurface;
|
||||
class Standard_OutOfRange;
|
||||
class Geom_Surface;
|
||||
class Adaptor3d_HSurface;
|
||||
|
||||
|
||||
//! A framework to convert a surface to a BSpline
|
||||
//! surface. This is done by approximation to a BSpline
|
||||
//! surface within a given tolerance.
|
||||
class GeomConvert_ApproxSurface
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs a surface approximation framework defined by
|
||||
//! - the conic Surf
|
||||
//! - the tolerance value Tol3d
|
||||
//! - the degree of continuity UContinuity, VContinuity
|
||||
//! in the directions of the U and V parameters
|
||||
//! - the highest degree MaxDegU, MaxDegV which
|
||||
//! the polynomial defining the BSpline curve may
|
||||
//! have in the directions of the U and V parameters
|
||||
//! - the maximum number of segments MaxSegments
|
||||
//! allowed in the resulting BSpline curve
|
||||
//! - the index of precision PrecisCode.
|
||||
Standard_EXPORT GeomConvert_ApproxSurface(const Handle(Geom_Surface)& Surf, const Standard_Real Tol3d, const GeomAbs_Shape UContinuity, const GeomAbs_Shape VContinuity, const Standard_Integer MaxDegU, const Standard_Integer MaxDegV, const Standard_Integer MaxSegments, const Standard_Integer PrecisCode);
|
||||
|
||||
//! Constructs a surface approximation framework defined by
|
||||
//! - the Surf
|
||||
//! - the tolerance value Tol3d
|
||||
//! - the degree of continuity UContinuity, VContinuity
|
||||
//! in the directions of the U and V parameters
|
||||
//! - the highest degree MaxDegU, MaxDegV which
|
||||
//! the polynomial defining the BSpline curve may
|
||||
//! have in the directions of the U and V parameters
|
||||
//! - the maximum number of segments MaxSegments
|
||||
//! allowed in the resulting BSpline curve
|
||||
//! - the index of precision PrecisCode.
|
||||
Standard_EXPORT GeomConvert_ApproxSurface(const Handle(Adaptor3d_HSurface)& Surf, const Standard_Real Tol3d, const GeomAbs_Shape UContinuity, const GeomAbs_Shape VContinuity, const Standard_Integer MaxDegU, const Standard_Integer MaxDegV, const Standard_Integer MaxSegments, const Standard_Integer PrecisCode);
|
||||
|
||||
//! Returns the BSpline surface resulting from the approximation algorithm.
|
||||
Standard_EXPORT Handle(Geom_BSplineSurface) Surface() const;
|
||||
|
||||
//! Returns Standard_True if the approximation has be done
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! Returns true if the approximation did come out with a result that
|
||||
//! is not NECESSARILY within the required tolerance or a result
|
||||
//! that is not recognized with the wished continuities.
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
//! Returns the greatest distance between a point on the
|
||||
//! source conic surface and the BSpline surface
|
||||
//! resulting from the approximation (>0 when an approximation
|
||||
//! has been done, 0 if no approximation )
|
||||
Standard_EXPORT Standard_Real MaxError() const;
|
||||
|
||||
//! Prints on the stream o informations on the current state of the object.
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Converts a surface to B-spline
|
||||
Standard_EXPORT void Approximate (const Handle(Adaptor3d_HSurface)& theSurf, const Standard_Real theTol3d, const GeomAbs_Shape theUContinuity, const GeomAbs_Shape theVContinuity, const Standard_Integer theMaxDegU, const Standard_Integer theMaxDegV, const Standard_Integer theMaxSegments, const Standard_Integer thePrecisCode);
|
||||
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Handle(Geom_BSplineSurface) myBSplSurf;
|
||||
Standard_Real myMaxError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_ApproxSurface_HeaderFile
|
@@ -1,125 +0,0 @@
|
||||
-- Created on: 1991-10-03
|
||||
-- Copyright (c) 1991-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 BSplineCurveKnotSplitting from GeomConvert
|
||||
|
||||
|
||||
|
||||
--- Purpose : An algorithm to determine points at which a BSpline
|
||||
-- curve should be split in order to obtain arcs of the same continuity.
|
||||
-- If you require curves with a minimum continuity for
|
||||
-- your computation, it is useful to know the points
|
||||
-- between which an arc has a continuity of a given
|
||||
-- order. The continuity order is given at the construction time.
|
||||
-- For a BSpline curve, the discontinuities are
|
||||
-- localized at the knot values. Between two knot values
|
||||
-- the BSpline is infinitely and continuously
|
||||
-- differentiable. At a given knot, the continuity is equal
|
||||
-- to: Degree - Mult, where Degree is the
|
||||
-- degree of the BSpline curve and Mult is the multiplicity of the knot.
|
||||
-- It is possible to compute the arcs which correspond to
|
||||
-- this splitting using the global function
|
||||
-- SplitBSplineCurve provided by the package GeomConvert.
|
||||
-- A BSplineCurveKnotSplitting object provides a framework for:
|
||||
-- - defining the curve to be analyzed and the
|
||||
-- required degree of continuity,
|
||||
-- - implementing the computation algorithm, and
|
||||
-- - consulting the results.
|
||||
|
||||
|
||||
|
||||
|
||||
uses Array1OfInteger from TColStd,
|
||||
HArray1OfInteger from TColStd,
|
||||
BSplineCurve from Geom
|
||||
|
||||
|
||||
raises DimensionError from Standard,
|
||||
RangeError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create (BasisCurve : BSplineCurve from Geom; ContinuityRange : Integer)
|
||||
returns BSplineCurveKnotSplitting
|
||||
--- Purpose : Determines points at which the BSpline curve
|
||||
-- BasisCurve should be split in order to obtain arcs
|
||||
-- with a degree of continuity equal to ContinuityRange.
|
||||
-- These points are knot values of BasisCurve. They
|
||||
-- are identified by indices in the knots table of BasisCurve.
|
||||
-- Use the available interrogation functions to access
|
||||
-- computed values, followed by the global function
|
||||
-- SplitBSplineCurve (provided by the package GeomConvert) to split the curve.
|
||||
-- Exceptions
|
||||
-- Standard_RangeError if ContinuityRange is less than zero.
|
||||
raises RangeError;
|
||||
|
||||
|
||||
|
||||
NbSplits (me) returns Integer is static;
|
||||
--- Purpose :Returns the number of points at which the analyzed
|
||||
-- BSpline curve should be split, in order to obtain arcs
|
||||
-- with the continuity required by this framework.
|
||||
-- All these points correspond to knot values. Note that
|
||||
-- the first and last points of the curve, which bound the
|
||||
-- first and last arcs, are counted among these splitting points.
|
||||
|
||||
|
||||
Splitting (me; SplitValues : in out Array1OfInteger)
|
||||
--- Purpose : Loads the SplitValues table with the split knots
|
||||
-- values computed in this framework. Each value in the
|
||||
-- table is an index in the knots table of the BSpline
|
||||
-- curve analyzed by this algorithm.
|
||||
-- The values in SplitValues are given in ascending
|
||||
-- order and comprise the indices of the knots which
|
||||
-- give the first and last points of the curve. Use two
|
||||
-- consecutive values from the table as arguments of the
|
||||
-- global function SplitBSplineCurve (provided by the
|
||||
-- package GeomConvert) to split the curve.
|
||||
-- Exceptions
|
||||
-- Standard_DimensionError if the array SplitValues
|
||||
-- was not created with the following bounds:
|
||||
-- - 1, and
|
||||
-- - the number of split points computed in this
|
||||
-- framework (as given by the function NbSplits).
|
||||
raises DimensionError
|
||||
is static;
|
||||
|
||||
|
||||
SplitValue (me; Index : Integer) returns Integer
|
||||
--- Purpose : Returns the split knot of index Index to the split knots
|
||||
-- table computed in this framework. The returned value
|
||||
-- is an index in the knots table of the BSpline curve
|
||||
-- analyzed by this algorithm.
|
||||
-- Notes:
|
||||
-- - If Index is equal to 1, the corresponding knot
|
||||
-- gives the first point of the curve.
|
||||
-- - If Index is equal to the number of split knots
|
||||
-- computed in this framework, the corresponding
|
||||
-- point is the last point of the curve.
|
||||
-- Exceptions
|
||||
-- Standard_RangeError if Index is less than 1 or
|
||||
-- greater than the number of split knots computed in this framework.
|
||||
raises RangeError
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
splitIndexes : HArray1OfInteger;
|
||||
|
||||
end BSplineCurveKnotSplitting;
|
||||
|
@@ -15,10 +15,11 @@
|
||||
//Jean-Claude Vauthier 27 November 1991
|
||||
//Passage sur C1 Aout 1992
|
||||
|
||||
#include <GeomConvert_BSplineCurveKnotSplitting.ixx>
|
||||
#include <Standard_RangeError.hxx>
|
||||
|
||||
#include <BSplCLib.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomConvert_BSplineCurveKnotSplitting.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
#include <Standard_RangeError.hxx>
|
||||
|
||||
typedef TColStd_Array1OfInteger Array1OfInteger;
|
||||
typedef TColStd_HArray1OfInteger HArray1OfInteger;
|
||||
|
135
src/GeomConvert/GeomConvert_BSplineCurveKnotSplitting.hxx
Normal file
135
src/GeomConvert/GeomConvert_BSplineCurveKnotSplitting.hxx
Normal file
@@ -0,0 +1,135 @@
|
||||
// Created on: 1991-10-03
|
||||
// Copyright (c) 1991-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 _GeomConvert_BSplineCurveKnotSplitting_HeaderFile
|
||||
#define _GeomConvert_BSplineCurveKnotSplitting_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
class Standard_DimensionError;
|
||||
class Standard_RangeError;
|
||||
class Geom_BSplineCurve;
|
||||
|
||||
|
||||
//! An algorithm to determine points at which a BSpline
|
||||
//! curve should be split in order to obtain arcs of the same continuity.
|
||||
//! If you require curves with a minimum continuity for
|
||||
//! your computation, it is useful to know the points
|
||||
//! between which an arc has a continuity of a given
|
||||
//! order. The continuity order is given at the construction time.
|
||||
//! For a BSpline curve, the discontinuities are
|
||||
//! localized at the knot values. Between two knot values
|
||||
//! the BSpline is infinitely and continuously
|
||||
//! differentiable. At a given knot, the continuity is equal
|
||||
//! to: Degree - Mult, where Degree is the
|
||||
//! degree of the BSpline curve and Mult is the multiplicity of the knot.
|
||||
//! It is possible to compute the arcs which correspond to
|
||||
//! this splitting using the global function
|
||||
//! SplitBSplineCurve provided by the package GeomConvert.
|
||||
//! A BSplineCurveKnotSplitting object provides a framework for:
|
||||
//! - defining the curve to be analyzed and the
|
||||
//! required degree of continuity,
|
||||
//! - implementing the computation algorithm, and
|
||||
//! - consulting the results.
|
||||
class GeomConvert_BSplineCurveKnotSplitting
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Determines points at which the BSpline curve
|
||||
//! BasisCurve should be split in order to obtain arcs
|
||||
//! with a degree of continuity equal to ContinuityRange.
|
||||
//! These points are knot values of BasisCurve. They
|
||||
//! are identified by indices in the knots table of BasisCurve.
|
||||
//! Use the available interrogation functions to access
|
||||
//! computed values, followed by the global function
|
||||
//! SplitBSplineCurve (provided by the package GeomConvert) to split the curve.
|
||||
//! Exceptions
|
||||
//! Standard_RangeError if ContinuityRange is less than zero.
|
||||
Standard_EXPORT GeomConvert_BSplineCurveKnotSplitting(const Handle(Geom_BSplineCurve)& BasisCurve, const Standard_Integer ContinuityRange);
|
||||
|
||||
//! Returns the number of points at which the analyzed
|
||||
//! BSpline curve should be split, in order to obtain arcs
|
||||
//! with the continuity required by this framework.
|
||||
//! All these points correspond to knot values. Note that
|
||||
//! the first and last points of the curve, which bound the
|
||||
//! first and last arcs, are counted among these splitting points.
|
||||
Standard_EXPORT Standard_Integer NbSplits() const;
|
||||
|
||||
//! Loads the SplitValues table with the split knots
|
||||
//! values computed in this framework. Each value in the
|
||||
//! table is an index in the knots table of the BSpline
|
||||
//! curve analyzed by this algorithm.
|
||||
//! The values in SplitValues are given in ascending
|
||||
//! order and comprise the indices of the knots which
|
||||
//! give the first and last points of the curve. Use two
|
||||
//! consecutive values from the table as arguments of the
|
||||
//! global function SplitBSplineCurve (provided by the
|
||||
//! package GeomConvert) to split the curve.
|
||||
//! Exceptions
|
||||
//! Standard_DimensionError if the array SplitValues
|
||||
//! was not created with the following bounds:
|
||||
//! - 1, and
|
||||
//! - the number of split points computed in this
|
||||
//! framework (as given by the function NbSplits).
|
||||
Standard_EXPORT void Splitting (TColStd_Array1OfInteger& SplitValues) const;
|
||||
|
||||
//! Returns the split knot of index Index to the split knots
|
||||
//! table computed in this framework. The returned value
|
||||
//! is an index in the knots table of the BSpline curve
|
||||
//! analyzed by this algorithm.
|
||||
//! Notes:
|
||||
//! - If Index is equal to 1, the corresponding knot
|
||||
//! gives the first point of the curve.
|
||||
//! - If Index is equal to the number of split knots
|
||||
//! computed in this framework, the corresponding
|
||||
//! point is the last point of the curve.
|
||||
//! Exceptions
|
||||
//! Standard_RangeError if Index is less than 1 or
|
||||
//! greater than the number of split knots computed in this framework.
|
||||
Standard_EXPORT Standard_Integer SplitValue (const Standard_Integer Index) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) splitIndexes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_BSplineCurveKnotSplitting_HeaderFile
|
@@ -1,119 +0,0 @@
|
||||
-- Created on: 1996-03-12
|
||||
-- Created by: Bruno DUMORTIER
|
||||
-- Copyright (c) 1996-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 BSplineCurveToBezierCurve from GeomConvert
|
||||
|
||||
--- Purpose :An algorithm to convert a BSpline curve into a series
|
||||
-- of adjacent Bezier curves.
|
||||
-- A BSplineCurveToBezierCurve object provides a framework for:
|
||||
-- - defining the BSpline curve to be converted
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the results.
|
||||
-- References :
|
||||
-- Generating the Bezier points of B-spline curves and surfaces
|
||||
-- (Wolfgang Bohm) CAD volume 13 number 6 november 1981
|
||||
|
||||
uses
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfBezierCurve from TColGeom,
|
||||
BezierCurve from Geom,
|
||||
BSplineCurve from Geom
|
||||
|
||||
|
||||
raises
|
||||
DimensionError from Standard,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create (BasisCurve : BSplineCurve) returns BSplineCurveToBezierCurve;
|
||||
--- Purpose : Computes all the data needed to convert the
|
||||
-- BSpline curve BasisCurve into a series of adjacent Bezier arcs.
|
||||
|
||||
Create (BasisCurve : BSplineCurve;
|
||||
U1, U2 : Real;
|
||||
ParametricTolerance : Real)
|
||||
returns BSplineCurveToBezierCurve
|
||||
--- Purpose : Computes all the data needed to convert
|
||||
-- the portion of the BSpline curve BasisCurve
|
||||
-- limited by the two parameter values U1 and U2 into a series of adjacent Bezier arcs.
|
||||
-- The result consists of a series of BasisCurve arcs
|
||||
-- limited by points corresponding to knot values of the curve.
|
||||
-- Use the available interrogation functions to ascertain
|
||||
-- the number of computed Bezier arcs, and then to
|
||||
-- construct each individual Bezier curve (or all Bezier curves).
|
||||
-- Note: ParametricTolerance is not used.
|
||||
-- Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
|
||||
-- curve [FirstParameter, LastParameter]. The Tolerance criterion
|
||||
-- is ParametricTolerance.
|
||||
-- Raised if Abs (U2 - U1) <= ParametricTolerance.
|
||||
raises DomainError;
|
||||
|
||||
|
||||
Arc (me : in out; Index : Integer) returns BezierCurve
|
||||
--- Purpose : Constructs and returns the Bezier curve of index
|
||||
-- Index to the table of adjacent Bezier arcs
|
||||
-- computed by this algorithm.
|
||||
-- This Bezier curve has the same orientation as the
|
||||
-- BSpline curve analyzed in this framework.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than 1 or
|
||||
-- greater than the number of adjacent Bezier arcs
|
||||
-- computed by this algorithm.
|
||||
raises OutOfRange
|
||||
is static;
|
||||
|
||||
|
||||
Arcs (me : in out; Curves : in out Array1OfBezierCurve)
|
||||
--- Purpose : Constructs all the Bezier curves whose data is
|
||||
-- computed by this algorithm and loads these curves into the Curves table.
|
||||
-- The Bezier curves have the same orientation as the
|
||||
-- BSpline curve analyzed in this framework.
|
||||
-- Exceptions
|
||||
-- Standard_DimensionError if the Curves array was
|
||||
-- not created with the following bounds:
|
||||
-- - 1 , and
|
||||
-- - the number of adjacent Bezier arcs computed by
|
||||
-- this algorithm (as given by the function NbArcs).
|
||||
raises DimensionError
|
||||
is static;
|
||||
|
||||
Knots(me; TKnots : out Array1OfReal from TColStd)
|
||||
---Purpose: This methode returns the bspline's knots associated to
|
||||
-- the converted arcs
|
||||
raises DimensionError
|
||||
--- Purpose : Raised if the length of Curves is not equal to
|
||||
-- NbArcs + 1.
|
||||
is static;
|
||||
|
||||
NbArcs (me) returns Integer is static;
|
||||
--- Purpose :
|
||||
-- Returns the number of BezierCurve arcs.
|
||||
-- If at the creation time you have decomposed the basis curve
|
||||
-- between the parametric values UFirst, ULast the number of
|
||||
-- BezierCurve arcs depends on the number of knots included inside
|
||||
-- the interval [UFirst, ULast].
|
||||
-- If you have decomposed the whole basis B-spline curve the number
|
||||
-- of BezierCurve arcs NbArcs is equal to the number of knots less
|
||||
-- one.
|
||||
|
||||
fields
|
||||
|
||||
myCurve : BSplineCurve from Geom;
|
||||
|
||||
end BSplineCurveToBezierCurve;
|
@@ -14,18 +14,20 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GeomConvert_BSplineCurveToBezierCurve.ixx>
|
||||
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomConvert_BSplineCurveToBezierCurve.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomConvert_BSplineCurveToBezierCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomConvert_BSplineCurveToBezierCurve::GeomConvert_BSplineCurveToBezierCurve (const Handle(Geom_BSplineCurve)& BasisCurve)
|
||||
{
|
||||
myCurve = Handle(Geom_BSplineCurve)::DownCast(BasisCurve->Copy());
|
||||
|
134
src/GeomConvert/GeomConvert_BSplineCurveToBezierCurve.hxx
Normal file
134
src/GeomConvert/GeomConvert_BSplineCurveToBezierCurve.hxx
Normal file
@@ -0,0 +1,134 @@
|
||||
// Created on: 1996-03-12
|
||||
// Created by: Bruno DUMORTIER
|
||||
// Copyright (c) 1996-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 _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
|
||||
#define _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColGeom_Array1OfBezierCurve.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
class Geom_BSplineCurve;
|
||||
class Standard_DimensionError;
|
||||
class Standard_DomainError;
|
||||
class Standard_OutOfRange;
|
||||
class Geom_BezierCurve;
|
||||
|
||||
|
||||
//! An algorithm to convert a BSpline curve into a series
|
||||
//! of adjacent Bezier curves.
|
||||
//! A BSplineCurveToBezierCurve object provides a framework for:
|
||||
//! - defining the BSpline curve to be converted
|
||||
//! - implementing the construction algorithm, and
|
||||
//! - consulting the results.
|
||||
//! References :
|
||||
//! Generating the Bezier points of B-spline curves and surfaces
|
||||
//! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
|
||||
class GeomConvert_BSplineCurveToBezierCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Computes all the data needed to convert the
|
||||
//! BSpline curve BasisCurve into a series of adjacent Bezier arcs.
|
||||
Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(const Handle(Geom_BSplineCurve)& BasisCurve);
|
||||
|
||||
//! Computes all the data needed to convert
|
||||
//! the portion of the BSpline curve BasisCurve
|
||||
//! limited by the two parameter values U1 and U2 into a series of adjacent Bezier arcs.
|
||||
//! The result consists of a series of BasisCurve arcs
|
||||
//! limited by points corresponding to knot values of the curve.
|
||||
//! Use the available interrogation functions to ascertain
|
||||
//! the number of computed Bezier arcs, and then to
|
||||
//! construct each individual Bezier curve (or all Bezier curves).
|
||||
//! Note: ParametricTolerance is not used.
|
||||
//! Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
|
||||
//! curve [FirstParameter, LastParameter]. The Tolerance criterion
|
||||
//! is ParametricTolerance.
|
||||
//! Raised if Abs (U2 - U1) <= ParametricTolerance.
|
||||
Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(const Handle(Geom_BSplineCurve)& BasisCurve, const Standard_Real U1, const Standard_Real U2, const Standard_Real ParametricTolerance);
|
||||
|
||||
//! Constructs and returns the Bezier curve of index
|
||||
//! Index to the table of adjacent Bezier arcs
|
||||
//! computed by this algorithm.
|
||||
//! This Bezier curve has the same orientation as the
|
||||
//! BSpline curve analyzed in this framework.
|
||||
//! Exceptions
|
||||
//! Standard_OutOfRange if Index is less than 1 or
|
||||
//! greater than the number of adjacent Bezier arcs
|
||||
//! computed by this algorithm.
|
||||
Standard_EXPORT Handle(Geom_BezierCurve) Arc (const Standard_Integer Index);
|
||||
|
||||
//! Constructs all the Bezier curves whose data is
|
||||
//! computed by this algorithm and loads these curves into the Curves table.
|
||||
//! The Bezier curves have the same orientation as the
|
||||
//! BSpline curve analyzed in this framework.
|
||||
//! Exceptions
|
||||
//! Standard_DimensionError if the Curves array was
|
||||
//! not created with the following bounds:
|
||||
//! - 1 , and
|
||||
//! - the number of adjacent Bezier arcs computed by
|
||||
//! this algorithm (as given by the function NbArcs).
|
||||
Standard_EXPORT void Arcs (TColGeom_Array1OfBezierCurve& Curves);
|
||||
|
||||
//! This methode returns the bspline's knots associated to
|
||||
//! the converted arcs
|
||||
//! Raised if the length of Curves is not equal to
|
||||
//! NbArcs + 1.
|
||||
Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) const;
|
||||
|
||||
|
||||
//! Returns the number of BezierCurve arcs.
|
||||
//! If at the creation time you have decomposed the basis curve
|
||||
//! between the parametric values UFirst, ULast the number of
|
||||
//! BezierCurve arcs depends on the number of knots included inside
|
||||
//! the interval [UFirst, ULast].
|
||||
//! If you have decomposed the whole basis B-spline curve the number
|
||||
//! of BezierCurve arcs NbArcs is equal to the number of knots less
|
||||
//! one.
|
||||
Standard_EXPORT Standard_Integer NbArcs() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Geom_BSplineCurve) myCurve;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
|
@@ -1,168 +0,0 @@
|
||||
-- Created on: 1991-10-04
|
||||
-- Copyright (c) 1991-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 BSplineSurfaceKnotSplitting from GeomConvert
|
||||
|
||||
--- Purpose : An algorithm to determine isoparametric curves along
|
||||
-- which a BSpline surface should be split in order to
|
||||
-- obtain patches of the same continuity. The continuity order is given at the
|
||||
-- construction time. It is possible to compute the surface patches
|
||||
-- corresponding to the splitting with the method of package
|
||||
-- SplitBSplineSurface.
|
||||
-- For a B-spline surface the discontinuities are localised at
|
||||
-- the knot values. Between two knots values the B-spline is
|
||||
-- infinitely continuously differentiable. For each parametric
|
||||
-- direction at a knot of range index the continuity in this
|
||||
-- direction is equal to : Degree - Mult (Index) where Degree
|
||||
-- is the degree of the basis B-spline functions and Mult the
|
||||
-- multiplicity of the knot of range Index in the given direction.
|
||||
-- If for your computation you need to have B-spline surface with a
|
||||
-- minima of continuity it can be interesting to know between which
|
||||
-- knot values, a B-spline patch, has a continuity of given order.
|
||||
-- This algorithm computes the indexes of the knots where you should
|
||||
-- split the surface, to obtain patches with a constant continuity
|
||||
-- given at the construction time. If you just want to compute the
|
||||
-- local derivatives on the surface you don't need to create the
|
||||
-- BSpline patches, you can use the functions LocalD1, LocalD2,
|
||||
-- LocalD3, LocalDN of the class BSplineSurface from package Geom.
|
||||
|
||||
|
||||
|
||||
|
||||
uses BSplineSurface from Geom,
|
||||
Array1OfInteger from TColStd,
|
||||
HArray1OfInteger from TColStd
|
||||
|
||||
raises DimensionError from Standard,
|
||||
RangeError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create (BasisSurface : BSplineSurface;
|
||||
UContinuityRange, VContinuityRange : Integer)
|
||||
returns BSplineSurfaceKnotSplitting;
|
||||
--- Purpose : Determines the u- and v-isoparametric curves
|
||||
-- along which the BSpline surface BasisSurface
|
||||
-- should be split in order to obtain patches with a
|
||||
-- degree of continuity equal to UContinuityRange in
|
||||
-- the u parametric direction, and to
|
||||
-- VContinuityRange in the v parametric direction.
|
||||
-- These isoparametric curves are defined by
|
||||
-- parameters, which are BasisSurface knot values in
|
||||
-- the u or v parametric direction. They are identified
|
||||
-- by indices in the BasisSurface knots table in the
|
||||
-- corresponding parametric direction.
|
||||
-- Use the available interrogation functions to access
|
||||
-- computed values, followed by the global function
|
||||
-- SplitBSplineSurface (provided by the package
|
||||
-- GeomConvert) to split the surface.
|
||||
-- Exceptions
|
||||
-- Standard_RangeError if UContinuityRange or
|
||||
-- VContinuityRange is less than zero.
|
||||
|
||||
NbUSplits (me) returns Integer is static;
|
||||
--- Purpose : Returns the number of u-isoparametric curves
|
||||
-- along which the analysed BSpline surface should be
|
||||
-- split in order to obtain patches with the continuity
|
||||
-- required by this framework.
|
||||
-- The parameters which define these curves are knot
|
||||
-- values in the corresponding parametric direction.
|
||||
-- Note that the four curves which bound the surface are
|
||||
-- counted among these splitting curves.
|
||||
|
||||
NbVSplits (me) returns Integer is static;
|
||||
--- Purpose : Returns the number of v-isoparametric curves
|
||||
-- along which the analysed BSpline surface should be
|
||||
-- split in order to obtain patches with the continuity
|
||||
-- required by this framework.
|
||||
-- The parameters which define these curves are knot
|
||||
-- values in the corresponding parametric direction.
|
||||
-- Note that the four curves which bound the surface are
|
||||
-- counted among these splitting curves.
|
||||
|
||||
|
||||
Splitting (me; USplit, VSplit : in out Array1OfInteger)
|
||||
--- Purpose: Loads the USplit and VSplit tables with the split
|
||||
-- knots values computed in this framework. Each value
|
||||
-- in these tables is an index in the knots table
|
||||
-- corresponding to the u or v parametric direction of
|
||||
-- the BSpline surface analysed by this algorithm.
|
||||
-- The USplit and VSplit values are given in ascending
|
||||
-- order and comprise the indices of the knots which
|
||||
-- give the first and last isoparametric curves of the
|
||||
-- surface in the corresponding parametric direction.
|
||||
-- Use two consecutive values from the USplit table and
|
||||
-- two consecutive values from the VSplit table as
|
||||
-- arguments of the global function
|
||||
-- SplitBSplineSurface (provided by the package
|
||||
-- GeomConvert) to split the surface.
|
||||
-- Exceptions
|
||||
-- Standard_DimensionError if:
|
||||
-- - the array USplit was not created with the following bounds:
|
||||
-- - 1 , and
|
||||
-- - the number of split knots in the u parametric
|
||||
-- direction computed in this framework (as given
|
||||
-- by the function NbUSplits); or
|
||||
-- - the array VSplit was not created with the following bounds:
|
||||
-- - 1 , and
|
||||
-- - the number of split knots in the v parametric
|
||||
-- direction computed in this framework (as given
|
||||
-- by the function NbVSplits).
|
||||
raises DimensionError
|
||||
is static;
|
||||
|
||||
|
||||
USplitValue (me; UIndex : Integer) returns Integer
|
||||
--- Purpose : Returns the split knot of index UIndex
|
||||
-- to the split knots table for the u parametric direction
|
||||
-- computed in this framework. The returned value is
|
||||
-- an index in the knots table relative to the u
|
||||
-- parametric direction of the BSpline surface analysed by this algorithm.
|
||||
-- Note: If UIndex is equal to 1, or to the number of split knots for the u
|
||||
-- parametric direction computed in
|
||||
-- this framework, the corresponding knot gives the
|
||||
-- parameter of one of the bounding curves of the surface.
|
||||
-- Exceptions
|
||||
-- Standard_RangeError if UIndex is less than 1 or greater than the number
|
||||
-- of split knots for the u parametric direction computed in this framework.
|
||||
raises RangeError
|
||||
is static;
|
||||
|
||||
|
||||
VSplitValue (me; VIndex : Integer) returns Integer
|
||||
--- Purpose : Returns the split knot of index VIndex
|
||||
-- to the split knots table for the v parametric direction
|
||||
-- computed in this framework. The returned value is
|
||||
-- an index in the knots table relative to the v
|
||||
-- parametric direction of the BSpline surface analysed by this algorithm.
|
||||
-- Note: If UIndex is equal to 1, or to the number of split knots for the v
|
||||
-- parametric direction computed in
|
||||
-- this framework, the corresponding knot gives the
|
||||
-- parameter of one of the bounding curves of the surface.
|
||||
-- Exceptions
|
||||
-- Standard_RangeError if VIndex is less than 1 or greater than the number
|
||||
-- of split knots for the v parametric direction computed in this framework.
|
||||
raises RangeError
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
usplitIndexes : HArray1OfInteger;
|
||||
vsplitIndexes : HArray1OfInteger;
|
||||
|
||||
end BSplineSurfaceKnotSplitting;
|
@@ -15,12 +15,11 @@
|
||||
//Jean-Claude Vauthier 28 Novembre 1991
|
||||
//Passage sur C1 Aout 1992
|
||||
|
||||
|
||||
#include <GeomConvert_BSplineSurfaceKnotSplitting.ixx>
|
||||
|
||||
#include <Standard_RangeError.hxx>
|
||||
|
||||
#include <BSplCLib.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <GeomConvert_BSplineSurfaceKnotSplitting.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
#include <Standard_RangeError.hxx>
|
||||
|
||||
typedef TColStd_Array1OfInteger Array1OfInteger;
|
||||
typedef TColStd_HArray1OfInteger HArray1OfInteger;
|
||||
|
181
src/GeomConvert/GeomConvert_BSplineSurfaceKnotSplitting.hxx
Normal file
181
src/GeomConvert/GeomConvert_BSplineSurfaceKnotSplitting.hxx
Normal file
@@ -0,0 +1,181 @@
|
||||
// Created on: 1991-10-04
|
||||
// Copyright (c) 1991-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 _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile
|
||||
#define _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
class Standard_DimensionError;
|
||||
class Standard_RangeError;
|
||||
class Geom_BSplineSurface;
|
||||
|
||||
|
||||
//! An algorithm to determine isoparametric curves along
|
||||
//! which a BSpline surface should be split in order to
|
||||
//! obtain patches of the same continuity. The continuity order is given at the
|
||||
//! construction time. It is possible to compute the surface patches
|
||||
//! corresponding to the splitting with the method of package
|
||||
//! SplitBSplineSurface.
|
||||
//! For a B-spline surface the discontinuities are localised at
|
||||
//! the knot values. Between two knots values the B-spline is
|
||||
//! infinitely continuously differentiable. For each parametric
|
||||
//! direction at a knot of range index the continuity in this
|
||||
//! direction is equal to : Degree - Mult (Index) where Degree
|
||||
//! is the degree of the basis B-spline functions and Mult the
|
||||
//! multiplicity of the knot of range Index in the given direction.
|
||||
//! If for your computation you need to have B-spline surface with a
|
||||
//! minima of continuity it can be interesting to know between which
|
||||
//! knot values, a B-spline patch, has a continuity of given order.
|
||||
//! This algorithm computes the indexes of the knots where you should
|
||||
//! split the surface, to obtain patches with a constant continuity
|
||||
//! given at the construction time. If you just want to compute the
|
||||
//! local derivatives on the surface you don't need to create the
|
||||
//! BSpline patches, you can use the functions LocalD1, LocalD2,
|
||||
//! LocalD3, LocalDN of the class BSplineSurface from package Geom.
|
||||
class GeomConvert_BSplineSurfaceKnotSplitting
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Determines the u- and v-isoparametric curves
|
||||
//! along which the BSpline surface BasisSurface
|
||||
//! should be split in order to obtain patches with a
|
||||
//! degree of continuity equal to UContinuityRange in
|
||||
//! the u parametric direction, and to
|
||||
//! VContinuityRange in the v parametric direction.
|
||||
//! These isoparametric curves are defined by
|
||||
//! parameters, which are BasisSurface knot values in
|
||||
//! the u or v parametric direction. They are identified
|
||||
//! by indices in the BasisSurface knots table in the
|
||||
//! corresponding parametric direction.
|
||||
//! Use the available interrogation functions to access
|
||||
//! computed values, followed by the global function
|
||||
//! SplitBSplineSurface (provided by the package
|
||||
//! GeomConvert) to split the surface.
|
||||
//! Exceptions
|
||||
//! Standard_RangeError if UContinuityRange or
|
||||
//! VContinuityRange is less than zero.
|
||||
Standard_EXPORT GeomConvert_BSplineSurfaceKnotSplitting(const Handle(Geom_BSplineSurface)& BasisSurface, const Standard_Integer UContinuityRange, const Standard_Integer VContinuityRange);
|
||||
|
||||
//! Returns the number of u-isoparametric curves
|
||||
//! along which the analysed BSpline surface should be
|
||||
//! split in order to obtain patches with the continuity
|
||||
//! required by this framework.
|
||||
//! The parameters which define these curves are knot
|
||||
//! values in the corresponding parametric direction.
|
||||
//! Note that the four curves which bound the surface are
|
||||
//! counted among these splitting curves.
|
||||
Standard_EXPORT Standard_Integer NbUSplits() const;
|
||||
|
||||
//! Returns the number of v-isoparametric curves
|
||||
//! along which the analysed BSpline surface should be
|
||||
//! split in order to obtain patches with the continuity
|
||||
//! required by this framework.
|
||||
//! The parameters which define these curves are knot
|
||||
//! values in the corresponding parametric direction.
|
||||
//! Note that the four curves which bound the surface are
|
||||
//! counted among these splitting curves.
|
||||
Standard_EXPORT Standard_Integer NbVSplits() const;
|
||||
|
||||
//! Loads the USplit and VSplit tables with the split
|
||||
//! knots values computed in this framework. Each value
|
||||
//! in these tables is an index in the knots table
|
||||
//! corresponding to the u or v parametric direction of
|
||||
//! the BSpline surface analysed by this algorithm.
|
||||
//! The USplit and VSplit values are given in ascending
|
||||
//! order and comprise the indices of the knots which
|
||||
//! give the first and last isoparametric curves of the
|
||||
//! surface in the corresponding parametric direction.
|
||||
//! Use two consecutive values from the USplit table and
|
||||
//! two consecutive values from the VSplit table as
|
||||
//! arguments of the global function
|
||||
//! SplitBSplineSurface (provided by the package
|
||||
//! GeomConvert) to split the surface.
|
||||
//! Exceptions
|
||||
//! Standard_DimensionError if:
|
||||
//! - the array USplit was not created with the following bounds:
|
||||
//! - 1 , and
|
||||
//! - the number of split knots in the u parametric
|
||||
//! direction computed in this framework (as given
|
||||
//! by the function NbUSplits); or
|
||||
//! - the array VSplit was not created with the following bounds:
|
||||
//! - 1 , and
|
||||
//! - the number of split knots in the v parametric
|
||||
//! direction computed in this framework (as given
|
||||
//! by the function NbVSplits).
|
||||
Standard_EXPORT void Splitting (TColStd_Array1OfInteger& USplit, TColStd_Array1OfInteger& VSplit) const;
|
||||
|
||||
//! Returns the split knot of index UIndex
|
||||
//! to the split knots table for the u parametric direction
|
||||
//! computed in this framework. The returned value is
|
||||
//! an index in the knots table relative to the u
|
||||
//! parametric direction of the BSpline surface analysed by this algorithm.
|
||||
//! Note: If UIndex is equal to 1, or to the number of split knots for the u
|
||||
//! parametric direction computed in
|
||||
//! this framework, the corresponding knot gives the
|
||||
//! parameter of one of the bounding curves of the surface.
|
||||
//! Exceptions
|
||||
//! Standard_RangeError if UIndex is less than 1 or greater than the number
|
||||
//! of split knots for the u parametric direction computed in this framework.
|
||||
Standard_EXPORT Standard_Integer USplitValue (const Standard_Integer UIndex) const;
|
||||
|
||||
//! Returns the split knot of index VIndex
|
||||
//! to the split knots table for the v parametric direction
|
||||
//! computed in this framework. The returned value is
|
||||
//! an index in the knots table relative to the v
|
||||
//! parametric direction of the BSpline surface analysed by this algorithm.
|
||||
//! Note: If UIndex is equal to 1, or to the number of split knots for the v
|
||||
//! parametric direction computed in
|
||||
//! this framework, the corresponding knot gives the
|
||||
//! parameter of one of the bounding curves of the surface.
|
||||
//! Exceptions
|
||||
//! Standard_RangeError if VIndex is less than 1 or greater than the number
|
||||
//! of split knots for the v parametric direction computed in this framework.
|
||||
Standard_EXPORT Standard_Integer VSplitValue (const Standard_Integer VIndex) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) usplitIndexes;
|
||||
Handle(TColStd_HArray1OfInteger) vsplitIndexes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile
|
@@ -1,193 +0,0 @@
|
||||
-- Created on: 1996-03-12
|
||||
-- Created by: Bruno DUMORTIER
|
||||
-- Copyright (c) 1996-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 BSplineSurfaceToBezierSurface from GeomConvert
|
||||
|
||||
--- Purpose :
|
||||
-- This algorithm converts a B-spline surface into several
|
||||
-- Bezier surfaces. It uses an algorithm of knot insertion.
|
||||
-- A BSplineSurfaceToBezierSurface object provides a framework for:
|
||||
-- - defining the BSpline surface to be converted,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the results.
|
||||
-- References :
|
||||
-- Generating the Bezier points of B-spline curves and surfaces
|
||||
-- (Wolfgang Bohm) CAD volume 13 number 6 november 1981
|
||||
|
||||
uses
|
||||
Array1OfReal from TColStd,
|
||||
Array2OfBezierSurface from TColGeom,
|
||||
BezierSurface from Geom,
|
||||
BSplineSurface from Geom
|
||||
|
||||
|
||||
raises
|
||||
DimensionError from Standard,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (BasisSurface : BSplineSurface)
|
||||
returns BSplineSurfaceToBezierSurface;
|
||||
--- Purpose : Computes all the data needed to convert
|
||||
-- - the BSpline surface BasisSurface into a series of adjacent Bezier surfaces.
|
||||
-- The result consists of a grid of BasisSurface patches
|
||||
-- limited by isoparametric curves corresponding to knot
|
||||
-- values, both in the u and v parametric directions of
|
||||
-- the surface. A row in the grid corresponds to a series
|
||||
-- of adjacent patches, all limited by the same two
|
||||
-- u-isoparametric curves. A column in the grid
|
||||
-- corresponds to a series of adjacent patches, all
|
||||
-- limited by the same two v-isoparametric curves.
|
||||
-- Use the available interrogation functions to ascertain
|
||||
-- the number of computed Bezier patches, and then to
|
||||
-- construct each individual Bezier surface (or all Bezier surfaces).
|
||||
-- Note: ParametricTolerance is not used.
|
||||
|
||||
Create (BasisSurface : BSplineSurface;
|
||||
U1, U2, V1, V2 : Real;
|
||||
ParametricTolerance : Real)
|
||||
returns BSplineSurfaceToBezierSurface
|
||||
--- Purpose : Computes all the data needed to convert
|
||||
-- the patch of the BSpline surface BasisSurface
|
||||
-- limited by the two parameter values U1 and U2 in
|
||||
-- the u parametric direction, and by the two
|
||||
-- parameter values V1 and V2 in the v parametric
|
||||
-- direction, into a series of adjacent Bezier surfaces.
|
||||
-- The result consists of a grid of BasisSurface patches
|
||||
-- limited by isoparametric curves corresponding to knot
|
||||
-- values, both in the u and v parametric directions of
|
||||
-- the surface. A row in the grid corresponds to a series
|
||||
-- of adjacent patches, all limited by the same two
|
||||
-- u-isoparametric curves. A column in the grid
|
||||
-- corresponds to a series of adjacent patches, all
|
||||
-- limited by the same two v-isoparametric curves.
|
||||
-- Use the available interrogation functions to ascertain
|
||||
-- the number of computed Bezier patches, and then to
|
||||
-- construct each individual Bezier surface (or all Bezier surfaces).
|
||||
-- Note: ParametricTolerance is not used. Raises DomainError
|
||||
-- if U1 or U2 or V1 or V2 are out of the parametric bounds
|
||||
-- of the basis surface [FirstUKnotIndex, LastUKnotIndex] ,
|
||||
-- [FirstVKnotIndex, LastVKnotIndex] The tolerance criterion is
|
||||
-- ParametricTolerance.
|
||||
-- Raised if U2 - U1 <= ParametricTolerance or
|
||||
-- V2 - V1 <= ParametricTolerance.
|
||||
raises DomainError;
|
||||
|
||||
|
||||
Patch (me : in out; UIndex, VIndex : Integer)
|
||||
returns BezierSurface
|
||||
--- Purpose : Constructs and returns the Bezier surface of indices
|
||||
-- (UIndex, VIndex) to the patch grid computed on the
|
||||
-- BSpline surface analyzed by this algorithm.
|
||||
-- This Bezier surface has the same orientation as the
|
||||
-- BSpline surface analyzed in this framework.
|
||||
-- UIndex is an index common to a row in the patch
|
||||
-- grid. A row in the grid corresponds to a series of
|
||||
-- adjacent patches, all limited by the same two
|
||||
-- u-isoparametric curves of the surface. VIndex is an
|
||||
-- index common to a column in the patch grid. A column
|
||||
-- in the grid corresponds to a series of adjacent
|
||||
-- patches, all limited by the same two v-isoparametric
|
||||
-- curves of the surface.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if:
|
||||
-- - UIndex is less than 1 or greater than the number
|
||||
-- of rows in the patch grid computed on the BSpline
|
||||
-- surface analyzed by this algorithm (as returned by
|
||||
-- the function NbUPatches); or if
|
||||
-- - VIndex is less than 1 or greater than the number
|
||||
-- of columns in the patch grid computed on the
|
||||
-- BSpline surface analyzed by this algorithm (as
|
||||
-- returned by the function NbVPatches).
|
||||
raises OutOfRange
|
||||
is static;
|
||||
|
||||
|
||||
Patches (me : in out; Surfaces : in out Array2OfBezierSurface)
|
||||
--- Purpose : Constructs all the Bezier surfaces whose data is
|
||||
-- computed by this algorithm, and loads them into the Surfaces table.
|
||||
-- These Bezier surfaces have the same orientation as
|
||||
-- the BSpline surface analyzed in this framework.
|
||||
-- The Surfaces array is organised in the same way as
|
||||
-- the patch grid computed on the BSpline surface
|
||||
-- analyzed by this algorithm. A row in the array
|
||||
-- corresponds to a series of adjacent patches, all
|
||||
-- limited by the same two u-isoparametric curves of
|
||||
-- the surface. A column in the array corresponds to a
|
||||
-- series of adjacent patches, all limited by the same two
|
||||
-- v-isoparametric curves of the surface.
|
||||
-- Exceptions
|
||||
-- Standard_DimensionError if the Surfaces array
|
||||
-- was not created with the following bounds:
|
||||
-- - 1, and the number of adjacent patch series in the
|
||||
-- u parametric direction of the patch grid computed
|
||||
-- on the BSpline surface, analyzed by this algorithm
|
||||
-- (as given by the function NbUPatches) as row bounds,
|
||||
-- - 1, and the number of adjacent patch series in the
|
||||
-- v parametric direction of the patch grid computed
|
||||
-- on the BSpline surface, analyzed by this algorithm
|
||||
-- (as given by the function NbVPatches) as column bounds.
|
||||
raises DimensionError
|
||||
is static;
|
||||
|
||||
UKnots(me; TKnots : out Array1OfReal from TColStd)
|
||||
---Purpose: This methode returns the bspline's u-knots associated to
|
||||
-- the converted Patches
|
||||
raises DimensionError
|
||||
--- Purpose : Raised if the length of Curves is not equal to
|
||||
-- NbUPatches + 1.
|
||||
is static;
|
||||
|
||||
VKnots(me; TKnots : out Array1OfReal from TColStd)
|
||||
---Purpose: This methode returns the bspline's v-knots associated to
|
||||
-- the converted Patches
|
||||
raises DimensionError
|
||||
--- Purpose : Raised if the length of Curves is not equal to
|
||||
-- NbVPatches + 1.
|
||||
is static;
|
||||
|
||||
NbUPatches (me) returns Integer is static;
|
||||
--- Purpose :
|
||||
-- Returns the number of Bezier surfaces in the U direction.
|
||||
-- If at the creation time you have decomposed the basis Surface
|
||||
-- between the parametric values UFirst, ULast the number of
|
||||
-- Bezier surfaces in the U direction depends on the number of
|
||||
-- knots included inside the interval [UFirst, ULast].
|
||||
-- If you have decomposed the whole basis B-spline surface the
|
||||
-- number of Bezier surfaces NbUPatches is equal to the number of
|
||||
-- UKnots less one.
|
||||
|
||||
|
||||
NbVPatches (me) returns Integer is static;
|
||||
--- Purpose :
|
||||
-- Returns the number of Bezier surfaces in the V direction.
|
||||
-- If at the creation time you have decomposed the basis surface
|
||||
-- between the parametric values VFirst, VLast the number of
|
||||
-- Bezier surfaces in the V direction depends on the number of
|
||||
-- knots included inside the interval [VFirst, VLast].
|
||||
-- If you have decomposed the whole basis B-spline surface the
|
||||
-- number of Bezier surfaces NbVPatches is equal to the number of
|
||||
-- VKnots less one.
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
mySurface : BSplineSurface from Geom;
|
||||
|
||||
end BSplineSurfaceToBezierSurface;
|
@@ -14,18 +14,20 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GeomConvert_BSplineSurfaceToBezierSurface.ixx>
|
||||
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <GeomConvert_BSplineSurfaceToBezierSurface.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomConvert_BSplineSurfaceToBezierSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomConvert_BSplineSurfaceToBezierSurface::GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface)
|
||||
{
|
||||
mySurface = Handle(Geom_BSplineSurface)::DownCast(BasisSurface->Copy());
|
||||
|
202
src/GeomConvert/GeomConvert_BSplineSurfaceToBezierSurface.hxx
Normal file
202
src/GeomConvert/GeomConvert_BSplineSurfaceToBezierSurface.hxx
Normal file
@@ -0,0 +1,202 @@
|
||||
// Created on: 1996-03-12
|
||||
// Created by: Bruno DUMORTIER
|
||||
// Copyright (c) 1996-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 _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
|
||||
#define _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColGeom_Array2OfBezierSurface.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
class Geom_BSplineSurface;
|
||||
class Standard_DimensionError;
|
||||
class Standard_DomainError;
|
||||
class Standard_OutOfRange;
|
||||
class Geom_BezierSurface;
|
||||
|
||||
|
||||
|
||||
//! This algorithm converts a B-spline surface into several
|
||||
//! Bezier surfaces. It uses an algorithm of knot insertion.
|
||||
//! A BSplineSurfaceToBezierSurface object provides a framework for:
|
||||
//! - defining the BSpline surface to be converted,
|
||||
//! - implementing the construction algorithm, and
|
||||
//! - consulting the results.
|
||||
//! References :
|
||||
//! Generating the Bezier points of B-spline curves and surfaces
|
||||
//! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
|
||||
class GeomConvert_BSplineSurfaceToBezierSurface
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Computes all the data needed to convert
|
||||
//! - the BSpline surface BasisSurface into a series of adjacent Bezier surfaces.
|
||||
//! The result consists of a grid of BasisSurface patches
|
||||
//! limited by isoparametric curves corresponding to knot
|
||||
//! values, both in the u and v parametric directions of
|
||||
//! the surface. A row in the grid corresponds to a series
|
||||
//! of adjacent patches, all limited by the same two
|
||||
//! u-isoparametric curves. A column in the grid
|
||||
//! corresponds to a series of adjacent patches, all
|
||||
//! limited by the same two v-isoparametric curves.
|
||||
//! Use the available interrogation functions to ascertain
|
||||
//! the number of computed Bezier patches, and then to
|
||||
//! construct each individual Bezier surface (or all Bezier surfaces).
|
||||
//! Note: ParametricTolerance is not used.
|
||||
Standard_EXPORT GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface);
|
||||
|
||||
//! Computes all the data needed to convert
|
||||
//! the patch of the BSpline surface BasisSurface
|
||||
//! limited by the two parameter values U1 and U2 in
|
||||
//! the u parametric direction, and by the two
|
||||
//! parameter values V1 and V2 in the v parametric
|
||||
//! direction, into a series of adjacent Bezier surfaces.
|
||||
//! The result consists of a grid of BasisSurface patches
|
||||
//! limited by isoparametric curves corresponding to knot
|
||||
//! values, both in the u and v parametric directions of
|
||||
//! the surface. A row in the grid corresponds to a series
|
||||
//! of adjacent patches, all limited by the same two
|
||||
//! u-isoparametric curves. A column in the grid
|
||||
//! corresponds to a series of adjacent patches, all
|
||||
//! limited by the same two v-isoparametric curves.
|
||||
//! Use the available interrogation functions to ascertain
|
||||
//! the number of computed Bezier patches, and then to
|
||||
//! construct each individual Bezier surface (or all Bezier surfaces).
|
||||
//! Note: ParametricTolerance is not used. Raises DomainError
|
||||
//! if U1 or U2 or V1 or V2 are out of the parametric bounds
|
||||
//! of the basis surface [FirstUKnotIndex, LastUKnotIndex] ,
|
||||
//! [FirstVKnotIndex, LastVKnotIndex] The tolerance criterion is
|
||||
//! ParametricTolerance.
|
||||
//! Raised if U2 - U1 <= ParametricTolerance or
|
||||
//! V2 - V1 <= ParametricTolerance.
|
||||
Standard_EXPORT GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Real ParametricTolerance);
|
||||
|
||||
//! Constructs and returns the Bezier surface of indices
|
||||
//! (UIndex, VIndex) to the patch grid computed on the
|
||||
//! BSpline surface analyzed by this algorithm.
|
||||
//! This Bezier surface has the same orientation as the
|
||||
//! BSpline surface analyzed in this framework.
|
||||
//! UIndex is an index common to a row in the patch
|
||||
//! grid. A row in the grid corresponds to a series of
|
||||
//! adjacent patches, all limited by the same two
|
||||
//! u-isoparametric curves of the surface. VIndex is an
|
||||
//! index common to a column in the patch grid. A column
|
||||
//! in the grid corresponds to a series of adjacent
|
||||
//! patches, all limited by the same two v-isoparametric
|
||||
//! curves of the surface.
|
||||
//! Exceptions
|
||||
//! Standard_OutOfRange if:
|
||||
//! - UIndex is less than 1 or greater than the number
|
||||
//! of rows in the patch grid computed on the BSpline
|
||||
//! surface analyzed by this algorithm (as returned by
|
||||
//! the function NbUPatches); or if
|
||||
//! - VIndex is less than 1 or greater than the number
|
||||
//! of columns in the patch grid computed on the
|
||||
//! BSpline surface analyzed by this algorithm (as
|
||||
//! returned by the function NbVPatches).
|
||||
Standard_EXPORT Handle(Geom_BezierSurface) Patch (const Standard_Integer UIndex, const Standard_Integer VIndex);
|
||||
|
||||
//! Constructs all the Bezier surfaces whose data is
|
||||
//! computed by this algorithm, and loads them into the Surfaces table.
|
||||
//! These Bezier surfaces have the same orientation as
|
||||
//! the BSpline surface analyzed in this framework.
|
||||
//! The Surfaces array is organised in the same way as
|
||||
//! the patch grid computed on the BSpline surface
|
||||
//! analyzed by this algorithm. A row in the array
|
||||
//! corresponds to a series of adjacent patches, all
|
||||
//! limited by the same two u-isoparametric curves of
|
||||
//! the surface. A column in the array corresponds to a
|
||||
//! series of adjacent patches, all limited by the same two
|
||||
//! v-isoparametric curves of the surface.
|
||||
//! Exceptions
|
||||
//! Standard_DimensionError if the Surfaces array
|
||||
//! was not created with the following bounds:
|
||||
//! - 1, and the number of adjacent patch series in the
|
||||
//! u parametric direction of the patch grid computed
|
||||
//! on the BSpline surface, analyzed by this algorithm
|
||||
//! (as given by the function NbUPatches) as row bounds,
|
||||
//! - 1, and the number of adjacent patch series in the
|
||||
//! v parametric direction of the patch grid computed
|
||||
//! on the BSpline surface, analyzed by this algorithm
|
||||
//! (as given by the function NbVPatches) as column bounds.
|
||||
Standard_EXPORT void Patches (TColGeom_Array2OfBezierSurface& Surfaces);
|
||||
|
||||
//! This methode returns the bspline's u-knots associated to
|
||||
//! the converted Patches
|
||||
//! Raised if the length of Curves is not equal to
|
||||
//! NbUPatches + 1.
|
||||
Standard_EXPORT void UKnots (TColStd_Array1OfReal& TKnots) const;
|
||||
|
||||
//! This methode returns the bspline's v-knots associated to
|
||||
//! the converted Patches
|
||||
//! Raised if the length of Curves is not equal to
|
||||
//! NbVPatches + 1.
|
||||
Standard_EXPORT void VKnots (TColStd_Array1OfReal& TKnots) const;
|
||||
|
||||
|
||||
//! Returns the number of Bezier surfaces in the U direction.
|
||||
//! If at the creation time you have decomposed the basis Surface
|
||||
//! between the parametric values UFirst, ULast the number of
|
||||
//! Bezier surfaces in the U direction depends on the number of
|
||||
//! knots included inside the interval [UFirst, ULast].
|
||||
//! If you have decomposed the whole basis B-spline surface the
|
||||
//! number of Bezier surfaces NbUPatches is equal to the number of
|
||||
//! UKnots less one.
|
||||
Standard_EXPORT Standard_Integer NbUPatches() const;
|
||||
|
||||
|
||||
//! Returns the number of Bezier surfaces in the V direction.
|
||||
//! If at the creation time you have decomposed the basis surface
|
||||
//! between the parametric values VFirst, VLast the number of
|
||||
//! Bezier surfaces in the V direction depends on the number of
|
||||
//! knots included inside the interval [VFirst, VLast].
|
||||
//! If you have decomposed the whole basis B-spline surface the
|
||||
//! number of Bezier surfaces NbVPatches is equal to the number of
|
||||
//! VKnots less one.
|
||||
Standard_EXPORT Standard_Integer NbVPatches() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Geom_BSplineSurface) mySurface;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
|
@@ -1,323 +0,0 @@
|
||||
-- Created on: 1996-06-06
|
||||
-- Created by: Philippe MANGIN
|
||||
-- Copyright (c) 1996-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 CompBezierSurfacesToBSplineSurface from GeomConvert
|
||||
|
||||
---Purpose: An algorithm to convert a grid of adjacent
|
||||
-- non-rational Bezier surfaces (with continuity CM) into a
|
||||
-- BSpline surface (with continuity CM).
|
||||
-- A CompBezierSurfacesToBSplineSurface object
|
||||
-- provides a framework for:
|
||||
-- - defining the grid of adjacent Bezier surfaces
|
||||
-- which is to be converted into a BSpline surface,
|
||||
-- - implementing the computation algorithm, and
|
||||
-- - consulting the results.
|
||||
-- Warning
|
||||
-- Do not attempt to convert rational Bezier surfaces using such an algorithm.
|
||||
-- Input is array of Bezier patch
|
||||
-- 1 2 3 4 -> VIndex [1, NbVPatches] -> VDirection
|
||||
-- -----------------------
|
||||
-- 1 | | | | |
|
||||
-- -----------------------
|
||||
-- 2 | | | | |
|
||||
-- -----------------------
|
||||
-- 3 | | | | |
|
||||
-- -----------------------
|
||||
-- UIndex [1, NbUPatches] Udirection
|
||||
--
|
||||
-- Warning! Patches must have compatible parametrization
|
||||
|
||||
uses
|
||||
Array2OfBezierSurface from TColGeom,
|
||||
HArray2OfPnt from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
Shape from GeomAbs,
|
||||
HArray1OfInteger from TColStd
|
||||
|
||||
raises
|
||||
DimensionError from Standard,
|
||||
NotImplemented from Standard,
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create(Beziers : Array2OfBezierSurface)
|
||||
---Purpose : Computes all the data needed to build a "C0"
|
||||
-- continuous BSpline surface equivalent to the grid of
|
||||
-- adjacent non-rational Bezier surfaces Beziers.
|
||||
-- Each surface in the Beziers grid becomes a natural
|
||||
-- patch, limited by knots values, on the BSpline surface
|
||||
-- whose data is computed. Surfaces in the grid must
|
||||
-- satisfy the following conditions:
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive surfaces in a row of the Beziers grid
|
||||
-- must be u-isoparametric bounding curves of these two surfaces.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive surfaces in a column of the Beziers
|
||||
-- grid must be v-isoparametric bounding curves of these two surfaces.
|
||||
-- The BSpline surface whose data is computed has the
|
||||
-- following characteristics:
|
||||
-- - Its degree in the u (respectively v) parametric
|
||||
-- direction is equal to that of the Bezier surface
|
||||
-- which has the highest degree in the u
|
||||
-- (respectively v) parametric direction in the Beziers grid.
|
||||
-- - It is a "Piecewise Bezier" in both u and v
|
||||
-- parametric directions, i.e.:
|
||||
-- - the knots are regularly spaced in each
|
||||
-- parametric direction (i.e. the difference between
|
||||
-- two consecutive knots is a constant), and
|
||||
-- - all the multiplicities of the surface knots in a
|
||||
-- given parametric direction are equal to
|
||||
-- Degree, which is the degree of the BSpline
|
||||
-- surface in this parametric direction, except for
|
||||
-- the first and last knots for which the multiplicity is
|
||||
-- equal to Degree + 1.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive columns of Bezier surfaces in the
|
||||
-- Beziers grid become u-isoparametric curves,
|
||||
-- corresponding to knots values of the BSpline surface.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive rows of Bezier surfaces in the Beziers
|
||||
-- grid become v-isoparametric curves
|
||||
-- corresponding to knots values of the BSpline surface.
|
||||
-- Use the available consultation functions to access the
|
||||
-- computed data. This data may be used to construct the BSpline surface.
|
||||
-- Warning
|
||||
-- The surfaces in the Beziers grid must be adjacent, i.e.
|
||||
-- two consecutive Bezier surfaces in the grid (in a row
|
||||
-- or column) must have a coincident bounding curve. In
|
||||
-- addition, the location of the parameterization on each
|
||||
-- of these surfaces (i.e. the relative location of u and v
|
||||
-- isoparametric curves on the surface) is of importance
|
||||
-- with regard to the positioning of the surfaces in the
|
||||
-- Beziers grid. Care must be taken with respect to the
|
||||
-- above, as these properties are not checked and an
|
||||
-- error may occur if they are not satisfied.
|
||||
-- Exceptions
|
||||
-- Standard_NotImplemented if one of the Bezier
|
||||
-- surfaces of the Beziers grid is rational.
|
||||
returns CompBezierSurfacesToBSplineSurface
|
||||
raises NotImplemented;
|
||||
|
||||
Create(Beziers : Array2OfBezierSurface;
|
||||
Tolerance : Real;
|
||||
RemoveKnots : Boolean = Standard_True)
|
||||
---Purpose : Build an Ci uniform (Rational) BSpline surface
|
||||
-- The higest Continuity Ci is imposed, like the
|
||||
-- maximal deformation is lower than <Tolerance>.
|
||||
-- Warning: The Continuity C0 is imposed without any check.
|
||||
returns CompBezierSurfacesToBSplineSurface
|
||||
raises NotImplemented;
|
||||
|
||||
Create(Beziers : Array2OfBezierSurface;
|
||||
UKnots : Array1OfReal;
|
||||
VKnots : Array1OfReal;
|
||||
UContinuity : Shape = GeomAbs_C0;
|
||||
VContinuity : Shape = GeomAbs_C0;
|
||||
Tolerance : Real = 1.0e-4)
|
||||
---Purpose : Computes all the data needed to construct a BSpline
|
||||
-- surface equivalent to the adjacent non-rational
|
||||
-- Bezier surfaces Beziers grid.
|
||||
-- Each surface in the Beziers grid becomes a natural
|
||||
-- patch, limited by knots values, on the BSpline surface
|
||||
-- whose data is computed. Surfaces in the grid must
|
||||
-- satisfy the following conditions:
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive surfaces in a row of the Beziers grid
|
||||
-- must be u-isoparametric bounding curves of these two surfaces.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive surfaces in a column of the Beziers
|
||||
-- grid must be v-isoparametric bounding curves of these two surfaces.
|
||||
-- The BSpline surface whose data is computed has the
|
||||
-- following characteristics:
|
||||
-- - Its degree in the u (respectively v) parametric
|
||||
-- direction is equal to that of the Bezier surface
|
||||
-- which has the highest degree in the u
|
||||
-- (respectively v) parametric direction in the Beziers grid.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive columns of Bezier surfaces in the
|
||||
-- Beziers grid become u-isoparametric curves
|
||||
-- corresponding to knots values of the BSpline surface.
|
||||
-- - Coincident bounding curves between two
|
||||
-- consecutive rows of Bezier surfaces in the Beziers
|
||||
-- grid become v-isoparametric curves
|
||||
-- corresponding to knots values of the BSpline surface.
|
||||
-- Knots values of the BSpline surface are given in the two tables:
|
||||
-- - UKnots for the u parametric direction (which
|
||||
-- corresponds to the order of Bezier surface columns in the Beziers grid), and
|
||||
-- - VKnots for the v parametric direction (which
|
||||
-- corresponds to the order of Bezier surface rows in the Beziers grid).
|
||||
-- The dimensions of UKnots (respectively VKnots)
|
||||
-- must be equal to the number of columns (respectively,
|
||||
-- rows) of the Beziers grid, plus 1 .
|
||||
-- UContinuity and VContinuity, which are both
|
||||
-- defaulted to GeomAbs_C0, specify the required
|
||||
-- continuity on the BSpline surface. If the required
|
||||
-- degree of continuity is greater than 0 in a given
|
||||
-- parametric direction, a deformation is applied locally
|
||||
-- on the initial surface (as defined by the Beziers grid)
|
||||
-- to satisfy this condition. This local deformation is not
|
||||
-- applied however, if it is greater than Tolerance
|
||||
-- (defaulted to 1.0 e-7). In such cases, the
|
||||
-- continuity condition is not satisfied, and the function
|
||||
-- IsDone will return false. A small tolerance value
|
||||
-- prevents any modification of the surface and a large
|
||||
-- tolerance value "smoothes" the surface.
|
||||
-- Use the available consultation functions to access the
|
||||
-- computed data. This data may be used to construct the BSpline surface.
|
||||
-- Warning
|
||||
-- The surfaces in the Beziers grid must be adjacent, i.e.
|
||||
-- two consecutive Bezier surfaces in the grid (in a row
|
||||
-- or column) must have a coincident bounding curve. In
|
||||
-- addition, the location of the parameterization on each
|
||||
-- of these surfaces (i.e. the relative location of u and v
|
||||
-- isoparametric curves on the surface) is of importance
|
||||
-- with regard to the positioning of the surfaces in the
|
||||
-- Beziers grid. Care must be taken with respect to the
|
||||
-- above, as these properties are not checked and an
|
||||
-- error may occur if they are not satisfied.
|
||||
-- Exceptions
|
||||
-- Standard_DimensionMismatch:
|
||||
-- - if the number of knots in the UKnots table (i.e. the
|
||||
-- length of the UKnots array) is not equal to the
|
||||
-- number of columns of Bezier surfaces in the
|
||||
-- Beziers grid plus 1, or
|
||||
-- - if the number of knots in the VKnots table (i.e. the
|
||||
-- length of the VKnots array) is not equal to the
|
||||
-- number of rows of Bezier surfaces in the Beziers grid, plus 1.
|
||||
-- Standard_ConstructionError:
|
||||
-- - if UContinuity and VContinuity are not equal to
|
||||
-- one of the following values: GeomAbs_C0,
|
||||
-- GeomAbs_C1, GeomAbs_C2 and GeomAbs_C3; or
|
||||
-- - if the number of columns in the Beziers grid is
|
||||
-- greater than 1, and the required degree of
|
||||
-- continuity in the u parametric direction is greater
|
||||
-- than that of the Bezier surface with the highest
|
||||
-- degree in the u parametric direction (in the Beziers grid), minus 1; or
|
||||
-- - if the number of rows in the Beziers grid is
|
||||
-- greater than 1, and the required degree of
|
||||
-- continuity in the v parametric direction is greater
|
||||
-- than that of the Bezier surface with the highest
|
||||
-- degree in the v parametric direction (in the Beziers grid), minus 1 .
|
||||
-- Standard_NotImplemented if one of the Bezier
|
||||
-- surfaces in the Beziers grid is rational.
|
||||
returns CompBezierSurfacesToBSplineSurface
|
||||
raises ConstructionError,
|
||||
DimensionError,
|
||||
NotImplemented;
|
||||
|
||||
Perform (me : in out; Beziers : Array2OfBezierSurface)
|
||||
---Purpose : It used internaly by the constructors.
|
||||
is private;
|
||||
|
||||
NbUKnots (me) returns Integer;
|
||||
---Purpose : Returns the number of knots in the U direction
|
||||
-- of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
|
||||
NbUPoles (me) returns Integer;
|
||||
---Purpose : Returns number of poles in the U direction
|
||||
-- of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
|
||||
NbVKnots (me) returns Integer;
|
||||
---Purpose : Returns the number of knots in the V direction
|
||||
-- of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
|
||||
NbVPoles (me) returns Integer;
|
||||
---Purpose : Returns the number of poles in the V direction
|
||||
-- of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
|
||||
Poles(me)
|
||||
---Purpose : Returns the table of poles of the BSpline surface
|
||||
-- whose data is computed in this framework.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns HArray2OfPnt;
|
||||
|
||||
|
||||
UKnots (me)
|
||||
---Purpose : Returns the knots table for the u parametric
|
||||
-- direction of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns HArray1OfReal;
|
||||
|
||||
UDegree (me) returns Integer;
|
||||
---Purpose : Returns the degree for the u parametric
|
||||
-- direction of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
|
||||
VKnots (me)
|
||||
---Purpose : Returns the knots table for the v parametric
|
||||
-- direction of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns HArray1OfReal;
|
||||
|
||||
|
||||
VDegree (me)
|
||||
---Purpose : Returns the degree for the v parametric
|
||||
-- direction of the BSpline surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
returns Integer;
|
||||
|
||||
UMultiplicities (me)
|
||||
---Purpose :
|
||||
-- Returns the multiplicities table for the u
|
||||
-- parametric direction of the knots of the BSpline
|
||||
-- surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns HArray1OfInteger;
|
||||
|
||||
VMultiplicities (me)
|
||||
---Purpose : -- Returns the multiplicities table for the v
|
||||
-- parametric direction of the knots of the BSpline
|
||||
-- surface whose data is computed in this framework.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns HArray1OfInteger;
|
||||
|
||||
IsDone(me)
|
||||
---Purpose : Returns true if the conversion was successful.
|
||||
-- Unless an exception was raised at the time of
|
||||
-- construction, the conversion of the Bezier surface
|
||||
-- grid assigned to this algorithm is always carried out.
|
||||
-- IsDone returns false if the constraints defined at the
|
||||
-- time of construction cannot be respected. This occurs
|
||||
-- when there is an incompatibility between a required
|
||||
-- degree of continuity on the BSpline surface, and the
|
||||
-- maximum tolerance accepted for local deformations
|
||||
-- of the surface. In such a case the computed data
|
||||
-- does not satisfy all the initial constraints.
|
||||
returns Boolean ;
|
||||
|
||||
|
||||
fields
|
||||
myUDegree : Integer;
|
||||
myVDegree : Integer;
|
||||
myVMults : HArray1OfInteger;
|
||||
myUMults : HArray1OfInteger;
|
||||
myUKnots : HArray1OfReal;
|
||||
myVKnots : HArray1OfReal;
|
||||
myPoles : HArray2OfPnt;
|
||||
isrational : Boolean;
|
||||
myDone : Boolean;
|
||||
|
||||
end CompBezierSurfacesToBSplineSurface;
|
@@ -14,20 +14,21 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GeomConvert_CompBezierSurfacesToBSplineSurface.ixx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <GeomConvert_CompBezierSurfacesToBSplineSurface.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <TColGeom_Array2OfBezierSurface.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_DimensionError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <TColGeom_Array2OfBezierSurface.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
// ============================================================================
|
||||
GeomConvert_CompBezierSurfacesToBSplineSurface::
|
||||
|
@@ -0,0 +1,314 @@
|
||||
// Created on: 1996-06-06
|
||||
// Created by: Philippe MANGIN
|
||||
// Copyright (c) 1996-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 _GeomConvert_CompBezierSurfacesToBSplineSurface_HeaderFile
|
||||
#define _GeomConvert_CompBezierSurfacesToBSplineSurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColGeom_Array2OfBezierSurface.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
class Standard_DimensionError;
|
||||
class Standard_NotImplemented;
|
||||
class Standard_ConstructionError;
|
||||
|
||||
|
||||
//! An algorithm to convert a grid of adjacent
|
||||
//! non-rational Bezier surfaces (with continuity CM) into a
|
||||
//! BSpline surface (with continuity CM).
|
||||
//! A CompBezierSurfacesToBSplineSurface object
|
||||
//! provides a framework for:
|
||||
//! - defining the grid of adjacent Bezier surfaces
|
||||
//! which is to be converted into a BSpline surface,
|
||||
//! - implementing the computation algorithm, and
|
||||
//! - consulting the results.
|
||||
//! Warning
|
||||
//! Do not attempt to convert rational Bezier surfaces using such an algorithm.
|
||||
//! Input is array of Bezier patch
|
||||
//! 1 2 3 4 -> VIndex [1, NbVPatches] -> VDirection
|
||||
//! -----------------------
|
||||
//! 1 | | | | |
|
||||
//! -----------------------
|
||||
//! 2 | | | | |
|
||||
//! -----------------------
|
||||
//! 3 | | | | |
|
||||
//! -----------------------
|
||||
//! UIndex [1, NbUPatches] Udirection
|
||||
//!
|
||||
//! Warning! Patches must have compatible parametrization
|
||||
class GeomConvert_CompBezierSurfacesToBSplineSurface
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Computes all the data needed to build a "C0"
|
||||
//! continuous BSpline surface equivalent to the grid of
|
||||
//! adjacent non-rational Bezier surfaces Beziers.
|
||||
//! Each surface in the Beziers grid becomes a natural
|
||||
//! patch, limited by knots values, on the BSpline surface
|
||||
//! whose data is computed. Surfaces in the grid must
|
||||
//! satisfy the following conditions:
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive surfaces in a row of the Beziers grid
|
||||
//! must be u-isoparametric bounding curves of these two surfaces.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive surfaces in a column of the Beziers
|
||||
//! grid must be v-isoparametric bounding curves of these two surfaces.
|
||||
//! The BSpline surface whose data is computed has the
|
||||
//! following characteristics:
|
||||
//! - Its degree in the u (respectively v) parametric
|
||||
//! direction is equal to that of the Bezier surface
|
||||
//! which has the highest degree in the u
|
||||
//! (respectively v) parametric direction in the Beziers grid.
|
||||
//! - It is a "Piecewise Bezier" in both u and v
|
||||
//! parametric directions, i.e.:
|
||||
//! - the knots are regularly spaced in each
|
||||
//! parametric direction (i.e. the difference between
|
||||
//! two consecutive knots is a constant), and
|
||||
//! - all the multiplicities of the surface knots in a
|
||||
//! given parametric direction are equal to
|
||||
//! Degree, which is the degree of the BSpline
|
||||
//! surface in this parametric direction, except for
|
||||
//! the first and last knots for which the multiplicity is
|
||||
//! equal to Degree + 1.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive columns of Bezier surfaces in the
|
||||
//! Beziers grid become u-isoparametric curves,
|
||||
//! corresponding to knots values of the BSpline surface.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive rows of Bezier surfaces in the Beziers
|
||||
//! grid become v-isoparametric curves
|
||||
//! corresponding to knots values of the BSpline surface.
|
||||
//! Use the available consultation functions to access the
|
||||
//! computed data. This data may be used to construct the BSpline surface.
|
||||
//! Warning
|
||||
//! The surfaces in the Beziers grid must be adjacent, i.e.
|
||||
//! two consecutive Bezier surfaces in the grid (in a row
|
||||
//! or column) must have a coincident bounding curve. In
|
||||
//! addition, the location of the parameterization on each
|
||||
//! of these surfaces (i.e. the relative location of u and v
|
||||
//! isoparametric curves on the surface) is of importance
|
||||
//! with regard to the positioning of the surfaces in the
|
||||
//! Beziers grid. Care must be taken with respect to the
|
||||
//! above, as these properties are not checked and an
|
||||
//! error may occur if they are not satisfied.
|
||||
//! Exceptions
|
||||
//! Standard_NotImplemented if one of the Bezier
|
||||
//! surfaces of the Beziers grid is rational.
|
||||
Standard_EXPORT GeomConvert_CompBezierSurfacesToBSplineSurface(const TColGeom_Array2OfBezierSurface& Beziers);
|
||||
|
||||
//! Build an Ci uniform (Rational) BSpline surface
|
||||
//! The higest Continuity Ci is imposed, like the
|
||||
//! maximal deformation is lower than <Tolerance>.
|
||||
//! Warning: The Continuity C0 is imposed without any check.
|
||||
Standard_EXPORT GeomConvert_CompBezierSurfacesToBSplineSurface(const TColGeom_Array2OfBezierSurface& Beziers, const Standard_Real Tolerance, const Standard_Boolean RemoveKnots = Standard_True);
|
||||
|
||||
//! Computes all the data needed to construct a BSpline
|
||||
//! surface equivalent to the adjacent non-rational
|
||||
//! Bezier surfaces Beziers grid.
|
||||
//! Each surface in the Beziers grid becomes a natural
|
||||
//! patch, limited by knots values, on the BSpline surface
|
||||
//! whose data is computed. Surfaces in the grid must
|
||||
//! satisfy the following conditions:
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive surfaces in a row of the Beziers grid
|
||||
//! must be u-isoparametric bounding curves of these two surfaces.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive surfaces in a column of the Beziers
|
||||
//! grid must be v-isoparametric bounding curves of these two surfaces.
|
||||
//! The BSpline surface whose data is computed has the
|
||||
//! following characteristics:
|
||||
//! - Its degree in the u (respectively v) parametric
|
||||
//! direction is equal to that of the Bezier surface
|
||||
//! which has the highest degree in the u
|
||||
//! (respectively v) parametric direction in the Beziers grid.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive columns of Bezier surfaces in the
|
||||
//! Beziers grid become u-isoparametric curves
|
||||
//! corresponding to knots values of the BSpline surface.
|
||||
//! - Coincident bounding curves between two
|
||||
//! consecutive rows of Bezier surfaces in the Beziers
|
||||
//! grid become v-isoparametric curves
|
||||
//! corresponding to knots values of the BSpline surface.
|
||||
//! Knots values of the BSpline surface are given in the two tables:
|
||||
//! - UKnots for the u parametric direction (which
|
||||
//! corresponds to the order of Bezier surface columns in the Beziers grid), and
|
||||
//! - VKnots for the v parametric direction (which
|
||||
//! corresponds to the order of Bezier surface rows in the Beziers grid).
|
||||
//! The dimensions of UKnots (respectively VKnots)
|
||||
//! must be equal to the number of columns (respectively,
|
||||
//! rows) of the Beziers grid, plus 1 .
|
||||
//! UContinuity and VContinuity, which are both
|
||||
//! defaulted to GeomAbs_C0, specify the required
|
||||
//! continuity on the BSpline surface. If the required
|
||||
//! degree of continuity is greater than 0 in a given
|
||||
//! parametric direction, a deformation is applied locally
|
||||
//! on the initial surface (as defined by the Beziers grid)
|
||||
//! to satisfy this condition. This local deformation is not
|
||||
//! applied however, if it is greater than Tolerance
|
||||
//! (defaulted to 1.0 e-7). In such cases, the
|
||||
//! continuity condition is not satisfied, and the function
|
||||
//! IsDone will return false. A small tolerance value
|
||||
//! prevents any modification of the surface and a large
|
||||
//! tolerance value "smoothes" the surface.
|
||||
//! Use the available consultation functions to access the
|
||||
//! computed data. This data may be used to construct the BSpline surface.
|
||||
//! Warning
|
||||
//! The surfaces in the Beziers grid must be adjacent, i.e.
|
||||
//! two consecutive Bezier surfaces in the grid (in a row
|
||||
//! or column) must have a coincident bounding curve. In
|
||||
//! addition, the location of the parameterization on each
|
||||
//! of these surfaces (i.e. the relative location of u and v
|
||||
//! isoparametric curves on the surface) is of importance
|
||||
//! with regard to the positioning of the surfaces in the
|
||||
//! Beziers grid. Care must be taken with respect to the
|
||||
//! above, as these properties are not checked and an
|
||||
//! error may occur if they are not satisfied.
|
||||
//! Exceptions
|
||||
//! Standard_DimensionMismatch:
|
||||
//! - if the number of knots in the UKnots table (i.e. the
|
||||
//! length of the UKnots array) is not equal to the
|
||||
//! number of columns of Bezier surfaces in the
|
||||
//! Beziers grid plus 1, or
|
||||
//! - if the number of knots in the VKnots table (i.e. the
|
||||
//! length of the VKnots array) is not equal to the
|
||||
//! number of rows of Bezier surfaces in the Beziers grid, plus 1.
|
||||
//! Standard_ConstructionError:
|
||||
//! - if UContinuity and VContinuity are not equal to
|
||||
//! one of the following values: GeomAbs_C0,
|
||||
//! GeomAbs_C1, GeomAbs_C2 and GeomAbs_C3; or
|
||||
//! - if the number of columns in the Beziers grid is
|
||||
//! greater than 1, and the required degree of
|
||||
//! continuity in the u parametric direction is greater
|
||||
//! than that of the Bezier surface with the highest
|
||||
//! degree in the u parametric direction (in the Beziers grid), minus 1; or
|
||||
//! - if the number of rows in the Beziers grid is
|
||||
//! greater than 1, and the required degree of
|
||||
//! continuity in the v parametric direction is greater
|
||||
//! than that of the Bezier surface with the highest
|
||||
//! degree in the v parametric direction (in the Beziers grid), minus 1 .
|
||||
//! Standard_NotImplemented if one of the Bezier
|
||||
//! surfaces in the Beziers grid is rational.
|
||||
Standard_EXPORT GeomConvert_CompBezierSurfacesToBSplineSurface(const TColGeom_Array2OfBezierSurface& Beziers, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const GeomAbs_Shape UContinuity = GeomAbs_C0, const GeomAbs_Shape VContinuity = GeomAbs_C0, const Standard_Real Tolerance = 1.0e-4);
|
||||
|
||||
//! Returns the number of knots in the U direction
|
||||
//! of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer NbUKnots() const;
|
||||
|
||||
//! Returns number of poles in the U direction
|
||||
//! of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer NbUPoles() const;
|
||||
|
||||
//! Returns the number of knots in the V direction
|
||||
//! of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer NbVKnots() const;
|
||||
|
||||
//! Returns the number of poles in the V direction
|
||||
//! of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer NbVPoles() const;
|
||||
|
||||
//! Returns the table of poles of the BSpline surface
|
||||
//! whose data is computed in this framework.
|
||||
const Handle(TColgp_HArray2OfPnt)& Poles() const;
|
||||
|
||||
//! Returns the knots table for the u parametric
|
||||
//! direction of the BSpline surface whose data is computed in this framework.
|
||||
const Handle(TColStd_HArray1OfReal)& UKnots() const;
|
||||
|
||||
//! Returns the degree for the u parametric
|
||||
//! direction of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer UDegree() const;
|
||||
|
||||
//! Returns the knots table for the v parametric
|
||||
//! direction of the BSpline surface whose data is computed in this framework.
|
||||
const Handle(TColStd_HArray1OfReal)& VKnots() const;
|
||||
|
||||
//! Returns the degree for the v parametric
|
||||
//! direction of the BSpline surface whose data is computed in this framework.
|
||||
Standard_Integer VDegree() const;
|
||||
|
||||
|
||||
//! Returns the multiplicities table for the u
|
||||
//! parametric direction of the knots of the BSpline
|
||||
//! surface whose data is computed in this framework.
|
||||
const Handle(TColStd_HArray1OfInteger)& UMultiplicities() const;
|
||||
|
||||
//! -- Returns the multiplicities table for the v
|
||||
//! parametric direction of the knots of the BSpline
|
||||
//! surface whose data is computed in this framework.
|
||||
const Handle(TColStd_HArray1OfInteger)& VMultiplicities() const;
|
||||
|
||||
//! Returns true if the conversion was successful.
|
||||
//! Unless an exception was raised at the time of
|
||||
//! construction, the conversion of the Bezier surface
|
||||
//! grid assigned to this algorithm is always carried out.
|
||||
//! IsDone returns false if the constraints defined at the
|
||||
//! time of construction cannot be respected. This occurs
|
||||
//! when there is an incompatibility between a required
|
||||
//! degree of continuity on the BSpline surface, and the
|
||||
//! maximum tolerance accepted for local deformations
|
||||
//! of the surface. In such a case the computed data
|
||||
//! does not satisfy all the initial constraints.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! It used internaly by the constructors.
|
||||
Standard_EXPORT void Perform (const TColGeom_Array2OfBezierSurface& Beziers);
|
||||
|
||||
|
||||
Standard_Integer myUDegree;
|
||||
Standard_Integer myVDegree;
|
||||
Handle(TColStd_HArray1OfInteger) myVMults;
|
||||
Handle(TColStd_HArray1OfInteger) myUMults;
|
||||
Handle(TColStd_HArray1OfReal) myUKnots;
|
||||
Handle(TColStd_HArray1OfReal) myVKnots;
|
||||
Handle(TColgp_HArray2OfPnt) myPoles;
|
||||
Standard_Boolean isrational;
|
||||
Standard_Boolean myDone;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <GeomConvert_CompBezierSurfacesToBSplineSurface.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_CompBezierSurfacesToBSplineSurface_HeaderFile
|
@@ -1,80 +0,0 @@
|
||||
-- Created on: 1996-09-23
|
||||
-- Created by: Philippe MANGIN
|
||||
-- Copyright (c) 1996-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.
|
||||
|
||||
-- Modified: Fri Jul 10 11:23:35 1998
|
||||
-- JCT : Add WithRatio,MinM
|
||||
|
||||
|
||||
class CompCurveToBSplineCurve from GeomConvert
|
||||
|
||||
---Purpose: Algorithm converts and concat several curve in an BSplineCurve
|
||||
|
||||
uses
|
||||
ParameterisationType from Convert,
|
||||
BoundedCurve from Geom,
|
||||
BSplineCurve from Geom
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
|
||||
Create(Parameterisation : ParameterisationType from Convert = Convert_TgtThetaOver2);
|
||||
---Purpose: Initialize the algorithme
|
||||
-- - Parameterisation is used to convert
|
||||
|
||||
|
||||
Create (BasisCurve : BoundedCurve from Geom;
|
||||
Parameterisation : ParameterisationType from Convert
|
||||
= Convert_TgtThetaOver2)
|
||||
---Purpose: Initialize the algorithme with one curve
|
||||
-- - Parameterisation is used to convert
|
||||
returns CompCurveToBSplineCurve;
|
||||
|
||||
|
||||
Add (me : in out;
|
||||
NewCurve : BoundedCurve from Geom;
|
||||
Tolerance : Real from Standard;
|
||||
After : Boolean from Standard = Standard_False;
|
||||
WithRatio : Boolean from Standard = Standard_True;
|
||||
MinM : Integer from Standard = 0)
|
||||
---Purpose: Append a curve in the BSpline Return False if the
|
||||
-- curve is not G0 with the BSplineCurve. Tolerance
|
||||
-- is used to check continuity and decrease
|
||||
-- Multiplicity at the common Knot until MinM
|
||||
-- if MinM = 0, the common Knot can be removed
|
||||
returns Boolean;
|
||||
|
||||
|
||||
Add (me : in out;
|
||||
FirstCurve : in out BSplineCurve from Geom;
|
||||
SecondCurve: in out BSplineCurve from Geom;
|
||||
After : Boolean from Standard;
|
||||
WithRatio : Boolean from Standard;
|
||||
MinM : Integer from Standard)
|
||||
---Purpose: Concat two BSplineCurves.
|
||||
is private;
|
||||
|
||||
BSplineCurve(me) returns BSplineCurve from Geom;
|
||||
|
||||
Clear(me : in out);
|
||||
---Purpose: Clear a result curve
|
||||
|
||||
fields
|
||||
myCurve : BSplineCurve from Geom;
|
||||
myTol : Real;
|
||||
myType : ParameterisationType from Convert;
|
||||
|
||||
end CompCurveToBSplineCurve;
|
@@ -17,19 +17,16 @@
|
||||
// Modified: Fri Jul 10 11:23:35 1998
|
||||
// JCT : Add WithRatio,MinM
|
||||
|
||||
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.ixx>
|
||||
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : constructor
|
||||
|
89
src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.hxx
Normal file
89
src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.hxx
Normal file
@@ -0,0 +1,89 @@
|
||||
// Created on: 1996-09-23
|
||||
// Created by: Philippe MANGIN
|
||||
// Copyright (c) 1996-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 _GeomConvert_CompCurveToBSplineCurve_HeaderFile
|
||||
#define _GeomConvert_CompCurveToBSplineCurve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Convert_ParameterisationType.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Geom_BSplineCurve;
|
||||
class Geom_BoundedCurve;
|
||||
|
||||
|
||||
//! Algorithm converts and concat several curve in an BSplineCurve
|
||||
class GeomConvert_CompCurveToBSplineCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initialize the algorithme
|
||||
//! - Parameterisation is used to convert
|
||||
Standard_EXPORT GeomConvert_CompCurveToBSplineCurve(const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
||||
|
||||
//! Initialize the algorithme with one curve
|
||||
//! - Parameterisation is used to convert
|
||||
Standard_EXPORT GeomConvert_CompCurveToBSplineCurve(const Handle(Geom_BoundedCurve)& BasisCurve, const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
||||
|
||||
//! Append a curve in the BSpline Return False if the
|
||||
//! curve is not G0 with the BSplineCurve. Tolerance
|
||||
//! is used to check continuity and decrease
|
||||
//! Multiplicity at the common Knot until MinM
|
||||
//! if MinM = 0, the common Knot can be removed
|
||||
Standard_EXPORT Standard_Boolean Add (const Handle(Geom_BoundedCurve)& NewCurve, const Standard_Real Tolerance, const Standard_Boolean After = Standard_False, const Standard_Boolean WithRatio = Standard_True, const Standard_Integer MinM = 0);
|
||||
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) BSplineCurve() const;
|
||||
|
||||
//! Clear a result curve
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Concat two BSplineCurves.
|
||||
Standard_EXPORT void Add (Handle(Geom_BSplineCurve)& FirstCurve, Handle(Geom_BSplineCurve)& SecondCurve, const Standard_Boolean After, const Standard_Boolean WithRatio, const Standard_Integer MinM);
|
||||
|
||||
|
||||
Handle(Geom_BSplineCurve) myCurve;
|
||||
Standard_Real myTol;
|
||||
Convert_ParameterisationType myType;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_CompCurveToBSplineCurve_HeaderFile
|
Reference in New Issue
Block a user