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

Integration of OCCT 6.5.0 from SVN

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

2
src/IntCurveSurface/FILES Executable file
View File

@@ -0,0 +1,2 @@
IntCurveSurface_SurfaceTool.gxx

View File

@@ -0,0 +1,125 @@
-- File: IntCurveSurface.cdl
-- Created: Wed Apr 7 10:54:28 1993
-- Author: Laurent BUCHARD
---Copyright: Matra Datavision 1993
package IntCurveSurface
---Purpose: This package provides algorithmes to intersect a Curve
-- and a Surface.
-- Level: Internal
--
-- All the methods of the classes of this package are Internal.
-- except the methods of the classes <Intersection,
-- IntersectionPoint,
-- IntersectionSegment>
--
uses Standard, TCollection, TColStd, TColgp, gp,
Bnd, Intf, IntAna,
IntImp, IntSurf,
GeomAbs, StdFail ,
Adaptor3d, Geom,
math
is
--------------------------------------------------
enumeration TransitionOnCurve is
Tangent,In,Out;
---Purpose:
--
--
--
-- \ Uo ^ \ U1 ^
-- \ | n \ | n
-- Surf ====\======|=== ====\======|===
-- \ \
-- \ \
-- U1 \ Uo \
--
--
-- ( In ) ( Out )
--
--
--
-- \ /
-- \ /
-- \ /
-- \ /
-- Surf =====-----=====
--
-- ( Tangent )
-- Crb and Surf are C1
--------------------------------------------------
deferred class Intersection;
--------------------------------------------------
class IntersectionPoint;
--------------------------------------------------
class IntersectionSegment;
--------------------------------------------------
class SequenceOfPnt instantiates
Sequence from TCollection(
IntersectionPoint from IntCurveSurface);
--------------------------------------------------
class SequenceOfSeg instantiates
Sequence from TCollection(
IntersectionSegment from IntCurveSurface);
--------------------------------------------------
generic class CurveTool;
--------------------------------------------------
generic class HCurveTool;
--------------------------------------------------
generic class SurfaceTool;
--------------------------------------------------
generic class Polygon;
--------------------------------------------------
generic class Polyhedron;
--------------------------------------------------
generic class PolygonTool;
--------------------------------------------------
generic class PolyhedronTool;
--------------------------------------------------
generic class QuadricCurveFunc;
--------------------------------------------------
generic class QuadricCurveExactInter,
TheQuadCurvFunc;
--------------------------------------------------
generic class Inter,
ThePolygon,
ThePolygonTool,
ThePolyhedron,
ThePolyhedronTool,
TheInterference,
TheCSFunction,
TheExactInter,
TheQuadCurvExactInter;
-------------------------------------------------
--class HCurveTool instantiates
-- CurveTool from IntCurveSurface
-- (HCurve from Adaptor3d);
--class HInter instantiates
-- Inter from IntCurveSurface (
-- HCurve from Adaptor3d,
-- HCurveTool from IntCurveSurface,
-- HSurface from Adaptor3d,
-- HSurfaceTool from IntCurveSurface);
class TheHCurveTool instantiates
HCurveTool from IntCurveSurface (
HCurve from Adaptor3d);
class HInter instantiates
Inter from IntCurveSurface (
HCurve from Adaptor3d,
TheHCurveTool from IntCurveSurface,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d);
end IntCurveSurface;

View File

@@ -0,0 +1,227 @@
-- File: IntCurveSurface_CurveTool.cdl
-- Created: Mon Jul 17 16:25:23 1995
-- Author: Modelistation
-- <model@mastox>
---Copyright: Matra Datavision 1995
generic class CurveTool from IntCurveSurface (
CurveGen as any)
uses
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec from gp,
Pnt from gp,
Circ from gp,
Elips from gp,
Hypr from gp,
Parab from gp,
Lin from gp,
BezierCurve from Geom,
BSplineCurve from Geom
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
--
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
LastParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
--
-- Services to break the curves to the expected continuity
--
-- If for example you need the curve to be C2 and the method
-- Continuity returns you something lower than C2 (say C1 for
-- example).
--
-- First compute the number of intervals with the requested
-- continuity with the method NbIntervals(). Note that if the
-- continuity is higher than the one you need NbIntervals will
-- return 1.
--
-- Then you get the parameters bounding the intervals with the
-- method Intervals, using an array of length at least
-- NbIntervals()+1.
--
-- If you need to create a curve with a restricted span you can
-- use the method Trim().
Continuity(myclass; C: CurveGen) returns Shape from GeomAbs
---Purpose:
---C++: inline
;
NbIntervals(myclass; C: CurveGen; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
;
Intervals(myclass; C: CurveGen; 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
---C++: inline
;
IsClosed(myclass; C: CurveGen) returns Boolean
---C++: inline
;
IsPeriodic(myclass; C: CurveGen) returns Boolean
---C++: inline
;
Period(myclass; C: CurveGen) returns Real
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
;
Value(myclass; C: CurveGen; U : Real) returns Pnt from gp
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D0 (myclass; C: CurveGen; U : Real; P : out Pnt from gp)
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D1 (myclass; C: CurveGen; 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.
---C++: inline
;
D2 (myclass; C: CurveGen; 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.
---C++: inline
;
D3 (myclass; C: CurveGen; 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.
---C++: inline
;
DN (myclass; C: CurveGen; 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.
---C++: inline
;
Resolution(myclass; C: CurveGen; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
;
GetType(myclass; C: CurveGen) returns CurveType from GeomAbs
---Purpose: Returns the type of the curve in the current
-- interval : Line, Circle, Ellipse, Hyperbola,
-- Parabola, BezierCurve, BSplineCurve, OtherCurve.
---C++: inline
;
--
-- The following methods must be called when GetType returned
-- the corresponding type.
--
Line(myclass; C: CurveGen) returns Lin from gp
raises
NoSuchObject from Standard
---C++: inline
;
Circle(myclass; C: CurveGen) returns Circ from gp
raises
NoSuchObject from Standard
---C++: inline
;
Ellipse(myclass; C: CurveGen) returns Elips from gp
raises
NoSuchObject from Standard
---C++: inline
;
Hyperbola(myclass; C: CurveGen) returns Hypr from gp
raises
NoSuchObject from Standard
---C++: inline
;
Parabola(myclass; C: CurveGen) returns Parab from gp
raises
NoSuchObject from Standard
---C++: inline
;
Bezier(myclass; C: CurveGen) returns BezierCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
BSpline(myclass; C: CurveGen) returns BSplineCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
NbSamples(myclass; C: CurveGen; U0,U1: Real from Standard)
returns Integer from Standard;
end CurveTool;

View File

@@ -0,0 +1,37 @@
// File: IntCurveSurface_CurveTool.gxx
// Created: Mon Jul 17 17:39:39 1995
// Author: Modelistation
// <model@mastox>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
//============================================================
Standard_Integer IntCurveSurface_CurveTool::NbSamples (const CurveGen& C,
const Standard_Real U0,
const Standard_Real U1) {
GeomAbs_CurveType typC = C.GetType();
static Standard_Real nbsOther = 10.0;
Standard_Real nbs = nbsOther;
if(typC == GeomAbs_Line)
nbs = 2;
else if(typC == GeomAbs_BezierCurve)
nbs = 3 + C.NbPoles();
else if(typC == GeomAbs_BSplineCurve) {
nbs = C.NbKnots();
nbs*= C.Degree();
nbs*= C.LastParameter()- C.FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs=2;
}
if(nbs>50)
nbs = 50;
return((Standard_Integer)nbs);
}

View File

@@ -0,0 +1,154 @@
// File: IntCurveSurface_CurveTool.lxx
// Created: Thu Oct 22 12:14:59 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <gp_Vec.hxx>
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <gp_Parab.hxx>
#include <gp_Hypr.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
//============================================================
inline Standard_Real IntCurveSurface_CurveTool::FirstParameter (const CurveGen& C) {
return(C.FirstParameter());
}
//============================================================
inline Standard_Real IntCurveSurface_CurveTool::LastParameter (const CurveGen& C) {
return(C.LastParameter());
}
//============================================================
inline GeomAbs_Shape IntCurveSurface_CurveTool::Continuity (const CurveGen& C) {
return(C.Continuity());
}
//============================================================
inline Standard_Integer IntCurveSurface_CurveTool::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
return(C.NbIntervals(Sh));
}
//============================================================
inline void IntCurveSurface_CurveTool::Intervals(const CurveGen& C,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh) {
C.Intervals(Tab,Sh);
}
//============================================================
inline Standard_Boolean IntCurveSurface_CurveTool::IsClosed(const CurveGen& C) {
return(C.IsClosed());
}
//============================================================
inline Standard_Boolean IntCurveSurface_CurveTool::IsPeriodic(const CurveGen& C) {
return(C.IsPeriodic());
}
//============================================================
inline Standard_Real IntCurveSurface_CurveTool::Period(const CurveGen& C) {
return(C.Period());
}
//============================================================
inline gp_Pnt IntCurveSurface_CurveTool::Value (const CurveGen& C,
const Standard_Real U) {
return(C.Value(U));
}
//============================================================
inline void IntCurveSurface_CurveTool::D0(const CurveGen& C,
const Standard_Real U,
gp_Pnt& P) {
C.D0(U,P);
}
//============================================================
inline void IntCurveSurface_CurveTool::D1 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T) {
C.D1(U,P,T);
}
//============================================================
inline void IntCurveSurface_CurveTool::D2 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T,
gp_Vec& N) {
C.D2(U,P,T,N);
}
//============================================================
inline void IntCurveSurface_CurveTool::D3 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& V1,
gp_Vec& V2,
gp_Vec& V3) {
C.D3(U,P,V1,V2,V3);
}
//============================================================
inline gp_Vec IntCurveSurface_CurveTool::DN (const CurveGen& C,
const Standard_Real U,
const Standard_Integer N) {
return(C.DN(U,N));
}
//============================================================
inline Standard_Real IntCurveSurface_CurveTool::Resolution(const CurveGen& C,
const Standard_Real R3d) {
return(C.Resolution(R3d));
}
//============================================================
inline GeomAbs_CurveType IntCurveSurface_CurveTool::GetType(const CurveGen& C) {
return(C.GetType());
}
//============================================================
inline gp_Lin IntCurveSurface_CurveTool::Line (const CurveGen& C) {
return(C.Line());
}
//============================================================
inline gp_Circ IntCurveSurface_CurveTool::Circle (const CurveGen& C) {
return(C.Circle());
}
//============================================================
inline gp_Elips IntCurveSurface_CurveTool::Ellipse (const CurveGen& C) {
return(C.Ellipse());
}
//============================================================
inline gp_Parab IntCurveSurface_CurveTool::Parabola (const CurveGen& C) {
return(C.Parabola());
}
//============================================================
inline gp_Hypr IntCurveSurface_CurveTool::Hyperbola (const CurveGen& C) {
return(C.Hyperbola());
}
//============================================================
inline Handle(Geom_BezierCurve) IntCurveSurface_CurveTool::Bezier (const CurveGen& C) {
return(C.Bezier());
}
//============================================================
inline Handle(Geom_BSplineCurve) IntCurveSurface_CurveTool::BSpline (const CurveGen& C) {
return(C.BSpline());
}
//============================================================

View File

@@ -0,0 +1,227 @@
-- File: IntCurveSurface_HCurveTool.cdl
-- Created: Mon Jul 17 16:25:23 1995
-- Author: Modelistation
-- <model@mastox>
---Copyright: Matra Datavision 1995
generic class HCurveTool from IntCurveSurface (CurveGen as any)
uses
Array1OfReal from TColStd,
HArray1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec from gp,
Pnt from gp,
Circ from gp,
Elips from gp,
Hypr from gp,
Parab from gp,
Lin from gp,
BezierCurve from Geom,
BSplineCurve from Geom
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
--
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
LastParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
--
-- Services to break the curves to the expected continuity
--
-- If for example you need the curve to be C2 and the method
-- Continuity returns you something lower than C2 (say C1 for
-- example).
--
-- First compute the number of intervals with the requested
-- continuity with the method NbIntervals(). Note that if the
-- continuity is higher than the one you need NbIntervals will
-- return 1.
--
-- Then you get the parameters bounding the intervals with the
-- method Intervals, using an array of length at least
-- NbIntervals()+1.
--
-- If you need to create a curve with a restricted span you can
-- use the method Trim().
Continuity(myclass; C: CurveGen) returns Shape from GeomAbs
---Purpose:
---C++: inline
;
NbIntervals(myclass; C: CurveGen; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
;
Intervals(myclass; C: CurveGen; 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
---C++: inline
;
IsClosed(myclass; C: CurveGen) returns Boolean
---C++: inline
;
IsPeriodic(myclass; C: CurveGen) returns Boolean
---C++: inline
;
Period(myclass; C: CurveGen) returns Real
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
;
Value(myclass; C: CurveGen; U : Real) returns Pnt from gp
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D0 (myclass; C: CurveGen; U : Real; P : out Pnt from gp)
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D1 (myclass; C: CurveGen; 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.
---C++: inline
;
D2 (myclass; C: CurveGen; 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.
---C++: inline
;
D3 (myclass; C: CurveGen; 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.
---C++: inline
;
DN (myclass; C: CurveGen; 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.
---C++: inline
;
Resolution(myclass; C: CurveGen; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
;
GetType(myclass; C: CurveGen) returns CurveType from GeomAbs
---Purpose: Returns the type of the curve in the current
-- interval : Line, Circle, Ellipse, Hyperbola,
-- Parabola, BezierCurve, BSplineCurve, OtherCurve.
---C++: inline
;
--
-- The following methods must be called when GetType returned
-- the corresponding type.
--
Line(myclass; C: CurveGen) returns Lin from gp
raises
NoSuchObject from Standard
---C++: inline
;
Circle(myclass; C: CurveGen) returns Circ from gp
raises
NoSuchObject from Standard
---C++: inline
;
Ellipse(myclass; C: CurveGen) returns Elips from gp
raises
NoSuchObject from Standard
---C++: inline
;
Hyperbola(myclass; C: CurveGen) returns Hypr from gp
raises
NoSuchObject from Standard
---C++: inline
;
Parabola(myclass; C: CurveGen) returns Parab from gp
raises
NoSuchObject from Standard
---C++: inline
;
Bezier(myclass; C: CurveGen) returns BezierCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
BSpline(myclass; C: CurveGen) returns BSplineCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
NbSamples(myclass; C: CurveGen; U0,U1: Real from Standard)
returns Integer from Standard;
SamplePars(myclass; C: CurveGen; U0,U1: Real from Standard;
Defl: Real from Standard; NbMin: Integer from Standard;
Pars: in out HArray1OfReal from TColStd);
end HCurveTool;

View File

@@ -0,0 +1,233 @@
// File: IntCurveSurface_CurveTool.gxx
// Created: Mon Jul 17 17:39:39 1995
// Author: Modelistation
// <model@mastox>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <gce_MakeLin.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#define myMinPnts 5
//============================================================
Standard_Integer IntCurveSurface_HCurveTool::NbSamples (const CurveGen& C,
const Standard_Real U0,
const Standard_Real U1) {
GeomAbs_CurveType typC = C->GetType();
static Standard_Real nbsOther = 10.0;
Standard_Real nbs = nbsOther;
if(typC == GeomAbs_Line)
nbs = 2;
else if(typC == GeomAbs_BezierCurve)
nbs = 3 + C->NbPoles();
else if(typC == GeomAbs_BSplineCurve) {
nbs = C->NbKnots();
nbs*= C->Degree();
nbs*= C->LastParameter()- C->FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs=2;
}
if(nbs>50)
nbs = 50;
return((Standard_Integer)nbs);
}
//============================================================
void IntCurveSurface_HCurveTool::SamplePars (const CurveGen& C,
const Standard_Real U0,
const Standard_Real U1,
const Standard_Real Defl,
const Standard_Integer NbMin,
Handle(TColStd_HArray1OfReal)& Pars) {
GeomAbs_CurveType typC = C->GetType();
static Standard_Real nbsOther = 10.0;
Standard_Real nbs = nbsOther;
if(typC == GeomAbs_Line)
nbs = 2;
else if(typC == GeomAbs_BezierCurve) {
nbs = 3 + C->NbPoles();
}
if(typC != GeomAbs_BSplineCurve) {
if(nbs>50)
nbs = 50;
Standard_Integer nnbs = (Standard_Integer)nbs;
Pars = new TColStd_HArray1OfReal(1, nnbs);
Standard_Real du = (U1-U0)/(nnbs - 1);
Pars->SetValue(1, U0);
Pars->SetValue(nnbs, U1);
Standard_Integer i;
Standard_Real u;
for(i = 2, u = U0+du; i < nnbs; ++i, u += du) {
Pars->SetValue(i, u);
}
return;
}
const Handle(Geom_BSplineCurve)& aBC = C->BSpline();
Standard_Integer i, j, k, nbi;
Standard_Real t1, t2, dt;
Standard_Integer ui1 = aBC->FirstUKnotIndex();
Standard_Integer ui2 = aBC->LastUKnotIndex();
for(i = ui1; i < ui2; ++i) {
if(U0 >= aBC->Knot(i) && U0 < aBC->Knot(i+1)) {
ui1 = i;
break;
}
}
for(i = ui2; i > ui1; --i) {
if(U1 <= aBC->Knot(i) && U1 > aBC->Knot(i-1)) {
ui2 = i;
break;
}
}
Standard_Integer nbsu = ui2-ui1+1; nbsu += (nbsu - 1) * (aBC->Degree()-1);
Standard_Boolean bUniform = Standard_False;
if(nbsu < NbMin) {
nbsu = NbMin;
bUniform = Standard_True;
}
TColStd_Array1OfReal aPars(1, nbsu);
TColStd_Array1OfBoolean aFlg(1, nbsu);
//Filling of sample parameters
if(bUniform) {
t1 = U0;
t2 = U1;
dt = (t2 - t1)/(nbsu - 1);
aPars(1) = t1;
aFlg(1) = Standard_False;
aPars(nbsu) = t2;
aFlg(nbsu) = Standard_False;
for(i = 2, t1 += dt; i < nbsu; ++i, t1 += dt) {
aPars(i) = t1;
aFlg(i) = Standard_False;
}
}
else {
nbi = aBC->Degree();
k = 0;
t1 = U0;
for(i = ui1+1; i <= ui2; ++i) {
if(i == ui2) t2 = U1;
else t2 = aBC->Knot(i);
dt = (t2 - t1)/nbi;
j = 1;
do {
++k;
aPars(k) = t1;
aFlg(k) = Standard_False;
t1 += dt;
}
while (++j <= nbi);
t1 = t2;
}
++k;
aPars(k) = t1;
}
//Analysis of deflection
Standard_Real aDefl2 = Max(Defl*Defl, 1.e-9);
Standard_Real tol = Max(0.01*aDefl2, 1.e-9);
Standard_Integer l;
Standard_Integer NbSamples = 2;
aFlg(1) = Standard_True;
aFlg(nbsu) = Standard_True;
j = 1;
Standard_Boolean bCont = Standard_True;
while (j < nbsu-1 && bCont) {
if(aFlg(j+1)) {
++j;
continue;
}
t2 = aPars(j);
gp_Pnt p1 = aBC->Value(t2);
for(k = j+2; k <= nbsu; ++k) {
t2 = aPars(k);
gp_Pnt p2 = aBC->Value(t2);
if(p1.SquareDistance(p2) <= tol) continue;
gce_MakeLin MkLin(p1, p2);
const gp_Lin& lin = MkLin.Value();
Standard_Boolean ok = Standard_True;
for(l = j+1; l < k; ++l) {
if(aFlg(l)) {
ok = Standard_False;
break;
}
gp_Pnt pp = aBC->Value(aPars(l));
Standard_Real d = lin.SquareDistance(pp);
if(d <= aDefl2) continue;
ok = Standard_False;
break;
}
if(!ok) {
j = k - 1;
aFlg(j) = Standard_True;
++NbSamples;
break;
}
if(aFlg(k)) {
j = k;
break;
}
}
if(k >= nbsu) bCont = Standard_False;
}
if(NbSamples < myMinPnts) {
//uniform distribution
NbSamples = myMinPnts;
Pars = new TColStd_HArray1OfReal(1, NbSamples);
t1 = U0;
t2 = U1;
dt = (t2 - t1)/(NbSamples - 1);
Pars->SetValue(1, t1);
Pars->SetValue(NbSamples, t2);
for(i = 2, t1 += dt; i < NbSamples; ++i, t1 += dt) {
Pars->SetValue(i, t1);
}
return;
}
Pars = new TColStd_HArray1OfReal(1, NbSamples);
j = 0;
for(i = 1; i <= nbsu; ++i) {
if(aFlg(i)) {
++j;
Pars->SetValue(j,aPars(i));
}
}
}

View File

@@ -0,0 +1,154 @@
// File: IntCurveSurface_HCurveTool.lxx
// Created: Thu Oct 22 12:14:59 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <gp_Vec.hxx>
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <gp_Parab.hxx>
#include <gp_Hypr.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
//============================================================
inline Standard_Real IntCurveSurface_HCurveTool::FirstParameter (const CurveGen& C) {
return(C->FirstParameter());
}
//============================================================
inline Standard_Real IntCurveSurface_HCurveTool::LastParameter (const CurveGen& C) {
return(C->LastParameter());
}
//============================================================
inline GeomAbs_Shape IntCurveSurface_HCurveTool::Continuity (const CurveGen& C) {
return(C->Continuity());
}
//============================================================
inline Standard_Integer IntCurveSurface_HCurveTool::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
return(C->NbIntervals(Sh));
}
//============================================================
inline void IntCurveSurface_HCurveTool::Intervals(const CurveGen& C,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh) {
C->Intervals(Tab,Sh);
}
//============================================================
inline Standard_Boolean IntCurveSurface_HCurveTool::IsClosed(const CurveGen& C) {
return(C->IsClosed());
}
//============================================================
inline Standard_Boolean IntCurveSurface_HCurveTool::IsPeriodic(const CurveGen& C) {
return(C->IsPeriodic());
}
//============================================================
inline Standard_Real IntCurveSurface_HCurveTool::Period(const CurveGen& C) {
return(C->Period());
}
//============================================================
inline gp_Pnt IntCurveSurface_HCurveTool::Value (const CurveGen& C,
const Standard_Real U) {
return(C->Value(U));
}
//============================================================
inline void IntCurveSurface_HCurveTool::D0(const CurveGen& C,
const Standard_Real U,
gp_Pnt& P) {
C->D0(U,P);
}
//============================================================
inline void IntCurveSurface_HCurveTool::D1 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T) {
C->D1(U,P,T);
}
//============================================================
inline void IntCurveSurface_HCurveTool::D2 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T,
gp_Vec& N) {
C->D2(U,P,T,N);
}
//============================================================
inline void IntCurveSurface_HCurveTool::D3 (const CurveGen& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& V1,
gp_Vec& V2,
gp_Vec& V3) {
C->D3(U,P,V1,V2,V3);
}
//============================================================
inline gp_Vec IntCurveSurface_HCurveTool::DN (const CurveGen& C,
const Standard_Real U,
const Standard_Integer N) {
return(C->DN(U,N));
}
//============================================================
inline Standard_Real IntCurveSurface_HCurveTool::Resolution(const CurveGen& C,
const Standard_Real R3d) {
return(C->Resolution(R3d));
}
//============================================================
inline GeomAbs_CurveType IntCurveSurface_HCurveTool::GetType(const CurveGen& C) {
return(C->GetType());
}
//============================================================
inline gp_Lin IntCurveSurface_HCurveTool::Line (const CurveGen& C) {
return(C->Line());
}
//============================================================
inline gp_Circ IntCurveSurface_HCurveTool::Circle (const CurveGen& C) {
return(C->Circle());
}
//============================================================
inline gp_Elips IntCurveSurface_HCurveTool::Ellipse (const CurveGen& C) {
return(C->Ellipse());
}
//============================================================
inline gp_Parab IntCurveSurface_HCurveTool::Parabola (const CurveGen& C) {
return(C->Parabola());
}
//============================================================
inline gp_Hypr IntCurveSurface_HCurveTool::Hyperbola (const CurveGen& C) {
return(C->Hyperbola());
}
//============================================================
inline Handle(Geom_BezierCurve) IntCurveSurface_HCurveTool::Bezier (const CurveGen& C) {
return(C->Bezier());
}
//============================================================
inline Handle(Geom_BSplineCurve) IntCurveSurface_HCurveTool::BSpline (const CurveGen& C) {
return(C->BSpline());
}
//============================================================

View File

@@ -0,0 +1,280 @@
-- File: IntCurveSurface_Inter.cdl
-- Created: Wed Apr 7 15:46:05 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class Inter from IntCurveSurface (
TheCurve as any;
TheCurveTool as any;
TheSurface as any;
TheSurfaceTool as any)
inherits Intersection from IntCurveSurface
---Purpose: This class provides the intersections between a
-- surface S(u,v) and a curve C(w) on their natural
-- domains (S: (uo,vo)->(u1,v1)) and (C: wo->w1).
--
-- The class <Intersection from IntCurveSurface>
-- describes the methods which are used to read
-- the results.
uses
Box from Bnd,
Lin from gp,
Elips from gp,
Circ from gp,
Parab from gp,
Hypr from gp,
IntConicQuad from IntAna,
IntersectionPoint from IntCurveSurface,
IntersectionSegment from IntCurveSurface,
SurfaceType from GeomAbs,
--modified by NIZHNY-MKK Tue Jul 26 14:31:08 2005
Array2OfPnt from TColgp,
Array1OfReal from TColStd,
BoundSortBox from Bnd
------------------------------------------------------------
class ThePolygon instantiates
Polygon from IntCurveSurface (
TheCurve,
TheCurveTool);
------------------------------------------------------------
class ThePolygonTool instantiates
PolygonTool from IntCurveSurface (
Pnt from gp,
ThePolygon,
Box from Bnd);
------------------------------------------------------------
class ThePolyhedron instantiates
Polyhedron from IntCurveSurface (
TheSurface,
TheSurfaceTool);
------------------------------------------------------------
class ThePolyhedronTool instantiates
PolyhedronTool from IntCurveSurface (
ThePolyhedron);
------------------------------------------------------------
class TheInterference instantiates
InterferencePolygonPolyhedron from Intf (
ThePolygon,
ThePolygonTool,
ThePolyhedron,
ThePolyhedronTool);
------------------------------------------------------------
-- find a root (u,v,w) from a starting point (u0,v0,w0) of the problem :
-- XS(u,v) = XC(w)
-- YS(u,v) = YC(w)
-- ZS(u,v) = ZC(w)
-- where (XS,YS,ZS) is the point of parameters (u,v) on the
-- biparametric surface and (XC,YC,ZC) the point of parameter w on
-- the parametric curve.
--
class TheCSFunction instantiates
ZerCSParFunc from IntImp (
TheSurface,
TheSurfaceTool,
TheCurve,
TheCurveTool);
class TheExactInter instantiates
IntCS from IntImp (
TheSurface,
TheSurfaceTool,
TheCurve,
TheCurveTool,
TheCSFunction);
------------------------------------------------------------
-- find a root (u,v,w) from a starting point (w0) of the problem :
-- Q(X(w),Y(w),Z(w)) = 0
--
-- where Q(X,Y,Z) = 0 is the implicit expression of a quadric
-- and (X(w),Y(w),Z(w)) the point of parameter w on a parametric
-- curve.
--
class TheQuadCurvExactInter instantiates
QuadricCurveExactInter from IntCurveSurface(
TheSurface,
TheSurfaceTool,
TheCurve,
TheCurveTool);
--------------------------------------------------------------
is
Create
---Purpose: Empty Constructor
returns Inter from IntCurveSurface;
Perform(me : in out;
Curve : TheCurve;
Surface : TheSurface)
---Purpose: Compute the Intersection between the curve and the
-- surface
is static;
Perform(me : in out;
Curve : TheCurve;
Polygon : ThePolygon;
Surface : TheSurface)
---Purpose: Compute the Intersection between the curve and
-- the surface. The Curve is already sampled and
-- its polygon : <Polygon> is given.
is static;
Perform(me : in out;
Curve : TheCurve;
ThePolygon: ThePolygon;
Surface : TheSurface;
Polyhedron: ThePolyhedron)
---Purpose: Compute the Intersection between the curve and
-- the surface. The Curve is already sampled and
-- its polygon : <Polygon> is given. The Surface is
-- also sampled and <Polyhedron> is given.
is static;
Perform(me : in out;
Curve : TheCurve;
ThePolygon: ThePolygon;
Surface : TheSurface;
Polyhedron: ThePolyhedron;
BndBSB : in out BoundSortBox from Bnd)
---Purpose: Compute the Intersection between the curve and
-- the surface. The Curve is already sampled and
-- its polygon : <Polygon> is given. The Surface is
-- also sampled and <Polyhedron> is given.
is static;
Perform(me : in out;
Curve : TheCurve;
Surface : TheSurface;
Polyhedron: ThePolyhedron)
---Purpose: Compute the Intersection between the curve and
-- the surface. The Surface is already sampled and
-- its polyhedron : <Polyhedron> is given.
is static;
------------------------------------------------------------
------ Implementation functions :
------------------------------------------------------------
Perform(me : in out;
Curve : TheCurve;
Surface : TheSurface;
U0,V0,U1,V1: Real from Standard)
---Purpose: Compute the Intersection between the curve and the
-- surface
is static protected;
InternalPerformCurveQuadric(me : in out;
Curve : TheCurve;
Surface : TheSurface)
is static protected;
InternalPerform(me : in out;
Curve : TheCurve;
Polygon : ThePolygon;
Surface : TheSurface;
Polyhedron : ThePolyhedron;
U1,V1,U2,V2 : Real from Standard)
is static protected;
InternalPerform(me : in out;
Curve : TheCurve;
Polygon : ThePolygon;
Surface : TheSurface;
Polyhedron : ThePolyhedron;
U1,V1,U2,V2 : Real from Standard;
BSB : in out BoundSortBox from Bnd)
is static protected;
InternalPerform(me : in out;
Curve : TheCurve;
Polygon : ThePolygon;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
PerformConicSurf(me : in out;
Line : Lin from gp;
Curve : TheCurve;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
PerformConicSurf(me : in out;
Circle : Circ from gp;
Curve : TheCurve;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
PerformConicSurf(me : in out;
Ellipse : Elips from gp;
Curve : TheCurve;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
PerformConicSurf(me : in out;
Parab : Parab from gp;
Curve : TheCurve;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
PerformConicSurf(me : in out;
Hyper : Hypr from gp;
Curve : TheCurve;
Surface : TheSurface;
U1,V1,U2,V2 : Real from Standard)
is static protected;
AppendIntAna(me : in out;
Curve : TheCurve;
Surface : TheSurface;
InterAna : IntConicQuad from IntAna)
is static protected;
AppendPoint(me : in out;
Curve : TheCurve;
w : Real from Standard;
Surface : TheSurface;
u,v : Real from Standard)
is static protected;
AppendSegment(me : in out;
Curve : TheCurve;
u0,u1 : Real from Standard;
Surface : TheSurface)
is static protected;
--modified by NIZHNY-MKK Tue Jul 26 14:31:11 2005.BEGIN
DoSurface(me : in out;
surface : TheSurface;
u0,u1,v0,v1 : Real from Standard;
pntsOnSurface: in out Array2OfPnt from TColgp;
boxSurface : in out Box from Bnd;
gap : in out Real from Standard)
is private;
DoNewBounds(me : in out;
surface : TheSurface;
u0,u1,v0,v1 : Real from Standard;
pntsOnSurface: Array2OfPnt from TColgp;
X,Y,Z : Array1OfReal from TColStd;
Bounds : in out Array1OfReal from TColStd)
is private;
--modified by NIZHNY-MKK Tue Jul 26 14:40:22 2005.END
end Inter;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
-- File: IntCurveSurface_Intersection.cdl
-- Created: Wed Apr 7 16:18:57 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
deferred class Intersection from IntCurveSurface
---Level: Public
uses
IntersectionPoint from IntCurveSurface,
IntersectionSegment from IntCurveSurface,
SequenceOfPnt from IntCurveSurface,
SequenceOfSeg from IntCurveSurface
raises NotDone from StdFail,
OutOfRange from Standard
is
Initialize
---Purpose: Empty Constructor;
is protected;
IsDone(me)
---Purpose: returns the <done> field.
returns Boolean from Standard is static;
NbPoints(me)
---Purpose: returns the number of IntersectionPoint
-- if IsDone returns True.
-- else NotDone is raised.
returns Integer from Standard
raises NotDone from StdFail
is static;
Point(me; Index: Integer from Standard)
---Purpose: returns the IntersectionPoint of range <Index>
-- raises NotDone if the computation has failed or if
-- the computation has not been done
-- raises OutOfRange if Index is not in the range <1..NbPoints>
---C++: return const &
returns IntersectionPoint from IntCurveSurface
raises NotDone from StdFail,
OutOfRange from Standard
is static;
NbSegments(me)
---Purpose: returns the number of IntersectionSegment
-- if IsDone returns True.
-- else NotDone is raised.
returns Integer from Standard
raises NotDone from StdFail
is static;
Segment(me; Index: Integer from Standard)
---Purpose: returns the IntersectionSegment of range <Index>
-- raises NotDone if the computation has failed or if
-- the computation has not been done
-- raises OutOfRange if Index is not in the range <1..NbSegment>
---C++: return const &
returns IntersectionSegment from IntCurveSurface
raises NotDone from StdFail,
OutOfRange from Standard
is static;
SetValues(me:in out; Inter: Intersection from IntCurveSurface)
---Purpose: Internal method
-- copy the <Inter> fields to <me>
is static protected;
Append(me:in out; Inter: Intersection from IntCurveSurface;
FirstParamOnCurve: Real from Standard;
LastParamOnCurve : Real from Standard)
---Purpose: Internal method
-- Append the IntersectionPoints and
-- IntersectionSegments of <Inter> to <me>.
is static protected;
Append(me:in out; Pt: IntersectionPoint from IntCurveSurface)
---Purpose: Internal method
-- Append the IntersectionPoints of <Inter> to <me>
is static protected;
Append(me:in out; Seg: IntersectionSegment from IntCurveSurface)
---Purpose: Internal method
-- Append the IntersectionPoints of <Inter> to <me>
is static protected;
ResetFields(me:in out)
---Purpose: Internal method
-- Reset all the fields of <me>
-- Clear the sequences of IntersectionPoints and Segments
-- Set the field <done> to Standard_False.
is static protected;
Dump(me)
---Purpose: Dump all the fields.
is static;
fields
done : Boolean from Standard is protected;
lpnt : SequenceOfPnt from IntCurveSurface;
lseg : SequenceOfSeg from IntCurveSurface;
end Intersection;

View File

@@ -0,0 +1,121 @@
// File: IntCurveSurface_Intersection.cxx
// Created: Fri Apr 16 10:21:36 1993
// Author: Laurent BUCHARD
// <lbr@phobox>
#include <IntCurveSurface_Intersection.ixx>
#include <IntCurveSurface_IntersectionPoint.hxx>
#include <IntCurveSurface_IntersectionSegment.hxx>
#include <IntCurveSurface_TransitionOnCurve.hxx>
#define PARAMEQUAL(a,b) (Abs((a)-(b))< (1e-8))
//================================================================================
IntCurveSurface_Intersection::IntCurveSurface_Intersection(): done(Standard_False) {
}
//================================================================================
Standard_Boolean IntCurveSurface_Intersection::IsDone() const { return(done); }
//================================================================================
Standard_Integer IntCurveSurface_Intersection::NbPoints() const {
if (!done) {StdFail_NotDone::Raise();}
return lpnt.Length();
}
//================================================================================
Standard_Integer IntCurveSurface_Intersection::NbSegments() const {
if (!done) {StdFail_NotDone::Raise();}
return lseg.Length();
}
//================================================================================
const IntCurveSurface_IntersectionPoint& IntCurveSurface_Intersection::Point( const Standard_Integer N) const {
if (!done) {StdFail_NotDone::Raise();}
return lpnt.Value(N);
}
//================================================================================
const IntCurveSurface_IntersectionSegment& IntCurveSurface_Intersection::Segment( const Standard_Integer N) const {
if (!done) {StdFail_NotDone::Raise();}
return lseg.Value(N);
}
//================================================================================
void IntCurveSurface_Intersection::SetValues(const IntCurveSurface_Intersection& Other) {
if(Other.done) {
lseg.Clear();
lpnt.Clear();
Standard_Integer N = Other.lpnt.Length();
Standard_Integer i ;
for( i=1; i<= N ; i++) {
lpnt.Append(Other.lpnt.Value(i));
}
N = Other.lseg.Length();
for(i=1; i<= N ; i++) {
lseg.Append(Other.lseg.Value(i));
}
done=Standard_True;
}
else {
done=Standard_False;
}
}
//================================================================================
void IntCurveSurface_Intersection::Append(const IntCurveSurface_Intersection& Other,
// const Standard_Real a,
const Standard_Real ,
// const Standard_Real b)
const Standard_Real )
{
Standard_Integer i,ni;
if(Other.done) {
ni = Other.lpnt.Length();
for(i=1;i<=ni;i++) { Append(Other.Point(i)); }
ni = Other.lseg.Length();
for(i=1;i<=ni;i++) { Append(Other.Segment(i)); }
}
}
//================================================================================
void IntCurveSurface_Intersection::Append(const IntCurveSurface_IntersectionPoint& OtherPoint) {
Standard_Integer i,ni;
Standard_Real anu,anv,anw,u,v,w;
IntCurveSurface_TransitionOnCurve TrOnCurve,anTrOnCurve;
gp_Pnt P,anP;
ni = lpnt.Length();
for(i=1;i<=ni;i++) {
OtherPoint.Values(P,u,v,w,TrOnCurve);
lpnt(i).Values(anP,anu,anv,anw,anTrOnCurve);
if(PARAMEQUAL(u,anu)) {
if(PARAMEQUAL(v,anv)) {
if(PARAMEQUAL(w,anw)) {
if(anTrOnCurve==TrOnCurve) {
return;
}
}
}
}
}
lpnt.Append(OtherPoint);
}
//================================================================================
void IntCurveSurface_Intersection::Append(const IntCurveSurface_IntersectionSegment& OtherSegment) {
lseg.Append(OtherSegment);
}
//================================================================================
void IntCurveSurface_Intersection::ResetFields() {
if(done) {
lseg.Clear();
lpnt.Clear();
done=Standard_False;
}
}
//================================================================================
void IntCurveSurface_Intersection::Dump() const {
if(done) {
Standard_Integer i,ni;
ni = lpnt.Length();
for(i=1;i<=ni;i++) { Point(i).Dump(); }
ni = lseg.Length();
for(i=1;i<=ni;i++) { Segment(i).Dump(); }
}
else {
cout<<" Intersection NotDone"<<endl;
}
}

View File

@@ -0,0 +1,97 @@
-- File: IntCurveSurface_IntersectionPoint.cdl
-- Created: Wed Apr 7 16:35:02 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
class IntersectionPoint from IntCurveSurface
---Purpose: Definition of an interserction point between a
-- curve and a surface.
---Level: Public
uses
Pnt from gp,
TransitionOnCurve from IntCurveSurface
is
Create
---Purpose: Empty Constructor.
returns IntersectionPoint from IntCurveSurface;
Create(P : Pnt from gp;
USurf : Real from Standard;
VSurf : Real from Standard;
UCurv : Real from Standard;
TrCurv: TransitionOnCurve from IntCurveSurface)
---Purpose: Create an IntersectionPoint.
returns IntersectionPoint from IntCurveSurface;
SetValues(me: in out;
P : Pnt from gp;
USurf : Real from Standard;
VSurf : Real from Standard;
UCurv : Real from Standard;
TrCurv: TransitionOnCurve from IntCurveSurface)
---Purpose: Set the fields of the current IntersectionPoint.
is static;
Values(me;
P : out Pnt from gp;
USurf : out Real from Standard;
VSurf : out Real from Standard;
UCurv : out Real from Standard;
TrCurv: out TransitionOnCurve from IntCurveSurface)
---Purpose: Get the fields of the current IntersectionPoint.
is static;
Pnt(me)
---Purpose: returns the geometric point.
---C++: return const &
---C++: inline
returns Pnt from gp
is static;
U(me)
---Purpose: returns the U parameter on the surface.
---C++: inline
returns Real from Standard
is static;
V(me)
---Purpose: returns the V parameter on the surface.
---C++: inline
returns Real from Standard
is static;
W(me)
---Purpose: returns the parameter on the curve.
---C++: inline
returns Real from Standard
is static;
Transition(me)
---Purpose: returns the Transition of the point.
---C++: inline
returns TransitionOnCurve from IntCurveSurface
is static;
Dump(me)
---Purpose: Dump all the fields.
is static;
fields
myP : Pnt from gp;
myUSurf : Real from Standard;
myVSurf : Real from Standard;
myUCurv : Real from Standard;
myTrOnCurv: TransitionOnCurve from IntCurveSurface;
end IntersectionPoint;

View File

@@ -0,0 +1,65 @@
// ---- File: IntCurveSurface_IntersectionPoint.cxx
// -- Created: Wed Apr 7 16:35:02 1993
// -- Author: Laurent BUCHARD
// -- <lbr@sdsun2>
// ---Copyright: Matra Datavision 1993
#include <IntCurveSurface_IntersectionPoint.ixx>
//================================================================================
IntCurveSurface_IntersectionPoint::IntCurveSurface_IntersectionPoint() { }
//================================================================================
IntCurveSurface_IntersectionPoint::IntCurveSurface_IntersectionPoint(const gp_Pnt& P,
const Standard_Real USurf,
const Standard_Real VSurf,
const Standard_Real UCurv,
const IntCurveSurface_TransitionOnCurve TrOnCurv):
myP(P),myUSurf(USurf),myVSurf(VSurf),myUCurv(UCurv),myTrOnCurv(TrOnCurv)
{
}
//================================================================================
void IntCurveSurface_IntersectionPoint::SetValues(const gp_Pnt& P,
const Standard_Real USurf,
const Standard_Real VSurf,
const Standard_Real UCurv,
const IntCurveSurface_TransitionOnCurve TrOnCurv) {
myP=P;
myUSurf=USurf;
myVSurf=VSurf;
myUCurv=UCurv;
myTrOnCurv=TrOnCurv;
}
//================================================================================
void IntCurveSurface_IntersectionPoint::Values(gp_Pnt& P,
Standard_Real& USurf,
Standard_Real& VSurf,
Standard_Real& UCurv,
IntCurveSurface_TransitionOnCurve& TrOnCurv) const
{
P=myP;
USurf=myUSurf;
VSurf=myVSurf;
UCurv=myUCurv;
TrOnCurv=myTrOnCurv;
}
//================================================================================
void IntCurveSurface_IntersectionPoint::Dump() const {
cout<<"IntersectionPoint: P("<<myP.X()<<","<<myP.Y()<<","<<myP.Z()<<")"<<endl;
cout<<" : USurf("<<myUSurf<<") VSurf("<<myVSurf<<") UCurve("<<myUCurv<<")"<<endl;
cout<<" : TransitionOnSurf ";
switch(myTrOnCurv) {
case IntCurveSurface_Tangent: cout<<" Tangent "; break;
case IntCurveSurface_In: cout<<" In "; break;
case IntCurveSurface_Out: cout<<" Out "; break;
default: cout<< " XXXXX ";
}
cout<<endl;
}

View File

@@ -0,0 +1,26 @@
// ---- File: IntCurveSurface_IntersectionPoint.lxx
// -- Created: Wed Apr 7 16:35:02 1993
// -- Author: Laurent BUCHARD
// -- <lbr@sdsun2>
// ---Copyright: Matra Datavision 1993
inline const gp_Pnt& IntCurveSurface_IntersectionPoint::Pnt() const {
return(myP);
}
inline Standard_Real IntCurveSurface_IntersectionPoint::U() const {
return(myUSurf);
}
inline Standard_Real IntCurveSurface_IntersectionPoint::V() const {
return(myVSurf);
}
inline Standard_Real IntCurveSurface_IntersectionPoint::W() const {
return(myUCurv);
}
inline IntCurveSurface_TransitionOnCurve IntCurveSurface_IntersectionPoint::Transition() const {
return(myTrOnCurv);
}

View File

@@ -0,0 +1,68 @@
-- File: IntCurveSurface_IntersectionSegment.cdl
-- Created: Wed Apr 7 16:47:10 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
class IntersectionSegment from IntCurveSurface
---Purpose: A IntersectionSegment describes a segment of curve
-- (w1,w2) where distance(C(w),Surface) is less than a
-- given tolerances.
---Level: Public
uses
IntersectionPoint from IntCurveSurface
is
Create
returns IntersectionSegment from IntCurveSurface;
Create(P1: IntersectionPoint from IntCurveSurface;
P2: IntersectionPoint from IntCurveSurface)
returns IntersectionSegment from IntCurveSurface;
SetValues(me: in out;
P1: IntersectionPoint from IntCurveSurface;
P2: IntersectionPoint from IntCurveSurface)
is static;
Values(me;
P1: out IntersectionPoint from IntCurveSurface;
P2: out IntersectionPoint from IntCurveSurface)
is static;
FirstPoint(me;
P1: out IntersectionPoint from IntCurveSurface)
is static;
SecondPoint(me;
P2: out IntersectionPoint from IntCurveSurface)
is static;
FirstPoint(me)
returns IntersectionPoint from IntCurveSurface
---C++: return const &
is static;
SecondPoint(me)
returns IntersectionPoint from IntCurveSurface
---C++: return const &
is static;
Dump(me)
is static;
fields
myP1 : IntersectionPoint from IntCurveSurface;
myP2 : IntersectionPoint from IntCurveSurface;
end IntersectionSegment;

View File

@@ -0,0 +1,57 @@
// -- File: IntCurveSurface_IntersectionSegment.cdl
// -- Created: Wed Apr 7 16:47:10 1993
// -- Author: Laurent BUCHARD
// -- <lbr@sdsun2>
// ---Copyright: Matra Datavision 1993
#include <IntCurveSurface_IntersectionSegment.ixx>
IntCurveSurface_IntersectionSegment::IntCurveSurface_IntersectionSegment()
{ }
//================================================================================
IntCurveSurface_IntersectionSegment::IntCurveSurface_IntersectionSegment(const IntCurveSurface_IntersectionPoint& P1,
const IntCurveSurface_IntersectionPoint& P2):
myP1(P1),myP2(P2)
{
}
//================================================================================
void IntCurveSurface_IntersectionSegment::SetValues(const IntCurveSurface_IntersectionPoint& P1,
const IntCurveSurface_IntersectionPoint& P2) {
myP1 = P1;
myP2 = P2;
}
//================================================================================
void IntCurveSurface_IntersectionSegment::Values(IntCurveSurface_IntersectionPoint& P1,
IntCurveSurface_IntersectionPoint& P2) const
{
P1 = myP1;
P2 = myP2;
}
//================================================================================
void IntCurveSurface_IntersectionSegment::FirstPoint(IntCurveSurface_IntersectionPoint& P1) const {
P1 = myP1;
}
//================================================================================
void IntCurveSurface_IntersectionSegment::SecondPoint(IntCurveSurface_IntersectionPoint& P2) const {
P2 = myP2;
}
//================================================================================
const IntCurveSurface_IntersectionPoint &
IntCurveSurface_IntersectionSegment::FirstPoint() const {
return(myP1);
}
//================================================================================
const IntCurveSurface_IntersectionPoint &
IntCurveSurface_IntersectionSegment::SecondPoint() const {
return(myP2);
}
//================================================================================
void IntCurveSurface_IntersectionSegment::Dump() const {
cout<<"\nIntersectionSegment : "<<endl;
myP1.Dump();
myP2.Dump();
cout<<endl;
}

View File

@@ -0,0 +1,165 @@
-- File: Polygon.cdl
-- Created: Mon Oct 19 11:51:16 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
generic class Polygon from IntCurveSurface (
TheCurve as any;
TheCurveTool as any)
---Purpose: Describe a polyline as a topology to compute the
-- interference beetween two polylines 2 dimension.
uses Pnt from gp,
Box from Bnd,
Array1OfPnt from TColgp,
Array1OfReal from TColStd,
HArray1OfReal from TColStd
raises OutOfRange from Standard
is
Create (Curve : TheCurve;
NbPnt : Integer from Standard)
returns Polygon from IntCurveSurface;
Create (Curve : TheCurve;
U1,U2 : Real from Standard;
NbPnt : Integer from Standard)
returns Polygon from IntCurveSurface;
Create (Curve : TheCurve;
Upars : Array1OfReal from TColStd)
returns Polygon from IntCurveSurface;
Init (me:in out;
Curve : TheCurve)
is static protected;
Init (me:in out;
Curve : TheCurve;
Upars : Array1OfReal from TColStd)
is static protected;
Bounding (me)
returns Box from Bnd
---C++: return const &
---C++: inline
is static;
---Purpose: Give the bounding box of the polygon.
DeflectionOverEstimation(me)
returns Real from Standard
---C++: inline
is static;
SetDeflectionOverEstimation(me: in out; x:Real from Standard)
---C++: inline
is static;
Closed (me : in out; clos : Boolean from Standard)
---C++: inline
is static;
Closed (me)
returns Boolean from Standard
---C++: inline
is static;
NbSegments (me)
returns Integer
---C++: inline
is static;
---Purpose: Give the number of Segments in the polyline.
BeginOfSeg (me;
Index : in Integer)
returns Pnt from gp
raises OutOfRange from Standard
---C++: return const &
---C++: inline
is static;
---Purpose: Give the point of range Index in the Polygon.
EndOfSeg (me;
Index : in Integer)
returns Pnt from gp
raises OutOfRange from Standard
---C++: return const &
---C++: inline
is static;
---Purpose: Give the point of range Index in the Polygon.
-- Implementation :
InfParameter(me)
---Purpose: Returns the parameter (On the curve)
-- of the first point of the Polygon
returns Real from Standard
---C++: inline
is static;
SupParameter(me)
---Purpose: Returns the parameter (On the curve)
-- of the last point of the Polygon
returns Real from Standard
---C++: inline
is static;
ApproxParamOnCurve(me;
Index : in Integer from Standard;
ParamOnLine : in Real from Standard)
returns Real from Standard
raises OutOfRange from Standard
is static;
---Purpose: Give an approximation of the parameter on the curve
-- according to the discretization of the Curve.
-- Test needings :
Dump (me)
is static;
fields TheBnd : Box from Bnd;
TheDeflection : Real from Standard;
NbPntIn : Integer from Standard;
ThePnts : Array1OfPnt from TColgp;
ClosedPolygon : Boolean from Standard;
--- To compute an approximate parameter on the Curve
--
Binf : Real from Standard;
Bsup : Real from Standard;
myParams : HArray1OfReal from TColStd;
end Polygon;

View File

@@ -0,0 +1,248 @@
// File: IntCurveSurface_Polygon.gxx
// Created: Mon Oct 12 17:17:30 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <Standard_ConstructionError.hxx>
#include <Bnd_Box.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <gp_Lin.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
//======================================================================
//== On echantillonne sur le Domain de la Curve NbPts Points
//== a parametres constants.
//==
//== On estime la fleche maximum en prenant la distance maxi entre la
//== droite Curve.Value(X(i))-->Curve.Value(X(i+1))
//== et le point Curve.Value(X(i+1/2))
//======================================================================
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
const Standard_Integer tNbPts):
ThePnts(1,(tNbPts<5)? 5 : tNbPts)
{
Standard_Integer NbPts = (tNbPts<5)? 5 : tNbPts;
NbPntIn = NbPts;
Binf = TheCurveTool::FirstParameter(C);
Bsup = TheCurveTool::LastParameter(C);
Init(C);
}
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Integer tNbPts):
ThePnts(1,(tNbPts<5)? 5 : tNbPts) , Binf(U1) , Bsup(U2)
{
Standard_Integer NbPts = (tNbPts<5)? 5 : tNbPts;
NbPntIn = NbPts;
Init(C);
}
//=======================================================================
//function : IntCurveSurface_Polygon
//purpose :
//=======================================================================
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
const TColStd_Array1OfReal& Upars):
ThePnts(1,Upars.Length()) , Binf(Upars(Upars.Lower())) , Bsup(Upars(Upars.Upper()))
{
//ddout << "IntCurveSurface_Polygon::IntCurveSurface_Polygon" << endl;
Standard_Integer NbPts = Upars.Length();
//ddout << "NbPts :" << NbPts << endl;
NbPntIn = NbPts;
Init(C, Upars);
}
void IntCurveSurface_Polygon::Init(const TheCurve& C) {
Standard_Real u=Binf;
Standard_Real u1=Bsup;
Standard_Real du=(u1-u)/(Standard_Real)(NbPntIn-1);
Standard_Integer i=1;
gp_Pnt P;
do {
TheCurveTool::D0(C,u,P);
TheBnd.Add(P);
ThePnts.SetValue(i,P);
u+=du;
i++;
}
while(i<=NbPntIn);
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//---
TheDeflection = 0.0;
if(NbPntIn>3) {
i=1;
u=Binf;
u+=du * 0.5;
do {
gp_Pnt Pm=TheCurveTool::Value(C,u);
gp_Pnt P1=ThePnts.Value(i);
gp_Pnt P2=ThePnts.Value(i+1);
gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2)));
Standard_Real t=L.Distance(Pm);
if(t>TheDeflection) {
TheDeflection = t;
}
u+=du;
i++;
}
while(i<NbPntIn);
TheBnd.Enlarge(1.5*TheDeflection);
}
else {
TheBnd.Enlarge(1e-10);
}
ClosedPolygon = Standard_False;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void IntCurveSurface_Polygon::Init(const TheCurve& C,
const TColStd_Array1OfReal& Upars) {
//ddout << "IntCurveSurface_Polygon::Init" << endl;
Standard_Real u=Binf;
Standard_Real u1=Bsup;
Standard_Integer i=1, i0 = Upars.Lower()-1;
gp_Pnt P;
myParams = new TColStd_HArray1OfReal(1, Upars.Length());
do {
//ddout << "-------------Parameter : " << i << " " << Upars(i+i0) << endl;
myParams->SetValue(i, Upars(i+i0));
TheCurveTool::D0(C,Upars(i+i0),P);
//ddout << "P : " << P.X() << " " << P.Y() << " " << P.Z() << endl;
TheBnd.Add(P);
ThePnts.SetValue(i,P);
i++;
}
while(i<=NbPntIn);
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//---
TheDeflection = 0.0;
if(NbPntIn>3) {
i=1;
//ddout << "Deflection estimation" << endl;
do {
u = 0.5*(Upars(i0+i)+Upars(i0+i+1));
//ddout << "===========Parameter : " << i << " " << u << endl;
gp_Pnt Pm=TheCurveTool::Value(C,u);
//ddout << "Pm : " << Pm.X() << " " << Pm.Y() << " " << Pm.Z() << endl;
gp_Pnt P1=ThePnts.Value(i);
//ddout << "P1 : " << P1.X() << " " << P1.Y() << " " << P1.Z() << endl;
gp_Pnt P2=ThePnts.Value(i+1);
//ddout << "P2 : " << P2.X() << " " << P2.Y() << " " << P2.Z() << endl;
gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2)));
Standard_Real t=L.Distance(Pm);
//ddout << "Distance " << t << endl;
if(t>TheDeflection) {
TheDeflection = t;
}
i++;
}
while(i<NbPntIn);
//ddout << " TheDeflection = " << TheDeflection << endl;
TheBnd.Enlarge(1.5*TheDeflection);
}
else {
TheBnd.Enlarge(1e-10);
}
ClosedPolygon = Standard_False;
}
//======================================================================
Standard_Real IntCurveSurface_Polygon::ApproxParamOnCurve(const Standard_Integer TheIndex,
const Standard_Real TheParamOnLine) const
{
//ddout << "IntCurveSurface_Polygon::ApproxParamOnCurve" << endl;
if(TheParamOnLine < 0.0 || TheParamOnLine >1.0) {
cout<<" ParamOnLine = "<<TheParamOnLine<<" avec Index = "
<<TheIndex<<" dans IntCurveSurface_Polygon::ApproxParamOnCurve"<<endl;
return(Binf+(TheParamOnLine*(Bsup-Binf))/(Standard_Real)(NbPntIn-1));
}
Standard_Integer Index = TheIndex;
Standard_Real ParamOnLine = TheParamOnLine;
if (Index > NbPntIn) {
cout << "OutOfRange Polygon::ApproxParamOnCurve " <<endl;
}
if((Index == NbPntIn) && (ParamOnLine == 0.0)) {
Index--; ParamOnLine=1.0;
}
Standard_Real du, u;
if (myParams.IsNull())
{
du = (Bsup-Binf)/(Standard_Real)(NbPntIn-1);
u = Binf + du * (Standard_Real)(Index-1);
}
else
{
du = myParams->Value(Index+1) - myParams->Value(Index);
u = myParams->Value(Index);
}
u += du * ParamOnLine;
return (u);
}
//======================================================================
void IntCurveSurface_Polygon::Dump(void) const {
#if 0
static Standard_Integer Compteur=0;
char tamp[100];
Compteur++;
sprintf(tamp,"Poly%d",Compteur);
cout<<" @@@@@@@@@@@ F i c h i e r : "<<tamp<<" @@@@@@@@@@"<<endl;
FILE *fp;
fp=fopen(tamp,"w");
if(fp==NULL) {
cout<<"PolyGonGen::Erreur en Ouverture Fichier"<<tamp<<endl;
return;
}
fprintf(fp,"\n#Discretisation de : %f ---> %f \n",Binf,Bsup);
fprintf(fp,"\npol %d %d %f",Compteur,NbPntIn,TheDeflection);
gp_Pnt p1,p2;
for (Standard_Integer iObje=1; iObje<=NbSegments(); iObje++) {
p1=BeginOfSeg(iObje);
fprintf(fp,"\npnt %d %f %f",Compteur,p1.X(),p1.Y());
}
p1=EndOfSeg(NbSegments());
fprintf(fp,"\npnt %d %f %f",Compteur,p1.X(),p1.Y());
fprintf(fp,"\ndispol %d\n#\n",Compteur);
fclose(fp);
#endif
}
//======================================================================
//======================================================================

View File

@@ -0,0 +1,49 @@
// File: IntCurveSurface+_Polygon.lxx
// Created: Thu 3 Jun 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
//======================================================================
inline const Bnd_Box& IntCurveSurface_Polygon::Bounding(void) const {
return(TheBnd);
}
//======================================================================
inline Standard_Real IntCurveSurface_Polygon::DeflectionOverEstimation() const {
return(TheDeflection);
}
//======================================================================
inline void IntCurveSurface_Polygon::SetDeflectionOverEstimation
(const Standard_Real x) {
TheDeflection = x;
TheBnd.Enlarge(TheDeflection);
}
//======================================================================
inline void IntCurveSurface_Polygon::Closed(const Standard_Boolean flag) {
ClosedPolygon = flag;
}
//======================================================================
inline Standard_Boolean IntCurveSurface_Polygon::Closed(void) const {
return(Standard_False); //-- Voir si le cas Closed est traitable
}
//======================================================================
inline Standard_Integer IntCurveSurface_Polygon::NbSegments(void) const {
return(NbPntIn-1);
}
//======================================================================
inline const gp_Pnt& IntCurveSurface_Polygon::BeginOfSeg(const Standard_Integer Index) const {
return ThePnts(Index);
}
//======================================================================
inline const gp_Pnt& IntCurveSurface_Polygon::EndOfSeg(const Standard_Integer TheIndex) const {
return ThePnts(TheIndex+1);
}
//======================================================================
inline Standard_Real IntCurveSurface_Polygon::InfParameter() const {
return(Binf);
}
//======================================================================
inline Standard_Real IntCurveSurface_Polygon::SupParameter() const {
return(Bsup);
}
//======================================================================

View File

@@ -0,0 +1,69 @@
-- File: IntCurveSurface_PolygonTool.cdl
-- Created: Fri Aug 2 08:18:37 1991
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1991
generic class PolygonTool from IntCurveSurface(
ThePoint as any;
ThePolygon as any;
TheBoundingBox as any)
---Purpose:
raises OutOfRange from Standard
is
Bounding (myclass; thePolygon : ThePolygon)
returns TheBoundingBox;
---Purpose: Give the bounding box of the polygon.
---C++: inline
---C++: return const &
DeflectionOverEstimation
(myclass; thePolygon : ThePolygon)
---C++: inline
returns Real from Standard;
Closed (myclass; thePolygon : ThePolygon)
---C++: inline
returns Boolean from Standard;
NbSegments (myclass; thePolygon : ThePolygon)
---C++: inline
returns Integer from Standard;
BeginOfSeg (myclass; thePolygon : ThePolygon;
Index : in Integer)
---C++: inline
returns ThePoint
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
EndOfSeg (myclass; thePolygon : ThePolygon;
Index : in Integer)
---C++: inline
returns ThePoint
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
Dump (myclass; thePolygon : ThePolygon);
end PolygonTool;

View File

@@ -0,0 +1,23 @@
// File: IntCurve_ToolPolygon.gxx
// Created: Thu Jan 14 14:52:18 1993
// Author: Laurent BUCHARD
// <lbr@phylox>
void IntCurveSurface_PolygonTool::Dump(const ThePolygon& L) {
static Standard_Integer num=0;
num++;
Standard_Integer nbs = IntCurveSurface_PolygonTool::NbSegments(L);
cout<<"\npol2d "<<num<<" "<<nbs<<endl;
cout<<"Deflection "<<IntCurveSurface_PolygonTool::DeflectionOverEstimation(L)<<endl;
for(Standard_Integer i=1;i<=nbs;i++) {
gp_Pnt P(IntCurveSurface_PolygonTool::BeginOfSeg(L,i));
cout<<"pnt "<<num<<" "<<i<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
}
gp_Pnt PF(IntCurveSurface_PolygonTool::EndOfSeg(L,nbs));
cout<<"pnt "<<num<<" "<<nbs<<" "<< PF.X()<<" "<<PF.Y()<<" "<<PF.Z()<<endl;
}

View File

@@ -0,0 +1,50 @@
// File: IntCurveSurface_PolygonTool.gxx
// Created: Thu Jun 3 14:52:18 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
#include ThePolygon_hxx
//=================================================================
inline const TheBoundingBox& IntCurveSurface_PolygonTool::Bounding
(const ThePolygon& thePolygon)
{
return thePolygon.Bounding();
}
//=================================================================
inline Standard_Real IntCurveSurface_PolygonTool::DeflectionOverEstimation
(const ThePolygon& thePolygon)
{
return thePolygon.DeflectionOverEstimation();
}
//=================================================================
inline Standard_Boolean IntCurveSurface_PolygonTool::Closed
(const ThePolygon& thePolygon)
{
return thePolygon.Closed();
}
//=================================================================
inline Standard_Integer IntCurveSurface_PolygonTool::NbSegments
(const ThePolygon& thePolygon)
{
return thePolygon.NbSegments();
}
//=================================================================
inline const ThePoint& IntCurveSurface_PolygonTool::BeginOfSeg
(const ThePolygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.BeginOfSeg(Index);
}
//=================================================================
inline const ThePoint& IntCurveSurface_PolygonTool::EndOfSeg
(const ThePolygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.EndOfSeg(Index);
}
//=================================================================

View File

@@ -0,0 +1,277 @@
-- File: IntCurveSurface_Polyhedron.cdl
-- Created: Wed Feb 3 11:24:14 1993
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1993
generic class Polyhedron from IntCurveSurface (
ThePSurface as any;
ThePSurfaceTool as any)
---Purpose: This class provides a linear approximation of the PSurface.
--
uses XYZ from gp,
Pnt from gp,
Array2OfPnt from TColgp,
Array2OfReal from TColStd,
Box from Bnd,
HArray1OfBox from Bnd,
Array1OfReal from TColStd
raises OutOfRange from Standard
is
Create(Surface : ThePSurface;
nbdU,nbdV : Integer from Standard;
U1,V1,U2,V2 : Real from Standard)
-- Create a polyhedron on a sub-domain.
-- the numbre of samples on each parametric direction is given.
returns Polyhedron from IntCurveSurface;
Create(Surface : ThePSurface;
Upars, Vpars : Array1OfReal from TColStd)
-- Create a polyhedron on a sub-domain.
-- the numbre of samples on each parametric direction is given.
returns Polyhedron from IntCurveSurface;
Destroy(me: in out);
---C++: alias ~
DeflectionOverEstimation
(me : in out; flec : Real from Standard)
is static;
DeflectionOnTriangle(me; Surface : ThePSurface;
Index : Integer from Standard)
returns Real from Standard
is static;
UMinSingularity(me : in out; Sing : Boolean from Standard)
is static;
UMaxSingularity(me : in out; Sing : Boolean from Standard)
is static;
VMinSingularity(me : in out; Sing : Boolean from Standard)
is static;
VMaxSingularity(me : in out; Sing : Boolean from Standard)
is static;
Size(me;nbdu, nbdv : in out Integer)
---Purpose: get the size of the discretization.
is static;
Init(me:in out;
Surface : ThePSurface;
U1,V1,U2,V2 : Real from Standard)
-- Implementation function.
is static protected;
Init(me:in out;
Surface : ThePSurface;
Upars, Vpars : Array1OfReal from TColStd)
-- Implementation function.
is static protected;
NbTriangles (me)
---Purpose: Give the number of triangles in this double array of
---triangles (nbdu*nbdv*2).
returns Integer
is static;
Triangle(me; Index : in Integer;
P1,P2,P3 : out Integer)
---Purpose: Give the 3 points of the triangle of addresse Index in
-- the double array of triangles.
raises OutOfRange from Standard
is static;
TriConnex (me;
Triang : in Integer;
Pivot,Pedge : in Integer;
TriCon : out Integer;
OtherP : out Integer)
---Purpose: Give the addresse Tricon of the triangle connexe to the
-- triangle of address Triang by the edge Pivot Pedge and
-- the third point of this connexe triangle. When we are
-- on a free edge TriCon==0 but the function return the
-- value of the triangle in the other side of Pivot on
-- the free edge. Used to turn around a vertex.
returns Integer from Standard
raises OutOfRange from Standard
is static;
NbPoints (me)
---Purpose: Give the number of point in the double array of
-- triangles ((nbdu+1)*(nbdv+1)).
returns Integer from Standard
is static;
Point (me : in out ;
thePnt : in Pnt from gp;
lig, col : in Integer;
U,V : in Real from Standard)
---Purpose: Set the value of a field of the double array of
-- points.
raises OutOfRange from Standard
is static;
Point (me;
Index : in Integer;
U,V : out Real from Standard)
---Purpose: Give the point of index i in the MaTriangle.
---C++: return const &
returns Pnt from gp
raises OutOfRange from Standard
is static;
Point (me;
Index : in Integer)
---Purpose: Give the point of index i in the MaTriangle.
---C++: return const &
returns Pnt from gp
raises OutOfRange from Standard
is static;
Point (me;
Index : in Integer;
P : out Pnt from gp)
---Purpose: Give the point of index i in the MaTriangle.
raises OutOfRange from Standard
is static;
Bounding (me)
---Purpose: Give the bounding box of the MaTriangle.
---C++: return const &
returns Box from Bnd
is static;
FillBounding (me : in out)
---Purpose: Compute the array of boxes. The box <n> corresponding
-- to the triangle <n>.
is static;
ComponentsBounding
(me)
returns HArray1OfBox from Bnd
is static;
---Purpose: Give the array of boxes. The box <n> corresponding
-- to the triangle <n>.
---C++: return const &
DeflectionOverEstimation
(me)
returns Real from Standard
is static;
HasUMinSingularity
(me)
returns Boolean from Standard
is static;
HasUMaxSingularity
(me)
returns Boolean from Standard
is static;
HasVMinSingularity
(me)
returns Boolean from Standard
is static;
HasVMaxSingularity
(me)
returns Boolean from Standard
is static;
PlaneEquation (me;
Triang : in Integer from Standard;
NormalVector : out XYZ from gp;
PolarDistance : out Real from Standard)
raises OutOfRange from Standard
is static;
---Purpose: Give the plane equation of the triangle of addresse Triang.
Contain (me;
Triang : in Integer from Standard;
ThePnt : in Pnt from gp)
returns Boolean
raises OutOfRange from Standard
is static;
---Purpose: Give the plane equation of the triangle of addresse Triang.
Parameters(me; Index : Integer from Standard;
U,V : out Real from Standard)
raises OutOfRange from Standard;
-- Modified by Sergey KHROMOV - Fri Dec 7 10:04:01 2001 Begin
IsOnBound(me; Index1: Integer from Standard;
Index2: Integer from Standard)
---Purpose: This method returns true if the edge based on points with
-- indices Index1 and Index2 represents a boundary edge. It is
-- necessary to take into account the boundary deflection for
-- this edge.
returns Boolean from Standard;
GetBorderDeflection(me)
---Purpose: This method returns a border deflection.
---C++: inline
returns Real from Standard;
ComputeBorderDeflection(me; Surface : ThePSurface;
Parameter: Real from Standard;
PMin : Real from Standard;
PMax : Real from Standard;
isUIso : Boolean from Standard)
---Purpose: This method computes and returns a deflection of isoline
-- of given parameter on Surface.
returns Real from Standard
is private;
-- Modified by Sergey KHROMOV - Fri Dec 7 10:04:08 2001 End
-- Test needings :
Dump (me)
is static;
fields
nbdeltaU : Integer from Standard;
nbdeltaV : Integer from Standard;
TheBnd : Box from Bnd;
TheComponentsBnd : HArray1OfBox from Bnd;
TheDeflection : Real from Standard;
C_MyPnts : Address from Standard;
C_MyU : Address from Standard;
C_MyV : Address from Standard;
UMinSingular : Boolean from Standard;
UMaxSingular : Boolean from Standard;
VMinSingular : Boolean from Standard;
VMaxSingular : Boolean from Standard;
-- Modified by Sergey KHROMOV - Fri Dec 7 12:00:42 2001 Begin
TheBorderDeflection: Real from Standard;
C_MyIsOnBounds : Address from Standard;
-- Modified by Sergey KHROMOV - Fri Dec 7 12:00:43 2001 End
end Polyhedron;

View File

@@ -0,0 +1,849 @@
// File: IntCurveSurface_Polyhedron.gxx
// Created: Wed Feb 3 11:33:09 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Lin.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <Bnd_Array1OfBox.hxx>
#include <Standard_ConstructionError.hxx>
//#if defined (WNT) || !defined (DEB)
#include <stdio.h>
//#endif
#define CHECKBOUNDS 0
//-----------------------------------------------------
#define LONGUEUR_MINI_EDGE_TRIANGLE 1e-15
//=======================================================================
//function : IntCurveSurface_Polyhedron
//purpose :
//=======================================================================
IntCurveSurface_Polyhedron::IntCurveSurface_Polyhedron (const ThePSurface& Surface,
const Standard_Integer nbdU,
const Standard_Integer nbdV,
const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2)
: nbdeltaU((nbdU<3)? 3 : nbdU),
nbdeltaV((nbdV<3)? 3 : nbdV),
TheDeflection(Epsilon(100.)),
C_MyPnts(NULL),C_MyU(NULL),C_MyV(NULL),C_MyIsOnBounds(NULL)
{
Standard_Integer t = (nbdeltaU+1)*(nbdeltaV+1)+1;
gp_Pnt *CMyPnts = new gp_Pnt[t]; C_MyPnts = (void *)CMyPnts;
Standard_Real *CMyU = new Standard_Real[t]; C_MyU = (void *)CMyU;
Standard_Real *CMyV = new Standard_Real[t]; C_MyV = (void *)CMyV;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:46 2001 Begin
Standard_Boolean *CMyIsOnBounds = new Standard_Boolean[t];
C_MyIsOnBounds = (void *)CMyIsOnBounds;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:47 2001 End
Init(Surface,u1,v1,u2,v2);
}
//=======================================================================
//function : IntCurveSurface_Polyhedron
//purpose :
//=======================================================================
IntCurveSurface_Polyhedron::IntCurveSurface_Polyhedron (const ThePSurface& Surface,
const TColStd_Array1OfReal& Upars,
const TColStd_Array1OfReal& Vpars)
: nbdeltaU(Upars.Length()-1),
nbdeltaV(Vpars.Length()-1),
TheDeflection(Epsilon(100.)),
C_MyPnts(NULL),C_MyU(NULL),C_MyV(NULL),C_MyIsOnBounds(NULL)
{
Standard_Integer t = (nbdeltaU+1)*(nbdeltaV+1)+1;
gp_Pnt *CMyPnts = new gp_Pnt[t]; C_MyPnts = (void *)CMyPnts;
Standard_Real *CMyU = new Standard_Real[t]; C_MyU = (void *)CMyU;
Standard_Real *CMyV = new Standard_Real[t]; C_MyV = (void *)CMyV;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:46 2001 Begin
Standard_Boolean *CMyIsOnBounds = new Standard_Boolean[t];
C_MyIsOnBounds = (void *)CMyIsOnBounds;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:47 2001 End
Init(Surface, Upars, Vpars);
}
void IntCurveSurface_Polyhedron::Destroy() {
//-- printf("\n IntCurveSurface_Polyhedron::Destroy\n");
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts; if(C_MyPnts) delete [] CMyPnts;
Standard_Real *CMyU = (Standard_Real *)C_MyU; if(C_MyU) delete [] CMyU;
Standard_Real *CMyV = (Standard_Real *)C_MyV; if(C_MyV) delete [] CMyV;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:46 2001 Begin
Standard_Boolean *CMyIsOnBounds = (Standard_Boolean *)C_MyIsOnBounds;
if(C_MyIsOnBounds) delete [] CMyIsOnBounds;
// Modified by Sergey KHROMOV - Fri Dec 7 12:03:47 2001 End
C_MyPnts=C_MyU=C_MyV=C_MyIsOnBounds=NULL;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Init(const ThePSurface& Surface,
const Standard_Real U0,
const Standard_Real V0,
const Standard_Real U1,
const Standard_Real V1) {
static Standard_Integer DebugDump = 0;
Standard_Integer i1,i2;
Standard_Real U,V;
Standard_Real U1mU0sNbdeltaU = (U1-U0)/(Standard_Real)nbdeltaU;
Standard_Real V1mV0sNbdeltaV = (V1-V0)/(Standard_Real)nbdeltaV;
gp_Pnt TP;
Standard_Integer Index=1;
//-- --------------------------------------------------
//-- Index varie de 1 -> (nbdu+1)*(nbdv+1)
//-- V est la colonne
//-- U est la ligne
//-- --------------------------------------------------
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
Standard_Real *CMyU = (Standard_Real *)C_MyU;
Standard_Real *CMyV = (Standard_Real *)C_MyV;
Standard_Boolean *CMyIsOnBounds = (Standard_Boolean *)C_MyIsOnBounds;
for (i1 = 0, U = U0; i1 <= nbdeltaU; i1++, U+= U1mU0sNbdeltaU) {
for (i2 = 0, V = V0; i2 <= nbdeltaV; i2++, V+= V1mV0sNbdeltaV ) {
ThePSurfaceTool::D0(Surface,U,V,TP);
//-- Point(TP,i1, i2,U,V);
CMyPnts[Index] = TP;
CMyU[Index] = U;
CMyV[Index] = V;
// Modified by Sergey KHROMOV - Fri Dec 7 12:07:51 2001
CMyIsOnBounds[Index] = (i1 == 0 || i1 == nbdeltaU ||
i2 == 0 || i2 == nbdeltaV);
// Modified by Sergey KHROMOV - Fri Dec 7 12:07:52 2001
TheBnd.Add(TP);
Index++;
}
}
//-- Calcul de la deflection Triangle <-> Point milieu
Standard_Real tol=0.0; Standard_Integer nbtriangles = NbTriangles();
for (i1=1; i1<=nbtriangles; i1++) {
Standard_Real tol1 = DeflectionOnTriangle(Surface,i1);
if(tol1>tol) tol=tol1;
}
//-- Calcul de la deflection Bord <-> Point milieu
DeflectionOverEstimation(tol*1.2);
FillBounding();
// Modified by Sergey KHROMOV - Fri Dec 7 11:23:33 2001 Begin
Standard_Real aDeflection;
TheBorderDeflection = RealFirst();
// Compute the deflection on the lower bound (U-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, U0, V0, V1, Standard_True);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the upper bound (U-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, U1, V0, V1, Standard_True);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the lower bound (V-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, V0, U0, U1, Standard_False);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the upper bound (V-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, V1, U0, U1, Standard_False);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Modified by Sergey KHROMOV - Fri Dec 7 11:23:34 2001 End
if(DebugDump) {
Dump();
}
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Init(const ThePSurface& Surface,
const TColStd_Array1OfReal& Upars,
const TColStd_Array1OfReal& Vpars) {
static Standard_Integer DebugDump = 0;
Standard_Integer i1,i2;
Standard_Real U,V;
gp_Pnt TP;
Standard_Integer Index=1;
//-- --------------------------------------------------
//-- Index varie de 1 -> (nbdu+1)*(nbdv+1)
//-- V est la colonne
//-- U est la ligne
//-- --------------------------------------------------
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
Standard_Real *CMyU = (Standard_Real *)C_MyU;
Standard_Real *CMyV = (Standard_Real *)C_MyV;
Standard_Boolean *CMyIsOnBounds = (Standard_Boolean *)C_MyIsOnBounds;
Standard_Integer i0 = Upars.Lower(), j0 = Vpars.Lower();
for (i1 = 0; i1 <= nbdeltaU; i1++) {
U = Upars(i1+i0);
for (i2 = 0; i2 <= nbdeltaV; i2++) {
V = Vpars(i2+j0);
ThePSurfaceTool::D0(Surface,U,V,TP);
//-- Point(TP,i1, i2,U,V);
CMyPnts[Index] = TP;
CMyU[Index] = U;
CMyV[Index] = V;
// Modified by Sergey KHROMOV - Fri Dec 7 12:07:51 2001
CMyIsOnBounds[Index] = (i1 == 0 || i1 == nbdeltaU ||
i2 == 0 || i2 == nbdeltaV);
// Modified by Sergey KHROMOV - Fri Dec 7 12:07:52 2001
TheBnd.Add(TP);
Index++;
}
}
//-- Calcul de la deflection Triangle <-> Point milieu
Standard_Real tol=0.0; Standard_Integer nbtriangles = NbTriangles();
for (i1=1; i1<=nbtriangles; i1++) {
Standard_Real tol1 = DeflectionOnTriangle(Surface,i1);
if(tol1>tol) tol=tol1;
}
//-- Calcul de la deflection Bord <-> Point milieu
DeflectionOverEstimation(tol*1.2);
FillBounding();
// Modified by Sergey KHROMOV - Fri Dec 7 11:23:33 2001 Begin
Standard_Real aDeflection;
TheBorderDeflection = RealFirst();
Standard_Real U0 = Upars(i0);
Standard_Real V0 = Vpars(j0);
Standard_Real U1 = Upars(Upars.Upper());
Standard_Real V1 = Vpars(Vpars.Upper());
// Compute the deflection on the lower bound (U-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, U0, V0, V1, Standard_True);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the upper bound (U-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, U1, V0, V1, Standard_True);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the lower bound (V-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, V0, U0, U1, Standard_False);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Compute the deflection on the upper bound (V-isoline) of the surface.
aDeflection = ComputeBorderDeflection(Surface, V1, U0, U1, Standard_False);
if (aDeflection > TheBorderDeflection)
TheBorderDeflection = aDeflection;
// Modified by Sergey KHROMOV - Fri Dec 7 11:23:34 2001 End
if(DebugDump) {
Dump();
}
}
//=======================================================================
//function : DeflectionOnTriangle
//purpose :
//=======================================================================
Standard_Real IntCurveSurface_Polyhedron::DeflectionOnTriangle (const ThePSurface& Surface,
const Standard_Integer Triang) const
{
Standard_Integer i1,i2,i3;
Triangle(Triang,i1,i2,i3);
//-- Calcul de l equation du plan
Standard_Real u1,v1,u2,v2,u3,v3;
gp_Pnt P1,P2,P3;
P1 = Point(i1,u1,v1);
P2 = Point(i2,u2,v2);
P3 = Point(i3,u3,v3);
if(P1.SquareDistance(P2)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
if(P1.SquareDistance(P3)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
if(P2.SquareDistance(P3)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
gp_XYZ XYZ1=P2.XYZ()-P1.XYZ();
gp_XYZ XYZ2=P3.XYZ()-P2.XYZ();
gp_XYZ XYZ3=P1.XYZ()-P3.XYZ();
gp_Vec NormalVector((XYZ1^XYZ2)+(XYZ2^XYZ3)+(XYZ3^XYZ1));
NormalVector.Normalize();
//-- Standard_Real PolarDistance = NormalVector * P1.XYZ();
//-- Calcul du point u,v au centre du triangle
Standard_Real u = (u1+u2+u3)/3.0;
Standard_Real v = (v1+v2+v3)/3.0;
gp_Pnt P = ThePSurfaceTool::Value(Surface,u,v);
gp_Vec P1P(P1,P);
return(Abs(P1P.Dot(NormalVector)));
}
//=======================================================================
//function : Parameters
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Parameters( const Standard_Integer Index
,Standard_Real &U
,Standard_Real &V) const
{
#if CHECKBOUNDS
if(Index<0 || Index>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::Parameters\n");
}
#endif
Standard_Real *CMyU = (Standard_Real *)C_MyU;
U = CMyU[Index];
Standard_Real *CMyV = (Standard_Real *)C_MyV;
V = CMyV[Index];
}
//=======================================================================
//function : DeflectionOverEstimation
//purpose : Set
//=======================================================================
void IntCurveSurface_Polyhedron::DeflectionOverEstimation(const Standard_Real flec)
{
if(flec<0.0001) {
TheDeflection=0.0001;
TheBnd.Enlarge(0.0001);
}
else {
TheDeflection=flec;
TheBnd.Enlarge(flec);
}
}
//=======================================================================
//function : DeflectionOverEstimation
//purpose : Get
//=======================================================================
Standard_Real IntCurveSurface_Polyhedron::DeflectionOverEstimation() const
{
return TheDeflection;
}
//=======================================================================
//function : Bounding
//purpose :
//=======================================================================
const Bnd_Box& IntCurveSurface_Polyhedron::Bounding() const
{
return TheBnd;
}
//=======================================================================
//function : FillBounding
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::FillBounding()
{
TheComponentsBnd=new Bnd_HArray1OfBox(1, NbTriangles());
Bnd_Box Boite;
Standard_Integer np1, np2, np3;
Standard_Integer nbtriangles = NbTriangles();
for (Standard_Integer iTri=1; iTri<=nbtriangles; iTri++) {
Triangle(iTri, np1, np2, np3);
gp_Pnt p1(Point(np1));
gp_Pnt p2(Point(np2));
gp_Pnt p3(Point(np3));
Boite.SetVoid();
if(p1.SquareDistance(p2)>LONGUEUR_MINI_EDGE_TRIANGLE) {
if(p1.SquareDistance(p3)>LONGUEUR_MINI_EDGE_TRIANGLE) {
if(p2.SquareDistance(p3)>LONGUEUR_MINI_EDGE_TRIANGLE) {
Boite.Add(p1);
Boite.Add(p2);
Boite.Add(p3);
Boite.Enlarge(TheDeflection);
}
}
}
Boite.Enlarge(TheDeflection);
TheComponentsBnd->SetValue(iTri,Boite);
}
}
//=======================================================================
//function : ComponentsBounding
//purpose :
//=======================================================================
const Handle(Bnd_HArray1OfBox)&
IntCurveSurface_Polyhedron::ComponentsBounding() const
{
return TheComponentsBnd;
}
//=======================================================================
//function : NbTriangles
//purpose :
//=======================================================================
Standard_Integer IntCurveSurface_Polyhedron::NbTriangles () const
{
return nbdeltaU*nbdeltaV*2;
}
//=======================================================================
//function : NbPoints
//purpose :
//=======================================================================
Standard_Integer IntCurveSurface_Polyhedron::NbPoints () const
{
return (nbdeltaU+1)*(nbdeltaV+1);
}
//=======================================================================
//function : TriConnex
//purpose :
//=======================================================================
Standard_Integer IntCurveSurface_Polyhedron::TriConnex
(const Standard_Integer Triang,
const Standard_Integer Pivot,
const Standard_Integer Pedge,
Standard_Integer& TriCon,
Standard_Integer& OtherP) const
{
#ifdef DEB
Standard_Integer nbdeltaUp1 = nbdeltaU + 1;
Standard_Integer nbdeltaUm2 = nbdeltaU + nbdeltaU;
#endif
Standard_Integer Pivotm1 = Pivot-1;
Standard_Integer nbdeltaVp1 = nbdeltaV+1;
Standard_Integer nbdeltaVm2 = nbdeltaV + nbdeltaV;
// Pivot position in the MaTriangle :
Standard_Integer ligP = Pivotm1/nbdeltaVp1;
Standard_Integer colP = Pivotm1 - ligP * nbdeltaVp1;
// Point sur Edge position in the MaTriangle and edge typ :
#ifndef DEB
Standard_Integer ligE =0, colE =0, typE =0;
#else
Standard_Integer ligE, colE, typE;
#endif
if (Pedge!=0) {
ligE= (Pedge-1)/nbdeltaVp1;
colE= (Pedge-1) - (ligE * nbdeltaVp1);
// Horizontal
if (ligP==ligE) typE=1;
// Vertical
else if (colP==colE) typE=2;
// Oblique
else typE=3;
}
else {
typE=0;
}
// Triangle position General case :
#ifndef DEB
Standard_Integer linT =0, colT =0;
Standard_Integer linO =0, colO =0;
Standard_Integer t =0, tt =0;
#else
Standard_Integer linT, colT;
Standard_Integer linO, colO;
Standard_Integer t,tt;
#endif
if (Triang!=0) {
t = (Triang-1)/(nbdeltaVm2);
tt= (Triang-1)-t*nbdeltaVm2;
linT= 1+t;
colT= 1+tt;
if (typE==0) {
if (ligP==linT) {
ligE=ligP-1;
colE=colP-1;
typE=3;
}
else {
if (colT==ligP+ligP) {
ligE=ligP;
colE=colP-1;
typE=1;
}
else {
ligE=ligP+1;
colE=colP+1;
typE=3;
}
}
}
switch (typE) {
case 1: // Horizontal
if (linT==ligP) {
linT++;
linO=ligP+1;
colO=(colP>colE)? colP : colE; //--colO=Max(colP, colE);
}
else {
linT--;
linO=ligP-1;
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
}
break;
case 2: // Vertical
if (colT==(colP+colP)) {
colT++;
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
colO=colP+1;;
}
else {
colT--;
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
colO=colP-1;;
}
break;
case 3: // Oblique
if ((colT&1)==0) {
colT--;
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
}
else {
colT++;
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
colO=(colP>colE)? colP : colE; //--colO=Max(colP, colE);
}
break;
}
}
else {
// Unknown Triangle position :
if (Pedge==0) {
// Unknown edge :
linT=(1>ligP)? 1 : ligP; //--linT=Max(1, ligP);
colT=(1>(colP+colP))? 1 : (colP+colP); //--colT=Max(1, colP+colP);
if (ligP==0) linO=ligP+1;
else linO=ligP-1;
colO=colP;
}
else {
// Known edge We take the left or down connectivity :
switch (typE) {
case 1: // Horizontal
linT=ligP+1;
colT=(colP>colE)? colP : colE; //--colT=Max(colP,colE);
colT+=colT;
linO=ligP+1;
colO=(colP>colE)? colP : colE; //--colO=Max(colP,colE);
break;
case 2: // Vertical
linT=(ligP>ligE)? ligP : ligE; //--linT=Max(ligP, ligE);
colT=colP+colP;
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
colO=colP-1;
break;
case 3: // Oblique
linT=(ligP>ligE)? ligP : ligE; //--linT=Max(ligP, ligE);
colT=colP+colE;
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
break;
}
}
}
TriCon=(linT-1)*nbdeltaVm2 + colT;
if (linT<1) {
linO=0;
colO=colP+colP-colE;
if (colO<0) {colO=0;linO=1;}
else if (colO>nbdeltaV) {colO=nbdeltaV;linO=1;}
TriCon=0;
}
else if (linT>nbdeltaU) {
linO=nbdeltaU;
colO=colP+colP-colE;
if (colO<0) {colO=0;linO=nbdeltaU-1;}
else if (colO>nbdeltaV) {colO=nbdeltaV;linO=nbdeltaU-1;}
TriCon=0;
}
if (colT<1) {
colO=0;
linO=ligP+ligP-ligE;
if (linO<0) {linO=0;colO=1;}
else if (linO>nbdeltaU) {linO=nbdeltaU;colO=1;}
TriCon=0;
}
else if (colT>nbdeltaV) {
colO=nbdeltaV;
linO=ligP+ligP-ligE;
if (linO<0) {linO=0;colO=nbdeltaV-1;}
else if (linO>nbdeltaU) {linO=nbdeltaU;colO=nbdeltaV-1;}
TriCon=0;
}
OtherP=linO*nbdeltaVp1 + colO+1;
return TriCon;
}
//=======================================================================
//function : PlaneEquation
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::PlaneEquation (const Standard_Integer Triang,
gp_XYZ& NormalVector,
Standard_Real& PolarDistance) const
{
Standard_Integer i1,i2,i3;
Triangle(Triang,i1,i2,i3);
//-- gp_XYZ v1=Point(i2).XYZ()-Point(i1).XYZ();
//-- gp_XYZ v2=Point(i3).XYZ()-Point(i2).XYZ();
//-- gp_XYZ v3=Point(i1).XYZ()-Point(i3).XYZ();
gp_XYZ Pointi1(Point(i1).XYZ());
gp_XYZ Pointi2(Point(i2).XYZ());
gp_XYZ Pointi3(Point(i3).XYZ());
gp_XYZ v1= Pointi2 - Pointi1;
gp_XYZ v2= Pointi3 - Pointi2;
gp_XYZ v3= Pointi1 - Pointi3;
if(v1.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
if(v2.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
if(v3.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
NormalVector.Normalize();
PolarDistance = NormalVector * Point(i1).XYZ();
}
//=======================================================================
//function : Contain
//purpose :
//=======================================================================
Standard_Boolean IntCurveSurface_Polyhedron::Contain (const Standard_Integer Triang,
const gp_Pnt& ThePnt) const
{
Standard_Integer i1,i2,i3;
Triangle(Triang,i1,i2,i3);
gp_XYZ Pointi1(Point(i1).XYZ());
gp_XYZ Pointi2(Point(i2).XYZ());
gp_XYZ Pointi3(Point(i3).XYZ());
gp_XYZ v1=(Pointi2-Pointi1)^(ThePnt.XYZ()-Pointi1);
gp_XYZ v2=(Pointi3-Pointi2)^(ThePnt.XYZ()-Pointi2);
gp_XYZ v3=(Pointi1-Pointi3)^(ThePnt.XYZ()-Pointi3);
if (v1*v2 >= 0. && v2*v3 >= 0. && v3*v1>=0.)
return Standard_True;
else
return Standard_False;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Dump() const
{
}
//=======================================================================
//function : Size
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Size (Standard_Integer& nbdu,
Standard_Integer& nbdv) const
{
nbdu=nbdeltaU;
nbdv=nbdeltaV;
}
//=======================================================================
//function : Triangle
//purpose :
//=======================================================================
void IntCurveSurface_Polyhedron::Triangle (const Standard_Integer Index,
Standard_Integer& P1,
Standard_Integer& P2,
Standard_Integer& P3) const
{
Standard_Integer line=1+((Index-1)/(nbdeltaV*2));
Standard_Integer colon=1+((Index-1)%(nbdeltaV*2));
Standard_Integer colpnt=(colon+1)/2;
// General formula = (line-1)*(nbdeltaV+1)+colpnt
// Position of P1 = MesXYZ(line,colpnt);
P1= (line-1)*(nbdeltaV+1) + colpnt;
// Position of P2= MesXYZ(line+1,colpnt+((colon-1)%2));
P2= line*(nbdeltaV+1) + colpnt+((colon-1)%2);
// Position of P3= MesXYZ(line+(colon%2),colpnt+1);
P3= (line-1+(colon%2))*(nbdeltaV+1) + colpnt + 1;
}
//=======================================================================
//function : Point
//=======================================================================
const gp_Pnt& IntCurveSurface_Polyhedron::Point(const Standard_Integer Index
,Standard_Real& U
,Standard_Real& V) const
{
#if CHECKBOUNDS
if(Index<0 || Index>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::Parameters\n");
}
#endif
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
Standard_Real *CMyU = (Standard_Real *)C_MyU;
Standard_Real *CMyV = (Standard_Real *)C_MyV;
U=CMyU[Index];
V=CMyV[Index];
return CMyPnts[Index];
}
//=======================================================================
//function : Point
//=======================================================================
const gp_Pnt& IntCurveSurface_Polyhedron::Point(const Standard_Integer Index) const {
#if CHECKBOUNDS
if(Index<0 || Index>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::Parameters\n");
}
#endif
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
return CMyPnts[Index];
}
//=======================================================================
//function : Point
//=======================================================================
//void IntCurveSurface_Polyhedron::Point (const gp_Pnt& p,
// const Standard_Integer lig,
// const Standard_Integer col,
// const Standard_Real u,
// const Standard_Real v)
void IntCurveSurface_Polyhedron::Point (const gp_Pnt& ,
const Standard_Integer ,
const Standard_Integer ,
const Standard_Real ,
const Standard_Real )
{
printf("\n IntCurveSurface_Polyhedron::Point : Ne dois pas etre appelle\n");
}
//=======================================================================
//function : Point
//=======================================================================
void IntCurveSurface_Polyhedron::Point (const Standard_Integer Index,gp_Pnt& P) const
{
#if CHECKBOUNDS
if(Index<0 || Index>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::Parameters\n");
}
#endif
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
P = CMyPnts[Index];
}
// Modified by Sergey KHROMOV - Fri Dec 7 10:12:47 2001 Begin
//=======================================================================
//function : IsOnBound
//purpose : This method returns true if the edge based on points with
// indices Index1 and Index2 represents a boundary edge.
//=======================================================================
Standard_Boolean IntCurveSurface_Polyhedron::IsOnBound
(const Standard_Integer Index1,
const Standard_Integer Index2) const
{
#if CHECKBOUNDS
if(Index1<0 || Index1>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::IsOnBound\n");
}
if(Index2<0 || Index2>((nbdeltaU+1)*(nbdeltaV+1))) {
printf("\n Erreur IntCurveSurface_Polyhedron::IsOnBound\n");
}
#endif
Standard_Boolean *CMyIsOnBounds = (Standard_Boolean *)C_MyIsOnBounds;
Standard_Integer aDiff = Abs(Index1 - Index2);
Standard_Integer i;
// Check if points are neighbour ones.
if (aDiff != 1 && aDiff != nbdeltaV + 1)
return Standard_False;
for (i = 0; i <= nbdeltaU; i++) {
if ((Index1 == 1 + i*(nbdeltaV + 1)) && (Index2 == Index1 - 1))
return Standard_False;
if ((Index1 == (1 + i)*(nbdeltaV + 1)) && (Index2 == Index1 + 1))
return Standard_False;
}
return (CMyIsOnBounds[Index1] && CMyIsOnBounds[Index2]);
}
//=======================================================================
//function : ComputeBorderDeflection
//purpose : This method computes and returns a deflection of isoline
// of given parameter on Surface.
//=======================================================================
Standard_Real IntCurveSurface_Polyhedron::ComputeBorderDeflection
(const ThePSurface &Surface,
const Standard_Real Parameter,
const Standard_Real PMin,
const Standard_Real PMax,
const Standard_Boolean isUIso) const
{
Standard_Integer aNbSamples;
Standard_Integer i;
if (isUIso)
aNbSamples = nbdeltaV;
else
aNbSamples = nbdeltaU;
Standard_Real aDelta = (PMax - PMin)/aNbSamples;
Standard_Real aPar = PMin;
Standard_Real aDeflection = RealFirst();
gp_XYZ aP1;
gp_XYZ aP2;
gp_XYZ aPMid;
gp_XYZ aPParMid;
for (i = 0; i <= aNbSamples; i++, aPar+= aDelta) {
if (isUIso) {
aP1 = ThePSurfaceTool::Value(Surface, Parameter, aPar).XYZ();
aP2 = ThePSurfaceTool::Value(Surface, Parameter, aPar + aDelta).XYZ();
aPParMid = ThePSurfaceTool::Value(Surface, Parameter, aPar + aDelta/2.).XYZ();
} else {
aP1 = ThePSurfaceTool::Value(Surface, aPar, Parameter).XYZ();
aP2 = ThePSurfaceTool::Value(Surface, aPar + aDelta, Parameter).XYZ();
aPParMid = ThePSurfaceTool::Value(Surface, aPar + aDelta/2., Parameter).XYZ();
}
aPMid = (aP2 + aP1)/2.;
Standard_Real aDist = (aPMid - aPParMid).Modulus();
if (aDist > aDeflection)
aDeflection = aDist;
}
return aDeflection;
}
// Modified by Sergey KHROMOV - Fri Dec 7 11:21:52 2001 End

View File

@@ -0,0 +1,15 @@
// File: IntCurveSurface_Polyhedron.lxx
// Created: Fri Dec 7 10:07:51 2001
// Author: Sergey KHROMOV
// <skv@dimox>
//=======================================================================
//function : GetBorderDeflection
//purpose : This method returns a border deflection.
//=======================================================================
inline Standard_Real IntCurveSurface_Polyhedron::GetBorderDeflection() const
{
return TheBorderDeflection;
}

View File

@@ -0,0 +1,124 @@
-- File: IntCurveSurface_PolyhedronTool.cdl
-- Created: Fri Mar 12 11:05:50 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class PolyhedronTool from IntCurveSurface
(ThePolyhedron as any) -- as Polyhedron from IntCurveSurface
---Purpose: Describe the signature of a polyhedral surface with
-- only triangular facets and the necessary informations
-- to compute the interferences.
uses XYZ from gp,
Pnt from gp,
Box from Bnd,
HArray1OfBox from Bnd
raises OutOfRange from Standard
is
Bounding (myclass; thePolyh : ThePolyhedron)
---Purpose: Give the bounding box of the PolyhedronTool.
---C++: return const &
---C++: inline
returns Box from Bnd;
ComponentsBounding
(myclass; thePolyh : ThePolyhedron)
---Purpose: Give the array of boxes. The box <n> corresponding
-- to the triangle <n>.
---C++: return const &
---C++: inline
returns HArray1OfBox from Bnd;
DeflectionOverEstimation
(myclass; thePolyh : ThePolyhedron)
---Purpose: Give the tolerance of the polygon.
---C++: inline
returns Real from Standard;
-- Structure needings :
NbTriangles (myclass; thePolyh : ThePolyhedron)
returns Integer from Standard;
---Purpose: Give the number of triangles in this polyedral surface.
---C++: inline
Triangle (myclass; thePolyh : ThePolyhedron;
Index : in Integer from Standard;
P1,P2,P3 : out Integer from Standard)
raises OutOfRange from Standard;
---Purpose: Give the indices of the 3 points of the triangle of
-- address Index in the PolyhedronTool.
---C++: inline
Point (myclass; thePolyh : ThePolyhedron;
Index : in Integer)
returns Pnt from gp
raises OutOfRange from Standard;
---Purpose: Give the point of index i in the polyedral surface.
---C++: return const &
---C++: inline
TriConnex (myclass; thePolyh : ThePolyhedron;
Triang : in Integer;
Pivot,Pedge : in Integer;
TriCon : out Integer;
OtherP : out Integer)
returns Integer
raises OutOfRange from Standard;
---Purpose: Give the addresse Tricon of the triangle connexe to
-- the triangle of address Triang by the edge Pivot Pedge
-- and the third point of this connexe triangle. When we
-- are on a free edge TriCon==0 but the function return
-- the value of the triangle in the other side of Pivot
-- on the free edge. Used to turn around a vertex.
---C++: inline
-- Modified by Sergey KHROMOV - Fri Dec 7 13:25:47 2001 Begin
IsOnBound(myclass; thePolyh: ThePolyhedron;
Index1 : Integer from Standard;
Index2 : Integer from Standard)
---Purpose: This method returns true if the edge based on points with
-- indices Index1 and Index2 represents a boundary edge. It is
-- necessary to take into account the boundary deflection for
-- this edge.
---C++: inline
returns Boolean from Standard;
GetBorderDeflection(myclass; thePolyh : ThePolyhedron)
---Purpose: This method returns a border deflection of the polyhedron.
---C++: inline
returns Real from Standard;
-- Modified by Sergey KHROMOV - Fri Dec 7 13:25:53 2001 End
Dump (myclass; thePolyh: ThePolyhedron);
end PolyhedronTool;

View File

@@ -0,0 +1,5 @@
void IntCurveSurface_PolyhedronTool::Dump(const ThePolyhedron& polyh) {
polyh.Dump();
}

View File

@@ -0,0 +1,86 @@
#include ThePolyhedron_hxx
inline const Bnd_Box& IntCurveSurface_PolyhedronTool::Bounding
(const ThePolyhedron& thePolyh)
{
return thePolyh.Bounding();
}
inline const Handle(Bnd_HArray1OfBox)& IntCurveSurface_PolyhedronTool::
ComponentsBounding(const ThePolyhedron& thePolyh)
{
return thePolyh.ComponentsBounding();
}
inline Standard_Real IntCurveSurface_PolyhedronTool::DeflectionOverEstimation
(const ThePolyhedron& thePolyh)
{
return thePolyh.DeflectionOverEstimation();
}
inline Standard_Integer IntCurveSurface_PolyhedronTool::NbTriangles
(const ThePolyhedron& thePolyh)
{
return thePolyh.NbTriangles();
}
inline void IntCurveSurface_PolyhedronTool::Triangle(const ThePolyhedron& thePolyh,
const Standard_Integer Index,
Standard_Integer& P1,
Standard_Integer& P2,
Standard_Integer& P3)
{
thePolyh.Triangle(Index, P1,P2,P3);
}
inline const gp_Pnt& IntCurveSurface_PolyhedronTool::Point
(const ThePolyhedron& thePolyh,
const Standard_Integer Index)
{
return thePolyh.Point(Index);
}
inline Standard_Integer IntCurveSurface_PolyhedronTool::TriConnex
(const ThePolyhedron& thePolyh,
const Standard_Integer Triang,
const Standard_Integer Pivot,
const Standard_Integer Pedge,
Standard_Integer& TriCon,
Standard_Integer& OtherP)
{
return thePolyh.TriConnex(Triang, Pivot, Pedge, TriCon, OtherP);
}
// Modified by Sergey KHROMOV - Fri Dec 7 13:47:07 2001 Begin
//=======================================================================
//function : IsOnBound
//purpose : This method returns true if the edge based on points with
// indices Index1 and Index2 represents a boundary edge.
//=======================================================================
inline Standard_Boolean IntCurveSurface_PolyhedronTool::IsOnBound
(const ThePolyhedron& thePolyh,
const Standard_Integer Index1,
const Standard_Integer Index2)
{
return thePolyh.IsOnBound(Index1, Index2);
}
//=======================================================================
//function : GetBorderDeflection
//purpose : This method returns a border deflection of the polyhedron.
//=======================================================================
inline Standard_Real IntCurveSurface_PolyhedronTool::GetBorderDeflection
(const ThePolyhedron& thePolyh)
{
return thePolyh.GetBorderDeflection();
}
// Modified by Sergey KHROMOV - Fri Dec 7 13:46:56 2001 End

View File

@@ -0,0 +1,86 @@
-- File: IntCurveSurface_QuadricCurveExactInter.cdl
-- Created: Wed Aug 18 18:50:09 1993
-- Author: Laurent BUCHARD
-- <lbr@nonox>
---Copyright: Matra Datavision 1993
generic class QuadricCurveExactInter from IntCurveSurface (
TheSurface as any;
TheSurfaceTool as any;
TheCurve as any;
TheCurveTool as any)
---Purpose: ---------------------------------------------------------
-- --
-- find a root (u,v,w) from a starting point (w0) of the problem :--
-- Q(X(w),Y(w),Z(w)) = 0 --
-- --
-- where Q(X,Y,Z) = 0 is the implicit expression of a quadric --
-- and (X(w),Y(w),Z(w)) the point of parameter w on a parametric --
-- curve. --
----------------------------------------------------------------------
uses
Quadric from IntSurf,
SequenceOfReal from TColStd
------------------------------------------------------------
class TheQuadCurvFunc instantiates QuadricCurveFunc from IntCurveSurface (
Quadric from IntSurf,
TheCurve,
TheCurveTool);
---Purpose: Provides the signed distance function : Q(w)
-- and its first derivative dQ(w)/dw
------------------------------------------------------------
is
Create(S: TheSurface; C: TheCurve)
---Purpose:
returns QuadricCurveExactInter from IntCurveSurface;
IsDone(me)
---Purpose:
returns Boolean from Standard
is static;
NbRoots(me)
---Purpose:
returns Integer from Standard
is static;
Root(me; Index: Integer from Standard)
---Purpose:
returns Real from Standard
is static;
NbIntervals(me)
---Purpose:
returns Integer from Standard
is static;
Intervals(me; Index: Integer from Standard;
U1,U2: out Real from Standard)
---Purpose: U1 and U2 are the parameters of
-- a segment on the curve.
is static;
fields
nbpnts : Integer from Standard;
pnts : SequenceOfReal from TColStd;
nbintv : Integer from Standard;
intv : SequenceOfReal from TColStd;
end QuadricCurveExactInter;

View File

@@ -0,0 +1,111 @@
// File: IntCurveSurface_QuadricCurveExactInter.cdl
// Created: Wed Aug 18 18:50:09 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
//-Copyright: Matra Datavision 1993
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001
#include <TColStd_SequenceOfReal.hxx>
#include <math_FunctionAllRoots.hxx>
#include <math_FunctionSample.hxx>
#include <IntSurf_Quadric.hxx>
#include <GeomAbs_SurfaceType.hxx>
#define EPSX 0.00000000000001
#define EPSDIST 0.00000001
#define EPSNUL 0.00000001
//================================================================================
IntCurveSurface_QuadricCurveExactInter::IntCurveSurface_QuadricCurveExactInter(const TheSurface& S,
const TheCurve& C)
: nbpnts(-1),nbintv(-1)
{
GeomAbs_SurfaceType QuadricType = TheSurfaceTool::GetType(S);
IntSurf_Quadric Quadric;
switch(QuadricType) {
case GeomAbs_Plane: { Quadric.SetValue(TheSurfaceTool::Plane(S)); break; }
case GeomAbs_Cylinder: { Quadric.SetValue(TheSurfaceTool::Cylinder(S)); break; }
case GeomAbs_Cone: { Quadric.SetValue(TheSurfaceTool::Cone(S)); break; }
case GeomAbs_Sphere: { Quadric.SetValue(TheSurfaceTool::Sphere(S)); break; }
default: {
//cout<<" Probleme Sur le Type de Surface dans IntCurveSurface_Inter::InternalPerform "<<endl;
break;
}
}
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001 Begin
Standard_Integer nbIntervals = TheCurveTool::NbIntervals(C, GeomAbs_C1);
TColStd_Array1OfReal anIntervals(1, nbIntervals + 1);
Standard_Integer ii;
TheCurveTool::Intervals(C, anIntervals, GeomAbs_C1);
for (ii = 1; ii <= nbIntervals; ii++) {
Standard_Real U1 = anIntervals.Value(ii);
Standard_Real U2 = anIntervals.Value(ii + 1);
math_FunctionSample Sample(U1,U2,TheCurveTool::NbSamples(C,U1,U2));
IntCurveSurface_TheQuadCurvFunc Function(Quadric,C);
math_FunctionAllRoots Roots(Function,Sample,EPSX,EPSDIST,EPSNUL);
if(Roots.IsDone()) {
Standard_Integer nbp = Roots.NbPoints();
Standard_Integer nbi = Roots.NbIntervals();
Standard_Integer i;
for( i = 1; i<=nbp; i++) {
pnts.Append(Roots.GetPoint(i));
//-- cout<<" QuadricCurveExactInter : Roots("<<i<<") = "<<Roots.GetPoint(i)<<endl;
}
Standard_Real a,b;
for(i = 1; i<=nbi; i++) {
Roots.GetInterval(i,a,b);
//cout<<" QuadricCurveExactInter : RootsSeg("<<i<<") = "<<a<<" , "<<b<<endl;
intv.Append(a);
intv.Append(b);
}
} else {
break;
}
}
if (ii > nbIntervals) {
nbpnts = pnts.Length();
nbintv = intv.Length()/2;
}
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001 End
}
//================================================================================
Standard_Boolean IntCurveSurface_QuadricCurveExactInter::IsDone() const {
return(nbpnts!=-1);
}
//================================================================================
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbRoots() const {
return(nbpnts);
}
//================================================================================
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbIntervals() const {
return(nbintv);
}
//================================================================================
Standard_Real IntCurveSurface_QuadricCurveExactInter::Root(const Standard_Integer Index) const {
return(pnts(Index));
}
//================================================================================
void IntCurveSurface_QuadricCurveExactInter::Intervals(const Standard_Integer Index,
Standard_Real& a,
Standard_Real& b) const
{
Standard_Integer Index2 = Index+Index-1;
a = intv(Index2);
b = intv(Index2+1);
}

View File

@@ -0,0 +1,75 @@
-- File: IntCurveSurface_QuadricCurveFunc.cdl
-- Created: Thu Aug 19 10:55:26 1993
-- Author: Laurent BUCHARD
-- <lbr@nonox>
---Copyright: Matra Datavision 1993
generic class QuadricCurveFunc from IntCurveSurface (
TheQuadric as any; -- as Quadric from IntCurveSurface
TheCurve as any;
TheCurveTool as any) -- as CurveTool from Adaptor3d
inherits FunctionWithDerivative from math
---Purpose: Implements the function Q(w) and its first
-- derivative used by FunctionAllRoots to find the
-- areas where the distance between the quadric and
-- the parametric curves is less than a given
-- tolerance.
--
-- where Q(X,Y,Z) = 0 is the implicit expression of a
-- quadric and (X(w),Y(w),Z(w)) the point of parameter w on
-- a parametric curve.
--
is
Create(Q: TheQuadric; C:TheCurve)
---Purpose: Create the function.
--
returns QuadricCurveFunc from IntCurveSurface;
Value(me: in out; Param: Real from Standard; F: out Real from Standard)
---Purpose: Computes the value of the signed distance between
-- the implicit surface and the point at parameter
-- Param on the parametrised curve.
-- Value always returns True.
returns Boolean from Standard
is redefined static;
Derivative(me: in out; Param: Real from Standard;
D: out Real from Standard)
---Purpose: Computes the derivative of the previous function at
-- parameter Param.
-- Derivative always returns True.
returns Boolean from Standard
is redefined static;
Values(me: in out; Param: Real from Standard; F,D: out Real from Standard)
---Purpose: Computes the value and the derivative of the function.
-- returns True.
returns Boolean from Standard
is redefined static;
fields
myQuadric : TheQuadric;
myCurve : TheCurve;
end QuadricCurveFunc;

View File

@@ -0,0 +1,44 @@
// File: IntCurveSurface_QuadricCurveFunc.gxx
// Created: Thu Aug 19 10:55:26 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
//-Copyright: Matra Datavision 1993
#include <gp_Vec.hxx>
//================================================================================
IntCurveSurface_QuadricCurveFunc::IntCurveSurface_QuadricCurveFunc(const TheQuadric& Q,
const TheCurve& C)
: myQuadric(Q), myCurve(C)
{
}
//================================================================================
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Value(const Standard_Real Param,
Standard_Real& F) {
F = myQuadric.Distance(TheCurveTool::Value(myCurve,Param));
return(Standard_True);
}
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Derivative(const Standard_Real Param,
Standard_Real& D) {
gp_Pnt P;
gp_Vec T;
TheCurveTool::D1(myCurve,Param,P,T);
D = T.Dot(myQuadric.Gradient(P));
return(Standard_True);
}
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Values(const Standard_Real Param,
Standard_Real& F,
Standard_Real& D) {
gp_Pnt P;
gp_Vec T,Grad;
TheCurveTool::D1(myCurve,Param,P,T);
myQuadric.ValAndGrad(P,F,Grad);
D = T.Dot(Grad);
return(Standard_True);
}

View File

@@ -0,0 +1,232 @@
-- File: IntCurveSurface_SurfaceTool.cdl
-- Created: Fri Jul 2 16:59:47 1993
-- Author: Laurent BUCHARD
-- <lbr@nonox>
---Copyright: Matra Datavision 1993
generic class SurfaceTool from IntCurveSurface
( TheSurface as any)
uses
Shape from GeomAbs,
SurfaceType from GeomAbs,
Pln from gp,
Cone from gp,
Cylinder from gp,
Sphere from gp,
Torus from gp,
Pnt from gp,
Vec from gp,
Array1OfReal from TColStd,
BezierSurface from Geom,
BSplineSurface from Geom,
HSurface from Adaptor3d,
HCurve from Adaptor3d,
Ax1 from gp,
Dir from gp
raises
NoSuchObject from Standard,
OutOfRange from Standard
is
FirstUParameter(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
FirstVParameter(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
LastUParameter(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
LastVParameter(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
NbUIntervals(myclass; S: TheSurface;
Sh : Shape from GeomAbs)
---C++: inline
returns Integer from Standard;
NbVIntervals(myclass; S: TheSurface;
Sh : Shape from GeomAbs)
---C++: inline
returns Integer from Standard;
UIntervals(myclass; S : TheSurface;
T : in out Array1OfReal from TColStd;
Sh : Shape from GeomAbs);
---C++: inline
VIntervals(myclass; S : TheSurface;
T : in out Array1OfReal from TColStd;
Sh : Shape from GeomAbs) ;
---C++: inline
UTrim(myclass; S : TheSurface;
First, Last, Tol : Real)
---C++: inline
returns HSurface from Adaptor3d
raises
OutOfRange from Standard;
---Purpose: If <First> >= <Last>
VTrim(myclass; S : TheSurface;
First, Last, Tol : Real)
---C++: inline
returns HSurface from Adaptor3d
raises
OutOfRange from Standard;
---Purpose: If <First> >= <Last>
IsUClosed(myclass; S: TheSurface)
---C++: inline
returns Boolean from Standard;
IsVClosed(myclass; S: TheSurface)
---C++: inline
returns Boolean from Standard;
IsUPeriodic(myclass; S: TheSurface)
---C++: inline
returns Boolean from Standard;
UPeriod(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
IsVPeriodic(myclass; S: TheSurface)
---C++: inline
returns Boolean from Standard;
VPeriod(myclass; S: TheSurface)
---C++: inline
returns Real from Standard;
Value(myclass; S : TheSurface;
u,v : Real from Standard)
---C++: inline
returns Pnt from gp;
D0(myclass; S : TheSurface;
u,v : Real from Standard;
P : out Pnt from gp);
---C++: inline
D1(myclass; S : TheSurface;
u,v : Real from Standard;
P : out Pnt from gp;
D1u,D1v: out Vec from gp);
---C++: inline
D2(myclass; S : TheSurface;
u,v : Real from Standard;
P : out Pnt from gp;
D1U,D1V,D2U,D2V,D2UV: out Vec from gp);
---C++: inline
D3(myclass; S : TheSurface;
u,v : Real from Standard;
P : out Pnt from gp;
D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV: out Vec from gp);
---C++: inline
DN(myclass; S : TheSurface;
u,v : Real from Standard;
Nu,Nv : Integer from Standard)
---C++: inline
returns Vec from gp;
UResolution(myclass; S:TheSurface; R3d: Real from Standard)
---C++: inline
returns Real from Standard;
VResolution(myclass; S:TheSurface; R3d: Real from Standard)
---C++: inline
returns Real from Standard;
GetType(myclass; S: TheSurface)
---C++: inline
returns SurfaceType from GeomAbs;
Plane(myclass; S: TheSurface)
---C++: inline
returns Pln from gp;
Cylinder(myclass; S : TheSurface) returns Cylinder from gp
raises NoSuchObject from Standard;
---C++: inline
Cone(myclass; S : TheSurface) returns Cone from gp
raises NoSuchObject from Standard;
---C++: inline
Torus(myclass; S : TheSurface) returns Torus from gp
raises NoSuchObject from Standard;
---C++: inline
Sphere(myclass; S : TheSurface) returns Sphere from gp
raises NoSuchObject from Standard;
---C++: inline
Bezier(myclass; S : TheSurface) returns BezierSurface from Geom
raises NoSuchObject from Standard;
---C++: inline
BSpline(myclass; S : TheSurface) returns BSplineSurface from Geom
raises NoSuchObject from Standard;
---C++: inline
AxeOfRevolution(myclass; S: TheSurface) returns Ax1 from gp
raises NoSuchObject from Standard;
---C++: inline
Direction(myclass; S: TheSurface) returns Dir from gp
raises NoSuchObject from Standard;
---C++: inline
BasisCurve(myclass; S:TheSurface) returns HCurve from Adaptor3d
raises NoSuchObject from Standard;
---C++: inline
--------------------------------------------------------------------------------
NbSamplesU(myclass; S : TheSurface) returns Integer from Standard;
NbSamplesV(myclass; S : TheSurface) returns Integer from Standard;
NbSamplesU(myclass; S : TheSurface; u1,u2: Real from Standard) returns Integer from Standard;
NbSamplesV(myclass; S : TheSurface; v1,v2: Real from Standard) returns Integer from Standard;
end SurfaceTool;

View File

@@ -0,0 +1,128 @@
//-- File : IntCurveSurface_SurfaceTool.gxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#include TheSurface_hxx
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesU(const TheSurface& S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S.GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + S.NbUPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = S.NbUKnots();
nbs*= S.UDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Torus:
{
nbs = 20;
}
break;
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_SurfaceOfRevolution:
case GeomAbs_SurfaceOfExtrusion:
{
nbs = 10;
}
break;
default:
{
nbs = 10;
}
break;
}
return(nbs);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesV(const TheSurface& S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S.GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + S.NbVPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = S.NbVKnots();
nbs*= S.VDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_Torus:
case GeomAbs_SurfaceOfRevolution:
case GeomAbs_SurfaceOfExtrusion:
{
nbs = 15;
}
break;
default:
{
nbs = 10;
}
break;
}
return(nbs);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesU(const TheSurface& S,
const Standard_Real u1,
const Standard_Real u2) {
Standard_Integer nbs = NbSamplesU(S);
Standard_Integer n = nbs;
if(nbs>10) {
Standard_Real uf = FirstUParameter(S);
Standard_Real ul = LastUParameter(S);
n*= (Standard_Integer)((u2-u1)/(uf-ul));
if(n>nbs) n = nbs;
if(n<5) n = 5;
}
return(n);
}
Standard_Integer IntCurveSurface_SurfaceTool::NbSamplesV(const TheSurface& S,
const Standard_Real v1,
const Standard_Real v2) {
Standard_Integer nbs = NbSamplesV(S);
Standard_Integer n = nbs;
if(nbs>10) {
Standard_Real vf = FirstVParameter(S);
Standard_Real vl = LastVParameter(S);
n*= (Standard_Integer)((v2-v1)/(vf-vl));
if(n>nbs) n = nbs;
if(n<5) n = 5;
}
return(n);
}

View File

@@ -0,0 +1,228 @@
//-- File : IntCurveSurface_SurfaceTool.lxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#include TheSurface_hxx
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Pln.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Cone.hxx>
#include <gp_Torus.hxx>
#include <gp_Sphere.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <Handle_Geom_BezierSurface.hxx>
#include <Handle_Geom_BSplineSurface.hxx>
#include <Handle_Adaptor3d_HSurface.hxx>
#include <Handle_Adaptor3d_HCurve.hxx>
inline Standard_Real IntCurveSurface_SurfaceTool::FirstUParameter(const TheSurface& Surf){ return Surf.FirstUParameter(); }
inline Standard_Real IntCurveSurface_SurfaceTool::FirstVParameter(const TheSurface& Surf){ return Surf.FirstVParameter();}
inline Standard_Real IntCurveSurface_SurfaceTool::LastUParameter(const TheSurface& Surf){ return Surf.LastUParameter();}
inline Standard_Real IntCurveSurface_SurfaceTool::LastVParameter(const TheSurface& Surf){ return Surf.LastVParameter();}
inline Standard_Integer IntCurveSurface_SurfaceTool::NbUIntervals(const TheSurface& Surf,
const GeomAbs_Shape S){
return Surf.NbUIntervals(S);
}
inline Standard_Integer IntCurveSurface_SurfaceTool::NbVIntervals(const TheSurface& Surf,
const GeomAbs_Shape S){
return Surf.NbVIntervals(S);
}
inline void IntCurveSurface_SurfaceTool::UIntervals(const TheSurface& Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S){
Surf.UIntervals(Tab,S);
}
inline void IntCurveSurface_SurfaceTool::VIntervals(const TheSurface& Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S){
Surf.VIntervals(Tab,S);
}
inline Handle_Adaptor3d_HSurface IntCurveSurface_SurfaceTool::UTrim(const TheSurface& Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol) {
return Surf.UTrim(F,L,Tol);
}
inline Handle_Adaptor3d_HSurface IntCurveSurface_SurfaceTool::VTrim(const TheSurface& Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol) {
return Surf.VTrim(F,L,Tol);
}
inline Standard_Boolean IntCurveSurface_SurfaceTool::IsUClosed(const TheSurface& S)
{
return S.IsUClosed();
}
inline Standard_Boolean IntCurveSurface_SurfaceTool::IsVClosed(const TheSurface& S)
{
return S.IsVClosed();
}
inline Standard_Boolean IntCurveSurface_SurfaceTool::IsUPeriodic(const TheSurface& S)
{
return S.IsUPeriodic();
}
inline Standard_Real IntCurveSurface_SurfaceTool::UPeriod(const TheSurface& S)
{
return S.UPeriod();
}
inline Standard_Boolean IntCurveSurface_SurfaceTool::IsVPeriodic(const TheSurface& S)
{
return S.IsVPeriodic();
}
inline Standard_Real IntCurveSurface_SurfaceTool::VPeriod(const TheSurface& S)
{
return S.VPeriod();
}
inline gp_Pnt IntCurveSurface_SurfaceTool::Value(const TheSurface& S,
const Standard_Real U,
const Standard_Real V )
{
return S.Value(U,V);
}
inline void IntCurveSurface_SurfaceTool::D0(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P)
{
S.D0(U,V,P);
}
inline void IntCurveSurface_SurfaceTool::D1(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V)
{
S.D1(U,V,P,D1U,D1V);
}
inline void IntCurveSurface_SurfaceTool::D2(const TheSurface& S,
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)
{
S.D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
}
inline void IntCurveSurface_SurfaceTool::D3(const TheSurface& S,
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)
{
S.D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
}
inline gp_Vec IntCurveSurface_SurfaceTool::DN(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
const Standard_Integer Nu,
const Standard_Integer Nv)
{
return S.DN(U,V,Nu,Nv);
}
inline Standard_Real IntCurveSurface_SurfaceTool::UResolution(const TheSurface& S,
const Standard_Real R3d)
{
return S.UResolution(R3d);
}
inline Standard_Real IntCurveSurface_SurfaceTool::VResolution(const TheSurface& S,
const Standard_Real R3d)
{
return S.VResolution(R3d);
}
inline GeomAbs_SurfaceType IntCurveSurface_SurfaceTool::GetType(const TheSurface& S )
{
return S.GetType();
}
inline gp_Pln IntCurveSurface_SurfaceTool::Plane(const TheSurface& S)
{
return S.Plane();
}
inline gp_Cylinder IntCurveSurface_SurfaceTool::Cylinder(const TheSurface& S)
{
return S.Cylinder();
}
inline gp_Cone IntCurveSurface_SurfaceTool::Cone(const TheSurface& S)
{
return S.Cone();
}
inline gp_Sphere IntCurveSurface_SurfaceTool::Sphere(const TheSurface& S)
{
return S.Sphere();
}
inline gp_Torus IntCurveSurface_SurfaceTool::Torus(const TheSurface& S)
{
return S.Torus();
}
inline Handle(Geom_BezierSurface) IntCurveSurface_SurfaceTool::Bezier(const TheSurface& S) {
return(S.Bezier());
}
inline Handle(Geom_BSplineSurface) IntCurveSurface_SurfaceTool::BSpline(const TheSurface& S) {
return(S.BSpline());
}
inline gp_Ax1 IntCurveSurface_SurfaceTool::AxeOfRevolution(const TheSurface& S) {
return(S.AxeOfRevolution());
}
inline gp_Dir IntCurveSurface_SurfaceTool::Direction(const TheSurface& S) {
return(S.Direction());
}
inline Handle(Adaptor3d_HCurve) IntCurveSurface_SurfaceTool::BasisCurve(const TheSurface& S) {
return(S.BasisCurve());
}