1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

57
src/GeomAdaptor/GeomAdaptor.cdl Executable file
View File

@@ -0,0 +1,57 @@
-- File: GeomAdaptator.cdl
-- Created: Thu Oct 8 10:33:07 1992
-- Author: Isabelle GRIGNON
---Copyright: Matra Davision 1992
package GeomAdaptor
---Purpose: this package contains the geometric definition of
-- curve and surface necessary to use algorithmes.
uses
Geom,
GeomAbs,
Adaptor3d,
gp,
Standard,
TColStd,
Geom2dAdaptor,
TColgp,
Precision
is
class Curve;
---Purpose: creation of the loaded curve the curve is C1 by piece.
-- Inherits Curve from Adaptor3d
class Surface;
---Purpose: creation of the loaded surface the surface is C1 by piece
-- Inherits Surface from Adaptor3d
private class GHSurface instantiates GenHSurface from Adaptor3d
(Surface from GeomAdaptor);
class HSurface;
---Purpose: Inherited from GHSurface. Provides a surface
-- handled by reference.
private class GHCurve instantiates GenHCurve from Adaptor3d
(Curve from GeomAdaptor);
class HCurve;
---Purpose: Inherited from GHCurve. Provides a curve
-- handled by reference.
MakeCurve( C : Curve from Adaptor3d)
---Purpose: Build a Geom_Curve using the informations from the
-- Curve from Adaptor3d
returns Curve from Geom;
MakeSurface( S : Surface from Adaptor3d)
---Purpose: Build a Geom_Surface using the informations from the
-- Surface from Adaptor3d
returns Surface from Geom;
end GeomAdaptor;

164
src/GeomAdaptor/GeomAdaptor.cxx Executable file
View File

@@ -0,0 +1,164 @@
// File: GeomAdaptor.cxx
// Created: Wed May 3 17:48:12 1995
// Author: Bruno DUMORTIER
// Copyright: OPEN CASCADE 1995
#include <GeomAdaptor.ixx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <Adaptor3d_HSurface.hxx>
//=======================================================================
//function : MakeCurve
//purpose :
//=======================================================================
Handle(Geom_Curve) GeomAdaptor::MakeCurve (const Adaptor3d_Curve& HC)
{
Handle(Geom_Curve) C;
switch (HC.GetType())
{
case GeomAbs_Line:
C = new Geom_Line(HC.Line());
break;
case GeomAbs_Circle:
C = new Geom_Circle(HC.Circle());
break;
case GeomAbs_Ellipse:
C = new Geom_Ellipse(HC.Ellipse());
break;
case GeomAbs_Parabola:
C = new Geom_Parabola(HC.Parabola());
break;
case GeomAbs_Hyperbola:
C = new Geom_Hyperbola(HC.Hyperbola());
break;
case GeomAbs_BezierCurve:
C = Handle(Geom_BezierCurve)::DownCast(HC.Bezier()->Copy());
break;
case GeomAbs_BSplineCurve:
C = Handle(Geom_BSplineCurve)::DownCast(HC.BSpline()->Copy());
break;
case GeomAbs_OtherCurve:
Standard_DomainError::Raise("GeomAdaptor::MakeCurve : OtherCurve");
}
// trim the curve if necassary.
if (! C.IsNull() &&
(HC.FirstParameter() != C->FirstParameter()) ||
(HC.LastParameter() != C->LastParameter())) {
C = new Geom_TrimmedCurve(C,HC.FirstParameter(),HC.LastParameter());
}
return C;
}
//=======================================================================
//function : MakeSurface
//purpose :
//=======================================================================
Handle(Geom_Surface) GeomAdaptor::MakeSurface(const Adaptor3d_Surface& HS)
{
Handle(Geom_Surface) S;
switch ( HS.GetType())
{
case GeomAbs_Plane:
S = new Geom_Plane(HS.Plane());
break;
case GeomAbs_Cylinder:
S = new Geom_CylindricalSurface(HS.Cylinder());
break;
case GeomAbs_Cone:
S = new Geom_ConicalSurface(HS.Cone());
break;
case GeomAbs_Sphere:
S = new Geom_SphericalSurface(HS.Sphere());
break;
case GeomAbs_Torus:
S = new Geom_ToroidalSurface(HS.Torus());
break;
case GeomAbs_BezierSurface:
S = Handle(Geom_BezierSurface)::DownCast(HS.Bezier()->Copy());
break;
case GeomAbs_BSplineSurface:
S = Handle(Geom_BSplineSurface)::DownCast(HS.BSpline()->Copy());
break;
case GeomAbs_SurfaceOfRevolution:
S = new Geom_SurfaceOfRevolution
(GeomAdaptor::MakeCurve(HS.BasisCurve()->Curve()),HS.AxeOfRevolution());
break;
case GeomAbs_SurfaceOfExtrusion:
S = new Geom_SurfaceOfLinearExtrusion
(GeomAdaptor::MakeCurve(HS.BasisCurve()->Curve()),HS.Direction());
break;
case GeomAbs_OffsetSurface:
S = new Geom_OffsetSurface(GeomAdaptor::MakeSurface(HS.BasisSurface()->Surface()),
HS.OffsetValue());
break;
case GeomAbs_OtherSurface:
Standard_DomainError::Raise("GeomAdaptor::MakeSurface : OtherSurface");
break;
}
if ( S.IsNull() )
return S;
// trim the surface if necassary.
Standard_Real U1, U2, V1, V2;
S->Bounds(U1, U2, V1, V2);
if ((HS.FirstUParameter() != U1 ) ||
(HS.LastUParameter () != U2 ) ||
(HS.FirstVParameter() != V1 ) ||
(HS.LastVParameter () != V2 ) ) {
S = new Geom_RectangularTrimmedSurface
(S,HS.FirstUParameter(),HS.LastUParameter(),
HS.FirstVParameter(),HS.LastVParameter());
}
return S;
}

View File

@@ -0,0 +1,278 @@
-- File: GeomAdaptor_Curve.cdl
-- Created: Tue Sep 1 10:58:10 1992
-- Author: Modelistation
---Copyright: Matra Datavision 1992
class Curve from GeomAdaptor inherits Curve from Adaptor3d
---Purpose: This class provides an interface between the services provided by any
-- curve from the package Geom and those required of the curve by algorithms which use it.
uses Vec from gp,
Pnt from gp,
Circ from gp,
Elips from gp,
Hypr from gp,
Parab from gp,
Lin from gp,
Array1OfReal from TColStd,
Curve from Geom,
BezierCurve from Geom,
BSplineCurve from Geom,
CurveType from GeomAbs,
Shape from GeomAbs,
HCurve from Adaptor3d
raises NoSuchObject from Standard,
ConstructionError from Standard,
OutOfRange from Standard,
DomainError from Standard
is
Create
returns Curve from GeomAdaptor;
---C++: inline
Create(C : Curve from Geom)
returns Curve from GeomAdaptor;
---C++: inline
Create(C : Curve from Geom; UFirst,ULast : Real)
returns Curve from GeomAdaptor
raises
ConstructionError from Standard;
---Purpose: ConstructionError is raised if Ufirst>Ulast
---C++: inline
Load(me : in out; C : Curve from Geom);
---C++: inline
Load(me : in out; C : Curve from Geom; UFirst,ULast : Real)
raises
ConstructionError from Standard;
---Purpose: ConstructionError is raised if Ufirst>Ulast
Curve(me) returns Curve from Geom
---Purpose:
-- Provides a curve inherited from Hcurve from Adaptor.
-- This is inherited to provide easy to use constructors.
---C++: return const&
---C++: inline
is static;
FirstParameter(me) returns Real
---C++: inline
is redefined static;
LastParameter(me) returns Real
---C++: inline
is redefined static;
Continuity(me) returns Shape from GeomAbs
is redefined static;
NbIntervals(me:in out; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(me) >= <S>
is redefined static;
Intervals(me: in out; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
--
-- The array must provide enough room to accomodate
-- for the parameters. i.e. T.Length() > NbIntervals()
raises
OutOfRange from Standard
is redefined static;
Trim(me; First, Last, Tol : Real) returns HCurve from Adaptor3d
---Purpose: Returns a curve equivalent of <me> between
-- parameters <First> and <Last>. <Tol> is used to
-- test for 3d points confusion.
raises
OutOfRange from Standard
---Purpose: If <First> >= <Last>
is redefined static;
IsClosed(me) returns Boolean
is redefined static;
IsPeriodic(me) returns Boolean
is redefined static;
Period(me) returns Real
raises
DomainError from Standard -- if the curve is not periodic
is redefined static;
Value(me; U : Real) returns Pnt from gp
--- Purpose : Computes the point of parameter U on the curve
is redefined static;
D0 (me; U : Real; P : out Pnt from gp)
--- Purpose : Computes the point of parameter U.
is redefined static;
D1 (me; U : Real; P : out Pnt from gp ; V : out Vec from gp)
--- Purpose : Computes the point of parameter U on the curve
-- with its first derivative.
--
-- Warning : On the specific case of BSplineCurve:
-- if the curve is cut in interval of continuity at least C1, the
-- derivatives are computed on the current interval.
-- else the derivatives are computed on the basis curve.
is redefined static;
D2 (me; U : Real; P : out Pnt from gp; V1, V2 : out Vec from gp)
--- Purpose :
-- Returns the point P of parameter U, the first and second
-- derivatives V1 and V2.
--
-- Warning : On the specific case of BSplineCurve:
-- if the curve is cut in interval of continuity at least C2, the
-- derivatives are computed on the current interval.
-- else the derivatives are computed on the basis curve.
is redefined static;
D3 (me; U : Real; P : out Pnt from gp; V1, V2, V3 : out Vec from gp)
--- Purpose :
-- Returns the point P of parameter U, the first, the second
-- and the third derivative.
--
-- Warning : On the specific case of BSplineCurve:
-- if the curve is cut in interval of continuity at least C3, the
-- derivatives are computed on the current interval.
-- else the derivatives are computed on the basis curve.
is redefined static;
DN (me; U : Real; N : Integer) returns Vec from gp
--- Purpose :
-- The returned vector gives the value of the derivative for the
-- order of derivation N.
-- Warning : On the specific case of BSplineCurve:
-- if the curve is cut in interval of continuity CN, the
-- derivatives are computed on the current interval.
-- else the derivatives are computed on the basis curve.
raises
OutOfRange from Standard
--- Purpose : Raised if N < 1.
is redefined static;
Resolution(me; R3d :Real) returns Real
---Purpose : returns the parametric resolution
is redefined static;
GetType(me) returns CurveType from GeomAbs
---C++: inline
is redefined static;
Line(me) returns Lin from gp
raises
NoSuchObject from Standard
is redefined static;
Circle(me) returns Circ from gp
raises
NoSuchObject from Standard
is redefined static;
Ellipse(me) returns Elips from gp
raises
NoSuchObject from Standard
is redefined static;
Hyperbola(me) returns Hypr from gp
raises
NoSuchObject from Standard
is redefined static;
Parabola(me) returns Parab from gp
raises
NoSuchObject from Standard
is redefined static;
Degree(me) returns Integer
raises
NoSuchObject from Standard
is redefined static;
---Purpose:
-- this should NEVER make a copy
-- of the underlying curve to read
-- the relevant information
--
IsRational(me) returns Boolean
raises
NoSuchObject from Standard
is redefined static;
---Purpose:
-- this should NEVER make a copy
-- of the underlying curve to read
-- the relevant information
--
NbPoles(me) returns Integer
raises
NoSuchObject from Standard
is redefined static;
---Purpose:
-- this should NEVER make a copy
-- of the underlying curve to read
-- the relevant information
--
NbKnots(me) returns Integer
raises
NoSuchObject from Standard
is redefined static;
---Purpose:
-- this should NEVER make a copy
-- of the underlying curve to read
-- the relevant information
--
Bezier(me) returns BezierCurve from Geom
raises
NoSuchObject from Standard
is redefined static;
---Purpose : this will NOT make a copy of the
-- Bezier Curve : If you want to modify
-- the Curve please make a copy yourself
-- Also it will NOT trim the surface to
-- myFirst/Last.
BSpline(me) returns BSplineCurve from Geom
raises
NoSuchObject from Standard
is redefined static;
---Purpose : this will NOT make a copy of the
-- BSpline Curve : If you want to modify
-- the Curve please make a copy yourself
-- Also it will NOT trim the surface to
-- myFirst/Last.
LocalContinuity(me; U1, U2 : Real) returns Shape from GeomAbs
is static private;
fields
myCurve : Curve from Geom ;
myTypeCurve : CurveType from GeomAbs ;
myFirst : Real from Standard ;
myLast : Real from Standard;
friends
class Surface from GeomAdaptor
end Curve;

View File

@@ -0,0 +1,843 @@
// File: GeomAdaptor_Curve.cxx
// Created: Thu Apr 29 11:54:32 1993
// Author: Bruno DUMORTIER
// Copyright: OPEN CASCADE 1993
// 20/02/97 : PMN -> Positionement local sur BSpline (PRO6902)
// 10/07/97 : PMN -> Pas de calcul de resolution dans Nb(Intervals)(PRO9248)
// 20/10/97 : RBV -> traitement des offset curves
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#include <GeomAdaptor_Curve.ixx>
#include <GeomAdaptor_HCurve.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <BSplCLib.hxx>
#include <GeomAbs_Shape.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Precision.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Hyperbola.hxx>
//#include <GeomConvert_BSplineCurveKnotSplitting.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_NotImplemented.hxx>
#include <Geom_OffsetCurve.hxx>
#define myBspl (*((Handle(Geom_BSplineCurve)*)&myCurve))
#define PosTol Precision::PConfusion()/2
//=======================================================================
//function : LocalContinuity
//purpose : Computes the Continuity of a BSplineCurve
// between the parameters U1 and U2
// The continuity is C(d-m)
// with d = degree,
// m = max multiplicity of the Knots between U1 and U2
//=======================================================================
GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
const Standard_Real U2)
const
{
Standard_NoSuchObject_Raise_if(myTypeCurve!=GeomAbs_BSplineCurve," ");
Standard_Integer Nb = myBspl->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBspl->Knots(TK);
myBspl->Multiplicities(TM);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,U1,myBspl->IsPeriodic(),
1,Nb,Index1,newFirst);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,U2,myBspl->IsPeriodic(),
1,Nb,Index2,newLast);
if ( Abs(newFirst-TK(Index1+1))<Precision::PConfusion()) {
if (Index1 < Nb) Index1++;
}
if ( Abs(newLast-TK(Index2))<Precision::PConfusion())
Index2--;
Standard_Integer MultMax;
// attention aux courbes peridiques.
if ( (myBspl->IsPeriodic()) && (Index1 == Nb) )
Index1 = 1;
if ( Index2 - Index1 <= 0) {
MultMax = 100; // CN entre 2 Noeuds consecutifs
}
else {
MultMax = TM(Index1+1);
for(Standard_Integer i = Index1+1;i<=Index2;i++) {
if ( TM(i)>MultMax) MultMax=TM(i);
}
MultMax = myBspl->Degree() - MultMax;
}
if ( MultMax <= 0) {
return GeomAbs_C0;
}
else if ( MultMax == 1) {
return GeomAbs_C1;
}
else if ( MultMax == 2) {
return GeomAbs_C2;
}
else if ( MultMax == 3) {
return GeomAbs_C3;
}
else {
return GeomAbs_CN;
}
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void GeomAdaptor_Curve::Load(const Handle(Geom_Curve)& C,
const Standard_Real UFirst,
const Standard_Real ULast)
{
if ( UFirst > ULast) Standard_ConstructionError::Raise();
myFirst = UFirst;
myLast = ULast;
if ( myCurve != C) {
myCurve = C;
const Handle(Standard_Type)& TheType = C->DynamicType();
if ( TheType == STANDARD_TYPE(Geom_TrimmedCurve)) {
Load((*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve(),UFirst,ULast);
}
else if ( TheType == STANDARD_TYPE(Geom_Circle)) {
myTypeCurve = GeomAbs_Circle;
}
else if ( TheType ==STANDARD_TYPE(Geom_Line)) {
myTypeCurve = GeomAbs_Line;
}
else if ( TheType == STANDARD_TYPE(Geom_Ellipse)) {
myTypeCurve = GeomAbs_Ellipse;
}
else if ( TheType == STANDARD_TYPE(Geom_Parabola)) {
myTypeCurve = GeomAbs_Parabola;
}
else if ( TheType == STANDARD_TYPE(Geom_Hyperbola)) {
myTypeCurve = GeomAbs_Hyperbola;
}
else if ( TheType == STANDARD_TYPE(Geom_BezierCurve)) {
myTypeCurve = GeomAbs_BezierCurve;
}
else if ( TheType == STANDARD_TYPE(Geom_BSplineCurve)) {
myTypeCurve = GeomAbs_BSplineCurve;
}
else {
myTypeCurve = GeomAbs_OtherCurve;
}
}
}
// --
// -- Global methods - Apply to the whole curve.
// --
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
{
if (myTypeCurve == GeomAbs_BSplineCurve)
return LocalContinuity(myFirst, myLast);
if (myCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
{
const GeomAbs_Shape S =
(*((Handle(Geom_OffsetCurve)*)&myCurve))->BasisCurve()->Continuity();
switch(S)
{
case GeomAbs_CN: return GeomAbs_CN;
case GeomAbs_C3: return GeomAbs_C2;
case GeomAbs_C2: return GeomAbs_C1;
case GeomAbs_C1: return GeomAbs_C0;
default:
Standard_NoSuchObject::Raise("GeomAdaptor_Curve::Continuity");
}
}
else if (myTypeCurve == GeomAbs_OtherCurve) {
Standard_NoSuchObject::Raise("GeomAdaptor_Curve::Contunuity");
}
return GeomAbs_CN;
}
//=======================================================================
//function : NbIntervals
//purpose :
//=======================================================================
Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S)
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBspl->FirstUKnotIndex();
Standard_Integer LastIndex = myBspl->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
Standard_Integer Cont;
switch ( S) {
case GeomAbs_G1:
case GeomAbs_G2:
Standard_DomainError::Raise("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if ( S == GeomAbs_C1) Cont = 1;
else if ( S == GeomAbs_C2) Cont = 2;
else if ( S == GeomAbs_C3) Cont = 3;
else Cont = myBspl->Degree();
Standard_Integer FirstIndex = myBspl->FirstUKnotIndex();
Standard_Integer LastIndex = myBspl->LastUKnotIndex();
Standard_Integer Degree = myBspl->Degree();
Standard_Integer NbKnots = myBspl->NbKnots();
TColStd_Array1OfInteger Mults (1, NbKnots);
myBspl->Multiplicities (Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter (NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults (Index) < Cont)
{
Inter (NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter (NbSplit) = Index;
Standard_Integer NbInt = NbSplit-1;
Standard_Integer Nb = myBspl->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBspl->Knots(TK);
myBspl->Multiplicities(TM);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,myFirst,
myBspl->IsPeriodic(),
1,Nb,Index1,newFirst);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,myLast,
myBspl->IsPeriodic(),
1,Nb,Index2,newLast);
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
if ( newLast-TK(Index2)> Eps) Index2++;
myNbIntervals = 1;
for ( Standard_Integer i=1; i<=NbInt; i++)
if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
}
break;
}
}
}
else if (myCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))){
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
case GeomAbs_G2:
Standard_DomainError::Raise("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
((*((Handle(Geom_OffsetCurve)*)&myCurve))->BasisCurve());
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the number of intervals obtained from the basis to
// vvv reflect parameter bounds
Standard_Integer iNbBasisInt = C.NbIntervals(BaseS), iInt;
if (iNbBasisInt>1)
{
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
C.Intervals(rdfInter,BaseS);
for (iInt=1; iInt<=iNbBasisInt; iInt++)
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
myNbIntervals++;
}
// akm 05/04/02 ^^^
}
return myNbIntervals;
}
//=======================================================================
//function : Intervals
//purpose :
//=======================================================================
void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
const GeomAbs_Shape S )
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve)
{
Standard_Integer FirstIndex = myBspl->FirstUKnotIndex();
Standard_Integer LastIndex = myBspl->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
Standard_Integer Cont;
switch ( S) {
case GeomAbs_G1:
case GeomAbs_G2:
Standard_DomainError::Raise("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if ( S == GeomAbs_C1) Cont = 1;
else if ( S == GeomAbs_C2) Cont = 2;
else if ( S == GeomAbs_C3) Cont = 3;
else Cont = myBspl->Degree();
Standard_Integer FirstIndex = myBspl->FirstUKnotIndex();
Standard_Integer LastIndex = myBspl->LastUKnotIndex();
Standard_Integer Degree = myBspl->Degree();
Standard_Integer NbKnots = myBspl->NbKnots();
TColStd_Array1OfInteger Mults (1, NbKnots);
myBspl->Multiplicities (Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter (NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults (Index) < Cont)
{
Inter (NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter (NbSplit) = Index;
Standard_Integer NbInt = NbSplit-1;
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
// Standard_Integer NbInt = Convector.NbSplits()-1;
// TColStd_Array1OfInteger Inter(1,NbInt+1);
// Convector.Splitting( Inter);
Standard_Integer Nb = myBspl->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBspl->Knots(TK);
myBspl->Multiplicities(TM);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,myFirst,
myBspl->IsPeriodic(),
1,Nb,Index1,newFirst);
BSplCLib::LocateParameter(myBspl->Degree(),TK,TM,myLast,
myBspl->IsPeriodic(),
1,Nb,Index2,newLast);
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
if ( newLast-TK(Index2)> Eps) Index2++;
Inter( 1) = Index1;
myNbIntervals = 1;
for ( Standard_Integer i=1; i<=NbInt; i++) {
if (Inter(i) > Index1 && Inter(i)<Index2 ) {
myNbIntervals++;
Inter(myNbIntervals) = Inter(i);
}
}
Inter(myNbIntervals+1) = Index2;
for (Standard_Integer I=1;I<=myNbIntervals+1;I++) {
T(I) = TK(Inter(I));
}
}
break;
}
}
}
else if (myCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))){
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
case GeomAbs_G2:
Standard_DomainError::Raise("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
((*((Handle(Geom_OffsetCurve)*)&myCurve))->BasisCurve());
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the array of intervals obtained from the basis to
// vvv reflect parameter bounds
Standard_Integer iNbBasisInt = C.NbIntervals(BaseS), iInt;
if (iNbBasisInt>1)
{
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
C.Intervals(rdfInter,BaseS);
for (iInt=1; iInt<=iNbBasisInt; iInt++)
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
T(++myNbIntervals)=rdfInter(iInt);
}
// old - myNbIntervals = C.NbIntervals(BaseS);
// old - C.Intervals(T, BaseS);
// akm 05/04/02 ^^^
}
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
}
//=======================================================================
//function : Trim
//purpose :
//=======================================================================
Handle(Adaptor3d_HCurve) GeomAdaptor_Curve::Trim(const Standard_Real First,
const Standard_Real Last,
const Standard_Real /*Tol*/) const
{
return Handle(GeomAdaptor_HCurve)(new GeomAdaptor_HCurve(myCurve,First,Last));
}
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
Standard_Boolean GeomAdaptor_Curve::IsClosed() const
{
if (!Precision::IsPositiveInfinite(myLast) &&
!Precision::IsNegativeInfinite(myFirst))
{
const gp_Pnt Pd = Value(myFirst);
const gp_Pnt Pf = Value(myLast);
return (Pd.Distance(Pf) <= Precision::Confusion());
}
return Standard_False;
}
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
Standard_Boolean GeomAdaptor_Curve::IsPeriodic() const
{
return (myCurve->IsPeriodic()? IsClosed() : Standard_False);
}
//=======================================================================
//function : Period
//purpose :
//=======================================================================
Standard_Real GeomAdaptor_Curve::Period() const
{
return myCurve->LastParameter() - myCurve->FirstParameter();
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
gp_Pnt GeomAdaptor_Curve::Value(const Standard_Real U) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve)&&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
return myBspl->LocalValue(U, Ideb, Ifin);
}
return myCurve->Value(U);
}
//=======================================================================
//function : D0
//purpose :
//=======================================================================
void GeomAdaptor_Curve::D0(const Standard_Real U, gp_Pnt& P) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve)&&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
myBspl->LocalD0( U, Ideb, Ifin, P);
}
else {
myCurve->D0(U, P);
}
}
//=======================================================================
//function : D1
//purpose :
//=======================================================================
void GeomAdaptor_Curve::D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve)&&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
myBspl->LocalD1( U, Ideb, Ifin, P, V);
}
else {
myCurve->D1( U, P, V);
}
}
//=======================================================================
//function : D2
//purpose :
//=======================================================================
void GeomAdaptor_Curve::D2(const Standard_Real U,
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve)&&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
myBspl->LocalD2( U, Ideb, Ifin, P, V1, V2);
}
else {
myCurve->D2( U, P, V1, V2);
}
}
//=======================================================================
//function : D3
//purpose :
//=======================================================================
void GeomAdaptor_Curve::D3(const Standard_Real U,
gp_Pnt& P, gp_Vec& V1,
gp_Vec& V2, gp_Vec& V3) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve) &&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
myBspl->LocalD3( U, Ideb, Ifin, P, V1, V2, V3);
}
else {
myCurve->D3( U, P, V1, V2, V3);
}
}
//=======================================================================
//function : DN
//purpose :
//=======================================================================
gp_Vec GeomAdaptor_Curve::DN(const Standard_Real U,
const Standard_Integer N) const
{
if ( (myTypeCurve == GeomAbs_BSplineCurve) &&
(U==myFirst || U==myLast) ) {
Standard_Integer Ideb, Ifin;
if (U==myFirst) {
myBspl->LocateU(myFirst, PosTol, Ideb, Ifin);
if (Ideb<1) Ideb=1;
if (Ideb>=Ifin) Ifin = Ideb+1;
}
if (U==myLast) {
myBspl->LocateU(myLast, PosTol, Ideb, Ifin);
if (Ifin>myBspl->NbKnots()) Ifin = myBspl->NbKnots();
if (Ideb>=Ifin) Ideb = Ifin-1;
}
return myBspl->LocalDN( U, Ideb, Ifin, N);
}
else {
return myCurve->DN( U, N);
}
}
//=======================================================================
//function : Resolution
//purpose :
//=======================================================================
Standard_Real GeomAdaptor_Curve::Resolution(const Standard_Real R3D) const
{
switch ( myTypeCurve) {
case GeomAbs_Line :
return R3D;
case GeomAbs_Circle: {
Standard_Real R = (*((Handle(Geom_Circle)*)&myCurve))->Circ().Radius();
if ( R > R3D/2. )
return 2*ASin(R3D/(2*R));
else
return 2*PI;
}
case GeomAbs_Ellipse: {
return R3D / (*((Handle(Geom_Ellipse)*)&myCurve))->MajorRadius();
}
case GeomAbs_BezierCurve: {
Standard_Real res;
(*((Handle(Geom_BezierCurve)*)&myCurve))->Resolution(R3D,res);
return res;
}
case GeomAbs_BSplineCurve: {
Standard_Real res;
(*((Handle(Geom_BSplineCurve)*)&myCurve))->Resolution(R3D,res);
return res;
}
default:
return Precision::Parametric(R3D);
}
}
// --
// -- The following methods must be called when GetType returned
// -- the corresponding type.
// --
//=======================================================================
//function : Line
//purpose :
//=======================================================================
gp_Lin GeomAdaptor_Curve::Line() const
{
Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Line, "");
return (*((Handle(Geom_Line)*)&myCurve))->Lin();
}
//=======================================================================
//function : Circle
//purpose :
//=======================================================================
gp_Circ GeomAdaptor_Curve::Circle() const
{
Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Circle, "");
return (*((Handle(Geom_Circle)*)&myCurve))->Circ();
}
//=======================================================================
//function : Ellipse
//purpose :
//=======================================================================
gp_Elips GeomAdaptor_Curve::Ellipse() const
{
Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Ellipse, "");
return (*((Handle(Geom_Ellipse)*)&myCurve))->Elips();
}
//=======================================================================
//function : Hyperbola
//purpose :
//=======================================================================
gp_Hypr GeomAdaptor_Curve::Hyperbola() const
{
Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Hyperbola, "");
return (*((Handle(Geom_Hyperbola)*)&myCurve))->Hypr();
}
//=======================================================================
//function : Parabola
//purpose :
//=======================================================================
gp_Parab GeomAdaptor_Curve::Parabola() const
{
Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Parabola, "");
return (*((Handle(Geom_Parabola)*)&myCurve))->Parab();
}
//=======================================================================
//function : Degree
//purpose :
//=======================================================================
Standard_Integer GeomAdaptor_Curve::Degree() const
{
if (myTypeCurve == GeomAbs_BezierCurve)
return (*((Handle(Geom_BezierCurve)*)&myCurve))->Degree();
else if (myTypeCurve == GeomAbs_BSplineCurve)
return (*((Handle(Geom_BSplineCurve)*)&myCurve))->Degree();
else
Standard_NoSuchObject::Raise();
// portage WNT
return 0;
}
//=======================================================================
//function : IsRational
//purpose :
//=======================================================================
Standard_Boolean GeomAdaptor_Curve::IsRational() const {
switch( myTypeCurve) {
case GeomAbs_BSplineCurve:
return (*((Handle(Geom_BSplineCurve)*)&myCurve))->IsRational();
case GeomAbs_BezierCurve:
return (*((Handle(Geom_BezierCurve)*)&myCurve))->IsRational();
default:
return Standard_False;
}
}
//=======================================================================
//function : NbPoles
//purpose :
//=======================================================================
Standard_Integer GeomAdaptor_Curve::NbPoles() const
{
if (myTypeCurve == GeomAbs_BezierCurve)
return (*((Handle(Geom_BezierCurve)*)&myCurve))->NbPoles();
else if (myTypeCurve == GeomAbs_BSplineCurve)
return (*((Handle(Geom_BSplineCurve)*)&myCurve))->NbPoles();
else
Standard_NoSuchObject::Raise();
// portage WNT
return 0;
}
//=======================================================================
//function : NbKnots
//purpose :
//=======================================================================
Standard_Integer GeomAdaptor_Curve::NbKnots() const
{
if ( myTypeCurve != GeomAbs_BSplineCurve)
Standard_NoSuchObject::Raise("GeomAdaptor_Curve::NbKnots");
return (*((Handle(Geom_BSplineCurve)*)&myCurve))->NbKnots();
}
//=======================================================================
//function : Bezier
//purpose :
//=======================================================================
Handle(Geom_BezierCurve) GeomAdaptor_Curve::Bezier() const
{
if ( myTypeCurve != GeomAbs_BezierCurve)
Standard_NoSuchObject::Raise("GeomAdaptor_Curve::Bezier");
return *((Handle(Geom_BezierCurve)*)&myCurve);
}
//=======================================================================
//function : BSpline
//purpose :
//=======================================================================
Handle(Geom_BSplineCurve) GeomAdaptor_Curve::BSpline() const
{
if ( myTypeCurve != GeomAbs_BSplineCurve)
Standard_NoSuchObject::Raise("GeomAdaptor_Curve::BSpline");
return *((Handle(Geom_BSplineCurve)*)&myCurve);
}

View File

@@ -0,0 +1,89 @@
// File: GeomAdaptor_Curve.lxx
// Created: Thu Apr 29 11:54:32 1993
// Author: Bruno DUMORTIER
// Copyright: OPEN CASCADE 1993
#include <gp_Pnt.hxx>
#include <Geom_Curve.hxx>
//=======================================================================
//function : GeomAdaptor_Curve
//purpose :
//=======================================================================
inline GeomAdaptor_Curve::GeomAdaptor_Curve()
{
}
//=======================================================================
//function : GeomAdaptor_Curve
//purpose :
//=======================================================================
inline GeomAdaptor_Curve::GeomAdaptor_Curve(const Handle(Geom_Curve)& C)
{
Load(C,C->FirstParameter(),C->LastParameter());
}
//=======================================================================
//function : GeomAdaptor_Curve
//purpose :
//=======================================================================
inline GeomAdaptor_Curve::GeomAdaptor_Curve(const Handle(Geom_Curve)& C,
const Standard_Real UFirst,
const Standard_Real ULast)
{
if (UFirst > ULast) Standard_ConstructionError::Raise();
Load(C,UFirst,ULast);
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
inline void GeomAdaptor_Curve::Load(const Handle(Geom_Curve)& C)
{
Load(C,C->FirstParameter(),C->LastParameter());
}
//=======================================================================
//function : FirstParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Curve::FirstParameter() const
{
return myFirst;
}
//=======================================================================
//function : LastParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Curve::LastParameter() const
{
return myLast;
}
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
inline const Handle(Geom_Curve)& GeomAdaptor_Curve::Curve() const
{
return myCurve;
}
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_CurveType GeomAdaptor_Curve::GetType() const
{
return myTypeCurve;
}

View File

@@ -0,0 +1,38 @@
-- File: GeomAdaptor_HCurve.cdl
-- Created: Fri Aug 25 14:35:04 1995
-- Author: Remi LEQUETTE
---Copyright: Matra Datavision 1995
class HCurve from GeomAdaptor inherits GHCurve from GeomAdaptor
---Purpose: An interface between the services provided by any
-- curve from the package Geom and those required of
-- the curve by algorithms which use it.
uses
Curve from Geom,
Curve from GeomAdaptor
raises
ConstructionError from Standard
is
Create returns mutable HCurve from GeomAdaptor;
---C++: inline
Create( AS : Curve from GeomAdaptor) returns mutable HCurve from GeomAdaptor;
---C++: inline
Create( S : Curve from Geom) returns mutable HCurve from GeomAdaptor;
---C++: inline
Create( S : Curve from Geom; UFirst,ULast : Real)
returns mutable HCurve from GeomAdaptor
---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
---C++: inline
raises ConstructionError from Standard;
end HCurve;

View File

@@ -0,0 +1,6 @@
// File: GeomAdaptor_HCurve.cxx
// Created: Fri Aug 25 14:40:42 1995
// Author: Remi LEQUETTE
// Copyright: OPEN CASCADE 1995
#include <GeomAdaptor_HCurve.ixx>

View File

@@ -0,0 +1,46 @@
// File: GeomAdaptor_HCurve.lxx
// Created: Fri Aug 25 14:40:42 1995
// Author: Remi LEQUETTE
// Copyright: OPEN CASCADE 1995
//=======================================================================
//function : GeomAdaptor_HCurve
//purpose :
//=======================================================================
inline GeomAdaptor_HCurve::GeomAdaptor_HCurve()
{
}
//=======================================================================
//function : GeomAdaptor_HCurve
//purpose :
//=======================================================================
inline GeomAdaptor_HCurve::GeomAdaptor_HCurve(const GeomAdaptor_Curve& AS) :
GeomAdaptor_GHCurve(AS)
{
}
//=======================================================================
//function : GeomAdaptor_HCurve
//purpose :
//=======================================================================
inline GeomAdaptor_HCurve::GeomAdaptor_HCurve(const Handle(Geom_Curve)& S)
{
ChangeCurve().Load(S);
}
//=======================================================================
//function : GeomAdaptor_HCurve
//purpose :
//=======================================================================
inline GeomAdaptor_HCurve::GeomAdaptor_HCurve(const Handle(Geom_Curve)& S,
const Standard_Real UFirst,
const Standard_Real ULast)
{
ChangeCurve().Load(S,UFirst,ULast);
}

View File

@@ -0,0 +1,39 @@
-- File: GeomAdaptor_HSurface.cdl
-- Created: Fri Aug 25 14:31:20 1995
-- Author: Remi LEQUETTE
---Copyright: Matra Datavision 1995
class HSurface from GeomAdaptor inherits GHSurface from GeomAdaptor
---Purpose: An interface between the services provided by any
-- surface from the package Geom and those required
-- of the surface by algorithms which use it.
uses
Surface from Geom,
Surface from GeomAdaptor
raises
ConstructionError from Standard
is
Create returns mutable HSurface from GeomAdaptor;
---C++: inline
Create( AS : Surface from GeomAdaptor) returns mutable HSurface from GeomAdaptor;
---C++: inline
Create( S : Surface from Geom) returns mutable HSurface from GeomAdaptor;
---C++: inline
Create( S : Surface from Geom; UFirst,ULast,VFirst,VLast : Real;
TolU : Real = 0.0;
TolV : Real = 0.0)
returns mutable HSurface from GeomAdaptor
raises ConstructionError from Standard;
---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
---C++: inline
end HSurface;

View File

@@ -0,0 +1,6 @@
// File: GeomAdaptor_HSurface.cxx
// Created: Fri Aug 25 14:44:25 1995
// Author: Remi LEQUETTE
// Copyright: OPEN CASCADE 1995
#include <GeomAdaptor_HSurface.ixx>

View File

@@ -0,0 +1,50 @@
// File: GeomAdaptor_HSurface.lxx
// Created: Fri Aug 25 14:44:25 1995
// Author: Remi LEQUETTE
// Copyright: OPEN CASCADE 1995
//=======================================================================
//function : GeomAdaptor_HSurface
//purpose :
//=======================================================================
inline GeomAdaptor_HSurface::GeomAdaptor_HSurface()
{
}
//=======================================================================
//function : GeomAdaptor_HSurface
//purpose :
//=======================================================================
inline GeomAdaptor_HSurface::GeomAdaptor_HSurface(const GeomAdaptor_Surface& AS) :
GeomAdaptor_GHSurface(AS)
{
}
//=======================================================================
//function : GeomAdaptor_HSurface
//purpose :
//=======================================================================
inline GeomAdaptor_HSurface::GeomAdaptor_HSurface(const Handle(Geom_Surface)& S)
{
ChangeSurface().Load(S);
}
//=======================================================================
//function : GeomAdaptor_HSurface
//purpose :
//=======================================================================
inline GeomAdaptor_HSurface::GeomAdaptor_HSurface(const Handle(Geom_Surface)& S,
const Standard_Real UFirst,
const Standard_Real ULast,
const Standard_Real VFirst,
const Standard_Real VLast,
const Standard_Real TolU,
const Standard_Real TolV)
{
ChangeSurface().Load(S,UFirst,ULast,VFirst,VLast,TolU,TolV);
}

View File

@@ -0,0 +1,382 @@
-- File: GeomAdaptor_Surface.cdl
-- Created: Fri May 14 15:08:27 1993
-- Author: Bruno DUMORTIER
---Copyright: Matra Datavision 1993
class Surface from GeomAdaptor inherits Surface from Adaptor3d
---Purpose: An interface between the services provided by any
-- surface from the package Geom and those required
-- of the surface by algorithms which use it.
uses
Pnt from gp,
Vec from gp,
Dir from gp,
Pln from gp,
Cone from gp,
Cylinder from gp,
Sphere from gp,
Torus from gp,
Ax1 from gp,
Array1OfReal from TColStd,
Surface from Geom,
BezierSurface from Geom,
BSplineSurface from Geom,
SurfaceType from GeomAbs,
Shape from GeomAbs,
Curve from GeomAdaptor,
HCurve from Adaptor3d,
HSurface from Adaptor3d
raises
NoSuchObject from Standard,
OutOfRange from Standard,
ConstructionError from Standard,
DomainError from Standard
is
Create returns Surface from GeomAdaptor;
---C++: inline
Create( S : Surface from Geom) returns Surface from GeomAdaptor;
---C++: inline
Create( S : Surface from Geom; UFirst,ULast,VFirst,VLast : Real;
TolU : Real = 0.0;
TolV : Real = 0.0)
returns Surface from GeomAdaptor
raises ConstructionError from Standard;
---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
---C++: inline
Load(me : in out; S : Surface from Geom);
---C++: inline
Load(me : in out; S : Surface from Geom;
UFirst,ULast,VFirst,VLast : Real;
TolU : Real = 0.0;
TolV : Real = 0.0)
raises ConstructionError from Standard;
---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
Surface(me) returns Surface from Geom
---C++: return const&
---C++: inline
is static;
--
-- Global methods - Apply to the whole surface.
--
FirstUParameter(me) returns Real
---C++:inline
is redefined static;
LastUParameter(me) returns Real
---C++:inline
is redefined static;
FirstVParameter(me) returns Real
---C++:inline
is redefined static;
LastVParameter(me) returns Real
---C++:inline
is redefined static;
UContinuity(me) returns Shape from GeomAbs
is redefined static;
VContinuity(me) returns Shape from GeomAbs
is redefined static;
NbUIntervals(me; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of U intervals for continuity
-- <S>. May be one if UContinuity(me) >= <S>
is redefined static;
NbVIntervals(me; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of V intervals for continuity
-- <S>. May be one if VContinuity(me) >= <S>
is redefined static;
UIntervals(me; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs )
---Purpose: Returns the intervals with the requested continuity
-- in the U direction.
raises
OutOfRange from Standard -- if the Length of the array does
-- have enought slots to accomodate
-- the result.
is redefined static;
VIntervals(me; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs )
---Purpose: Returns the intervals with the requested continuity
-- in the V direction.
raises
OutOfRange from Standard -- if the Length of the array does
-- have enought slots to accomodate
-- the result.
is redefined static;
UTrim(me; First, Last, Tol : Real) returns HSurface from Adaptor3d
---Purpose: Returns a surface trimmed in the U direction
-- equivalent of <me> between
-- parameters <First> and <Last>. <Tol> is used to
-- test for 3d points confusion.
raises
OutOfRange from Standard
---Purpose: If <First> >= <Last>
is redefined static ;
VTrim(me; First, Last, Tol : Real) returns HSurface from Adaptor3d
---Purpose: Returns a surface trimmed in the V direction between
-- parameters <First> and <Last>. <Tol> is used to
-- test for 3d points confusion.
raises
OutOfRange from Standard
---Purpose: If <First> >= <Last>
is redefined static ;
IsUClosed(me) returns Boolean
is redefined static;
IsVClosed(me) returns Boolean
is redefined static;
IsUPeriodic(me) returns Boolean
is redefined static;
UPeriod(me) returns Real
raises
DomainError from Standard -- if the curve is not periodic
is redefined static;
IsVPeriodic(me) returns Boolean
is redefined static;
VPeriod(me) returns Real
raises
DomainError from Standard -- if the curve is not periodic
is redefined static;
Value (me; U, V : Real) returns Pnt from gp
--- Purpose : Computes the point of parameters U,V on the surface.
is redefined static;
D0 (me; U, V : Real;
P : out Pnt from gp)
--- Purpose : Computes the point of parameters U,V on the surface.
is redefined static;
D1 (me; U, V : Real;
P : out Pnt from gp;
D1U, D1V : out Vec from gp)
--- Purpose : Computes the point and the first derivatives on
-- the surface.
--
-- Warning : On the specific case of BSplineSurface:
-- if the surface is cut in interval of continuity at least C1,
-- the derivatives are computed on the current interval.
-- else the derivatives are computed on the basis surface.
is redefined static;
D2 (me; U, V : Real;
P : out Pnt from gp;
D1U, D1V : out Vec from gp;
D2U, D2V : out Vec from gp;
D2UV : out Vec from gp)
--- Purpose : Computes the point, the first and second
-- derivatives on the surface.
--
-- Warning : On the specific case of BSplineSurface:
-- if the surface is cut in interval of continuity at least C2,
-- the derivatives are computed on the current interval.
-- else the derivatives are computed on the basis surface.
is redefined static;
D3 (me; U, V : Real;
P : out Pnt from gp;
D1U, D1V : out Vec from gp;
D2U, D2V : out Vec from gp;
D2UV : out Vec from gp;
D3U, D3V : out Vec from gp;
D3UUV, D3UVV : out Vec from gp)
--- Purpose : Computes the point, the first, second and third
-- derivatives on the surface.
--
-- Warning : On the specific case of BSplineSurface:
-- if the surface is cut in interval of continuity at least C3,
-- the derivatives are computed on the current interval.
-- else the derivatives are computed on the basis surface.
is redefined static;
DN (me; U, V : Real; Nu, Nv : Integer)
returns Vec from gp
--- Purpose : Computes the derivative of order Nu in the
-- direction U and Nv in the direction V at the point P(U, V).
--
-- Warning : On the specific case of BSplineSurface:
-- if the surface is cut in interval of continuity CN,
-- the derivatives are computed on the current interval.
-- else the derivatives are computed on the basis surface.
raises
OutOfRange from Standard
--- Purpose : Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
is redefined static;
UResolution(me; R3d : Real ) returns Real
---Purpose : Returns the parametric U resolution corresponding
-- to the real space resolution <R3d>.
is redefined static;
VResolution(me; R3d : Real ) returns Real
---Purpose : Returns the parametric V resolution corresponding
-- to the real space resolution <R3d>.
is redefined static;
GetType(me) returns SurfaceType from GeomAbs
---Purpose: Returns the type of the surface : Plane, Cylinder,
-- Cone, Sphere, Torus, BezierSurface,
-- BSplineSurface, SurfaceOfRevolution,
-- SurfaceOfExtrusion, OtherSurface
---C++:inline
is redefined static;
--
-- The following methods must be called when GetType returned
-- the corresponding type.
--
Plane(me) returns Pln from gp
raises NoSuchObject from Standard
is redefined static;
Cylinder(me) returns Cylinder from gp
raises NoSuchObject from Standard
is redefined static;
Cone(me) returns Cone from gp
raises NoSuchObject from Standard
is redefined static;
Sphere(me) returns Sphere from gp
raises NoSuchObject from Standard
is redefined static;
Torus(me) returns Torus from gp
raises NoSuchObject from Standard
is redefined static;
UDegree(me) returns Integer
raises NoSuchObject from Standard
is redefined static;
NbUPoles(me) returns Integer
raises NoSuchObject from Standard
is redefined static;
VDegree(me) returns Integer
raises NoSuchObject from Standard
is redefined static;
NbVPoles(me) returns Integer
raises NoSuchObject from Standard
is redefined static;
NbUKnots(me) returns Integer
raises
NoSuchObject from Standard
is redefined static;
NbVKnots(me) returns Integer
raises
NoSuchObject from Standard
is redefined static;
IsURational(me) returns Boolean
raises
NoSuchObject from Standard
is redefined static;
IsVRational(me) returns Boolean
raises
NoSuchObject from Standard
is redefined static;
Bezier(me) returns BezierSurface from Geom
---Purpose: This will NOT make a copy of the
-- Bezier Surface : If you want to modify
-- the Surface please make a copy yourself
-- Also it will NOT trim the surface to
-- myU/VFirst/Last.
raises
NoSuchObject from Standard
is redefined static;
BSpline(me) returns BSplineSurface from Geom
---Purpose: This will NOT make a copy of the
-- BSpline Surface : If you want to modify
-- the Surface please make a copy yourself
-- Also it will NOT trim the surface to
-- myU/VFirst/Last.
raises
NoSuchObject from Standard
is redefined static;
AxeOfRevolution(me) returns Ax1 from gp
raises
NoSuchObject from Standard -- only for SurfaceOfRevolution
is redefined static;
Direction(me) returns Dir from gp
raises
NoSuchObject from Standard -- only for SurfaceOfExtrusion
is redefined static;
BasisCurve(me) returns HCurve from Adaptor3d
raises
NoSuchObject from Standard -- only for SurfaceOfExtrusion
is redefined static;
BasisSurface(me) returns HSurface from Adaptor3d
raises
NoSuchObject from Standard -- only for Offset Surface
is redefined static;
OffsetValue(me) returns Real from Standard
raises
NoSuchObject from Standard -- only for Offset Surface
is redefined static;
Span (me;Side :Integer; Ideb,Ifin:Integer;
OutIdeb,OutIfin:out Integer;
NbKnots : Integer )
is private;
IfUVBound (me;U,V :Real;Ideb,Ifin,IVdeb,IVfin :out Integer;
USide,VSide: Integer)
returns Boolean from Standard
is private;
fields
mySurface : Surface from Geom;
mySurfaceType : SurfaceType from GeomAbs;
myUFirst : Real from Standard;
myULast : Real from Standard;
myVFirst : Real from Standard;
myVLast : Real from Standard;
myTolU, myTolV : Real from Standard;
end Surface;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
// File: GeomAdaptor_Surface.lxx
// Created: Tue May 18 16:12:12 1993
// Author: Bruno DUMORTIER
// Copyright: OPEN CASCADE 1993
#include <Geom_Surface.hxx>
//=======================================================================
//function : GeomAdaptor_Surface
//purpose :
//=======================================================================
inline GeomAdaptor_Surface::GeomAdaptor_Surface()
: myTolU(0.), myTolV(0.)
{}
//=======================================================================
//function : GeomAdaptor_Surface
//purpose :
//=======================================================================
inline GeomAdaptor_Surface::GeomAdaptor_Surface(const Handle(Geom_Surface)& S)
: myTolU(0.), myTolV(0.)
{
Load(S);
}
//=======================================================================
//function : GeomAdaptor_Surface
//purpose :
//=======================================================================
inline GeomAdaptor_Surface::GeomAdaptor_Surface(const Handle(Geom_Surface)& S,
const Standard_Real UFirst,
const Standard_Real ULast,
const Standard_Real VFirst,
const Standard_Real VLast,
const Standard_Real TolU,
const Standard_Real TolV)
{
Load(S,UFirst,ULast,VFirst,VLast,TolU,TolV);
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
inline void GeomAdaptor_Surface::Load(const Handle(Geom_Surface)& S)
{
Standard_Real U1,U2,V1,V2;
S->Bounds(U1,U2,V1,V2);
Load(S,U1,U2,V1,V2);
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
inline const Handle(Geom_Surface)& GeomAdaptor_Surface::Surface() const {
return mySurface;
}
//=======================================================================
//function : FirstUParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Surface::FirstUParameter() const {
return myUFirst;
}
//=======================================================================
//function : LastUParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Surface::LastUParameter() const {
return myULast;
}
//=======================================================================
//function : FirstVParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Surface::FirstVParameter() const {
return myVFirst;
}
//=======================================================================
//function : LastVParameter
//purpose :
//=======================================================================
inline Standard_Real GeomAdaptor_Surface::LastVParameter() const {
return myVLast;
}
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_SurfaceType GeomAdaptor_Surface::GetType() const {
return mySurfaceType;
}