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:
74
src/BRepAdaptor/BRepAdaptor.cdl
Executable file
74
src/BRepAdaptor/BRepAdaptor.cdl
Executable file
@@ -0,0 +1,74 @@
|
||||
-- File: BRepAdaptor.cdl
|
||||
-- Created: Fri Feb 19 11:02:26 1993
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
package BRepAdaptor
|
||||
|
||||
---Purpose: The BRepAdaptor package provides classes to access
|
||||
-- the geometry of the BRep models.
|
||||
--
|
||||
-- OverView of classes
|
||||
--
|
||||
-- * Surface : Provides the methods of Surface from
|
||||
-- Adpator on a Face.
|
||||
--
|
||||
-- * Curve : Provides the methods of Curve from
|
||||
-- Adaptor3d on an Edge.
|
||||
--
|
||||
-- * Curve2d : Provides the methods of Curve2d from
|
||||
-- Adaptor2d on an Edge on a Face.
|
||||
--
|
||||
|
||||
uses
|
||||
gp,
|
||||
TCollection,
|
||||
TColgp,
|
||||
TColStd,
|
||||
GeomAbs,
|
||||
Adaptor3d,
|
||||
Adaptor2d,
|
||||
Geom,
|
||||
Geom2d,
|
||||
GeomAdaptor,
|
||||
Geom2dAdaptor,
|
||||
TopoDS,
|
||||
BRep
|
||||
|
||||
is
|
||||
|
||||
class Surface;
|
||||
---Purpose: Transforms a Face in a Surface from Adaptor3d.
|
||||
|
||||
class Curve;
|
||||
---Purpose: Transforms an Edge in a Curve from Adaptor3d.
|
||||
|
||||
class Curve2d;
|
||||
---Purpose: Transforms an Edge on a Face in a Curve2d from
|
||||
-- Adaptor2d.
|
||||
|
||||
class CompCurve;
|
||||
---Purpose: Transforms a Wire in a Curve from Adaptor3d.
|
||||
|
||||
class HSurface instantiates GenHSurface from Adaptor3d
|
||||
(Surface from BRepAdaptor);
|
||||
|
||||
class HCurve instantiates GenHCurve from Adaptor3d
|
||||
(Curve from BRepAdaptor);
|
||||
|
||||
class HCurve2d instantiates GenHCurve2d from Adaptor2d
|
||||
(Curve2d from BRepAdaptor);
|
||||
|
||||
class HCompCurve instantiates GenHCurve from Adaptor3d
|
||||
(CompCurve from BRepAdaptor);
|
||||
|
||||
class Array1OfCurve
|
||||
instantiates Array1 from TCollection (Curve from BRepAdaptor);
|
||||
|
||||
class HArray1OfCurve
|
||||
instantiates HArray1 from TCollection (Curve from BRepAdaptor,
|
||||
Array1OfCurve from BRepAdaptor);
|
||||
|
||||
end BRepAdaptor;
|
268
src/BRepAdaptor/BRepAdaptor_CompCurve.cdl
Executable file
268
src/BRepAdaptor/BRepAdaptor_CompCurve.cdl
Executable file
@@ -0,0 +1,268 @@
|
||||
-- File: BRepAdaptor_CompCurve.cdl
|
||||
-- Created: Thu Aug 20 10:53:03 1998
|
||||
-- Author: Philippe MANGIN
|
||||
-- <pmn@sgi29>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class CompCurve from BRepAdaptor
|
||||
|
||||
inherits Curve from Adaptor3d
|
||||
|
||||
---Purpose: The Curve from BRepAdaptor allows to use a Wire
|
||||
-- of the BRep topology like a 3D curve.
|
||||
-- Warning: With this class of curve, C0 and C1 continuities
|
||||
-- are not assumed. So be carful with some algorithm!
|
||||
|
||||
uses
|
||||
Wire from TopoDS,
|
||||
Edge from TopoDS,
|
||||
CurveType from GeomAbs,
|
||||
Shape from GeomAbs,
|
||||
HCurve from Adaptor3d,
|
||||
HArray1OfCurve from BRepAdaptor,
|
||||
BezierCurve from Geom,
|
||||
BSplineCurve from Geom,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Circ from gp,
|
||||
Elips from gp,
|
||||
Hypr from gp,
|
||||
Parab from gp,
|
||||
Lin from gp
|
||||
|
||||
raises
|
||||
NullObject from Standard,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
Create returns CompCurve from BRepAdaptor;
|
||||
---Purpose: Creates an undefined Curve with no Wire loaded.
|
||||
|
||||
Create(W : Wire from TopoDS;
|
||||
KnotByCurvilinearAbcissa : Boolean = Standard_False)
|
||||
returns CompCurve from BRepAdaptor;
|
||||
|
||||
Create(W : Wire from TopoDS;
|
||||
KnotByCurvilinearAbcissa : Boolean;
|
||||
First, Last, Tol : Real)
|
||||
returns CompCurve from BRepAdaptor;
|
||||
---Purpose: Creates a Curve to acces to the geometry of edge
|
||||
-- <W>.
|
||||
--
|
||||
|
||||
Initialize(me : in out; W : Wire from TopoDS;
|
||||
KnotByCurvilinearAbcissa : Boolean)
|
||||
---Purpose: Sets the wire <W>.
|
||||
|
||||
is static;
|
||||
|
||||
Initialize(me : in out; W : Wire from TopoDS;
|
||||
KnotByCurvilinearAbcissa : Boolean;
|
||||
First, Last, Tol : Real )
|
||||
---Purpose: Sets wire <W> and trimmed parameter.
|
||||
is static;
|
||||
|
||||
SetPeriodic(me: in out; Periodic : Boolean)
|
||||
---Purpose: Set the flag Periodic.
|
||||
-- Warning: This method has no effect if the wire is not closed
|
||||
is static;
|
||||
|
||||
Wire(me) returns Wire from TopoDS
|
||||
---Purpose: Returns the wire.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Edge(me; U : Real;
|
||||
E : out Edge;
|
||||
UonE : out Real)
|
||||
---Purpose: returns an edge and one parameter on them
|
||||
-- corresponding to the parameter U.
|
||||
is static;
|
||||
|
||||
--
|
||||
-- Methods of Curve from GeomAdaptor.
|
||||
--
|
||||
|
||||
FirstParameter(me) returns Real
|
||||
is redefined static;
|
||||
|
||||
LastParameter(me) returns Real
|
||||
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.
|
||||
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C1.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C2.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C3.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard,
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not CN.
|
||||
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
|
||||
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;
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
NbPoles(me) returns Integer
|
||||
raises NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
NbKnots(me) returns Integer
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
|
||||
Bezier(me) returns BezierCurve from Geom
|
||||
---Warning :
|
||||
-- This will make a copy of the Bezier Curve .
|
||||
-- Be carefull when using this method
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
BSpline(me) returns BSplineCurve from Geom
|
||||
---Warning : This will make a copy of the BSpline Curve. Be
|
||||
-- carefull when using this method
|
||||
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
Prepare(me; W, D: in out Real; ind : in out Integer)
|
||||
is private;
|
||||
|
||||
InvPrepare(me; ind : Integer; F, D: in out Real)
|
||||
is private;
|
||||
|
||||
fields
|
||||
myWire : Wire from TopoDS;
|
||||
TFirst, TLast, PTol, myPeriod : Real;
|
||||
myCurves : HArray1OfCurve from BRepAdaptor;
|
||||
myKnots : HArray1OfReal from TColStd;
|
||||
CurIndex : Integer;
|
||||
Forward : Boolean;
|
||||
IsbyAC : Boolean;
|
||||
Periodic : Boolean;
|
||||
end CompCurve;
|
502
src/BRepAdaptor/BRepAdaptor_CompCurve.cxx
Executable file
502
src/BRepAdaptor/BRepAdaptor_CompCurve.cxx
Executable file
@@ -0,0 +1,502 @@
|
||||
// File: BRepAdaptor_CompCurve.cxx
|
||||
// Created: Thu Aug 20 11:16:25 1998
|
||||
// Author: Philippe MANGIN
|
||||
// <pmn@sgi29>
|
||||
|
||||
|
||||
#include <BRepAdaptor_CompCurve.ixx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_HCurve.hxx>
|
||||
#include <BRepAdaptor_HCompCurve.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
BRepAdaptor_CompCurve::BRepAdaptor_CompCurve()
|
||||
{
|
||||
}
|
||||
|
||||
BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& W,
|
||||
const Standard_Boolean AC)
|
||||
{
|
||||
Initialize(W, AC);
|
||||
}
|
||||
|
||||
BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& W,
|
||||
const Standard_Boolean AC,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(W, AC, First, Last, Tol);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W,
|
||||
const Standard_Boolean AC)
|
||||
{
|
||||
Standard_Integer ii, NbEdge;
|
||||
BRepTools_WireExplorer wexp;
|
||||
TopoDS_Edge E;
|
||||
|
||||
myWire = W;
|
||||
PTol = 0.0;
|
||||
IsbyAC = AC;
|
||||
|
||||
for (NbEdge=0, wexp.Init(myWire);
|
||||
wexp.More(); wexp.Next())
|
||||
if (! BRep_Tool::Degenerated(wexp.Current())) NbEdge++;
|
||||
|
||||
if (NbEdge == 0) return;
|
||||
|
||||
CurIndex = (NbEdge+1)/2;
|
||||
myCurves = new (BRepAdaptor_HArray1OfCurve) (1,NbEdge);
|
||||
myKnots = new (TColStd_HArray1OfReal) (1,NbEdge+1);
|
||||
myKnots->SetValue(1, 0.);
|
||||
|
||||
for (ii=0, wexp.Init(myWire);
|
||||
wexp.More(); wexp.Next()) {
|
||||
E = wexp.Current();
|
||||
if (! BRep_Tool::Degenerated(E)) {
|
||||
ii++;
|
||||
myCurves->ChangeValue(ii).Initialize(E);
|
||||
if (AC) {
|
||||
myKnots->SetValue(ii+1, myKnots->Value(ii));
|
||||
myKnots->ChangeValue(ii+1) +=
|
||||
GCPnts_AbscissaPoint::Length(myCurves->ChangeValue(ii));
|
||||
}
|
||||
else myKnots->SetValue(ii+1, (Standard_Real)ii);
|
||||
}
|
||||
}
|
||||
|
||||
Forward = Standard_True; // Defaut ; Les Edge Reverse seront parcourue
|
||||
// a rebourt.
|
||||
if((NbEdge > 2) || ((NbEdge==2) && (!myWire.Closed())) ) {
|
||||
TopAbs_Orientation Or = myCurves->Value(1).Edge().Orientation();
|
||||
Standard_Boolean B;
|
||||
TopoDS_Vertex VI, VL;
|
||||
B = TopExp::CommonVertex(myCurves->Value(1).Edge(),
|
||||
myCurves->Value(2).Edge(),
|
||||
VI);
|
||||
VL = TopExp::LastVertex(myCurves->Value(1).Edge());
|
||||
if (VI.IsSame(VL)) { // On Garde toujours le sens de parcout
|
||||
if (Or == TopAbs_REVERSED)
|
||||
Forward = Standard_False;
|
||||
}
|
||||
else {// On renverse toujours le sens de parcout
|
||||
if (Or != TopAbs_REVERSED)
|
||||
Forward = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
TFirst = 0;
|
||||
TLast = myKnots->Value(myKnots->Length());
|
||||
myPeriod = TLast - TFirst;
|
||||
if (NbEdge == 1) {
|
||||
Periodic = myCurves->Value(1).IsPeriodic();
|
||||
}
|
||||
else {
|
||||
Periodic = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W,
|
||||
const Standard_Boolean AC,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(W, AC);
|
||||
TFirst = First;
|
||||
TLast = Last;
|
||||
PTol = Tol;
|
||||
|
||||
// Trim des courbes extremes.
|
||||
Handle (BRepAdaptor_HCurve) HC;
|
||||
Standard_Integer i1, i2;
|
||||
Standard_Real f=TFirst, l=TLast, d;
|
||||
i1 = i2 = CurIndex;
|
||||
Prepare(f, d, i1);
|
||||
Prepare(l, d, i2);
|
||||
CurIndex = (i1+i2)/2; // Petite optimisation
|
||||
if (i1==i2) {
|
||||
if (l > f)
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(myCurves->Value(i1).Trim(f, l, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(myCurves->Value(i1).Trim(l, f, PTol));
|
||||
myCurves->SetValue(i1, HC->ChangeCurve());
|
||||
}
|
||||
else {
|
||||
const BRepAdaptor_Curve& c1 = myCurves->Value(i1);
|
||||
const BRepAdaptor_Curve& c2 = myCurves->Value(i2);
|
||||
Standard_Real k;
|
||||
|
||||
k = c1.LastParameter();
|
||||
if (k>f)
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(c1.Trim(f, k, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(c1.Trim(k, f, PTol));
|
||||
myCurves->SetValue(i1, HC->ChangeCurve());
|
||||
|
||||
k = c2.FirstParameter();
|
||||
if (k<=l)
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(c2.Trim(k, l, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(c2.Trim(l, k, PTol));
|
||||
myCurves->SetValue(i2, HC->ChangeCurve());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BRepAdaptor_CompCurve::SetPeriodic(const Standard_Boolean isPeriodic)
|
||||
{
|
||||
if (myWire.Closed()) {
|
||||
Periodic = isPeriodic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
{
|
||||
return myWire;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::Edge(const Standard_Real U,
|
||||
TopoDS_Edge& E,
|
||||
Standard_Real& UonE) const
|
||||
{
|
||||
Standard_Real d;
|
||||
Standard_Integer index = CurIndex;
|
||||
UonE = U;
|
||||
Prepare(UonE, d, index);
|
||||
E = myCurves->Value(index).Edge();
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::FirstParameter() const
|
||||
{
|
||||
return TFirst;
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::LastParameter() const
|
||||
{
|
||||
return TLast;
|
||||
}
|
||||
|
||||
GeomAbs_Shape BRepAdaptor_CompCurve::Continuity() const
|
||||
{
|
||||
if ( myCurves->Length() > 1) return GeomAbs_C0;
|
||||
return myCurves->Value(1).Continuity();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbIntervals(const GeomAbs_Shape S)
|
||||
{
|
||||
Standard_Integer NbInt, ii;
|
||||
for (ii=1, NbInt=0; ii<=myCurves->Length(); ii++)
|
||||
NbInt += myCurves->ChangeValue(ii).NbIntervals(S);
|
||||
|
||||
return NbInt;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::Intervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S)
|
||||
{
|
||||
Standard_Integer ii, jj, kk, n;
|
||||
Standard_Real f, F, delta;
|
||||
|
||||
// Premiere courbe (sens de parcourt de le edge)
|
||||
n = myCurves->ChangeValue(1).NbIntervals(S);
|
||||
Handle(TColStd_HArray1OfReal) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
myCurves->ChangeValue(1).Intervals(Ti->ChangeArray1(), S);
|
||||
InvPrepare(1, f, delta);
|
||||
F = myKnots->Value(1);
|
||||
if (delta < 0) {
|
||||
//sens de parcourt inverser
|
||||
for (kk=1,jj=Ti->Length(); jj>0; kk++, jj--)
|
||||
T(kk) = F + (Ti->Value(jj)-f)*delta;
|
||||
}
|
||||
else {
|
||||
for (kk=1; kk<=Ti->Length(); kk++)
|
||||
T(kk) = F + (Ti->Value(kk)-f)*delta;
|
||||
}
|
||||
|
||||
// et les suivante
|
||||
for (ii=2; ii<=myCurves->Length(); ii++) {
|
||||
n = myCurves->ChangeValue(ii).NbIntervals(S);
|
||||
if (n != Ti->Length()-1) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
myCurves->ChangeValue(ii).Intervals(Ti->ChangeArray1(), S);
|
||||
InvPrepare(ii, f, delta);
|
||||
F = myKnots->Value(ii);
|
||||
if (delta < 0) {
|
||||
//sens de parcourt inverser
|
||||
for (jj=Ti->Length()-1; jj>0; kk++, jj--)
|
||||
T(kk) = F + (Ti->Value(jj)-f)*delta;
|
||||
}
|
||||
else {
|
||||
for (jj=2; jj<=Ti->Length(); kk++, jj++)
|
||||
T(kk) = F + (Ti->Value(jj)-f)*delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Adaptor3d_HCurve) BRepAdaptor_CompCurve::Trim(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
BRepAdaptor_CompCurve C(myWire, IsbyAC, First, Last, Tol);
|
||||
Handle(BRepAdaptor_HCompCurve) HC =
|
||||
new (BRepAdaptor_HCompCurve) (C);
|
||||
return HC;
|
||||
}
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsClosed() const
|
||||
{
|
||||
return myWire.Closed();
|
||||
}
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic() const
|
||||
{
|
||||
return Periodic;
|
||||
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::Period() const
|
||||
{
|
||||
return myPeriod;
|
||||
}
|
||||
|
||||
gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
return myCurves->Value(index).Value(u);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D0(const Standard_Real U,
|
||||
gp_Pnt& P) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D0(u, P);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D1(const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D1(u, P, V);
|
||||
V*=d;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D2(const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D2(u, P, V1, V2);
|
||||
V1*=d;
|
||||
V2 *= d*d;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D3(const Standard_Real U,
|
||||
gp_Pnt& P,gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D3(u, P, V1, V2, V3);
|
||||
V1*=d;
|
||||
V2 *= d*d;
|
||||
V3 *= d*d*d;
|
||||
}
|
||||
|
||||
gp_Vec BRepAdaptor_CompCurve::DN(const Standard_Real U,
|
||||
const Standard_Integer N) const
|
||||
{
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
|
||||
return (myCurves->Value(index).DN(u, N) * Pow(d, N));
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::Resolution(const Standard_Real R3d) const
|
||||
{
|
||||
Standard_Real Res = 1.e200, r;
|
||||
Standard_Integer ii, L = myCurves->Length();
|
||||
for (ii=1; ii<=L; ii++) {
|
||||
r = myCurves->Value(ii).Resolution(R3d);
|
||||
if (r < Res) Res = r;
|
||||
}
|
||||
return Res;
|
||||
}
|
||||
|
||||
GeomAbs_CurveType BRepAdaptor_CompCurve::GetType() const
|
||||
{
|
||||
return GeomAbs_OtherCurve; //temporaire
|
||||
// if ( myCurves->Length() > 1) return GeomAbs_OtherCurve;
|
||||
// return myCurves->Value(1).GetType();
|
||||
}
|
||||
|
||||
gp_Lin BRepAdaptor_CompCurve::Line() const
|
||||
{
|
||||
return myCurves->Value(1).Line();
|
||||
}
|
||||
|
||||
gp_Circ BRepAdaptor_CompCurve::Circle() const
|
||||
{
|
||||
return myCurves->Value(1).Circle();
|
||||
}
|
||||
|
||||
gp_Elips BRepAdaptor_CompCurve::Ellipse() const
|
||||
{
|
||||
return myCurves->Value(1).Ellipse();
|
||||
}
|
||||
|
||||
gp_Hypr BRepAdaptor_CompCurve::Hyperbola() const
|
||||
{
|
||||
return myCurves->Value(1).Hyperbola();
|
||||
}
|
||||
|
||||
gp_Parab BRepAdaptor_CompCurve::Parabola() const
|
||||
{
|
||||
return myCurves->Value(1).Parabola();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::Degree() const
|
||||
{
|
||||
return myCurves->Value(1).Degree();
|
||||
}
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsRational() const
|
||||
{
|
||||
return myCurves->Value(1).IsRational();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbPoles() const
|
||||
{
|
||||
return myCurves->Value(1).NbPoles();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbKnots() const
|
||||
{
|
||||
return myCurves->Value(1).NbKnots();
|
||||
}
|
||||
|
||||
Handle(Geom_BezierCurve) BRepAdaptor_CompCurve::Bezier() const
|
||||
{
|
||||
return myCurves->Value(1).Bezier();
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) BRepAdaptor_CompCurve::BSpline() const
|
||||
{
|
||||
return myCurves->Value(1).BSpline();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
// Lorsque le parametre est pres de un "noeud" on determine la loi en
|
||||
// fonction du signe de tol:
|
||||
// - negatif -> Loi precedente au noeud.
|
||||
// - positif -> Loi consecutive au noeud.
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_CompCurve::Prepare(Standard_Real& W,
|
||||
Standard_Real& Delta,
|
||||
Standard_Integer& CurIndex) const
|
||||
{
|
||||
Standard_Real f,l, Wtest, Eps;
|
||||
Standard_Integer ii;
|
||||
if (W-TFirst < TLast-W) { Eps = PTol; }
|
||||
else { Eps = -PTol;}
|
||||
|
||||
|
||||
Wtest = W+Eps; //Decalage pour discriminer les noeuds
|
||||
if(Periodic){
|
||||
Wtest = ElCLib::InPeriod(Wtest,
|
||||
0,
|
||||
myPeriod);
|
||||
W = Wtest-Eps;
|
||||
}
|
||||
|
||||
// Recheche de le index
|
||||
Standard_Boolean Trouve = Standard_False;
|
||||
if (myKnots->Value(CurIndex) > Wtest) {
|
||||
for (ii=CurIndex-1; ii>0 && !Trouve; ii--)
|
||||
if (myKnots->Value(ii)<= Wtest) {
|
||||
CurIndex = ii;
|
||||
Trouve = Standard_True;
|
||||
}
|
||||
if (!Trouve) CurIndex = 1; // En dehors des bornes ...
|
||||
}
|
||||
|
||||
else if (myKnots->Value(CurIndex+1) <= Wtest) {
|
||||
for (ii=CurIndex+1; ii<=myCurves->Length() && !Trouve; ii++)
|
||||
if (myKnots->Value(ii+1)> Wtest) {
|
||||
CurIndex = ii;
|
||||
Trouve = Standard_True;
|
||||
}
|
||||
if (!Trouve) CurIndex = myCurves->Length(); // En dehors des bornes ...
|
||||
}
|
||||
|
||||
// Reverse ?
|
||||
const TopoDS_Edge& E = myCurves->Value(CurIndex).Edge();
|
||||
TopAbs_Orientation Or = E.Orientation();
|
||||
Standard_Boolean Reverse;
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
(!Forward && (Or != TopAbs_REVERSED));
|
||||
|
||||
// Calcul du parametre local
|
||||
BRep_Tool::Range(E, f, l);
|
||||
Delta = myKnots->Value(CurIndex+1) - myKnots->Value(CurIndex);
|
||||
if (Delta > PTol*1.e-9) Delta = (l-f)/Delta;
|
||||
|
||||
if (Reverse) {
|
||||
Delta *= -1;
|
||||
W = l + (W-myKnots->Value(CurIndex)) * Delta;
|
||||
}
|
||||
else {
|
||||
W = f + (W-myKnots->Value(CurIndex)) * Delta;
|
||||
}
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::InvPrepare(const Standard_Integer index,
|
||||
Standard_Real& First,
|
||||
Standard_Real& Delta) const
|
||||
{
|
||||
// Reverse ?
|
||||
const TopoDS_Edge& E = myCurves->Value(index).Edge();
|
||||
TopAbs_Orientation Or = E.Orientation();
|
||||
Standard_Boolean Reverse;
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
(!Forward && (Or != TopAbs_REVERSED));
|
||||
|
||||
// Calcul des parametres de reparametrisation
|
||||
// tel que : T = Ti + (t-First)*Delta
|
||||
Standard_Real f, l;
|
||||
BRep_Tool::Range(E, f, l);
|
||||
Delta = myKnots->Value(index+1) - myKnots->Value(index);
|
||||
if (l-f > PTol*1.e-9) Delta /= (l-f);
|
||||
|
||||
if (Reverse) {
|
||||
Delta *= -1;
|
||||
First = l;
|
||||
}
|
||||
else {
|
||||
First = f;
|
||||
}
|
||||
}
|
293
src/BRepAdaptor/BRepAdaptor_Curve.cdl
Executable file
293
src/BRepAdaptor/BRepAdaptor_Curve.cdl
Executable file
@@ -0,0 +1,293 @@
|
||||
-- File: BRepAdaptor_Curve.cdl
|
||||
-- Created: Fri Feb 19 12:04:59 1993
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Curve from BRepAdaptor inherits Curve from Adaptor3d
|
||||
|
||||
---Purpose: The Curve from BRepAdaptor allows to use an Edge
|
||||
-- of the BRep topology like a 3D curve.
|
||||
--
|
||||
-- It has the methods the class Curve from Adaptor3d.
|
||||
--
|
||||
-- It is created or Initialized with an Edge. It
|
||||
-- takes into account local coordinate systems. If
|
||||
-- the Edge has a 3D curve it is use with priority.
|
||||
-- If the edge has no 3D curve one of the curves on
|
||||
-- surface is used. It is possible to enforce using a
|
||||
-- curve on surface by creating or initialising with
|
||||
-- an Edge and a Face.
|
||||
|
||||
uses
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
CurveType from GeomAbs,
|
||||
Shape from GeomAbs,
|
||||
HCurve from Adaptor3d,
|
||||
Curve from GeomAdaptor,
|
||||
CurveOnSurface from Adaptor3d,
|
||||
HCurveOnSurface from Adaptor3d,
|
||||
BezierCurve from Geom,
|
||||
BSplineCurve from Geom,
|
||||
Array1OfReal from TColStd,
|
||||
Trsf from gp,
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Circ from gp,
|
||||
Elips from gp,
|
||||
Hypr from gp,
|
||||
Parab from gp,
|
||||
Lin from gp
|
||||
|
||||
raises
|
||||
NullObject from Standard,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
Create returns Curve from BRepAdaptor;
|
||||
---Purpose: Creates an undefined Curve with no Edge loaded.
|
||||
|
||||
Create(E : Edge from TopoDS) returns Curve from BRepAdaptor;
|
||||
---Purpose: Creates a Curve to acces to the geometry of edge
|
||||
-- <E>.
|
||||
|
||||
Create(E : Edge from TopoDS; F : Face from TopoDS)
|
||||
returns Curve from BRepAdaptor;
|
||||
---Purpose: Creates a Curve to acces to the geometry of edge
|
||||
-- <E>. The geometry will be computed using the
|
||||
-- parametric curve of <E> on the face <F>. An Error
|
||||
-- is raised if the edge does not have a pcurve on
|
||||
-- the face.
|
||||
|
||||
Initialize(me : in out; E : Edge from TopoDS)
|
||||
---Purpose: Sets the Curve <me> to acces to the geometry of
|
||||
-- edge <E>.
|
||||
is static;
|
||||
|
||||
Initialize(me : in out; E : Edge from TopoDS; F : Face from TopoDS)
|
||||
---Purpose: Sets the Curve <me> to acces to the geometry of
|
||||
-- edge <E>. The geometry will be computed using the
|
||||
-- parametric curve of <E> on the face <F>. An Error
|
||||
-- is raised if the edge does not have a pcurve on
|
||||
-- the face.
|
||||
raises DomainError from Standard
|
||||
is static;
|
||||
|
||||
Trsf(me) returns Trsf from gp
|
||||
---Purpose: Returns the coordinate system of the curve.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Is3DCurve(me) returns Boolean
|
||||
---Purpose: Returns True if the edge geometry is computed from
|
||||
-- a 3D curve.
|
||||
is static;
|
||||
|
||||
IsCurveOnSurface(me) returns Boolean
|
||||
---Purpose: Returns True if the edge geometry is computed from
|
||||
-- a pcurve on a surface.
|
||||
is static;
|
||||
|
||||
Curve(me) returns Curve from GeomAdaptor
|
||||
---Purpose: Returns the Curve of the edge.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
CurveOnSurface(me) returns CurveOnSurface from Adaptor3d
|
||||
---Purpose: Returns the CurveOnSurface of the edge.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Edge(me) returns Edge from TopoDS
|
||||
---Purpose: Returns the edge.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Tolerance(me) returns Real
|
||||
---Purpose: Returns the edge tolerance.
|
||||
--
|
||||
is static;
|
||||
|
||||
--
|
||||
-- Methods of Curve from GeomAdaptor.
|
||||
--
|
||||
|
||||
FirstParameter(me) returns Real
|
||||
is redefined static;
|
||||
|
||||
LastParameter(me) returns Real
|
||||
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.
|
||||
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C1.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C2.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C3.
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard,
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not CN.
|
||||
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
|
||||
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;
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
NbPoles(me) returns Integer
|
||||
raises NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
NbKnots(me) returns Integer
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
|
||||
Bezier(me) returns BezierCurve from Geom
|
||||
---Purpose:
|
||||
-- Warning :
|
||||
-- This will make a copy of the Bezier Curve
|
||||
-- since it applies to it myTsrf . Be carefull when
|
||||
-- using this method
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
BSpline(me) returns BSplineCurve from Geom
|
||||
---Purpose:
|
||||
-- Warning :
|
||||
-- This will make a copy of the BSpline Curve
|
||||
-- since it applies to it myTsrf . Be carefull when
|
||||
-- using this method
|
||||
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
fields
|
||||
|
||||
myTrsf : Trsf from gp;
|
||||
myCurve : Curve from GeomAdaptor;
|
||||
myConSurf : HCurveOnSurface from Adaptor3d;
|
||||
myEdge : Edge from TopoDS;
|
||||
|
||||
end Curve;
|
622
src/BRepAdaptor/BRepAdaptor_Curve.cxx
Executable file
622
src/BRepAdaptor/BRepAdaptor_Curve.cxx
Executable file
@@ -0,0 +1,622 @@
|
||||
// File: BRepAdaptor_Curve.cxx
|
||||
// Created: Fri Feb 19 16:47:06 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
|
||||
#include <BRepAdaptor_Curve.ixx>
|
||||
|
||||
#include <BRepAdaptor_HCurve.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve()
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E)
|
||||
{
|
||||
Initialize(E);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
Initialize(E,F);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E)
|
||||
{
|
||||
myConSurf.Nullify();
|
||||
myEdge = E;
|
||||
Standard_Real pf,pl;
|
||||
|
||||
TopLoc_Location L;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,pf,pl);
|
||||
|
||||
if (!C.IsNull()) {
|
||||
myCurve.Load(C,pf,pl);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Curve) PC;
|
||||
Handle(Geom_Surface) S;
|
||||
BRep_Tool::CurveOnSurface(E,PC,S,L,pf,pl);
|
||||
if (!PC.IsNull()) {
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load(S);
|
||||
Handle(Geom2dAdaptor_HCurve) HC = new Geom2dAdaptor_HCurve();
|
||||
HC->ChangeCurve2d().Load(PC,pf,pl);
|
||||
myConSurf = new Adaptor3d_HCurveOnSurface();
|
||||
myConSurf->ChangeCurve().Load(HC);
|
||||
myConSurf->ChangeCurve().Load(HS);
|
||||
}
|
||||
else {
|
||||
Standard_NullObject::Raise("BRepAdaptor_Curve::No geometry");
|
||||
}
|
||||
}
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
myConSurf.Nullify();
|
||||
|
||||
myEdge = E;
|
||||
TopLoc_Location L;
|
||||
Standard_Real pf,pl;
|
||||
Handle(Geom_Surface) S = BRep_Tool::Surface(F,L);
|
||||
Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(E,F,pf,pl);
|
||||
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load(S);
|
||||
Handle(Geom2dAdaptor_HCurve) HC = new Geom2dAdaptor_HCurve();
|
||||
HC->ChangeCurve2d().Load(PC,pf,pl);
|
||||
myConSurf = new Adaptor3d_HCurveOnSurface();
|
||||
myConSurf->ChangeCurve().Load(HC);
|
||||
myConSurf->ChangeCurve().Load(HS);
|
||||
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Trsf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Trsf& BRepAdaptor_Curve::Trsf() const
|
||||
{
|
||||
return myTrsf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Is3DCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::Is3DCurve() const
|
||||
{
|
||||
return myConSurf.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCurveOnSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::IsCurveOnSurface() const
|
||||
{
|
||||
return !myConSurf.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const GeomAdaptor_Curve& BRepAdaptor_Curve::Curve() const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurveOnSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Adaptor3d_CurveOnSurface& BRepAdaptor_Curve::CurveOnSurface() const
|
||||
{
|
||||
return *((Adaptor3d_CurveOnSurface*)&(myConSurf->Curve()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Edge& BRepAdaptor_Curve::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::Tolerance() const
|
||||
{
|
||||
return BRep_Tool::Tolerance(myEdge);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::FirstParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.FirstParameter();
|
||||
}
|
||||
else {
|
||||
return myConSurf->FirstParameter();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LastParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::LastParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.LastParameter();
|
||||
}
|
||||
else {
|
||||
return myConSurf->LastParameter();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape BRepAdaptor_Curve::Continuity() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.Continuity();
|
||||
}
|
||||
else {
|
||||
return myConSurf->Continuity();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepAdaptor_Curve::NbIntervals(const GeomAbs_Shape S)
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.NbIntervals(S);
|
||||
}
|
||||
else {
|
||||
return myConSurf->NbIntervals(S);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S)
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
myCurve.Intervals(T, S);
|
||||
}
|
||||
else {
|
||||
myConSurf->Intervals(T, S);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Trim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_HCurve) BRepAdaptor_Curve::Trim(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
// On fait une copie de this pour garder la trsf.
|
||||
Handle(BRepAdaptor_HCurve) res = new BRepAdaptor_HCurve();
|
||||
if (myConSurf.IsNull()){
|
||||
Standard_Real pf = FirstParameter(), pl = LastParameter();
|
||||
Handle(Geom_Curve) C = myCurve.Curve();
|
||||
((GeomAdaptor_Curve*) (void*) &myCurve)->Load(C,First,Last);
|
||||
res->ChangeCurve() = *this;
|
||||
((GeomAdaptor_Curve*) (void*) &myCurve)->Load(C,pf,pl);
|
||||
}
|
||||
else {
|
||||
Handle(Adaptor3d_HCurveOnSurface) sav = myConSurf;
|
||||
*((Handle_Adaptor3d_HCurveOnSurface*) (void*) &myConSurf) =
|
||||
Handle(Adaptor3d_HCurveOnSurface)::DownCast(myConSurf->Trim(First,Last,Tol));
|
||||
res->ChangeCurve() = *this;
|
||||
*((Handle_Adaptor3d_HCurveOnSurface*) (void*) &myConSurf) = sav;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::IsClosed() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.IsClosed();
|
||||
}
|
||||
else {
|
||||
return myConSurf->IsClosed();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.IsPeriodic();
|
||||
}
|
||||
else {
|
||||
return myConSurf->IsPeriodic();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Period
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::Period() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.Period();
|
||||
}
|
||||
else {
|
||||
return myConSurf->Period();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Pnt BRepAdaptor_Curve::Value(const Standard_Real U) const
|
||||
{
|
||||
gp_Pnt P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve.Value(U);
|
||||
else
|
||||
P = myConSurf->Value(U);
|
||||
P.Transform(myTrsf);
|
||||
return P;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D0(const Standard_Real U, gp_Pnt& P) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D0(U,P);
|
||||
else
|
||||
myConSurf->D0(U,P);
|
||||
P.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D1(const Standard_Real U,
|
||||
gp_Pnt& P, gp_Vec& V) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D1(U,P,V);
|
||||
else
|
||||
myConSurf->D1(U,P,V);
|
||||
P.Transform(myTrsf);
|
||||
V.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D2(const Standard_Real U,
|
||||
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D2(U,P,V1,V2);
|
||||
else
|
||||
myConSurf->D2(U,P,V1,V2);
|
||||
P.Transform(myTrsf);
|
||||
V1.Transform(myTrsf);
|
||||
V2.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D3(const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D3(U,P,V1,V2,V3);
|
||||
else
|
||||
myConSurf->D3(U,P,V1,V2,V3);
|
||||
P.Transform(myTrsf);
|
||||
V1.Transform(myTrsf);
|
||||
V2.Transform(myTrsf);
|
||||
V3.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec BRepAdaptor_Curve::DN(const Standard_Real U,
|
||||
const Standard_Integer N) const
|
||||
{
|
||||
gp_Vec V;
|
||||
if (myConSurf.IsNull())
|
||||
V = myCurve.DN(U,N);
|
||||
else
|
||||
V = myConSurf->DN(U,N);
|
||||
V.Transform(myTrsf);
|
||||
return V;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Resolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::Resolution(const Standard_Real R) const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.Resolution(R);
|
||||
}
|
||||
else {
|
||||
return myConSurf->Resolution(R);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTYpe
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_CurveType BRepAdaptor_Curve::GetType() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve.GetType();
|
||||
}
|
||||
else {
|
||||
return myConSurf->GetType();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Line
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Lin BRepAdaptor_Curve::Line() const
|
||||
{
|
||||
gp_Lin L;
|
||||
if (myConSurf.IsNull())
|
||||
L = myCurve.Line();
|
||||
else
|
||||
L = myConSurf->Line();
|
||||
L.Transform(myTrsf);
|
||||
return L;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Circle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Circ BRepAdaptor_Curve::Circle() const
|
||||
{
|
||||
gp_Circ C;
|
||||
if (myConSurf.IsNull())
|
||||
C = myCurve.Circle();
|
||||
else
|
||||
C = myConSurf->Circle();
|
||||
C.Transform(myTrsf);
|
||||
return C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Ellipse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Elips BRepAdaptor_Curve::Ellipse() const
|
||||
{
|
||||
gp_Elips E;
|
||||
if (myConSurf.IsNull())
|
||||
E = myCurve.Ellipse();
|
||||
else
|
||||
E = myConSurf->Ellipse();
|
||||
E.Transform(myTrsf);
|
||||
return E;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hyperbola
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Hypr BRepAdaptor_Curve::Hyperbola() const
|
||||
{
|
||||
gp_Hypr H;
|
||||
if (myConSurf.IsNull())
|
||||
H = myCurve.Hyperbola();
|
||||
else
|
||||
H = myConSurf->Hyperbola();
|
||||
H.Transform(myTrsf);
|
||||
return H;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Parabola
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Parab BRepAdaptor_Curve::Parabola() const
|
||||
{
|
||||
gp_Parab P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve.Parabola();
|
||||
else
|
||||
P = myConSurf->Parabola();
|
||||
P.Transform(myTrsf);
|
||||
return P;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Degree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepAdaptor_Curve::Degree() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.Degree();
|
||||
else
|
||||
return myConSurf->Degree();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAdaptor_Curve::IsRational() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.IsRational();
|
||||
else
|
||||
return myConSurf->IsRational();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepAdaptor_Curve::NbPoles() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.NbPoles();
|
||||
else
|
||||
return myConSurf->NbPoles();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbKnots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepAdaptor_Curve::NbKnots() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.NbKnots();
|
||||
else
|
||||
return myConSurf->NbKnots();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bezier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_BezierCurve) BRepAdaptor_Curve::Bezier() const
|
||||
{
|
||||
Handle(Geom_BezierCurve) BC;
|
||||
if (myConSurf.IsNull()) {
|
||||
BC = myCurve.Bezier();
|
||||
}
|
||||
else {
|
||||
BC = myConSurf->Bezier();
|
||||
}
|
||||
return Handle(Geom_BezierCurve)::DownCast(BC->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BSpline
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_BSplineCurve) BRepAdaptor_Curve::BSpline() const
|
||||
{
|
||||
Handle(Geom_BSplineCurve) BS;
|
||||
if (myConSurf.IsNull()) {
|
||||
BS = myCurve.BSpline();
|
||||
}
|
||||
else {
|
||||
BS = myConSurf->BSpline();
|
||||
}
|
||||
return Handle(Geom_BSplineCurve)::DownCast(BS->Transformed(myTrsf));
|
||||
}
|
63
src/BRepAdaptor/BRepAdaptor_Curve2d.cdl
Executable file
63
src/BRepAdaptor/BRepAdaptor_Curve2d.cdl
Executable file
@@ -0,0 +1,63 @@
|
||||
-- File: BRepAdaptor2d_Curve2d.cdl
|
||||
-- Created: Tue Jul 13 10:16:37 1993
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@nonox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Curve2d from BRepAdaptor inherits Curve from Geom2dAdaptor
|
||||
|
||||
---Purpose: The Curve2d from BRepAdaptor allows to use an Edge
|
||||
-- on a Face like a 2d curve. (curve in the
|
||||
-- parametric space).
|
||||
--
|
||||
-- It has the methods of the class Curve2d from
|
||||
-- Adpator.
|
||||
--
|
||||
-- It is created or initialized with a Face and an
|
||||
-- Edge. The methods are inherited from Curve from
|
||||
-- Geom2dAdaptor.
|
||||
|
||||
uses
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS
|
||||
|
||||
raises
|
||||
NullObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns Curve2d from BRepAdaptor;
|
||||
---Purpose: Creates an uninitialized curve2d.
|
||||
|
||||
Create(E : Edge from TopoDS; F : Face from TopoDS)
|
||||
returns Curve2d from BRepAdaptor
|
||||
---Purpose: Creates with the pcurve of <E> on <F>.
|
||||
raises
|
||||
NullObject from Standard; -- if <E> has no pcurve on <F>
|
||||
|
||||
Initialize(me : in out; E : Edge from TopoDS; F : Face from TopoDS)
|
||||
---Purpose: Initialize with the pcurve of <E> on <F>.
|
||||
raises
|
||||
NullObject from Standard -- if <E> has no pcurve on <F>
|
||||
is static;
|
||||
|
||||
Edge(me) returns Edge from TopoDS
|
||||
---Purpose: Returns the Edge.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Face(me) returns Face from TopoDS
|
||||
---Purpose: Returns the Face.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myEdge : Edge from TopoDS;
|
||||
myFace : Face from TopoDS;
|
||||
|
||||
end Curve2d;
|
67
src/BRepAdaptor/BRepAdaptor_Curve2d.cxx
Executable file
67
src/BRepAdaptor/BRepAdaptor_Curve2d.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// File: BRepAdaptor_Curve2d.cxx
|
||||
// Created: Tue Jul 13 19:13:38 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
|
||||
#include <BRepAdaptor_Curve2d.ixx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Curve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Curve2d::BRepAdaptor_Curve2d()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Curve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Curve2d::BRepAdaptor_Curve2d(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
Initialize(E,F);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve2d::Initialize(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
myEdge = E;
|
||||
myFace = F;
|
||||
Standard_Real pf,pl;
|
||||
const Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(E,F,pf,pl);
|
||||
Geom2dAdaptor_Curve::Load(PC,pf,pl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Edge& BRepAdaptor_Curve2d::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Face& BRepAdaptor_Curve2d::Face() const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
|
||||
|
408
src/BRepAdaptor/BRepAdaptor_Surface.cdl
Executable file
408
src/BRepAdaptor/BRepAdaptor_Surface.cdl
Executable file
@@ -0,0 +1,408 @@
|
||||
-- File: BRepAdaptor_Surface.cdl
|
||||
-- Created: Mon Feb 22 10:01:31 1993
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Surface from BRepAdaptor inherits Surface from Adaptor3d
|
||||
|
||||
---Purpose: The Surface from BRepAdaptor allows to use a Face
|
||||
-- of the BRep topology look like a 3D surface.
|
||||
--
|
||||
-- It has the methods of the class Surface from
|
||||
-- Adaptor3d.
|
||||
--
|
||||
-- It is created or initialized with a Face. It takes
|
||||
-- into account the local coordinates system.
|
||||
--
|
||||
-- The u,v parameter range is the minmax value for
|
||||
-- the restriction, unless the flag restriction is
|
||||
-- set to false.
|
||||
|
||||
uses
|
||||
Face from TopoDS,
|
||||
SurfaceType from GeomAbs,
|
||||
HSurface from Adaptor3d,
|
||||
HCurve from Adaptor3d,
|
||||
Surface from GeomAdaptor,
|
||||
Shape from GeomAbs,
|
||||
BezierSurface from Geom,
|
||||
BSplineSurface from Geom,
|
||||
Trsf from gp,
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Dir from gp,
|
||||
Pln from gp,
|
||||
Cylinder from gp,
|
||||
Sphere from gp,
|
||||
Torus from gp,
|
||||
Cone from gp,
|
||||
Ax1 from gp,
|
||||
Array1OfReal from TColStd
|
||||
|
||||
|
||||
raises
|
||||
|
||||
OutOfRange from Standard,
|
||||
DomainError from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create returns Surface from BRepAdaptor;
|
||||
---Purpose: Creates an undefined surface with no face loaded.
|
||||
|
||||
Create(F : Face from TopoDS;
|
||||
R : Boolean = Standard_True)
|
||||
returns Surface from BRepAdaptor;
|
||||
---Purpose: Creates a surface to access the geometry of <F>.
|
||||
-- If <Restriction> is true the parameter range is
|
||||
-- the parameter range in the UV space of the
|
||||
-- restriction.
|
||||
|
||||
Initialize(me : in out; F : Face from TopoDS;
|
||||
Restriction : Boolean = Standard_True)
|
||||
---Purpose: Sets the surface to the geometry of <F>.
|
||||
is static;
|
||||
|
||||
Surface(me) returns Surface from GeomAdaptor
|
||||
---Purpose: Returns the surface.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
ChangeSurface(me : in out) returns Surface from GeomAdaptor
|
||||
---Purpose: Returns the surface.
|
||||
--
|
||||
---C++: return &
|
||||
is static;
|
||||
|
||||
Trsf(me) returns Trsf from gp
|
||||
---Purpose: Returns the surface coordinate system.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Face(me) returns Face from TopoDS
|
||||
---Purpose: Returns the face.
|
||||
--
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
Tolerance(me) returns Real
|
||||
---Purpose: Returns the face tolerance.
|
||||
--
|
||||
is static;
|
||||
|
||||
--
|
||||
-- Methods of Surface from GeomAdaptor
|
||||
--
|
||||
|
||||
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
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
VContinuity(me) returns Shape from GeomAbs
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
NbUIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: If necessary, breaks the surface in U intervals of
|
||||
-- continuity <S>. And returns the number of
|
||||
-- intervals.
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
NbVIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: If necessary, breaks the surface in V intervals of
|
||||
-- continuity <S>. And returns the number of
|
||||
-- intervals.
|
||||
---C++:inline
|
||||
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
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
IsVClosed(me) returns Boolean
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
IsUPeriodic(me) returns Boolean
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
UPeriod(me) returns Real
|
||||
raises
|
||||
DomainError from Standard -- if the curve is not periodic
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
IsVPeriodic(me) returns Boolean
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
VPeriod(me) returns Real
|
||||
---C++:inline
|
||||
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.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current
|
||||
-- intervals is not C1.
|
||||
is redefined static;
|
||||
|
||||
D2 (me; U, V : Real;
|
||||
P : out Pnt from gp;
|
||||
D1U, D1V, D2U, D2V, D2UV : out Vec from gp)
|
||||
--- Purpose : Computes the point, the first and second
|
||||
-- derivatives on the surface.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current
|
||||
-- intervals is not C2.
|
||||
is redefined static;
|
||||
|
||||
D3 (me; U, V : Real; P : out Pnt from gp;
|
||||
D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : out Vec from gp)
|
||||
--- Purpose : Computes the point, the first, second and third
|
||||
-- derivatives on the surface.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current
|
||||
-- intervals is not C3.
|
||||
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).
|
||||
raises
|
||||
DomainError from Standard,
|
||||
--- Purpose : Raised if the current U interval is not not CNu
|
||||
-- and the current V interval is not CNv.
|
||||
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>.
|
||||
--
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
VResolution(me; R3d : Real ) returns Real
|
||||
---Purpose : Returns the parametric V resolution corresponding
|
||||
-- to the real space resolution <R3d>.
|
||||
--
|
||||
---C++:inline
|
||||
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;
|
||||
|
||||
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
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
NbUPoles(me) returns Integer
|
||||
raises NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
VDegree(me) returns Integer
|
||||
raises NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
NbVPoles(me) returns Integer
|
||||
raises NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
|
||||
NbUKnots(me) returns Integer
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
|
||||
NbVKnots(me) returns Integer
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
|
||||
IsURational(me) returns Boolean
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
IsVRational(me) returns Boolean
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++:inline
|
||||
is redefined static;
|
||||
|
||||
|
||||
Bezier(me) returns BezierSurface from Geom
|
||||
---Purpose:
|
||||
--Warning : this will make a copy of the
|
||||
-- Bezier Surface since it applies
|
||||
-- to it the myTsrf transformation
|
||||
-- Be Carefull when using this method
|
||||
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is redefined static;
|
||||
|
||||
BSpline(me) returns BSplineSurface from Geom
|
||||
---Purpose:
|
||||
-- Warning : this will make a copy of the
|
||||
-- BSpline Surface since it applies
|
||||
-- to it the myTsrf transformation
|
||||
-- Be Carefull when using this method
|
||||
|
||||
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
|
||||
---Purpose: only for SurfaceOfExtrusion and SurfaceOfRevolution
|
||||
-- Warning: this will make a copy of the underlying curve
|
||||
-- since it applies to it the transformation
|
||||
-- myTrsf. Be carefull when using this method.
|
||||
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;
|
||||
|
||||
fields
|
||||
|
||||
mySurf : Surface from GeomAdaptor;
|
||||
myTrsf : Trsf from gp;
|
||||
myFace : Face from TopoDS;
|
||||
|
||||
end Surface;
|
409
src/BRepAdaptor/BRepAdaptor_Surface.cxx
Executable file
409
src/BRepAdaptor/BRepAdaptor_Surface.cxx
Executable file
@@ -0,0 +1,409 @@
|
||||
// File: BRepAdaptor_Surface.cxx
|
||||
// Created: Fri Feb 19 16:47:06 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
#include <BRepAdaptor_Surface.ixx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Surface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Surface::BRepAdaptor_Surface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAdaptor_Surface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAdaptor_Surface::BRepAdaptor_Surface(const TopoDS_Face& F,
|
||||
const Standard_Boolean R)
|
||||
{
|
||||
Initialize(F,R);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::Initialize(const TopoDS_Face& F,
|
||||
const Standard_Boolean Restriction)
|
||||
{
|
||||
myFace = F;
|
||||
TopLoc_Location L;
|
||||
if (Restriction) {
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
|
||||
mySurf.Load(BRep_Tool::Surface(F,L),umin,umax,vmin,vmax);
|
||||
}
|
||||
else
|
||||
mySurf.Load(BRep_Tool::Surface(F,L));
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Surface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const GeomAdaptor_Surface& BRepAdaptor_Surface::Surface() const
|
||||
{
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAdaptor_Surface& BRepAdaptor_Surface::ChangeSurface()
|
||||
{
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Trsf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Trsf& BRepAdaptor_Surface::Trsf() const
|
||||
{
|
||||
return myTrsf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Face& BRepAdaptor_Surface::Face() const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Surface::Tolerance() const
|
||||
{
|
||||
return BRep_Tool::Tolerance(myFace);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::UIntervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
mySurf.UIntervals(T,S);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : VIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::VIntervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
mySurf.VIntervals(T,S);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UTrim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_HSurface) BRepAdaptor_Surface::UTrim
|
||||
(const Standard_Real First,
|
||||
const Standard_Real Last ,
|
||||
const Standard_Real Tol ) const
|
||||
{
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load
|
||||
(Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->UTrim(First,Last,Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : VTrim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_HSurface) BRepAdaptor_Surface::VTrim
|
||||
(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load
|
||||
(Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->VTrim(First,Last,Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Pnt BRepAdaptor_Surface::Value(const Standard_Real U,
|
||||
const Standard_Real V) const
|
||||
{
|
||||
return mySurf.Value(U,V).Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::D0(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P) const
|
||||
{
|
||||
mySurf.D0(U,V,P);
|
||||
P.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::D1(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V)const
|
||||
{
|
||||
mySurf.D1(U,V,P,D1U,D1V);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::D2(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P, gp_Vec& D1U,
|
||||
gp_Vec& D1V,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV)const
|
||||
{
|
||||
mySurf.D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
D2U.Transform(myTrsf);
|
||||
D2V.Transform(myTrsf);
|
||||
D2UV.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Surface::D3(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U, gp_Vec& D1V,
|
||||
gp_Vec& D2U, gp_Vec& D2V,
|
||||
gp_Vec& D2UV,
|
||||
gp_Vec& D3U, gp_Vec& D3V,
|
||||
gp_Vec& D3UUV, gp_Vec& D3UVV)const
|
||||
{
|
||||
mySurf.D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
D2U.Transform(myTrsf);
|
||||
D2V.Transform(myTrsf);
|
||||
D2UV.Transform(myTrsf);
|
||||
D3U.Transform(myTrsf);
|
||||
D3V.Transform(myTrsf);
|
||||
D3UUV.Transform(myTrsf);
|
||||
D3UVV.Transform(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec BRepAdaptor_Surface::DN(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
return mySurf.DN(U,V,Nu,Nv).Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Plane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Pln BRepAdaptor_Surface::Plane()const
|
||||
{
|
||||
return mySurf.Plane().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Cylinder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Cylinder BRepAdaptor_Surface::Cylinder()const
|
||||
{
|
||||
return mySurf.Cylinder().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Sphere
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Sphere BRepAdaptor_Surface::Sphere()const
|
||||
{
|
||||
return mySurf.Sphere().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Cone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Cone BRepAdaptor_Surface::Cone()const
|
||||
{
|
||||
return mySurf.Cone().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Torus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Torus BRepAdaptor_Surface::Torus()const
|
||||
{
|
||||
return mySurf.Torus().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bezier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_BezierSurface) BRepAdaptor_Surface::Bezier() const
|
||||
{
|
||||
return Handle(Geom_BezierSurface)::DownCast
|
||||
(mySurf.Bezier()->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BSpline
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_BSplineSurface) BRepAdaptor_Surface::BSpline() const
|
||||
{
|
||||
return Handle(Geom_BSplineSurface)::DownCast
|
||||
(mySurf.BSpline()->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AxeOfRevolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Ax1 BRepAdaptor_Surface::AxeOfRevolution() const
|
||||
{
|
||||
return mySurf.AxeOfRevolution().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Direction
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Dir BRepAdaptor_Surface::Direction() const
|
||||
{
|
||||
return mySurf.Direction().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BasisCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_HCurve) BRepAdaptor_Surface::BasisCurve() const
|
||||
{
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load
|
||||
(Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
|
||||
return HS->BasisCurve();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BasisSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_HSurface) BRepAdaptor_Surface::BasisSurface() const
|
||||
{
|
||||
Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface();
|
||||
HS->ChangeSurface().Load
|
||||
(Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->BasisSurface();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : OffsetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Surface::OffsetValue() const
|
||||
{
|
||||
return mySurf.OffsetValue();
|
||||
}
|
||||
|
261
src/BRepAdaptor/BRepAdaptor_Surface.lxx
Executable file
261
src/BRepAdaptor/BRepAdaptor_Surface.lxx
Executable file
@@ -0,0 +1,261 @@
|
||||
// File: BRepAdaptor_Surface.lxx
|
||||
// Created: Fri Feb 19 16:47:06 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstUParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::FirstUParameter() const
|
||||
{
|
||||
return mySurf.FirstUParameter();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LastUParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::LastUParameter() const
|
||||
{
|
||||
return mySurf.LastUParameter();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstVParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::FirstVParameter() const
|
||||
{
|
||||
return mySurf.FirstVParameter();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LastVParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::LastVParameter() const
|
||||
{
|
||||
return mySurf.LastVParameter();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline GeomAbs_Shape BRepAdaptor_Surface::UContinuity() const
|
||||
{
|
||||
return mySurf.UContinuity();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline GeomAbs_Shape BRepAdaptor_Surface::VContinuity() const
|
||||
{
|
||||
return mySurf.VContinuity();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbUIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbUIntervals
|
||||
(const GeomAbs_Shape S) const
|
||||
{
|
||||
return mySurf.NbUIntervals(S);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbVIntervals
|
||||
(const GeomAbs_Shape S) const
|
||||
{
|
||||
return mySurf.NbVIntervals(S);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsUClosed()const
|
||||
{
|
||||
return mySurf.IsUClosed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsVClosed()const
|
||||
{
|
||||
return mySurf.IsVClosed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsUPeriodic()const
|
||||
{
|
||||
return mySurf.IsUPeriodic();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::UPeriod()const
|
||||
{
|
||||
return mySurf.UPeriod();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsVPeriodic()const
|
||||
{
|
||||
return mySurf.IsVPeriodic();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::VPeriod()const
|
||||
{
|
||||
return mySurf.VPeriod();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UResolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::UResolution(const Standard_Real R3d)const
|
||||
{
|
||||
return mySurf.UResolution(R3d);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VResolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepAdaptor_Surface::VResolution(const Standard_Real R3d)const
|
||||
{
|
||||
return mySurf.VResolution(R3d);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline GeomAbs_SurfaceType BRepAdaptor_Surface::GetType()const
|
||||
{
|
||||
return mySurf.GetType();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::UDegree()const
|
||||
{
|
||||
return mySurf.UDegree();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbUPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbUPoles()const
|
||||
{
|
||||
return mySurf.NbUPoles();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::VDegree()const
|
||||
{
|
||||
return mySurf.VDegree();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbVPoles()const
|
||||
{
|
||||
return mySurf.NbVPoles();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbUKnots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbUKnots()const
|
||||
{
|
||||
return mySurf.NbUKnots();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVKnots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepAdaptor_Surface::NbVKnots()const
|
||||
{
|
||||
return mySurf.NbVKnots();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsURational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsURational()const
|
||||
{
|
||||
return mySurf.IsURational();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepAdaptor_Surface::IsVRational()const
|
||||
{
|
||||
return mySurf.IsVRational();
|
||||
}
|
||||
|
Reference in New Issue
Block a user