1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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

139
src/HLRBRep/HLRBRep.cdl Executable file
View File

@@ -0,0 +1,139 @@
-- File: HLRBRep.cdl
-- Created: Wed Oct 14 11:08:52 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
package HLRBRep
---Purpose: Hidden Lines Removal
-- algorithms on the BRep DataStructure.
--
-- The class PolyAlgo is used to remove Hidden lines
-- on Shapes with Triangulations.
uses
Standard,
StdFail,
MMgt,
gp,
Geom,
Geom2d,
TCollection,
TColgp,
TColStd,
GeomAbs,
LProp,
IntRes2d,
IntCurve,
IntCurveSurface,
TopAbs,
TopoDS,
TopExp,
TopTools,
HLRAlgo,
Adaptor3d,
BRep,
BRepAdaptor,
BRepTopAdaptor,
HLRTopoBRep
is
class CurveTool;
class BCurveTool;
class Curve;
class SurfaceTool;
class BSurfaceTool;
class Surface;
class CLPropsATool;
class CLProps instantiates CLProps from LProp (
Address from Standard, -- as Curve from HLRBRep
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
CLPropsATool from HLRBRep);
class SLPropsATool;
class SLProps instantiates SLProps from LProp (
Address from Standard, -- as Surface from HLRBRep
SLPropsATool from HLRBRep);
class CInter instantiates IntCurveCurveGen from IntCurve (
Address from Standard,
CurveTool from HLRBRep);
class LineTool;
class InterCSurf instantiates Inter from IntCurveSurface (
Lin from gp,
LineTool from HLRBRep,
Address from Standard,
SurfaceTool from HLRBRep);
class EdgeFaceTool;
class Intersector;
class EdgeData;
class FaceData;
class FaceIterator;
class Array1OfEData instantiates Array1 from TCollection
(EdgeData from HLRBRep);
class Array1OfFData instantiates Array1 from TCollection
(FaceData from HLRBRep);
class Data;
class ShapeToHLR;
class HLRToShape;
class ShapeBounds;
class SeqOfShapeBounds instantiates Sequence from TCollection
(ShapeBounds from HLRBRep);
class EdgeInterferenceTool;
class VertexList;
class EdgeIList;
class AreaLimit;
class EdgeBuilder;
class Hider;
class InternalAlgo;
class Algo;
---Purpose: Inherited from InternalAlgo to provide methods
-- with Shape from TopoDS.
class PolyAlgo;
---Purpose: to remove Hidden lines on Shapes with Triangulations.
class BiPoint;
class BiPnt2D;
class ListOfBPoint instantiates List from TCollection (
BiPoint from HLRBRep);
class ListOfBPnt2D instantiates List from TCollection (
BiPnt2D from HLRBRep);
class PolyHLRToShape;
MakeEdge(ec : Curve from HLRBRep;
U1,U2 : Real from Standard)
returns Edge from TopoDS;
PolyHLRAngleAndDeflection(InAngl : Real from Standard;
OutAngl, OutDefl : out Real from Standard);
end HLRBRep;

119
src/HLRBRep/HLRBRep.cxx Executable file
View File

@@ -0,0 +1,119 @@
// File: HLRBRep.cxx
// Created: Thu Aug 27 12:33:14 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRBRep.ixx>
#include <BRepLib_MakeEdge2d.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
//=======================================================================
//function : MakeEdge
//purpose :
//=======================================================================
TopoDS_Edge HLRBRep::MakeEdge (const HLRBRep_Curve& ec,
const Standard_Real U1,
const Standard_Real U2)
{
TopoDS_Edge Edg;
//gp_Pnt2d P,P1,P2;
Standard_Real sta3d = U1;
Standard_Real end3d = U2;
Standard_Real sta = ec.Parameter2d(U1);
Standard_Real end = ec.Parameter2d(U2);
if (ec.GetType() == GeomAbs_Line) {
Edg = BRepLib_MakeEdge2d(ec.Line(),sta,end);
}
else if (ec.GetType() == GeomAbs_Circle) {
Edg = BRepLib_MakeEdge2d(ec.Circle(),sta,end);
}
else if (ec.GetType() == GeomAbs_Ellipse) {
Edg = BRepLib_MakeEdge2d(ec.Ellipse(),sta,end);
}
else if (ec.GetType() == GeomAbs_Hyperbola) {
Edg = BRepLib_MakeEdge2d(ec.Hyperbola(),sta,end);
}
else if (ec.GetType() == GeomAbs_Parabola) {
Edg = BRepLib_MakeEdge2d(ec.Parabola(),sta,end);
}
else if (ec.GetType() == GeomAbs_BezierCurve) {
TColgp_Array1OfPnt2d Poles(1,ec.NbPoles());
if (ec.IsRational()) {
TColStd_Array1OfReal Weights(1,ec.NbPoles());
ec.PolesAndWeights(Poles,Weights);
Edg = BRepLib_MakeEdge2d(new Geom2d_BezierCurve(Poles,Weights),sta,end);
}
else {
ec.Poles(Poles);
Edg = BRepLib_MakeEdge2d(new Geom2d_BezierCurve(Poles),sta,end);
}
}
else if (ec.GetType() == GeomAbs_BSplineCurve) {
TColgp_Array1OfPnt2d Poles(1,ec.NbPoles());
TColStd_Array1OfReal knots(1,ec.NbKnots());
TColStd_Array1OfInteger mults(1,ec.NbKnots());
//-- ec.KnotsAndMultiplicities(knots,mults);
ec.Knots(knots);
ec.Multiplicities(mults);
if (ec.IsRational()) {
TColStd_Array1OfReal Weights(1,ec.NbPoles());
ec.PolesAndWeights(Poles,Weights);
Edg = BRepLib_MakeEdge2d
(new Geom2d_BSplineCurve
(Poles,Weights,knots,mults,ec.Degree()),sta,end);
}
else {
ec.Poles(Poles);
Edg = BRepLib_MakeEdge2d
(new Geom2d_BSplineCurve(Poles,knots,mults,ec.Degree()),sta,end);
}
}
else {
Standard_Integer nbPnt = 15;
TColgp_Array1OfPnt2d Poles(1,nbPnt);
TColStd_Array1OfReal knots(1,nbPnt);
TColStd_Array1OfInteger mults(1,nbPnt);
mults.Init(1);
mults(1 ) = 2;
mults(nbPnt) = 2;
Standard_Real step = (end3d-sta3d)/(nbPnt-1);
for (Standard_Integer i = 1; i <= nbPnt; i++) {
Poles(i) = ec.Value(sta3d);
knots(i) = sta3d;
sta3d += step;
}
Edg = BRepLib_MakeEdge2d
(new Geom2d_BSplineCurve(Poles,knots,mults,1),sta,end);
}
return Edg;
}
//=======================================================================
//function : PolyHLRAngleAndDeflection
//purpose :
//=======================================================================
void
HLRBRep::PolyHLRAngleAndDeflection (const Standard_Real InAngl,
Standard_Real& OutAngl,
Standard_Real& OutDefl)
{
static Standard_Real HAngMin = 1*PI/180;
static Standard_Real HAngLim = 5*PI/180;
static Standard_Real HAngMax = 35*PI/180;
OutAngl = InAngl;
if (OutAngl < HAngMin) OutAngl = HAngMin;
if (OutAngl > HAngMax) OutAngl = HAngMax;
OutAngl = HAngLim + sqrt((OutAngl - HAngMin) * (HAngMax - HAngLim) *
(HAngMax - HAngLim) / (HAngMax - HAngMin));
OutDefl = OutAngl * OutAngl * 0.5;
}

80
src/HLRBRep/HLRBRep_Algo.cdl Executable file
View File

@@ -0,0 +1,80 @@
-- File: HLRBRep_Algo.cdl
-- Created: Wed Aug 3 16:15:26 1994
-- Author: Christophe MARION
-- <cma@ecolox>
---Copyright: Matra Datavision 1994
class Algo from HLRBRep inherits InternalAlgo from HLRBRep
---Purpose: A framework to compute a shape as seen in a projection plane. This is done by
-- calculating the visible and the hidden parts of the shape.
-- HLRBRep_Algo works with three types of entity:
-- - shapes to be visualized
-- - edges in these shapes (these edges are
-- the basic entities which will be visualized or hidden), and
-- - faces in these shapes which hide the edges.
-- HLRBRep_Algo is based on the principle of comparing each edge of the shape to be
-- visualized with each of its faces, and calculating the visible and the hidden parts of each edge.
-- For a given projection, HLRBRep_Algo calculates a set of lines characteristic of the
-- object being represented. It is also used in conjunction with the
-- HLRBRep_HLRToShape extraction utilities, which reconstruct a new, simplified shape
-- from a selection of calculation results. This new shape is made up of edges, which
-- represent the shape visualized in the projection.
-- HLRBRep_Algo takes the shape itself into account whereas HLRBRep_PolyAlgo
-- works with a polyhedral simplification of the shape. When you use HLRBRep_Algo, you
-- obtain an exact result, whereas, when you use HLRBRep_PolyAlgo, you reduce
-- computation time but obtain polygonal segments. In the case of complicated
-- shapes, HLRBRep_Algo may be time-consuming.
-- An HLRBRep_Algo object provides a framework for:
-- - defining the point of view
-- - identifying the shape or shapes to be visualized
-- - calculating the outlines
-- - calculating the visible and hidden lines of the shape.
-- Warning
-- - Superimposed lines are not eliminated by this algorithm.
-- - There must be no unfinished objects inside the shape you wish to visualize.
-- - Points are not treated.
-- - Note that this is not the sort of algorithm used in generating shading, which
-- calculates the visible and hidden parts of each face in a shape to be visualized by
-- comparing each face in the shape with every other face in the same shape.
uses
TShared from MMgt,
Shape from TopoDS
is
Create returns mutable Algo from HLRBRep;
---Purpose: Constructs an empty framework for the
-- calculation of visible and hidden lines of a shape in a projection.
-- Use the function:
-- - Projector to define the point of view
-- - Add to select the shape or shapes to be visualized
-- - Update to compute the outlines of the shape, and
-- - Hide to compute the visible and hidden lines of the shape.
Create(A : Algo from HLRBRep) returns mutable Algo from HLRBRep;
Add(me : mutable; S : Shape from TopoDS;
SData : TShared from MMgt;
nbIso : Integer from Standard = 0)
---Purpose: add the Shape <S>.
is static;
Add(me : mutable; S : Shape from TopoDS;
nbIso : Integer from Standard = 0)
---Purpose: Adds the shape S to this framework, and
-- specifies the number of isoparameters nbiso desired in visualizing S.
-- You may add as many shapes as you wish. Use the function Add once for each shape.
is static;
Index(me : mutable; S : Shape from TopoDS)
returns Integer from Standard
---Purpose: return the index of the Shape <S> and
-- return 0 if the Shape <S> is not found.
is static;
OutLinedShapeNullify(me : mutable)
---Purpose: nullify all the results of OutLiner from HLRTopoBRep.
is static;
end Algo;

83
src/HLRBRep/HLRBRep_Algo.cxx Executable file
View File

@@ -0,0 +1,83 @@
// File: HLRBRep_Algo.cxx
// Created: Thu Aug 4 10:18:44 1994
// Author: Christophe MARION
// <cma@ecolox>
#define No_Standard_OutOfRange
#include <HLRBRep_Algo.ixx>
#include <HLRBRep_ShapeBounds.hxx>
#include <HLRTopoBRep_OutLiner.hxx>
//=======================================================================
//function : HLRBRep_Algo
//purpose :
//=======================================================================
HLRBRep_Algo::HLRBRep_Algo ()
{}
//=======================================================================
//function : HLRBRep_Algo
//purpose :
//=======================================================================
HLRBRep_Algo::HLRBRep_Algo (const Handle(HLRBRep_Algo)& A) :
HLRBRep_InternalAlgo(A)
{}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void HLRBRep_Algo::Add (const TopoDS_Shape& S,
const Handle(MMgt_TShared)& SData,
const Standard_Integer nbIso)
{
Load(new HLRTopoBRep_OutLiner(S),SData,nbIso);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void HLRBRep_Algo::Add (const TopoDS_Shape& S,
const Standard_Integer nbIso)
{
Load(new HLRTopoBRep_OutLiner(S),nbIso);
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer HLRBRep_Algo::Index (const TopoDS_Shape& S)
{
Standard_Integer n = NbShapes();
for (Standard_Integer i = 1; i <= n; i++) {
if (ShapeBounds(i).Shape()->OriginalShape() == S) return i;
if (ShapeBounds(i).Shape()->OutLinedShape() == S) return i;
}
return 0;
}
//=======================================================================
//function : OutLinedShapeNullify
//purpose :
//=======================================================================
void HLRBRep_Algo::OutLinedShapeNullify ()
{
Standard_Integer n = NbShapes();
for (Standard_Integer i = 1; i <= n; i++) {
ShapeBounds(i).Shape()->OutLinedShape(TopoDS_Shape());
ShapeBounds(i).Shape()->DataStructure().Clear();
}
}

View File

@@ -0,0 +1,91 @@
-- File: HLRBRep_AreaLimit.cdl
-- Created: Thu Apr 17 20:21:04 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class AreaLimit from HLRBRep inherits TShared from MMgt
---Purpose: The private nested class AreaLimit represents a --
-- vertex on the Edge with the state on the left and --
-- the right.
uses
Orientation from TopAbs,
State from TopAbs,
Intersection from HLRAlgo
is
Create(V : Intersection from HLRAlgo;
Boundary : Boolean from Standard;
Interference : Boolean from Standard;
StateBefore : State from TopAbs;
StateAfter : State from TopAbs;
EdgeBefore : State from TopAbs;
EdgeAfter : State from TopAbs)
returns mutable AreaLimit from HLRBRep;
---Purpose: The previous and next field are set to NULL.
StateBefore(me : mutable; St : State from TopAbs)
is static;
StateAfter(me : mutable; St : State from TopAbs)
is static;
EdgeBefore(me : mutable; St : State from TopAbs)
is static;
EdgeAfter(me : mutable; St : State from TopAbs)
is static;
Previous(me : mutable; P : AreaLimit from HLRBRep)
is static;
Next(me : mutable; N : AreaLimit from HLRBRep)
is static;
Vertex(me) returns Intersection from HLRAlgo
---C++: return const &
is static;
IsBoundary(me) returns Boolean from Standard
is static;
IsInterference(me) returns Boolean from Standard
is static;
StateBefore(me) returns State from TopAbs
is static;
StateAfter(me) returns State from TopAbs
is static;
EdgeBefore(me) returns State from TopAbs
is static;
EdgeAfter(me) returns State from TopAbs
is static;
Previous(me) returns mutable AreaLimit from HLRBRep
is static;
Next(me) returns mutable AreaLimit from HLRBRep
is static;
Clear(me : mutable)
is static;
fields
myVertex : Intersection from HLRAlgo;
myBoundary : Boolean from Standard;
myInterference : Boolean from Standard;
myStateBefore : State from TopAbs;
myStateAfter : State from TopAbs;
myEdgeBefore : State from TopAbs;
myEdgeAfter : State from TopAbs;
myPrevious : AreaLimit from HLRBRep;
myNext : AreaLimit from HLRBRep;
end AreaLimit;

192
src/HLRBRep/HLRBRep_AreaLimit.cxx Executable file
View File

@@ -0,0 +1,192 @@
// File: HLRBRep_AreaLimit.cxx
// Created: Thu Apr 17 21:43:21 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRBRep_AreaLimit.ixx>
//=======================================================================
//function : HLRBRep_AreaLimit
//purpose :
//=======================================================================
HLRBRep_AreaLimit::HLRBRep_AreaLimit(const HLRAlgo_Intersection& V,
const Standard_Boolean Boundary,
const Standard_Boolean Interference,
const TopAbs_State StateBefore,
const TopAbs_State StateAfter,
const TopAbs_State EdgeBefore,
const TopAbs_State EdgeAfter) :
myVertex (V),
myBoundary (Boundary),
myInterference(Interference),
myStateBefore (StateBefore),
myStateAfter (StateAfter),
myEdgeBefore (EdgeBefore),
myEdgeAfter (EdgeAfter)
{
}
//=======================================================================
//function : StateBefore
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::StateBefore(const TopAbs_State Stat)
{
myStateBefore = Stat;
}
//=======================================================================
//function : StateAfter
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::StateAfter(const TopAbs_State Stat)
{
myStateAfter = Stat;
}
//=======================================================================
//function : EdgeBefore
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::EdgeBefore(const TopAbs_State Stat)
{
myEdgeBefore = Stat;
}
//=======================================================================
//function : EdgeAfter
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::EdgeAfter(const TopAbs_State Stat)
{
myEdgeAfter = Stat;
}
//=======================================================================
//function : Previous
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::Previous(const Handle(HLRBRep_AreaLimit)& P)
{
myPrevious = P;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::Next(const Handle(HLRBRep_AreaLimit)& N)
{
myNext = N;
}
//=======================================================================
//function : Vertex
//purpose :
//=======================================================================
const HLRAlgo_Intersection & HLRBRep_AreaLimit::Vertex() const
{
return myVertex;
}
//=======================================================================
//function : IsBoundary
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_AreaLimit::IsBoundary() const
{
return myBoundary;
}
//=======================================================================
//function : IsInterference
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_AreaLimit::IsInterference() const
{
return myInterference;
}
//=======================================================================
//function : StateBefore
//purpose :
//=======================================================================
TopAbs_State HLRBRep_AreaLimit::StateBefore() const
{
return myStateBefore;
}
//=======================================================================
//function : StateAfter
//purpose :
//=======================================================================
TopAbs_State HLRBRep_AreaLimit::StateAfter() const
{
return myStateAfter;
}
//=======================================================================
//function : EdgeBefore
//purpose :
//=======================================================================
TopAbs_State HLRBRep_AreaLimit::EdgeBefore() const
{
return myEdgeBefore;
}
//=======================================================================
//function : EdgeAfter
//purpose :
//=======================================================================
TopAbs_State HLRBRep_AreaLimit::EdgeAfter() const
{
return myEdgeAfter;
}
//=======================================================================
//function : Previous
//purpose :
//=======================================================================
Handle(HLRBRep_AreaLimit) HLRBRep_AreaLimit::Previous () const
{
return myPrevious;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
Handle(HLRBRep_AreaLimit) HLRBRep_AreaLimit::Next () const
{
return myNext;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void HLRBRep_AreaLimit::Clear()
{
myPrevious.Nullify();
myNext.Nullify();
}

View File

@@ -0,0 +1,241 @@
-- File: HLRBRep_BCurveTool.cdl
-- Created: Mon Jul 17 16:25:23 1995
-- Author: Modelistation
-- <model@mastox>
---Copyright: Matra Datavision 1995
class BCurveTool from HLRBRep
uses
Array1OfReal from TColStd,
Array1OfPnt from TColgp,
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,
Curve from BRepAdaptor
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
--
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: Curve from BRepAdaptor)
returns Real from Standard;
---C++: inline
LastParameter(myclass; C: Curve from BRepAdaptor)
returns Real from Standard;
---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: Curve from BRepAdaptor)
returns Shape from GeomAbs;
---Purpose:
---C++: inline
NbIntervals(myclass; C : in out Curve from BRepAdaptor;
S : Shape from GeomAbs)
returns Integer from Standard;
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
Intervals(myclass; C : in out Curve from BRepAdaptor;
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: Curve from BRepAdaptor)
returns Boolean from Standard;
---C++: inline
IsPeriodic(myclass; C: Curve from BRepAdaptor)
returns Boolean from Standard;
---C++: inline
Period(myclass; C: Curve from BRepAdaptor)
returns Real from Standard
raises DomainError from Standard;
---C++: inline
Value(myclass; C : Curve from BRepAdaptor;
U : Real from Standard)
returns Pnt from gp;
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
D0 (myclass; C : Curve from BRepAdaptor;
U : Real from Standard;
P : out Pnt from gp);
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
D1 (myclass; C : Curve from BRepAdaptor;
U : Real from Standard;
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 : Curve from BRepAdaptor;
U : Real from Standard;
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 : Curve from BRepAdaptor;
U : Real from Standard;
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 : Curve from BRepAdaptor;
U : Real from Standard;
N : Integer from Standard)
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 : Curve from BRepAdaptor;
R3d : Real from Standard)
returns Real from Standard;
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
GetType(myclass; C: Curve from BRepAdaptor)
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: Curve from BRepAdaptor)
returns Lin from gp
raises NoSuchObject from Standard;
---C++: inline
Circle(myclass; C: Curve from BRepAdaptor)
returns Circ from gp
raises NoSuchObject from Standard;
---C++: inline
Ellipse(myclass; C: Curve from BRepAdaptor)
returns Elips from gp
raises NoSuchObject from Standard;
---C++: inline
Hyperbola(myclass; C: Curve from BRepAdaptor)
returns Hypr from gp
raises NoSuchObject from Standard;
---C++: inline
Parabola(myclass; C: Curve from BRepAdaptor)
returns Parab from gp
raises NoSuchObject from Standard;
---C++: inline
Bezier(myclass; C: Curve from BRepAdaptor)
returns BezierCurve from Geom
raises NoSuchObject from Standard;
BSpline(myclass; C: Curve from BRepAdaptor)
returns BSplineCurve from Geom
raises NoSuchObject from Standard;
Degree(myclass; C: Curve from BRepAdaptor)
returns Integer from Standard;
---C++: inline
IsRational(myclass; C: Curve from BRepAdaptor)
returns Boolean from Standard;
---C++: inline
NbPoles(myclass; C: Curve from BRepAdaptor)
returns Integer from Standard;
---C++: inline
NbKnots(myclass; C: Curve from BRepAdaptor)
returns Integer from Standard;
---C++: inline
Poles(myclass; C : Curve from BRepAdaptor;
T : in out Array1OfPnt from TColgp);
PolesAndWeights(myclass; C : Curve from BRepAdaptor;
T : in out Array1OfPnt from TColgp;
W : in out Array1OfReal from TColStd);
NbSamples(myclass; C : Curve from BRepAdaptor;
U0,U1 : Real from Standard)
returns Integer from Standard;
end BCurveTool;

View File

@@ -0,0 +1,97 @@
// File: HLRBRep_BCurveTool.cxx
// Created: Mon Jul 17 17:39:39 1995
// Author: Modelistation
// <model@mastox>
#include <HLRBRep_BCurveTool.ixx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt.hxx>
//=======================================================================
//function : NbSamples
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_BCurveTool::NbSamples (const BRepAdaptor_Curve& 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);
}
//=======================================================================
//function : Poles
//purpose :
//=======================================================================
void HLRBRep_BCurveTool::Poles(const BRepAdaptor_Curve& C,
TColgp_Array1OfPnt& T)
{
if(C.GetType() == GeomAbs_BezierCurve)
C.Bezier()->Poles(T);
else if(C.GetType() == GeomAbs_BSplineCurve)
C.BSpline()->Poles(T);
}
//=======================================================================
//function : PolesAndWeights
//purpose :
//=======================================================================
void HLRBRep_BCurveTool::PolesAndWeights(const BRepAdaptor_Curve& C,
TColgp_Array1OfPnt& T,
TColStd_Array1OfReal& W)
{
if(C.GetType() == GeomAbs_BezierCurve) {
const Handle(Geom_BezierCurve) HB = C.Bezier();
HB->Poles(T);
HB->Weights(W);
}
else if(C.GetType() == GeomAbs_BSplineCurve) {
const Handle(Geom_BSplineCurve) HB = C.BSpline();
HB->Poles(T);
HB->Weights(W);
}
}
//=======================================================================
//function : Bezier
//purpose :
//=======================================================================
Handle(Geom_BezierCurve)
HLRBRep_BCurveTool::Bezier (const BRepAdaptor_Curve& C)
{ return(C.Bezier()); }
//=======================================================================
//function : BSpline
//purpose :
//=======================================================================
Handle(Geom_BSplineCurve)
HLRBRep_BCurveTool::BSpline (const BRepAdaptor_Curve& C)
{ return(C.BSpline()); }

View File

@@ -0,0 +1,256 @@
// File: HLRBRep_BCurveTool.lxx
// Created: Thu Oct 22 12:14:59 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#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 <BRepAdaptor_Curve.hxx>
//=======================================================================
//function : FirstParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BCurveTool::FirstParameter (const BRepAdaptor_Curve& C)
{ return(C.FirstParameter()); }
//=======================================================================
//function : LastParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BCurveTool::LastParameter (const BRepAdaptor_Curve& C)
{ return(C.LastParameter()); }
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
inline GeomAbs_Shape
HLRBRep_BCurveTool::Continuity (const BRepAdaptor_Curve& C)
{ return(C.Continuity()); }
//=======================================================================
//function : NbIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BCurveTool::NbIntervals(BRepAdaptor_Curve& C,
const GeomAbs_Shape Sh)
{ return(C.NbIntervals(Sh)); }
//=======================================================================
//function : Intervals
//purpose :
//=======================================================================
inline void
HLRBRep_BCurveTool::Intervals(BRepAdaptor_Curve& C,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh)
{ C.Intervals(Tab,Sh); }
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BCurveTool::IsClosed(const BRepAdaptor_Curve& C)
{ return(C.IsClosed()); }
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BCurveTool::IsPeriodic(const BRepAdaptor_Curve& C)
{ return(C.IsPeriodic()); }
//=======================================================================
//function : Period
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BCurveTool::Period(const BRepAdaptor_Curve& C)
{ return(C.Period()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline gp_Pnt
HLRBRep_BCurveTool::Value (const BRepAdaptor_Curve& C,
const Standard_Real U)
{ return(C.Value(U)); }
//=======================================================================
//function : D0
//purpose :
//=======================================================================
inline void
HLRBRep_BCurveTool::D0(const BRepAdaptor_Curve& C,
const Standard_Real U,
gp_Pnt& P)
{ C.D0(U,P); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void
HLRBRep_BCurveTool::D1 (const BRepAdaptor_Curve& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T)
{ C.D1(U,P,T); }
inline void
HLRBRep_BCurveTool::D2 (const BRepAdaptor_Curve& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& T,
gp_Vec& N)
{ C.D2(U,P,T,N); }
//=======================================================================
//function : D3
//purpose :
//=======================================================================
inline void
HLRBRep_BCurveTool::D3 (const BRepAdaptor_Curve& C,
const Standard_Real U,
gp_Pnt& P,
gp_Vec& V1,
gp_Vec& V2,
gp_Vec& V3)
{ C.D3(U,P,V1,V2,V3); }
//=======================================================================
//function : DN
//purpose :
//=======================================================================
inline gp_Vec
HLRBRep_BCurveTool::DN (const BRepAdaptor_Curve& C,
const Standard_Real U,
const Standard_Integer N)
{ return(C.DN(U,N)); }
//=======================================================================
//function : Resolution
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BCurveTool::Resolution(const BRepAdaptor_Curve& C,
const Standard_Real R3d)
{ return(C.Resolution(R3d)); }
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_CurveType
HLRBRep_BCurveTool::GetType(const BRepAdaptor_Curve& C)
{ return(C.GetType()); }
//=======================================================================
//function : Line
//purpose :
//=======================================================================
inline gp_Lin
HLRBRep_BCurveTool::Line (const BRepAdaptor_Curve& C)
{ return(C.Line()); }
//=======================================================================
//function : Circle
//purpose :
//=======================================================================
inline gp_Circ
HLRBRep_BCurveTool::Circle (const BRepAdaptor_Curve& C)
{ return(C.Circle()); }
//=======================================================================
//function : Ellipse
//purpose :
//=======================================================================
inline gp_Elips
HLRBRep_BCurveTool::Ellipse (const BRepAdaptor_Curve& C)
{ return(C.Ellipse()); }
//=======================================================================
//function : Parabola
//purpose :
//=======================================================================
inline gp_Parab
HLRBRep_BCurveTool::Parabola (const BRepAdaptor_Curve& C)
{ return(C.Parabola()); }
//=======================================================================
//function : Hyperbola
//purpose :
//=======================================================================
inline gp_Hypr
HLRBRep_BCurveTool::Hyperbola (const BRepAdaptor_Curve& C)
{ return(C.Hyperbola()); }
//=======================================================================
//function : Degree
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BCurveTool::Degree (const BRepAdaptor_Curve& C)
{ return(C.Degree()); }
//=======================================================================
//function : IsRational
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BCurveTool::IsRational (const BRepAdaptor_Curve& C)
{ return(C.IsRational()); }
//=======================================================================
//function : NbPoles
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BCurveTool::NbPoles (const BRepAdaptor_Curve& C)
{ return(C.NbPoles()); }
//=======================================================================
//function : NbKnots
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BCurveTool::NbKnots(const BRepAdaptor_Curve& C)
{ return(C.NbKnots()); }

View File

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

View File

@@ -0,0 +1,155 @@
//-- File : HLRBRep_BSurfaceTool.cxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#include <HLRBRep_BSurfaceTool.ixx>
#include <BRepAdaptor_Surface.hxx>
//=======================================================================
//function : NbSamplesU
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_BSurfaceTool::NbSamplesU(const BRepAdaptor_Surface& 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);
}
//=======================================================================
//function : NbSamplesV
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_BSurfaceTool::NbSamplesV(const BRepAdaptor_Surface& 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);
}
//=======================================================================
//function : NbSamplesU
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_BSurfaceTool::NbSamplesU(const BRepAdaptor_Surface& 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);
}
//=======================================================================
//function : NbSamplesV
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_BSurfaceTool::NbSamplesV(const BRepAdaptor_Surface& 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,475 @@
//-- File : HLRBRep_BSurfaceTool.lxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#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>
#include <BRepAdaptor_Surface.hxx>
//=======================================================================
//function : FirstUParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::FirstUParameter(const BRepAdaptor_Surface& Surf)
{ return Surf.FirstUParameter(); }
//=======================================================================
//function : FirstVParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::FirstVParameter(const BRepAdaptor_Surface& Surf)
{ return Surf.FirstVParameter(); }
//=======================================================================
//function : LastUParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::LastUParameter(const BRepAdaptor_Surface& Surf)
{ return Surf.LastUParameter(); }
//=======================================================================
//function : LastVParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::LastVParameter(const BRepAdaptor_Surface& Surf)
{ return Surf.LastVParameter(); }
//=======================================================================
//function : NbUIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbUIntervals(const BRepAdaptor_Surface& Surf,
const GeomAbs_Shape S)
{ return Surf.NbUIntervals(S); }
//=======================================================================
//function : NbVIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbVIntervals(const BRepAdaptor_Surface& Surf,
const GeomAbs_Shape S)
{ return Surf.NbVIntervals(S); }
//=======================================================================
//function : UIntervals
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::UIntervals(const BRepAdaptor_Surface& Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S)
{ Surf.UIntervals(Tab,S); }
//=======================================================================
//function : VIntervals
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::VIntervals(const BRepAdaptor_Surface& Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S)
{ Surf.VIntervals(Tab,S); }
//=======================================================================
//function : UTrim
//purpose :
//=======================================================================
inline Handle_Adaptor3d_HSurface
HLRBRep_BSurfaceTool::UTrim(const BRepAdaptor_Surface& Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol)
{ return Surf.UTrim(F,L,Tol); }
//=======================================================================
//function : VTrim
//purpose :
//=======================================================================
inline Handle_Adaptor3d_HSurface
HLRBRep_BSurfaceTool::VTrim(const BRepAdaptor_Surface& Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol)
{ return Surf.VTrim(F,L,Tol); }
//=======================================================================
//function : IsUClosed
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsUClosed(const BRepAdaptor_Surface& S)
{ return S.IsUClosed(); }
//=======================================================================
//function : IsVClosed
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsVClosed(const BRepAdaptor_Surface& S)
{ return S.IsVClosed(); }
//=======================================================================
//function : IsUPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsUPeriodic(const BRepAdaptor_Surface& S)
{ return S.IsUPeriodic(); }
//=======================================================================
//function : UPeriod
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::UPeriod(const BRepAdaptor_Surface& S)
{ return S.UPeriod(); }
//=======================================================================
//function : IsVPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsVPeriodic(const BRepAdaptor_Surface& S)
{ return S.IsVPeriodic(); }
//=======================================================================
//function : VPeriod
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::VPeriod(const BRepAdaptor_Surface& S)
{ return S.VPeriod(); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline gp_Pnt
HLRBRep_BSurfaceTool::Value(const BRepAdaptor_Surface& S,
const Standard_Real U,
const Standard_Real V )
{ return S.Value(U,V); }
//=======================================================================
//function : D0
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::D0(const BRepAdaptor_Surface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P)
{ S.D0(U,V,P); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::D1(const BRepAdaptor_Surface& 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); }
//=======================================================================
//function : D2
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::D2(const BRepAdaptor_Surface& 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); }
//=======================================================================
//function : D3
//purpose :
//=======================================================================
inline void
HLRBRep_BSurfaceTool::D3(const BRepAdaptor_Surface& 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); }
//=======================================================================
//function : DN
//purpose :
//=======================================================================
inline gp_Vec
HLRBRep_BSurfaceTool::DN(const BRepAdaptor_Surface& S,
const Standard_Real U,
const Standard_Real V,
const Standard_Integer Nu,
const Standard_Integer Nv)
{ return S.DN(U,V,Nu,Nv); }
//=======================================================================
//function : UResolution
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::UResolution(const BRepAdaptor_Surface& S,
const Standard_Real R3d)
{ return S.UResolution(R3d); }
//=======================================================================
//function : VResolution
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_BSurfaceTool::VResolution(const BRepAdaptor_Surface& S,
const Standard_Real R3d)
{ return S.VResolution(R3d); }
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_SurfaceType
HLRBRep_BSurfaceTool::GetType(const BRepAdaptor_Surface& S )
{ return S.GetType(); }
//=======================================================================
//function : Plane
//purpose :
//=======================================================================
inline gp_Pln
HLRBRep_BSurfaceTool::Plane(const BRepAdaptor_Surface& S)
{ return S.Plane(); }
//=======================================================================
//function : Cylinder
//purpose :
//=======================================================================
inline gp_Cylinder
HLRBRep_BSurfaceTool::Cylinder(const BRepAdaptor_Surface& S)
{ return S.Cylinder(); }
//=======================================================================
//function : Cone
//purpose :
//=======================================================================
inline gp_Cone
HLRBRep_BSurfaceTool::Cone(const BRepAdaptor_Surface& S)
{ return S.Cone(); }
//=======================================================================
//function : Sphere
//purpose :
//=======================================================================
inline gp_Sphere
HLRBRep_BSurfaceTool::Sphere(const BRepAdaptor_Surface& S)
{ return S.Sphere(); }
//=======================================================================
//function : Torus
//purpose :
//=======================================================================
inline gp_Torus
HLRBRep_BSurfaceTool::Torus(const BRepAdaptor_Surface& S)
{ return S.Torus(); }
//=======================================================================
//function : Bezier
//purpose :
//=======================================================================
inline Handle(Geom_BezierSurface)
HLRBRep_BSurfaceTool::Bezier(const BRepAdaptor_Surface& S)
{ return(S.Bezier()); }
//=======================================================================
//function : BSpline
//purpose :
//=======================================================================
inline Handle(Geom_BSplineSurface)
HLRBRep_BSurfaceTool::BSpline(const BRepAdaptor_Surface& S)
{ return(S.BSpline()); }
//=======================================================================
//function : AxeOfRevolution
//purpose :
//=======================================================================
inline gp_Ax1
HLRBRep_BSurfaceTool::AxeOfRevolution(const BRepAdaptor_Surface& S)
{ return(S.AxeOfRevolution()); }
//=======================================================================
//function : Direction
//purpose :
//=======================================================================
inline gp_Dir
HLRBRep_BSurfaceTool::Direction(const BRepAdaptor_Surface& S)
{ return(S.Direction()); }
//=======================================================================
//function : BasisCurve
//purpose :
//=======================================================================
inline Handle(Adaptor3d_HCurve)
HLRBRep_BSurfaceTool::BasisCurve(const BRepAdaptor_Surface& S)
{ return(S.BasisCurve()); }
//=======================================================================
//function : UContinuity
//purpose :
//=======================================================================
inline GeomAbs_Shape
HLRBRep_BSurfaceTool::UContinuity(const BRepAdaptor_Surface& S)
{ return(S.UContinuity()); }
//=======================================================================
//function : VContinuity
//purpose :
//=======================================================================
inline GeomAbs_Shape
HLRBRep_BSurfaceTool::VContinuity(const BRepAdaptor_Surface& S)
{ return(S.VContinuity()); }
//=======================================================================
//function : UDegree
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::UDegree(const BRepAdaptor_Surface& S)
{ return(S.UDegree()); }
//=======================================================================
//function : NbUPoles
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbUPoles(const BRepAdaptor_Surface& S)
{ return(S.NbUPoles()); }
//=======================================================================
//function : NbUKnots
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbUKnots(const BRepAdaptor_Surface& S)
{ return(S.NbUKnots()); }
//=======================================================================
//function : IsURational
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsURational(const BRepAdaptor_Surface& S)
{ return(S.IsURational()); }
//=======================================================================
//function : VDegree
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::VDegree(const BRepAdaptor_Surface& S)
{ return(S.VDegree()); }
//=======================================================================
//function : NbVPoles
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbVPoles(const BRepAdaptor_Surface& S)
{ return(S.NbVPoles()); }
//=======================================================================
//function : NbVKnots
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_BSurfaceTool::NbVKnots(const BRepAdaptor_Surface& S)
{ return(S.NbVKnots()); }
//=======================================================================
//function : IsVRational
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_BSurfaceTool::IsVRational(const BRepAdaptor_Surface& S)
{ return(S.IsVRational()); }

83
src/HLRBRep/HLRBRep_BiPnt2D.cdl Executable file
View File

@@ -0,0 +1,83 @@
-- File: HLRBRep_BiPnt2D.cdl
-- Created: Fri Aug 21 17:10:30 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class BiPnt2D from HLRBRep
---Purpose: Contains the colors of a shape.
uses
Boolean from Standard,
Real from Standard,
Pnt2d from gp,
Shape from TopoDS
is
Create
returns BiPnt2D from HLRBRep;
Create(x1,y1,x2,y2 : Real from Standard;
S : Shape from TopoDS;
reg1,regn,outl,intl : Boolean from Standard)
returns BiPnt2D from HLRBRep;
P1(me) returns Pnt2d from gp
---C++: inline
---C++: return const &
is static;
P2(me) returns Pnt2d from gp
---C++: inline
---C++: return const &
is static;
Shape(me) returns Shape from TopoDS
---C++: inline
---C++: return const &
is static;
Shape(me : in out; S : Shape from TopoDS)
---C++: inline
is static;
Rg1Line(me) returns Boolean from Standard
---C++: inline
is static;
Rg1Line(me : in out; B : Boolean from Standard)
---C++: inline
is static;
RgNLine(me) returns Boolean from Standard
---C++: inline
is static;
RgNLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
OutLine(me) returns Boolean from Standard
---C++: inline
is static;
OutLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
IntLine(me) returns Boolean from Standard
---C++: inline
is static;
IntLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
fields
myP1 : Pnt2d from gp;
myP2 : Pnt2d from gp;
myShape : Shape from TopoDS;
myFlags : Boolean from Standard;
end BiPnt2D;

41
src/HLRBRep/HLRBRep_BiPnt2D.cxx Executable file
View File

@@ -0,0 +1,41 @@
// File: HLRBRep_BiPnt2D.cxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRBRep_BiPnt2D.ixx>
//=======================================================================
//function : HLRBRep_BiPnt2D
//purpose :
//=======================================================================
HLRBRep_BiPnt2D::HLRBRep_BiPnt2D ()
{
}
//=======================================================================
//function : HLRBRep_BiPnt2D
//purpose :
//=======================================================================
HLRBRep_BiPnt2D::HLRBRep_BiPnt2D (const Standard_Real x1,
const Standard_Real y1,
const Standard_Real x2,
const Standard_Real y2,
const TopoDS_Shape& S,
const Standard_Boolean reg1,
const Standard_Boolean regn,
const Standard_Boolean outl,
const Standard_Boolean intl) :
myP1(x1,y1),
myP2(x2,y2),
myShape(S),
myFlags(0)
{
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
IntLine(intl);
}

118
src/HLRBRep/HLRBRep_BiPnt2D.lxx Executable file
View File

@@ -0,0 +1,118 @@
// File: HLRBRep_BiPnt2D.lxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#define EMskRg1Line ((Standard_Boolean)1)
#define EMskRgNLine ((Standard_Boolean)2)
#define EMskOutLine ((Standard_Boolean)4)
#define EMskIntLine ((Standard_Boolean)8)
//=======================================================================
//function : P1
//purpose :
//=======================================================================
inline const gp_Pnt2d & HLRBRep_BiPnt2D::P1 () const
{ return myP1; }
//=======================================================================
//function : P2
//purpose :
//=======================================================================
inline const gp_Pnt2d & HLRBRep_BiPnt2D::P2 () const
{ return myP2; }
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const TopoDS_Shape & HLRBRep_BiPnt2D::Shape () const
{ return myShape; }
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline void HLRBRep_BiPnt2D::Shape (const TopoDS_Shape& S)
{ myShape = S; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPnt2D::Rg1Line () const
{ return (myFlags & EMskRg1Line) != 0; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline void HLRBRep_BiPnt2D::Rg1Line (const Standard_Boolean B)
{
if (B) myFlags |= EMskRg1Line;
else myFlags &= ~EMskRg1Line;
}
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPnt2D::RgNLine () const
{ return (myFlags & EMskRgNLine) != 0; }
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPnt2D::RgNLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskRgNLine;
else myFlags &= ~EMskRgNLine;
}
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPnt2D::OutLine () const
{ return (myFlags & EMskOutLine) != 0; }
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPnt2D::OutLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskOutLine;
else myFlags &= ~EMskOutLine;
}
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPnt2D::IntLine () const
{ return (myFlags & EMskIntLine) != 0; }
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPnt2D::IntLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskIntLine;
else myFlags &= ~EMskIntLine;
}

83
src/HLRBRep/HLRBRep_BiPoint.cdl Executable file
View File

@@ -0,0 +1,83 @@
-- File: HLRBRep_BiPoint.cdl
-- Created: Fri Aug 21 17:10:30 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class BiPoint from HLRBRep
---Purpose: Contains the colors of a shape.
uses
Boolean from Standard,
Real from Standard,
Pnt from gp,
Shape from TopoDS
is
Create
returns BiPoint from HLRBRep;
Create(x1,y1,z1,x2,y2,z2 : Real from Standard;
S : Shape from TopoDS;
reg1,regn,outl,intl : Boolean from Standard)
returns BiPoint from HLRBRep;
P1(me) returns Pnt from gp
---C++: inline
---C++: return const &
is static;
P2(me) returns Pnt from gp
---C++: inline
---C++: return const &
is static;
Shape(me) returns Shape from TopoDS
---C++: inline
---C++: return const &
is static;
Shape(me : in out; S : Shape from TopoDS)
---C++: inline
is static;
Rg1Line(me) returns Boolean from Standard
---C++: inline
is static;
Rg1Line(me : in out; B : Boolean from Standard)
---C++: inline
is static;
RgNLine(me) returns Boolean from Standard
---C++: inline
is static;
RgNLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
OutLine(me) returns Boolean from Standard
---C++: inline
is static;
OutLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
IntLine(me) returns Boolean from Standard
---C++: inline
is static;
IntLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
fields
myP1 : Pnt from gp;
myP2 : Pnt from gp;
myShape : Shape from TopoDS;
myFlags : Boolean from Standard;
end BiPoint;

43
src/HLRBRep/HLRBRep_BiPoint.cxx Executable file
View File

@@ -0,0 +1,43 @@
// File: HLRBRep_BiPoint.cxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRBRep_BiPoint.ixx>
//=======================================================================
//function : HLRBRep_BiPoint
//purpose :
//=======================================================================
HLRBRep_BiPoint::HLRBRep_BiPoint ()
{
}
//=======================================================================
//function : HLRBRep_BiPoint
//purpose :
//=======================================================================
HLRBRep_BiPoint::HLRBRep_BiPoint (const Standard_Real x1,
const Standard_Real y1,
const Standard_Real z1,
const Standard_Real x2,
const Standard_Real y2,
const Standard_Real z2,
const TopoDS_Shape& S,
const Standard_Boolean reg1,
const Standard_Boolean regn,
const Standard_Boolean outl,
const Standard_Boolean intl) :
myP1(x1,y1,z1),
myP2(x2,y2,z2),
myShape(S),
myFlags(0)
{
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
IntLine(intl);
}

118
src/HLRBRep/HLRBRep_BiPoint.lxx Executable file
View File

@@ -0,0 +1,118 @@
// File: HLRBRep_BiPoint.lxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#define EMskRg1Line ((Standard_Boolean)1)
#define EMskRgNLine ((Standard_Boolean)2)
#define EMskOutLine ((Standard_Boolean)4)
#define EMskIntLine ((Standard_Boolean)8)
//=======================================================================
//function : P1
//purpose :
//=======================================================================
inline const gp_Pnt & HLRBRep_BiPoint::P1 () const
{ return myP1; }
//=======================================================================
//function : P2
//purpose :
//=======================================================================
inline const gp_Pnt & HLRBRep_BiPoint::P2 () const
{ return myP2; }
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const TopoDS_Shape & HLRBRep_BiPoint::Shape () const
{ return myShape; }
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline void HLRBRep_BiPoint::Shape (const TopoDS_Shape& S)
{ myShape = S; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPoint::Rg1Line () const
{ return (myFlags & EMskRg1Line) != 0; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline void HLRBRep_BiPoint::Rg1Line (const Standard_Boolean B)
{
if (B) myFlags |= EMskRg1Line;
else myFlags &= ~EMskRg1Line;
}
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPoint::RgNLine () const
{ return (myFlags & EMskRgNLine) != 0; }
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPoint::RgNLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskRgNLine;
else myFlags &= ~EMskRgNLine;
}
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPoint::OutLine () const
{ return (myFlags & EMskOutLine) != 0; }
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPoint::OutLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskOutLine;
else myFlags &= ~EMskOutLine;
}
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_BiPoint::IntLine () const
{ return (myFlags & EMskIntLine) != 0; }
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline void HLRBRep_BiPoint::IntLine (const Standard_Boolean B)
{
if (B) myFlags |= EMskIntLine;
else myFlags &= ~EMskIntLine;
}

View File

@@ -0,0 +1,76 @@
-- File: HLRBRep_CLPropsATool.cdl
-- Created: Tue Apr 20 18:34:23 1993
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1993
class CLPropsATool from HLRBRep
uses
Curve from HLRBRep,
Pnt2d from gp,
Vec2d from gp
is
Value(myclass; A : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp);
---Purpose: Computes the point <P> of parameter <U> on the
-- Curve from HLRBRep <C>.
--
---C++: inline
D1 (myclass; A : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V1 : out Vec2d from gp);
---Purpose: Computes the point <P> and first derivative <V1>
-- of parameter <U> on the curve <C>.
--
---C++: inline
D2 (myclass; A : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V1, V2 : out Vec2d from gp);
---Purpose: Computes the point <P>, the first derivative <V1>
-- and second derivative <V2> of parameter <U> on the
-- curve <C>.
--
---C++: inline
D3 (myclass; A : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V1, V2, V3 : out Vec2d from gp);
---Purpose: Computes the point <P>, the first derivative <V1>,
-- the second derivative <V2> and third derivative
-- <V3> of parameter <U> on the curve <C>.
--
---C++: inline
Continuity(myclass; A : Address from Standard)
returns Integer from Standard;
---Purpose: returns the order of continuity of the curve <C>.
-- returns 1 : first derivative only is computable
-- returns 2 : first and second derivative only are
-- computable. returns 3 : first, second and third
-- are computable.
--
---C++: inline
FirstParameter(myclass; A : Address from Standard)
returns Real from Standard;
---Purpose: returns the first parameter bound of the curve.
--
---C++: inline
LastParameter(myclass; A : Address from Standard)
returns Real from Standard;
---Purpose: returns the last parameter bound of the curve.
-- FirstParameter must be less than LastParamenter.
--
---C++: inline
end CLPropsATool;

View File

@@ -0,0 +1,6 @@
// File: HLRBRep_CLPropsTool.cxx
// Created: Tue Aug 18 15:40:26 1992
// Author: Herve LEGRAND
// <hl@bravox>
#include <HLRBRep_CLPropsATool.ixx>

View File

@@ -0,0 +1,86 @@
// File: HLRBRep_CLPropsATool.lxx
// Created: Tue Aug 18 15:40:26 1992
// Author: Herve LEGRAND
// <hl@bravox>
#include <Standard_NotImplemented.hxx>
#include <HLRBRep_Curve.hxx>
#include <GeomAbs_Shape.hxx>
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline void HLRBRep_CLPropsATool::Value
(const Standard_Address A,
const Standard_Real U,
gp_Pnt2d& P)
{ P = ((HLRBRep_Curve*)A)->Value(U); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void HLRBRep_CLPropsATool::D1
(const Standard_Address A,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1)
{ ((HLRBRep_Curve*)A)->D1(U,P,V1); }
//=======================================================================
//function : D2
//purpose :
//=======================================================================
inline void HLRBRep_CLPropsATool::D2
(const Standard_Address A,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
gp_Vec2d& V2)
{ ((HLRBRep_Curve*)A)->D2(U, P, V1, V2); }
//=======================================================================
//function : D3
//purpose :
//=======================================================================
inline void HLRBRep_CLPropsATool::D3
(const Standard_Address A,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
gp_Vec2d& V2,
gp_Vec2d& V3)
{ ((HLRBRep_Curve*)A)->D3(U, P, V1, V2, V3); }
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_CLPropsATool::Continuity
(const Standard_Address)
{ return GeomAbs_C2; }
//=======================================================================
//function : FirstParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_CLPropsATool::FirstParameter
(const Standard_Address A)
{ return ((HLRBRep_Curve*)A)->FirstParameter(); }
//=======================================================================
//function : LastParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_CLPropsATool::LastParameter
(const Standard_Address A)
{ return ((HLRBRep_Curve*)A)->LastParameter(); }

326
src/HLRBRep/HLRBRep_Curve.cdl Executable file
View File

@@ -0,0 +1,326 @@
-- File: HLRBRep_Curve.cdl
-- Created: Thu Apr 1 15:09:20 1993
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1993
class Curve from HLRBRep
---Purpose: Defines a 2d curve by projection of a 3D curve on
-- a plane with an optional perspective
-- transformation.
uses
Integer from Standard,
Boolean from Standard,
ShortReal from Standard,
Real from Standard,
Address from Standard,
Pnt from gp,
Vec from gp,
Pnt2d from gp,
Vec2d from gp,
Dir2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
Shape from GeomAbs,
CurveType from GeomAbs,
Array1OfPnt2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Edge from TopoDS,
Curve from BRepAdaptor
raises
NoSuchObject from Standard,
DomainError from Standard,
OutOfRange from Standard,
UndefinedDerivative from StdFail
is
Create returns Curve from HLRBRep;
---Purpose: Creates an undefined Curve.
Projector(me : in out; Proj : Address from Standard)
---C++: inline
is static;
Curve(me : in out) returns Curve from BRepAdaptor
---Purpose: Returns the 3D curve.
---C++: return &
---C++: inline
is static;
Curve(me : in out; E : Edge from TopoDS)
---Purpose: Sets the 3D curve to be projected.
is static;
Parameter2d(me; P3d : Real from Standard) returns Real from Standard
---Purpose: Returns the parameter on the 2d curve from the
-- parameter on the 3d curve.
is static;
Parameter3d(me; P2d : Real from Standard) returns Real from Standard
---Purpose: Returns the parameter on the 3d curve from the
-- parameter on the 2d curve.
is static;
Update(me : in out; TotMin : Address from Standard;
TotMax : Address from Standard)
returns Real from Standard
---Purpose: Update the minmax and the internal data
is static;
UpdateMinMax(me : in out; TotMin : Address from Standard;
TotMax : Address from Standard)
returns Real from Standard
---Purpose: Update the minmax returns tol for enlarge;
is static;
Z(me; U : Real from Standard) returns Real from Standard
--- Purpose : Computes the Z coordinate of the point of
-- parameter U on the curve in the viewing coordinate system
is static;
Value3D(me; U : Real from Standard) returns Pnt from gp
--- Purpose : Computes the 3D point of parameter U on the
-- curve.
--
---C++: inline
is static;
D0 (me; U : Real from Standard;
P : out Pnt from gp)
--- Purpose : Computes the 3D point of parameter U on the
-- curve.
--
---C++: inline
is static;
D1(me; U : Real from Standard;
P : out Pnt from gp ;
V : out Vec from gp)
--- Purpose : Computes the point of parameter U on the curve
-- with its first derivative.
--
---C++: inline
is static;
Tangent(me; AtStart : Boolean from Standard;
P : out Pnt2d from gp;
D : out Dir2d from gp)
--- Purpose : Depending on <AtStart> computes the 2D point and
-- tangent on the curve at sart (or at end). If the first
-- derivative is null look after at start (or before at end)
-- with the second derivative.
--
raises
UndefinedDerivative from StdFail
is static;
--
-- Global methods - Apply to the whole curve.
--
FirstParameter(me) returns Real from Standard
---C++: inline
is static;
LastParameter(me) returns Real from Standard
---C++: inline
is static;
Continuity(me) returns Shape from GeomAbs
---C++: inline
is static;
NbIntervals(me: in out; S : Shape from GeomAbs)
returns Integer from Standard
---Purpose: If necessary, breaks the curve in intervals of
-- continuity <S>. And returns the number of
-- intervals.
---C++: inline
is static;
Intervals(me: in out; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
--
-- The array must provide enough room to accomodate
-- for the parameters. i.e. T.Length() > NbIntervals()
raises
OutOfRange from Standard
---C++: inline
;
IsClosed(me) returns Boolean from Standard
---C++: inline
is static;
IsPeriodic(me) returns Boolean from Standard
---C++: inline
is static;
Period(me) returns Real
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
is static;
Value(me; U : Real from Standard) returns Pnt2d from gp
--- Purpose : Computes the point of parameter U on the curve.
--
---C++: inline
is static;
D0 (me; U : Real from Standard;
P : out Pnt2d from gp)
--- Purpose : Computes the point of parameter U on the curve.
is static;
D1 (me; U : Real from Standard;
P : out Pnt2d from gp;
V : out Vec2d from gp)
--- Purpose : Computes the point of parameter U on the curve
-- with its first derivative.
raises
DomainError from Standard
--- Purpose : Raised if the continuity of the current interval
-- is not C1.
is static;
D2 (me; U : Real from Standard;
P : out Pnt2d from gp ;
V1,V2 : out Vec2d from gp)
raises
DomainError from Standard
--- Purpose : Raised if the continuity of the current interval
-- is not C2.
is static;
D3 (me; U : Real from Standard;
P : out Pnt2d from gp;
V1, V2, V3 : out Vec2d from gp)
--- Purpose :
-- Returns the point P of parameter U, the first, the second
-- and the third derivative.
raises
DomainError from Standard
--- Purpose : Raised if the continuity of the current interval
-- is not C3.
is static;
DN (me; U : Real from Standard;
N : Integer from Standard) returns Vec2d from gp
--- Purpose :
-- The returned vector gives the value of the derivative for the
-- order of derivation N.
raises
DomainError from Standard,
--- Purpose : Raised if the continuity of the current interval
-- is not CN.
OutOfRange from Standard
--- Purpose : Raised if N < 1.
is static;
Resolution(me; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
is static;
GetType(me) 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
is static;
--
-- The following methods must be called when GetType returned
-- the corresponding type.
--
Line(me) returns Lin2d from gp
raises
NoSuchObject from Standard
is static;
Circle(me) returns Circ2d from gp
raises
NoSuchObject from Standard
is static;
Ellipse(me) returns Elips2d from gp
raises
NoSuchObject from Standard
is static;
Hyperbola(me) returns Hypr2d from gp
raises
NoSuchObject from Standard
is static;
Parabola(me) returns Parab2d from gp
raises
NoSuchObject from Standard
is static;
IsRational(me) returns Boolean from Standard
---C++:inline
is static;
Degree(me) returns Integer from Standard
---C++: inline
is static;
NbPoles(me) returns Integer from Standard
---C++: inline
is static;
Poles(me; TP : in out Array1OfPnt2d from TColgp)
raises
NoSuchObject from Standard, -- if rational
OutOfRange from Standard -- if TP has not length NbPoles
is static;
PolesAndWeights(me; TP : in out Array1OfPnt2d from TColgp;
TW : in out Array1OfReal from TColStd)
raises
NoSuchObject from Standard, -- if not rational
OutOfRange from Standard -- if TW has not length NbPoles
is static;
NbKnots(me) returns Integer from Standard
raises
NoSuchObject from Standard
---C++: inline
is static;
Knots(me; kn: out Array1OfReal from TColStd)
is static;
Multiplicities(me; mu: out Array1OfInteger from TColStd)
is static;
fields
myCurve : Curve from BRepAdaptor;
myType : CurveType from GeomAbs;
myProj : Address from Standard;
-- description of the line in the plane containing the line and the eye
myOX : Real from Standard;
myOZ : Real from Standard;
myVX : Real from Standard;
myVZ : Real from Standard;
myOF : Real from Standard;
end Curve;

598
src/HLRBRep/HLRBRep_Curve.cxx Executable file
View File

@@ -0,0 +1,598 @@
// File: HLRBRep_Curve.gxx
// Created: Fri Mar 13 11:08:32 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRBRep_Curve.ixx>
#include <gp.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pln.hxx>
#include <Precision.hxx>
#include <ProjLib.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <HLRAlgo.hxx>
#include <HLRAlgo_Projector.hxx>
#include <HLRBRep_CLProps.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Handle_Geom_BSplineCurve.hxx>
#include <Handle_Geom_BezierCurve.hxx>
#define OCC155 // jfa 05.03.2002 // bad vectors projection
//=======================================================================
//function : HLRBRep_Curve
//purpose :
//=======================================================================
HLRBRep_Curve::HLRBRep_Curve ()
{}
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
void HLRBRep_Curve::Curve (const TopoDS_Edge& E)
{ myCurve.Initialize(E); }
//=======================================================================
//function : Parameter2d
//purpose :
//=======================================================================
Standard_Real
HLRBRep_Curve::Parameter2d (const Standard_Real P3d) const
{
// Mathematical formula for lines
// myOF P3d (myOF myVX - myOZ myVX + myOX myVZ)
// P2d -> --------------------------------------------
// (-myOF + myOZ) (-myOF + myOZ + P3d myVZ)
Standard_Real P2d;
if (myType == GeomAbs_Line) {
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real FmOZ = myOF - myOZ;
P2d = myOF * P3d * (myVX * FmOZ + myOX * myVZ) /
(FmOZ * (FmOZ - P3d * myVZ));
}
else P2d = P3d * myVX;
}
else if (myType == GeomAbs_Ellipse) {
P2d = P3d + myOX;
}
else P2d = P3d;
return P2d;
}
//=======================================================================
//function : Parameter3d
//purpose :
//=======================================================================
Standard_Real
HLRBRep_Curve::Parameter3d (const Standard_Real P2d) const
{
// Mathematical formula for lines
// 2
// (-myOF + myOZ) P2d
// P3d -> -----------------------------------------------------
// (myOF - myOZ) (myOF myVX + P2d myVZ) + myOF myOX myVZ
Standard_Real P3d;
if (myType == GeomAbs_Line) {
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real FmOZ = myOF - myOZ;
P3d = P2d * FmOZ * FmOZ /
(FmOZ * (myOF * myVX + P2d * myVZ) + myOF * myOX * myVZ);
}
else P3d = P2d / myVX;
}
else if (myType == GeomAbs_Ellipse) {
P3d = P2d - myOX;
}
else P3d = P2d;
return P3d;
}
//=======================================================================
//function : Update
//purpose :
//=======================================================================
Standard_Real HLRBRep_Curve::Update (const Standard_Address TotMin,
const Standard_Address TotMax)
{
GeomAbs_CurveType typ = HLRBRep_BCurveTool::GetType(myCurve);
myType = GeomAbs_OtherCurve;
switch (typ) {
case GeomAbs_Line:
myType = typ;
break;
case GeomAbs_Circle:
if (!((HLRAlgo_Projector*) myProj)->Perspective()) {
gp_Dir D1 = HLRBRep_BCurveTool::Circle(myCurve).Axis().Direction();
D1.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (D1.IsParallel(gp::DZ(),Precision::Angular()))
myType = GeomAbs_Circle;
else if (Abs(D1.Dot(gp::DZ())) < Precision::Angular()*10) //*10: The minor radius of ellipse should not be too small.
myType = GeomAbs_OtherCurve;
else {
myType = GeomAbs_Ellipse;
// compute the angle offset
gp_Dir D3 = D1.Crossed(gp::DZ());
gp_Dir D2 = HLRBRep_BCurveTool::Circle(myCurve).XAxis().Direction();
D2.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
myOX = D3.AngleWithRef(D2,D1);
}
}
break;
case GeomAbs_Ellipse:
if (!((HLRAlgo_Projector*) myProj)->Perspective()) {
gp_Dir D1 = HLRBRep_BCurveTool::Ellipse(myCurve).Axis().Direction();
D1.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (D1.IsParallel(gp::DZ(),Precision::Angular())) {
myOX = 0.; // no offset on the angle
myType = GeomAbs_Ellipse;
}
}
break;
case GeomAbs_BezierCurve:
if (HLRBRep_BCurveTool::Degree(myCurve) == 1)
myType = GeomAbs_Line;
else if (!((HLRAlgo_Projector*) myProj)->Perspective())
myType = typ;
break;
case GeomAbs_BSplineCurve:
if (!((HLRAlgo_Projector*) myProj)->Perspective())
myType = typ;
break;
default:
break;
}
if (myType == GeomAbs_Line) {
// compute the values for a line
gp_Lin L;
Standard_Real l3d = 1.; // length of the 3d bezier curve
if (HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_Line) {
L = HLRBRep_BCurveTool::Line(myCurve);
}
else { // bezier degree 1
gp_Pnt PL;
gp_Vec VL;
HLRBRep_BCurveTool::D1(myCurve,0,PL,VL);
L = gp_Lin(PL,VL);
l3d = PL.Distance(HLRBRep_BCurveTool::Value(myCurve,1.));
}
gp_Pnt P = L.Location();
gp_Vec V = L.Direction();
P.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
V.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
gp_Pnt2d F;
gp_Vec2d VFX;
D1(0.,F,VFX);
VFX.Normalize();
myVX = (VFX.X()*V.X()+VFX.Y()*V.Y()) * l3d;
Standard_Real l = - (VFX.X()*F.X() + VFX.Y()*F.Y());
F.SetCoord(F.X()+VFX.X()*l,F.Y()+VFX.Y()*l);
myOX = VFX.X()*(P.X()-F.X()) + VFX.Y()*(P.Y()-F.Y());
gp_Vec VFZ(-F.X(),-F.Y(),((HLRAlgo_Projector*) myProj)->Focus());
myOF = VFZ.Magnitude();
VFZ /= myOF;
myVZ = VFZ * V;
myVZ *= l3d;
myOZ = VFZ * gp_Vec(P.X()-F.X(),P.Y()-F.Y(),P.Z());
}
else myVX = Sqrt(V.X() * V.X() + V.Y() * V.Y()) * l3d;
}
return(UpdateMinMax(TotMin,TotMax));
}
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
Standard_Real
HLRBRep_Curve::UpdateMinMax (const Standard_Address TotMin,
const Standard_Address TotMax)
{
Standard_Real a = HLRBRep_BCurveTool::FirstParameter(myCurve);
Standard_Real b = HLRBRep_BCurveTool::LastParameter(myCurve);
Standard_Real x,y,z,tolMinMax = 0;
((HLRAlgo_Projector*) myProj)->Project(Value3D(a),x,y,z);
HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
if (myType != GeomAbs_Line) {
Standard_Integer nbPnt = 30;
Standard_Integer i;
Standard_Real step = (b-a)/(nbPnt+1);
#ifndef DEB
Standard_Real xa,ya,za,xb =0.,yb =0.,zb =0.;
#else
Standard_Real xa,ya,za,xb,yb,zb;
#endif
Standard_Real dx1,dy1,dz1,dd1;
Standard_Real dx2,dy2,dz2,dd2;
for (i = 1; i <= nbPnt; i++) {
a += step;
xa = xb; ya = yb; za = zb;
xb = x ; yb = y ; zb = z ;
((HLRAlgo_Projector*) myProj)->Project(Value3D(a),x,y,z);
HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
if (i >= 2) {
dx1 = x - xa; dy1 = y - ya; dz1 = z - za;
dd1 = sqrt (dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
if (dd1 > 0) {
dx2 = xb - xa; dy2 = yb - ya; dz2 = zb - za;
dd2 = sqrt (dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
if (dd2 > 0) {
Standard_Real p = (dx1 * dx2 + dy1 * dy2 + dz1 * dz2) / (dd1 * dd2);
dx1 = xa + p * dx1 - xb;
dy1 = ya + p * dy1 - yb;
dz1 = za + p * dz1 - zb;
dd1 = sqrt (dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
if (dd1 > tolMinMax) tolMinMax = dd1;
}
}
}
}
}
((HLRAlgo_Projector*) myProj)->Project(Value3D(b),x,y,z);
HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
return tolMinMax;
}
//=======================================================================
//function : Z
//purpose :
//=======================================================================
Standard_Real HLRBRep_Curve::Z (const Standard_Real U) const
{
gp_Pnt P3d;
HLRBRep_BCurveTool::D0(myCurve,U,P3d);
P3d.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
return P3d.Z();
}
//=======================================================================
//function : Tangent
//purpose :
//=======================================================================
void HLRBRep_Curve::Tangent (const Standard_Boolean AtStart,
gp_Pnt2d& P,
gp_Dir2d& D) const
{
Standard_Real U;
if (AtStart) U = HLRBRep_BCurveTool::FirstParameter(myCurve);
else U = HLRBRep_BCurveTool::LastParameter (myCurve);
D0(U,P);
HLRBRep_CLProps CLP(2,Epsilon(1.));
const Standard_Address crv = (const Standard_Address)this;
CLP.SetCurve(crv);
CLP.SetParameter(U);
StdFail_UndefinedDerivative_Raise_if
(!CLP.IsTangentDefined(), "HLRBRep_Curve::Tangent");
CLP.Tangent(D);
}
//=======================================================================
//function : D0
//purpose :
//=======================================================================
void HLRBRep_Curve::D0 (const Standard_Real U, gp_Pnt2d& P) const
{
#if 0
gp_Pnt P3d;
HLRBRep_BCurveTool::D0(myCurve,U,P3d);
P3d.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real R = 1.-P3d.Z()/((HLRAlgo_Projector*) myProj)->Focus();
P.SetCoord(P3d.X()/R,P3d.Y()/R);
}
else P.SetCoord(P3d.X(),P3d.Y());
#else
gp_Pnt P3d;
HLRBRep_BCurveTool::D0(myCurve,U,P3d);
((HLRAlgo_Projector*) myProj)->Project(P3d,P);
#endif
}
//=======================================================================
//function : D1
//purpose :
//=======================================================================
void HLRBRep_Curve::D1 (const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V) const
{
// Mathematical formula for lines
// X'[t] X[t] Z'[t]
// D1 = -------- + -------------
// Z[t] Z[t] 2
// 1 - ---- f (1 - ----)
// f f
#if 0
gp_Pnt P3D;
gp_Vec V13D;
HLRBRep_BCurveTool::D1(myCurve,U,P3D,V13D);
P3D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
V13D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
Standard_Real R = 1. - P3D.Z()/f;
Standard_Real e = V13D.Z()/(f*R*R);
P.SetCoord(P3D .X()/R , P3D .Y()/R );
V.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
}
else {
P.SetCoord(P3D .X(),P3D .Y());
V.SetCoord(V13D.X(),V13D.Y());
}
#else
gp_Pnt P3D;
gp_Vec V13D;
HLRBRep_BCurveTool::D1(myCurve,U,P3D,V13D);
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
Standard_Real R = 1. - P3D.Z()/f;
Standard_Real e = V13D.Z()/(f*R*R);
P.SetCoord(P3D .X()/R , P3D .Y()/R );
V.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
}
else {
#ifdef OCC155
((HLRAlgo_Projector*) myProj)->Project(P3D,V13D,P,V);
#else
((HLRAlgo_Projector*) myProj)->Project(P3D,P);
gp_Pnt2d opop;
gp_Pnt uiui(V13D.X(),V13D.Y(),V13D.Z());
((HLRAlgo_Projector*) myProj)->Project(uiui,opop);
V.SetCoord(opop.X(),opop.Y());
#endif
}
#endif
}
//=======================================================================
//function : D2
//purpose :
//=======================================================================
void HLRBRep_Curve::D2 (const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
gp_Vec2d& V2) const
{
// Mathematical formula for lines
// 2
// 2 X'[t] Z'[t] 2 X[t] Z'[t] X''[t] X[t] Z''[t]
// D2 = ------------- + -------------- + -------- + -------------
// Z[t] 2 2 Z[t] 3 Z[t] Z[t] 2
// f (1 - ----) f (1 - ----) 1 - ---- f (1 - ----)
// f f f f
gp_Pnt P3D;
gp_Vec V13D,V23D;
HLRBRep_BCurveTool::D2(myCurve,U,P3D,V13D,V23D);
P3D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
V13D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
V23D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
Standard_Real R = 1. - P3D.Z() / f;
Standard_Real q = f*R*R;
Standard_Real e = V13D.Z()/q;
Standard_Real c = e*V13D.Z()/(f*R);
P .SetCoord(P3D .X()/R , P3D .Y()/R );
V1.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
V2.SetCoord(V23D.X()/R + 2*V13D.X()*e + P3D.X()*V23D.Z()/q + 2*P3D.X()*c,
V23D.Y()/R + 2*V13D.Y()*e + P3D.Y()*V23D.Z()/q + 2*P3D.Y()*c);
}
else {
P .SetCoord(P3D .X(),P3D .Y());
V1.SetCoord(V13D.X(),V13D.Y());
V2.SetCoord(V23D.X(),V23D.Y());
}
}
//=======================================================================
//function : D3
//purpose :
//=======================================================================
void HLRBRep_Curve::D3 (const Standard_Real,
gp_Pnt2d&,
gp_Vec2d&,
gp_Vec2d&,
gp_Vec2d&) const
{
}
//=======================================================================
//function : DN
//purpose :
//=======================================================================
gp_Vec2d HLRBRep_Curve::DN (const Standard_Real,
const Standard_Integer) const
{ return gp_Vec2d(); }
//=======================================================================
//function : Line
//purpose :
//=======================================================================
gp_Lin2d HLRBRep_Curve::Line () const
{
gp_Pnt2d P;
gp_Vec2d V;
D1(0.,P,V);
return gp_Lin2d(P,V);
}
//=======================================================================
//function : Circle
//purpose :
//=======================================================================
gp_Circ2d HLRBRep_Curve::Circle () const
{
gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
return ProjLib::Project(gp_Pln(gp::XOY()),C);
}
//=======================================================================
//function : Ellipse
//purpose :
//=======================================================================
gp_Elips2d HLRBRep_Curve::Ellipse () const
{
GeomAbs_CurveType typ = HLRBRep_BCurveTool::GetType(myCurve);
if (typ == GeomAbs_Ellipse) {
gp_Elips E = HLRBRep_BCurveTool::Ellipse(myCurve);
E.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
return ProjLib::Project(gp_Pln(gp::XOY()),E);
}
else { // this is a circle
gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
const gp_Dir& D1 = C.Axis().Direction();
const gp_Dir& D3 = D1.Crossed(gp::DZ());
const gp_Dir& D2 = D1.Crossed(D3);
Standard_Real rap = sqrt( D2.X()*D2.X() + D2.Y()*D2.Y() );
gp_Dir2d d(D1.Y(),-D1.X());
gp_Pnt2d p(C.Location().X(),C.Location().Y());
gp_Elips2d El(gp_Ax2d(p,d),C.Radius(),C.Radius()*rap);
if ( D1.Z() < 0 ) El.Reverse();
return El;
}
}
//=======================================================================
//function : Hyperbola
//purpose :
//=======================================================================
gp_Hypr2d HLRBRep_Curve::Hyperbola () const
{ return gp_Hypr2d(); }
//=======================================================================
//function : Parabola
//purpose :
//=======================================================================
gp_Parab2d HLRBRep_Curve::Parabola () const
{ return gp_Parab2d(); }
//=======================================================================
//function : Poles
//purpose :
//=======================================================================
void HLRBRep_Curve::Poles (TColgp_Array1OfPnt2d& TP) const
{
Standard_Integer i1 = TP.Lower();
Standard_Integer i2 = TP.Upper();
TColgp_Array1OfPnt TP3(i1,i2);
//-- HLRBRep_BCurveTool::Poles(myCurve,TP3);
if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
(HLRBRep_BCurveTool::BSpline(myCurve))->Poles(TP3);
}
else {
(HLRBRep_BCurveTool::Bezier(myCurve))->Poles(TP3);
}
for (Standard_Integer i = i1; i <= i2; i++) {
((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
}
}
//=======================================================================
//function : PolesAndWeights
//purpose :
//=======================================================================
void HLRBRep_Curve::PolesAndWeights (TColgp_Array1OfPnt2d& TP,
TColStd_Array1OfReal& TW) const
{
Standard_Integer i1 = TP.Lower();
Standard_Integer i2 = TP.Upper();
TColgp_Array1OfPnt TP3(i1,i2);
//-- HLRBRep_BCurveTool::PolesAndWeights(myCurve,TP3,TW);
if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
HB->Poles(TP3);
HB->Weights(TW);
//-- (HLRBRep_BCurveTool::BSpline(myCurve))->PolesAndWeights(TP3,TW);
}
else {
Handle(Geom_BezierCurve) HB = (HLRBRep_BCurveTool::Bezier(myCurve));
HB->Poles(TP3);
HB->Weights(TW);
//-- (HLRBRep_BCurveTool::Bezier(myCurve))->PolesAndWeights(TP3,TW);
}
for (Standard_Integer i = i1; i <= i2; i++) {
((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
}
}
//=======================================================================
//function : Knots
//purpose :
//=======================================================================
void HLRBRep_Curve::Knots (TColStd_Array1OfReal& kn) const
{
if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
HB->Knots(kn);
}
}
//=======================================================================
//function : Multiplicities
//purpose :
//=======================================================================
void HLRBRep_Curve::Multiplicities (TColStd_Array1OfInteger& mu) const
{
if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
HB->Multiplicities(mu);
}
}

194
src/HLRBRep/HLRBRep_Curve.lxx Executable file
View File

@@ -0,0 +1,194 @@
// File: HLRBRep_Curve.lxx
// Created: Fri Mar 13 11:08:32 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <Standard_NotImplemented.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Parab2d.hxx>
#include <HLRBRep_BCurveTool.hxx>
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline void HLRBRep_Curve::Projector(const Standard_Address Proj)
{ myProj = Proj; }
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
inline BRepAdaptor_Curve& HLRBRep_Curve::Curve()
{ return myCurve; }
//=======================================================================
//function : Value3D
//purpose :
//=======================================================================
inline gp_Pnt HLRBRep_Curve::Value3D(const Standard_Real U) const
{
gp_Pnt P;
D0(U,P);
return P;
}
//=======================================================================
//function : D0
//purpose :
//=======================================================================
inline void HLRBRep_Curve::D0(const Standard_Real U, gp_Pnt& P) const
{ HLRBRep_BCurveTool::D0(myCurve,U,P); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void HLRBRep_Curve::D1(const Standard_Real U,
gp_Pnt& P,
gp_Vec& V) const
{ HLRBRep_BCurveTool::D1(myCurve,U,P,V); }
//=======================================================================
//function : FirstParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Curve::FirstParameter() const
{ return Parameter2d(HLRBRep_BCurveTool::FirstParameter(myCurve)); }
//=======================================================================
//function : LastParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Curve::LastParameter() const
{ return Parameter2d(HLRBRep_BCurveTool::LastParameter(myCurve)); }
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
inline GeomAbs_Shape HLRBRep_Curve::Continuity() const
{ return HLRBRep_BCurveTool::Continuity(myCurve); }
//=======================================================================
//function : NbIntervals
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Curve::NbIntervals
(const GeomAbs_Shape S)
{ return HLRBRep_BCurveTool::NbIntervals(myCurve,S); }
//=======================================================================
//function : Intervals
//purpose :
//=======================================================================
inline void HLRBRep_Curve::Intervals(TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh)
{ HLRBRep_BCurveTool::Intervals(myCurve,Tab,Sh); }
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Curve::IsClosed()const
{ return HLRBRep_BCurveTool::IsClosed(myCurve); }
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Curve::IsPeriodic()const
{ return HLRBRep_BCurveTool::IsPeriodic(myCurve); }
//=======================================================================
//function : Period
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Curve::Period()const
{ return HLRBRep_BCurveTool::Period(myCurve); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline gp_Pnt2d HLRBRep_Curve::Value
(const Standard_Real U) const
{
gp_Pnt2d P;
D0(U,P);
return P;
}
//=======================================================================
//function : Resolution
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Curve::Resolution
(const Standard_Real R3d) const
{ return HLRBRep_BCurveTool::Resolution(myCurve,R3d); }
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_CurveType HLRBRep_Curve::GetType() const
{ return myType; }
//=======================================================================
//function : Degree
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Curve::Degree() const
{ return HLRBRep_BCurveTool::Degree(myCurve); }
//=======================================================================
//function : NbPoles
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Curve::NbPoles() const
{ return HLRBRep_BCurveTool::NbPoles(myCurve); }
//=======================================================================
//function : NbKnots
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Curve::NbKnots() const
{ return HLRBRep_BCurveTool::NbKnots(myCurve); }
//=======================================================================
//function : IsRational
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Curve::IsRational() const
{
return HLRBRep_BCurveTool::IsRational(myCurve);
}

233
src/HLRBRep/HLRBRep_CurveTool.cdl Executable file
View File

@@ -0,0 +1,233 @@
-- File: HLRBRep_CurveTool.cdl
-- Created: Mon Jul 17 16:25:23 1995
-- Author: Modelistation
-- <model@mastox>
---Copyright: Matra Datavision 1995
class CurveTool from HLRBRep
uses
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec2d from gp,
Pnt2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
BezierCurve from Geom2d,
BSplineCurve from Geom2d
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
--
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: Address from Standard)
returns Real from Standard;
---C++: inline
LastParameter(myclass; C: Address from Standard)
returns Real from Standard;
---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: Address from Standard)
returns Shape from GeomAbs;
---Purpose:
---C++: inline
NbIntervals(myclass; C: Address from Standard)
returns Integer from Standard;
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
Intervals(myclass; C : Address from Standard;
T : in out Array1OfReal from TColStd)
---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
GetInterval (myclass; C : Address from Standard
; Index : Integer from Standard
; Tab : Array1OfReal from TColStd
; U1, U2 : out Real from Standard);
---Purpose : output the bounds of interval of index <Index>
-- used if Type == Composite.
---C++: inline
IsClosed(myclass; C: Address from Standard)
returns Boolean from Standard;
---C++: inline
IsPeriodic(myclass; C: Address from Standard)
returns Boolean from Standard;
---C++: inline
Period(myclass; C: Address from Standard)
returns Real from Standard
raises DomainError from Standard; -- if the curve is not periodic
---C++: inline
Value(myclass; C: Address from Standard; U : Real)
returns Pnt2d from gp;
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
D0 (myclass; C : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp);
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
D1 (myclass; C : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V : out Vec2d 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 : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V1, V2 : out Vec2d 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 : Address from Standard;
U : Real from Standard;
P : out Pnt2d from gp;
V1, V2, V3 : out Vec2d 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 : Address from Standard;
U : Real from Standard;
N : Integer from Standard)
returns Vec2d 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 : Address from Standard;
R3d : Real from Standard)
returns Real from Standard;
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
GetType(myclass; C: Address from Standard)
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
TheType(myclass; C: Address from Standard)
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: Address from Standard) returns Lin2d from gp
raises NoSuchObject from Standard;
---C++: inline
Circle(myclass; C: Address from Standard) returns Circ2d from gp
raises NoSuchObject from Standard;
---C++: inline
Ellipse(myclass; C: Address from Standard) returns Elips2d from gp
raises NoSuchObject from Standard;
---C++: inline
Hyperbola(myclass; C: Address from Standard) returns Hypr2d from gp
raises NoSuchObject from Standard;
---C++: inline
Parabola(myclass; C: Address from Standard) returns Parab2d from gp
raises NoSuchObject from Standard;
---C++: inline
Bezier(myclass; C: Address from Standard)
returns BezierCurve from Geom2d
raises NoSuchObject from Standard;
---C++: inline
BSpline(myclass; C: Address from Standard)
returns BSplineCurve from Geom2d
raises NoSuchObject from Standard;
---C++: inline
EpsX(myclass; C:Address from Standard)
---C++: inline
returns Real from Standard;
NbSamples(myclass; C : Address from Standard;
U0,U1: Real from Standard)
returns Integer from Standard;
NbSamples(myclass; C: Address from Standard)
returns Integer from Standard;
end CurveTool;

View File

@@ -0,0 +1,67 @@
// File: HLRBRep_CurveTool.cxx
// Created: Mon Jul 17 17:39:39 1995
// Author: Modelistation
// <model@mastox>
#include <HLRBRep_CurveTool.ixx>
#include <HLRBRep_Curve.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Handle_Geom2d_BezierCurve.hxx>
#include <Handle_Geom2d_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
//=======================================================================
//function : NbSamples
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_CurveTool::NbSamples (const Standard_Address C)
{
GeomAbs_CurveType typC = ((HLRBRep_Curve *)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 + ((HLRBRep_Curve *)C)->NbPoles();
else if(typC == GeomAbs_BSplineCurve) {
nbs = ((HLRBRep_Curve *)C)->NbKnots();
nbs*= ((HLRBRep_Curve *)C)->Degree();
if(nbs < 2.0) nbs=2;
}
if(nbs>50)
nbs = 50;
return((Standard_Integer)nbs);
}
//=======================================================================
//function : NbSamples
//purpose :
//=======================================================================
Standard_Integer
HLRBRep_CurveTool::NbSamples (const Standard_Address C,
const Standard_Real u1,
const Standard_Real u2)
{
GeomAbs_CurveType typC = ((HLRBRep_Curve *)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 + ((HLRBRep_Curve *)C)->NbPoles();
else if(typC == GeomAbs_BSplineCurve) {
nbs = ((HLRBRep_Curve *)C)->NbKnots();
nbs*= ((HLRBRep_Curve *)C)->Degree();
if(nbs < 2.0) nbs=2;
}
if(nbs>50)
nbs = 50;
return((Standard_Integer)nbs);
}

300
src/HLRBRep/HLRBRep_CurveTool.lxx Executable file
View File

@@ -0,0 +1,300 @@
// File: HLRBRep_CurveTool.lxx
// Created: Thu Oct 22 12:14:59 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <HLRBRep_Curve.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Parab2d.hxx>
#include <gp_Hypr2d.hxx>
#include <Handle_Geom2d_BezierCurve.hxx>
#include <Handle_Geom2d_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
#define IS_C2_COMPOSITE 0
//=======================================================================
//function : FirstParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_CurveTool::FirstParameter (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->FirstParameter()); }
//=======================================================================
//function : LastParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_CurveTool::LastParameter (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->LastParameter()); }
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
inline GeomAbs_Shape
HLRBRep_CurveTool::Continuity (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Continuity()); }
//=======================================================================
//function : NbIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_CurveTool::NbIntervals(const Standard_Address C)
{
#if IS_C2_COMPOSITE
return(((HLRBRep_Curve *)C)->NbIntervals(GeomAbs_C2));
#else
return(((HLRBRep_Curve *)C)->NbIntervals(GeomAbs_C1));
#endif
}
//=======================================================================
//function : Intervals
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::Intervals(const Standard_Address C,
TColStd_Array1OfReal& Tab)
{
#if IS_C2_COMPOSITE
((HLRBRep_Curve *)C)->Intervals(Tab,GeomAbs_C2);
#else
((HLRBRep_Curve *)C)->Intervals(Tab,GeomAbs_C1);
#endif
}
//=======================================================================
//function : GetInterval
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::GetInterval(const Standard_Address C,
const Standard_Integer i,
const TColStd_Array1OfReal& Tab,
Standard_Real& a,
Standard_Real& b)
{
a = Tab.Value(i);
b = Tab.Value(i+1);
}
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_CurveTool::IsClosed(const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->IsClosed()); }
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_CurveTool::IsPeriodic(const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->IsPeriodic()); }
//=======================================================================
//function : Period
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_CurveTool::Period(const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Period()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline gp_Pnt2d
HLRBRep_CurveTool::Value (const Standard_Address C,
const Standard_Real U)
{ return(((HLRBRep_Curve *)C)->Value(U)); }
//=======================================================================
//function : D0
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::D0(const Standard_Address C,
const Standard_Real U,
gp_Pnt2d& P)
{ ((HLRBRep_Curve *)C)->D0(U,P); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::D1 (const Standard_Address C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T)
{ ((HLRBRep_Curve *)C)->D1(U,P,T); }
//=======================================================================
//function : D2
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::D2 (const Standard_Address C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T,
gp_Vec2d& N)
{ ((HLRBRep_Curve *)C)->D2(U,P,T,N); }
//=======================================================================
//function : D3
//purpose :
//=======================================================================
inline void
HLRBRep_CurveTool::D3 (const Standard_Address C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
gp_Vec2d& V2,
gp_Vec2d& V3)
{ ((HLRBRep_Curve *)C)->D3(U,P,V1,V2,V3); }
//=======================================================================
//function : DN
//purpose :
//=======================================================================
inline gp_Vec2d
HLRBRep_CurveTool::DN (const Standard_Address C,
const Standard_Real U,
const Standard_Integer N)
{ return(((HLRBRep_Curve *)C)->DN(U,N)); }
//=======================================================================
//function : Resolution
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_CurveTool::Resolution(const Standard_Address C,
const Standard_Real R3d)
{ return(((HLRBRep_Curve *)C)->Resolution(R3d)); }
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_CurveType
HLRBRep_CurveTool::GetType(const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->GetType()); }
//=======================================================================
//function : TheType
//purpose :
//=======================================================================
inline GeomAbs_CurveType
HLRBRep_CurveTool::TheType(const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->GetType()); }
//=======================================================================
//function : Line
//purpose :
//=======================================================================
inline gp_Lin2d
HLRBRep_CurveTool::Line (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Line()); }
//=======================================================================
//function : Circle
//purpose :
//=======================================================================
inline gp_Circ2d
HLRBRep_CurveTool::Circle (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Circle()); }
//=======================================================================
//function : Ellipse
//purpose :
//=======================================================================
inline gp_Elips2d
HLRBRep_CurveTool::Ellipse (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Ellipse()); }
//=======================================================================
//function : Parabola
//purpose :
//=======================================================================
inline gp_Parab2d
HLRBRep_CurveTool::Parabola (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Parabola()); }
//=======================================================================
//function : Hyperbola
//purpose :
//=======================================================================
inline gp_Hypr2d
HLRBRep_CurveTool::Hyperbola (const Standard_Address C)
{ return(((HLRBRep_Curve *)C)->Hyperbola()); }
//=======================================================================
//function : Bezier
//purpose :
//=======================================================================
inline Handle(Geom2d_BezierCurve)
HLRBRep_CurveTool::Bezier (const Standard_Address C)
{
cout<<" HLRBRep_CurveTool::Bezier : Not Implemented "<<endl;
//-- return(((HLRBRep_Curve *)C)->Bezier());
return(0);
}
//=======================================================================
//function : BSpline
//purpose :
//=======================================================================
inline Handle(Geom2d_BSplineCurve)
HLRBRep_CurveTool::BSpline (const Standard_Address C)
{
cout<<" HLRBRep_CurveTool::BSpline : Not Implemented "<<endl;
//-- return(((HLRBRep_Curve *)C)->BSpline());
return(0);
}
//=======================================================================
//function : EpsX
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_CurveTool::EpsX(const Standard_Address C)
{ return(1e-10); }

371
src/HLRBRep/HLRBRep_Data.cdl Executable file
View File

@@ -0,0 +1,371 @@
-- File: HLRBRep_Data.cdl
-- Created: Mon Jan 11 13:58:26 1993
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1993
class Data from HLRBRep inherits TShared from MMgt
uses
Address from Standard,
Integer from Standard,
Boolean from Standard,
ShortReal from Standard,
Real from Standard,
Array1OfInteger from TColStd,
Pnt from gp,
Pnt2d from gp,
Dir2d from gp,
CurveType from GeomAbs,
SurfaceType from GeomAbs,
State from TopAbs,
Orientation from TopAbs,
IndexedMapOfShape from TopTools,
IntersectionPoint from IntRes2d,
Interference from HLRAlgo,
InterferenceList from HLRAlgo,
Projector from HLRAlgo,
EdgeData from HLRBRep,
FaceData from HLRBRep,
Array1OfEData from HLRBRep,
Array1OfFData from HLRBRep,
FaceIterator from HLRBRep,
EdgeFaceTool from HLRBRep,
Intersector from HLRBRep,
Curve from HLRBRep,
CLProps from HLRBRep,
Surface from HLRBRep,
SLProps from HLRBRep,
TopolTool from BRepTopAdaptor,
MapOfShapeTool from BRepTopAdaptor
raises
UndefinedDerivative from StdFail
is
--
-- Method to load or edit the Data Structure
--
Create(NV, NE, NF : Integer from Standard)
---Purpose: Create an empty data structure of <NV> vertices,
-- <NE> edges and <NF> faces.
returns mutable Data from HLRBRep;
Write(me : mutable; DS : Data from HLRBRep;
dv,de,df : Integer from Standard)
---Purpose: Write <DS> in me with a translation of
-- <dv>,<de>,<df>.
is static;
EDataArray(me : mutable) returns Array1OfEData from HLRBRep
---C++: inline
---C++: return &
is static;
FDataArray(me : mutable) returns Array1OfFData from HLRBRep
---C++: inline
---C++: return &
is static;
Tolerance(me : mutable; tol : ShortReal from Standard)
---C++: inline
---Purpose: Set the tolerance for the rejections during the
-- exploration
is static;
Tolerance(me) returns ShortReal from Standard
---C++: inline
---Purpose: returns the tolerance for the rejections during
-- the exploration
is static;
Update(me : mutable; P : Projector from HLRAlgo)
---Purpose: end of building of the Data and updating
-- all the informations linked to the projection.
is static;
Projector(me : mutable) returns Projector from HLRAlgo
---C++: inline
---C++: return &
is static;
--
-- Methods to query the Data
--
NbVertices(me) returns Integer from Standard
---C++: inline
is static;
NbEdges(me) returns Integer from Standard
---C++: inline
is static;
NbFaces(me) returns Integer from Standard
---C++: inline
is static;
EdgeMap(me : mutable) returns IndexedMapOfShape from TopTools
---C++: inline
---C++: return &
is static;
FaceMap(me : mutable) returns IndexedMapOfShape from TopTools
---C++: inline
---C++: return &
is static;
--
-- Exploration of non rejected visible edges
--
InitBoundSort(me : mutable;
MinMaxTot : Address from Standard;
e1,e2 : Integer from Standard)
---Purpose: to compare with only non rejected edges.
is static;
InitEdge(me : mutable; FI : Integer from Standard;
MST: in out MapOfShapeTool from BRepTopAdaptor)
---Purpose: Begin an iteration only on visible Edges
-- crossing the face number <FI>.
is static;
MoreEdge(me : mutable) returns Boolean from Standard
is static;
NextEdge(me : mutable; skip : Boolean from Standard = Standard_True)
is static;
Edge(me) returns Integer from Standard
---Purpose: Returns the current Edge
is static;
HidingTheFace(me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the current edge to be hidden
-- belongs to the hiding face.
is static;
SimpleHidingFace(me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the current hiding face is not an
-- auto-intersected one.
is static;
--
-- Intersection of current edge with face
--
InitInterference(me : mutable)
---Purpose: Intersect the current Edge with the boundary of
-- the hiding face. The interferences are given by
-- the More, Next, and Value methods.
is static;
MoreInterference(me) returns Boolean from Standard
---C++: inline
is static;
NextInterference(me : mutable)
is static;
RejectedInterference(me : mutable) returns Boolean from Standard
---Purpose: Returns True if the interference is rejected.
is static;
AboveInterference(me : mutable) returns Boolean from Standard
---Purpose: Returns True if the rejected interference is above
-- the face.
is static;
Interference(me : mutable) returns Interference from HLRAlgo
---C++: inline
---C++: return &
is static;
LocalLEGeometry2D(me : mutable; Param : Real from Standard;
Tg : out Dir2d from gp;
Nm : out Dir2d from gp;
Cu : out Real from Standard)
---Purpose: Returns the local description of the projection of
-- the current LEdge at parameter <Param>.
raises
UndefinedDerivative from StdFail
is static;
LocalFEGeometry2D(me : mutable; FE : Integer from Standard;
Param : Real from Standard;
Tg : out Dir2d from gp;
Nm : out Dir2d from gp;
Cu : out Real from Standard)
---Purpose: Returns the local description of the projection of
-- the current FEdge at parameter <Param>.
raises
UndefinedDerivative from StdFail
is static;
EdgeState(me : mutable; p1,p2 : Real from Standard;
stbef, staf : out State from TopAbs)
---Purpose: Returns the local 3D state of the intersection
-- between the current edge and the current face at the
-- <p1> and <p2> parameters.
is static;
EdgeOfTheHidingFace(me; E : Integer from Standard;
ED : EdgeData from HLRBRep)
returns Boolean from Standard
---Purpose: Returns the true if the Edge <ED> belongs to the
-- Hiding Face.
---C++: inline
is static;
HidingStartLevel(me : mutable; E : Integer from Standard;
ED : EdgeData from HLRBRep;
IL : InterferenceList from HLRAlgo)
returns Integer from Standard
---Purpose: Returns the number of levels of hiding face above
-- the first point of the edge <ED>. The
-- InterferenceList is given to compute far away of
-- the Interferences and then come back.
is static;
Compare(me : mutable; E : Integer from Standard;
ED : EdgeData from HLRBRep)
returns State from TopAbs
---Purpose: Returns the state of the Edge <ED> after
-- classification.
is static;
SimplClassify(me : mutable; E : Integer from Standard;
ED : EdgeData from HLRBRep;
Nbp : Integer from Standard;
p1, p2 : Real from Standard)
returns State from TopAbs;
---Purpose: Simple classification of part of edge [p1, p2]
-- returns OUT if at least 1 of Nbp points of edge is out
-- othewise returns IN
-- It is used to check "suspision" hided part of edge.
-- The following methods are private
OrientOutLine(me : mutable; I : Integer from Standard;
FD : out FaceData from HLRBRep)
returns Boolean from Standard
---Purpose: Orient the OutLines ( left must be inside in
-- projection ). Returns True if the face of a closed
-- shell has been inverted;
is static private;
OrientOthEdge(me : mutable; I : Integer from Standard;
FD : out FaceData from HLRBRep)
---Purpose: Orient the Edges which are not Internal OutLine,
-- not Double and not IsoLine.
is static private;
Classify(me : mutable; E : Integer from Standard;
ED : EdgeData from HLRBRep;
LevelFlag : Boolean from Standard;
Level : out Integer from Standard;
param : Real from Standard)
returns State from TopAbs
---Purpose: Classification of an edge.
is static private;
RejectedPoint(me : mutable; PInter : IntersectionPoint from IntRes2d;
BoundOri : Orientation from TopAbs;
NumSeg : Integer from Standard) --- -1 if Point else NumSegment
returns Boolean from Standard
---Purpose: Returns True if the intersection is rejected.
is static private;
SameVertex(me : mutable; head1,head2 : Boolean from Standard)
returns Boolean from Standard
---Purpose: returns True if there is a common vertex between
-- myLE and myFE dependig on <head1> and <head2>.
is static private;
Destroy(me: mutable);
---C++: alias ~
fields
-- basic data : Vertices, Edges, Faces
myNbVertices : Integer from Standard;
myNbEdges : Integer from Standard;
myNbFaces : Integer from Standard;
myEMap : IndexedMapOfShape from TopTools;
myFMap : IndexedMapOfShape from TopTools;
myEData : Array1OfEData from HLRBRep;
myFData : Array1OfFData from HLRBRep;
myEdgeIndices : Array1OfInteger from TColStd;
myToler : ShortReal from Standard;
myProj : Projector from HLRAlgo;
myLLProps : CLProps from HLRBRep;
myFLProps : CLProps from HLRBRep;
mySLProps : SLProps from HLRBRep;
myBigSize : Real from Standard;
-- Face exploration
myFaceItr1 : FaceIterator from HLRBRep;
myFaceItr2 : FaceIterator from HLRBRep;
-- Current hiding face
iFace : Integer from Standard;
iFaceData : Address from Standard;
iFaceGeom : Address from Standard;
iFaceMinMax : Address from Standard;
iFaceType : SurfaceType from GeomAbs;
iFaceBack : Boolean from Standard;
iFaceSimp : Boolean from Standard;
iFaceSmpl : Boolean from Standard;
iFaceTest : Boolean from Standard;
-- Exploration of edges to be hidden
myHideCount : Integer from Standard;
myDeca : Real from Standard[16];
mySurD : Real from Standard[16];
myCurSortEd : Integer from Standard;
myNbrSortEd : Integer from Standard;
-- Current hidden edge, to be intersected
myLE : Integer from Standard;
myLEOutLine : Boolean from Standard;
myLEInternal : Boolean from Standard;
myLEDouble : Boolean from Standard;
myLEIsoLine : Boolean from Standard;
myLEData : Address from Standard;
myLEGeom : Address from Standard;
myLEMinMax : Address from Standard;
myLEType : CurveType from GeomAbs;
myLETol : ShortReal from Standard;
-- Exploration of hiding face for intersection
myFE : Integer from Standard;
myFEOri : Orientation from TopAbs;
myFEOutLine : Boolean from Standard;
myFEInternal : Boolean from Standard;
myFEDouble : Boolean from Standard;
myFEData : Address from Standard;
myFEGeom : Address from Standard;
myFEType : CurveType from GeomAbs;
myFETol : ShortReal from Standard;
-- Intersections
myIntersector : Intersector from HLRBRep;
myClassifier : TopolTool from BRepTopAdaptor;
mySameVertex : Boolean from Standard;
myIntersected : Boolean from Standard;
myNbPoints : Integer from Standard;
myNbSegments : Integer from Standard;
iInterf : Integer from Standard;
myIntf : Interference from HLRAlgo;
myAboveIntf : Boolean from Standard;
myReject : Address from Standard;
end Data;

2449
src/HLRBRep/HLRBRep_Data.cxx Executable file

File diff suppressed because it is too large Load Diff

127
src/HLRBRep/HLRBRep_Data.lxx Executable file
View File

@@ -0,0 +1,127 @@
// File: HLRBRep_Data.lxx
// Created: Thu Apr 17 16:56:27 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
//=======================================================================
//function : EDataArray
//purpose :
//=======================================================================
inline HLRBRep_Array1OfEData & HLRBRep_Data::EDataArray ()
{ return myEData; }
//=======================================================================
//function : FDataArray
//purpose :
//=======================================================================
inline HLRBRep_Array1OfFData & HLRBRep_Data::FDataArray ()
{ return myFData; }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline void HLRBRep_Data::Tolerance (const Standard_ShortReal tol)
{ myToler = tol; }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_ShortReal HLRBRep_Data::Tolerance () const
{ return myToler; }
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline HLRAlgo_Projector & HLRBRep_Data::Projector ()
{ return myProj; }
//=======================================================================
//function : NbVertices
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Data::NbVertices () const
{ return myNbVertices; }
//=======================================================================
//function : NbEdges
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Data::NbEdges () const
{ return myNbEdges; }
//=======================================================================
//function : NbFaces
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Data::NbFaces () const
{ return myNbFaces; }
//=======================================================================
//function : EdgeMap
//purpose :
//=======================================================================
inline TopTools_IndexedMapOfShape & HLRBRep_Data::EdgeMap ()
{ return myEMap; }
//=======================================================================
//function : FaceMap
//purpose :
//=======================================================================
inline TopTools_IndexedMapOfShape & HLRBRep_Data::FaceMap ()
{ return myFMap; }
//=======================================================================
//function : SimpleHidingFace
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Data::SimpleHidingFace () const
{ return iFaceSimp; }
//=======================================================================
//function : HidingTheFace
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Data::HidingTheFace () const
{ return iFaceTest; }
//=======================================================================
//function : MoreInterference
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Data::MoreInterference () const
{ return (iInterf <= myNbPoints + 2*myNbSegments); }
//=======================================================================
//function : Interference
//purpose :
//=======================================================================
inline HLRAlgo_Interference & HLRBRep_Data::Interference ()
{ return myIntf; }
//=======================================================================
//function :EdgeOfTheHidingFace
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_Data::EdgeOfTheHidingFace (const Standard_Integer E,
const HLRBRep_EdgeData& ED) const
{ return ED.HideCount() == myHideCount-1; }

View File

@@ -0,0 +1,167 @@
-- File: HLRBRep_EdgeBuilder.cdl
-- Created: Thu Apr 17 20:11:57 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class EdgeBuilder from HLRBRep
uses
Integer from Standard,
State from TopAbs,
Orientation from TopAbs,
Intersection from HLRAlgo,
AreaLimit from HLRBRep,
VertexList from HLRBRep
raises
NoMoreObject from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
Create (VList : in out VertexList from HLRBRep)
returns EdgeBuilder from HLRBRep
---Purpose: Creates an EdgeBuilder algorithm. <VList>
-- describes the edge and the interferences.
-- AreaLimits are created from the vertices.
-- Builds(IN) is automatically called.
raises
DomainError from Standard; -- when the VertexList is incoherent
InitAreas(me : in out)
---Purpose: Initialize an iteration on the areas.
---Category: Area
is static;
NextArea(me : in out)
---Purpose: Set the current area to the next area.
---Category: Area
raises
NoSuchObject from Standard -- when there is no next area
is static;
PreviousArea(me : in out)
---Purpose: Set the current area to the previous area.
---Category: Area
raises
NoSuchObject from Standard -- when there is no previous area
is static;
HasArea(me) returns Boolean from Standard
---Purpose: Returns True if there is a current area.
---Category: Area
is static;
AreaState(me) returns State from TopAbs
---Purpose: Returns the state of the current area.
---Category: Area
is static;
AreaEdgeState(me) returns State from TopAbs
---Purpose: Returns the edge state of the current area.
---Category: Area
is static;
LeftLimit(me) returns AreaLimit from HLRBRep
---Purpose: Returns the AreaLimit beginning the current area.
-- This is a NULL handle when the area is infinite on
-- the left.
--
---Category: Area
is static;
RightLimit(me) returns AreaLimit from HLRBRep
---Purpose: Returns the AreaLimit ending the current area.
-- This is a NULL handle when the area is infinite on
-- the right.
--
---Category: Area
is static;
Builds(me : in out; ToBuild : State from TopAbs)
---Purpose: Reinitialize the results iteration to the parts
-- with State <ToBuild>. If this method is not called
-- after construction the default is <ToBuild> = IN.
--
---Category: Edge
raises
DomainError from Standard -- when <ToBuild> is UNKNOWN
is static;
MoreEdges(me) returns Boolean from Standard
---Purpose: Returns True if there are more new edges to build.
is static;
NextEdge(me : in out)
---Purpose: Proceeds to the next edge to build. Skip all
-- remaining vertices on the current edge.
--
---Category: Edge
raises
NoMoreObject from Standard -- when MoreEdges would return False.
is static;
MoreVertices(me) returns Boolean from Standard
---Purpose: True if there are more vertices in the current new
-- edge.
--
---Category: Vertex
raises
NoSuchObject from Standard -- when there is no current Edge
is static;
NextVertex(me : in out)
---Purpose: Proceeds to the next vertex of the current edge.
--
---Category: Vertex
raises
NoSuchObject from Standard -- when there is no current edge
is static;
Current(me) returns Intersection from HLRAlgo
---Purpose: Returns the current vertex of the current edge.
---Category: Vertex
---C++: return const &
raises
NoSuchObject from Standard -- when there is no current vertex
is static;
IsBoundary(me) returns Boolean from Standard
---Purpose: Returns True if the current vertex comes from the
-- boundary of the edge.
--
---Category: Vertex
raises
NoSuchObject from Standard -- when there is no current vertex
is static;
IsInterference(me) returns Boolean from Standard
---Purpose: Returns True if the current vertex was an
-- interference.
--
---Category: Vertex
raises
NoSuchObject from Standard -- when there is no current vertex
is static;
Orientation(me) returns Orientation from TopAbs
---Purpose: Returns the new orientation of the current vertex.
--
---Category: Vertex
raises
NoSuchObject from Standard -- when there is no current vertex
is static;
Destroy(me : in out);
---C++: alias ~
fields
toBuild : State from TopAbs;
myLimits : AreaLimit from HLRBRep;
left : AreaLimit from HLRBRep;
right : AreaLimit from HLRBRep;
current : Integer from Standard;
end EdgeBuilder;

View File

@@ -0,0 +1,468 @@
// File: HLRBRep_EdgeBuilder.cxx
// Created: Thu Apr 17 21:45:17 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_EdgeBuilder.ixx>
#include <TopAbs.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : HLRBRep_EdgeBuilder
//purpose :
//=======================================================================
HLRBRep_EdgeBuilder::HLRBRep_EdgeBuilder (HLRBRep_VertexList& VList)
{
// at creation the EdgeBuilder explore the VertexList
// and use it to build a list of "AreaLimit" on the edge.
// An area is a part of the curve between
// two consecutive vertices
Standard_DomainError_Raise_if(!VList.More(),
"EdgeBuilder : Empty vertex list");
Handle(HLRBRep_AreaLimit) last,cur;
TopAbs_State before,after,ebefore,eafter;
HLRAlgo_Intersection V;
// loop on the Vertices
for (;VList.More();VList.Next()) {
before = after = ebefore = eafter = TopAbs_UNKNOWN;
// compute the states
if (VList.IsBoundary()) {
switch (VList.Orientation()) {
case TopAbs_FORWARD :
ebefore = TopAbs_OUT;
eafter = TopAbs_IN;
break;
case TopAbs_REVERSED :
ebefore = TopAbs_IN;
eafter = TopAbs_OUT;
break;
case TopAbs_INTERNAL :
ebefore = TopAbs_IN;
eafter = TopAbs_IN;
break;
case TopAbs_EXTERNAL :
ebefore = TopAbs_OUT;
eafter = TopAbs_OUT;
break;
}
}
if (VList.IsInterference()) {
switch (VList.Transition()) {
case TopAbs_FORWARD :
before = TopAbs_OUT;
after = TopAbs_IN;
break;
case TopAbs_REVERSED :
before = TopAbs_IN;
after = TopAbs_OUT;
break;
case TopAbs_INTERNAL :
before = TopAbs_IN;
after = TopAbs_IN;
break;
case TopAbs_EXTERNAL :
before = TopAbs_OUT;
after = TopAbs_OUT;
break;
}
switch (VList.BoundaryTransition()) {
case TopAbs_FORWARD :
after = TopAbs_ON;
break;
case TopAbs_REVERSED :
before = TopAbs_ON;
break;
case TopAbs_INTERNAL :
before = TopAbs_ON;
after = TopAbs_ON;
break;
case TopAbs_EXTERNAL :
break;
}
}
// create the Limit and connect to list
V = VList.Current();
cur = new HLRBRep_AreaLimit(V,
VList.IsBoundary(),
VList.IsInterference(),
before,after,
ebefore,eafter);
if (myLimits.IsNull()) {
myLimits = cur;
last = cur;
}
else {
last->Next(cur);
cur->Previous(last);
last = cur;
}
}
// periodicity, make a circular list
if (VList.IsPeriodic()) {
last->Next(myLimits);
myLimits->Previous(last);
}
// process UNKNOWN areas
TopAbs_State stat = TopAbs_UNKNOWN;
TopAbs_State estat = TopAbs_UNKNOWN;
cur = myLimits;
while (!cur.IsNull()) {
if (stat == TopAbs_UNKNOWN) {
stat = cur->StateBefore();
if (stat == TopAbs_UNKNOWN) {
stat = cur->StateAfter();
}
}
if (estat == TopAbs_UNKNOWN) {
estat = cur->EdgeBefore();
if (estat == TopAbs_UNKNOWN) {
estat = cur->EdgeAfter();
}
}
cur = cur->Next();
// test for periodicicity
if (cur == myLimits)
break;
}
// error if no interferences
Standard_DomainError_Raise_if(stat == TopAbs_UNKNOWN,
"EdgeBuilder : No interferences");
// if no boundary the edge covers the whole curve
if (estat == TopAbs_UNKNOWN)
estat = TopAbs_IN;
// propagate states
cur = myLimits;
while (!cur.IsNull()) {
if (cur->StateBefore() == TopAbs_UNKNOWN)
cur->StateBefore(stat);
else
stat = cur->StateAfter();
if (cur->StateAfter() == TopAbs_UNKNOWN)
cur->StateAfter(stat);
if (cur->EdgeBefore() == TopAbs_UNKNOWN)
cur->EdgeBefore(estat);
else
estat = cur->EdgeAfter();
if (cur->EdgeAfter() == TopAbs_UNKNOWN)
cur->EdgeAfter(estat);
cur = cur->Next();
if (cur == myLimits)
break;
}
// initialise with IN parts
Builds(TopAbs_IN);
}
//=======================================================================
//function : InitAreas
//purpose : set on the first area
//=======================================================================
void HLRBRep_EdgeBuilder::InitAreas()
{
left = myLimits->Previous();
right = myLimits;
}
//=======================================================================
//function : NextArea
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::NextArea()
{
left = right;
if (!right.IsNull())
right = right->Next();
}
//=======================================================================
//function : PreviousArea
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::PreviousArea()
{
right = left;
if (!left.IsNull())
left = left->Previous();
}
//=======================================================================
//function : HasArea
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeBuilder::HasArea() const
{
if (left.IsNull())
if (right.IsNull()) return Standard_False;
if (right == myLimits) return Standard_False;
return Standard_True;
}
//=======================================================================
//function : AreaState
//purpose :
//=======================================================================
TopAbs_State HLRBRep_EdgeBuilder::AreaState() const
{
TopAbs_State stat = TopAbs_UNKNOWN;
if (!left.IsNull())
stat = left->StateAfter();
if (!right.IsNull())
stat = right->StateBefore();
return stat;
}
//=======================================================================
//function : AreaEdgeState
//purpose :
//=======================================================================
TopAbs_State HLRBRep_EdgeBuilder::AreaEdgeState() const
{
TopAbs_State stat = TopAbs_UNKNOWN;
if (!left.IsNull())
stat = left->EdgeAfter();
if (!right.IsNull())
stat = right->EdgeBefore();
return stat;
}
//=======================================================================
//function : LeftLimit
//purpose :
//=======================================================================
Handle(HLRBRep_AreaLimit) HLRBRep_EdgeBuilder::LeftLimit() const
{
return left;
}
//=======================================================================
//function : RightLimit
//purpose :
//=======================================================================
Handle(HLRBRep_AreaLimit) HLRBRep_EdgeBuilder::RightLimit() const
{
return right;
}
//=======================================================================
//function : Builds
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::Builds(const TopAbs_State ToBuild)
{
toBuild = ToBuild;
InitAreas();
do {
if ((AreaState() == toBuild) &&
(AreaEdgeState() == TopAbs_IN)) {
if (left.IsNull())
current = 2;
else
current = 1;
return;
}
NextArea();
}
while (HasArea());
current = 3;
}
//=======================================================================
//function : MoreEdges
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeBuilder::MoreEdges() const
{
return HasArea();
}
//=======================================================================
//function : NextEdge
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::NextEdge()
{
// clean the current edge
while (AreaState() == toBuild)
NextArea();
// go to the next edge
while (HasArea()) {
if ((AreaState() == toBuild) &&
(AreaEdgeState() == TopAbs_IN)) {
if (left.IsNull())
current = 2;
else
current = 1;
return;
}
NextArea();
}
}
//=======================================================================
//function : MoreVertices
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeBuilder::MoreVertices() const
{
return (current < 3);
}
//=======================================================================
//function : NextVertex
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::NextVertex()
{
if (current == 1) {
current = 2;
if (right.IsNull())
current = 3;
}
else if (current == 2) {
NextArea();
if ((AreaState() == toBuild) && (AreaEdgeState() == TopAbs_IN))
current = 2;
else
current = 3;
}
else
Standard_NoSuchObject::Raise("EdgeBuilder::NextVertex : No current edge");
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
const HLRAlgo_Intersection& HLRBRep_EdgeBuilder::Current() const
{
if (current == 1)
return left->Vertex();
else if (current == 2)
return right->Vertex();
else
Standard_NoSuchObject::Raise("EdgeBuilder::Current : No current vertex");
return left->Vertex(); // only for WNT.
}
//=======================================================================
//function : IsBoundary
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeBuilder::IsBoundary() const
{
if (current == 1)
return left->IsBoundary();
else if (current == 2)
return right->IsBoundary();
else
Standard_NoSuchObject::Raise
("EdgeBuilder::IsBoundary : No current vertex");
return left->IsBoundary(); // only for WNT.
}
//=======================================================================
//function : IsInterference
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeBuilder::IsInterference() const
{
if (current == 1)
return left->IsInterference();
else if (current == 2)
return right->IsInterference();
else
Standard_NoSuchObject::Raise
("EdgeBuilder::IsInterference : No current vertex");
return left->IsInterference(); // only for WNT.
}
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
TopAbs_Orientation HLRBRep_EdgeBuilder::Orientation() const
{
if (current == 1) {
if ((left->StateBefore() == left->StateAfter()) &&
(left->EdgeBefore() == left->EdgeAfter()))
return TopAbs_INTERNAL;
else
return TopAbs_FORWARD;
}
else if (current == 2) {
if ((right->StateBefore() == right->StateAfter()) &&
(right->EdgeBefore() == right->EdgeAfter()))
return TopAbs_INTERNAL;
else
return TopAbs_REVERSED;
}
return TopAbs_EXTERNAL; // only for WNT.
}
//=======================================================================
//function : Destroy
//purpose :
//=======================================================================
void HLRBRep_EdgeBuilder::Destroy()
{
Handle(HLRBRep_AreaLimit) cur = myLimits;
while (!cur.IsNull()) {
Handle(HLRBRep_AreaLimit) n = cur->Next();
cur->Clear();
cur = n;
}
left.Nullify();
right.Nullify();
myLimits.Nullify();
}

204
src/HLRBRep/HLRBRep_EdgeData.cdl Executable file
View File

@@ -0,0 +1,204 @@
-- File: HLRBRep_EdgeData.cdl
-- Created: Thu Apr 17 11:34:54 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class EdgeData from HLRBRep
uses
ShortReal from Standard,
Address from Standard,
Integer from Standard,
Boolean from Standard,
ShortReal from Standard,
Dir2d from gp,
EdgeStatus from HLRAlgo,
Curve from HLRBRep,
Edge from TopoDS
is
Create returns EdgeData from HLRBRep;
Set(me : in out;
Reg1 : Boolean from Standard;
RegN : Boolean from Standard;
EG : Edge from TopoDS;
V1, V2 : Integer from Standard;
Out1,Out2 : Boolean from Standard;
Cut1,Cut2 : Boolean from Standard;
Start : Real from Standard;
TolStart : ShortReal from Standard;
End : Real from Standard;
TolEnd : ShortReal from Standard)
is static;
Selected(me) returns Boolean from Standard
---C++: inline
is static;
Selected(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Rg1Line(me) returns Boolean from Standard
---C++: inline
is static;
Rg1Line(me : in out; B : Boolean from Standard)
---C++: inline
is static;
RgNLine(me) returns Boolean from Standard
---C++: inline
is static;
RgNLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Vertical(me) returns Boolean from Standard
---C++: inline
is static;
Vertical(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Simple(me) returns Boolean from Standard
---C++: inline
is static;
Simple(me : in out; B : Boolean from Standard)
---C++: inline
is static;
OutLVSta(me) returns Boolean from Standard
---C++: inline
is static;
OutLVSta(me : in out; B : Boolean from Standard)
---C++: inline
is static;
OutLVEnd(me) returns Boolean from Standard
---C++: inline
is static;
OutLVEnd(me : in out; B : Boolean from Standard)
---C++: inline
is static;
CutAtSta(me) returns Boolean from Standard
---C++: inline
is static;
CutAtSta(me : in out; B : Boolean from Standard)
---C++: inline
is static;
CutAtEnd(me) returns Boolean from Standard
---C++: inline
is static;
CutAtEnd(me : in out; B : Boolean from Standard)
---C++: inline
is static;
VerAtSta(me) returns Boolean from Standard
---C++: inline
is static;
VerAtSta(me : in out; B : Boolean from Standard)
---C++: inline
is static;
VerAtEnd(me) returns Boolean from Standard
---C++: inline
is static;
VerAtEnd(me : in out; B : Boolean from Standard)
---C++: inline
is static;
AutoIntersectionDone(me) returns Boolean from Standard
---C++: inline
is static;
AutoIntersectionDone(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Used(me) returns Boolean from Standard
---C++: inline
is static;
Used(me : in out; B : Boolean from Standard)
---C++: inline
is static;
HideCount(me) returns Integer from Standard
---C++: inline
is static;
HideCount(me : in out; I : Integer from Standard)
---C++: inline
is static;
VSta(me) returns Integer from Standard
---C++: inline
is static;
VSta(me : in out; I : Integer from Standard)
---C++: inline
is static;
VEnd(me) returns Integer from Standard
---C++: inline
is static;
VEnd(me : in out; I : Integer from Standard)
---C++: inline
is static;
UpdateMinMax(me : in out; TotMinMax : Address from Standard)
is static;
MinMax(me) returns Address from Standard
---C++: inline
is static;
Status(me : in out) returns EdgeStatus from HLRAlgo
---C++: inline
---C++: return &
is static;
ChangeGeometry(me : in out) returns Curve from HLRBRep
---C++: inline
---C++: return &
is static;
Geometry(me) returns Curve from HLRBRep
---C++: inline
---C++: return const &
is static;
Curve(me : in out) returns Address from Standard
---C++: inline
is static;
Tolerance(me) returns ShortReal from Standard
---C++: inline
is static;
fields
myFlags : Boolean from Standard;
myHideCount : Integer from Standard;
myVSta : Integer from Standard;
myVEnd : Integer from Standard;
myMinMax : Integer from Standard[16];
myStatus : EdgeStatus from HLRAlgo;
myGeometry : Curve from HLRBRep;
myTolerance : ShortReal from Standard;
end EdgeData;

View File

@@ -0,0 +1,80 @@
// File: HLRBRep_EdgeData.cxx
// Created: Thu Apr 17 11:44:47 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRBRep_EdgeData.ixx>
#include <BRep_Tool.hxx>
//=======================================================================
//function : EdgeData
//purpose :
//=======================================================================
HLRBRep_EdgeData::HLRBRep_EdgeData () :
myFlags(0),
myHideCount(0)
{ Selected(Standard_True); }
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRBRep_EdgeData::Set (const Standard_Boolean Rg1L,
const Standard_Boolean RgNL,
const TopoDS_Edge& EG,
const Standard_Integer V1,
const Standard_Integer V2,
const Standard_Boolean Out1,
const Standard_Boolean Out2,
const Standard_Boolean Cut1,
const Standard_Boolean Cut2,
const Standard_Real Start,
const Standard_ShortReal TolStart,
const Standard_Real End,
const Standard_ShortReal TolEnd)
{
Rg1Line(Rg1L);
RgNLine(RgNL);
Used(Standard_False);
ChangeGeometry().Curve(EG);
myTolerance = (Standard_ShortReal)(BRep_Tool::Tolerance(EG));
VSta(V1);
VEnd(V2);
OutLVSta(Out1);
OutLVEnd(Out2);
CutAtSta(Cut1);
CutAtEnd(Cut2);
Status().Initialize
(Start,(Standard_ShortReal)(ChangeGeometry().Curve().Resolution
((Standard_Real)TolStart)),
End ,(Standard_ShortReal)(ChangeGeometry().Curve().Resolution
((Standard_Real)TolEnd )));
}
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
void HLRBRep_EdgeData::UpdateMinMax (const Standard_Address TotMinMax)
{
myMinMax[ 0] = ((Standard_Integer*)TotMinMax)[ 0];
myMinMax[ 1] = ((Standard_Integer*)TotMinMax)[ 1];
myMinMax[ 2] = ((Standard_Integer*)TotMinMax)[ 2];
myMinMax[ 3] = ((Standard_Integer*)TotMinMax)[ 3];
myMinMax[ 4] = ((Standard_Integer*)TotMinMax)[ 4];
myMinMax[ 5] = ((Standard_Integer*)TotMinMax)[ 5];
myMinMax[ 6] = ((Standard_Integer*)TotMinMax)[ 6];
myMinMax[ 7] = ((Standard_Integer*)TotMinMax)[ 7];
myMinMax[ 8] = ((Standard_Integer*)TotMinMax)[ 8];
myMinMax[ 9] = ((Standard_Integer*)TotMinMax)[ 9];
myMinMax[10] = ((Standard_Integer*)TotMinMax)[10];
myMinMax[11] = ((Standard_Integer*)TotMinMax)[11];
myMinMax[12] = ((Standard_Integer*)TotMinMax)[12];
myMinMax[13] = ((Standard_Integer*)TotMinMax)[13];
myMinMax[14] = ((Standard_Integer*)TotMinMax)[14];
myMinMax[15] = ((Standard_Integer*)TotMinMax)[15];
}

363
src/HLRBRep/HLRBRep_EdgeData.lxx Executable file
View File

@@ -0,0 +1,363 @@
// File: HLRBRep_EdgeData.lxx
// Created: Thu Apr 17 11:42:44 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#define EMaskSelected ((Standard_Boolean)1)
#define EMaskUsed ((Standard_Boolean)2)
#define EMaskRg1Line ((Standard_Boolean)4)
#define EMaskVertical ((Standard_Boolean)8)
#define EMaskSimple ((Standard_Boolean)16)
#define EMaskOutLVSta ((Standard_Boolean)32)
#define EMaskOutLVEnd ((Standard_Boolean)64)
#define EMaskIntDone ((Standard_Boolean)128)
#define EMaskCutAtSta ((Standard_Boolean)256)
#define EMaskCutAtEnd ((Standard_Boolean)512)
#define EMaskVerAtSta ((Standard_Boolean)1024)
#define EMaskVerAtEnd ((Standard_Boolean)2048)
#define EMaskRgNLine ((Standard_Boolean)4096)
//=======================================================================
//function : Selected
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::Selected () const
{ return (myFlags & EMaskSelected) != 0; }
//=======================================================================
//function : Selected
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::Selected (const Standard_Boolean B)
{
if (B) myFlags |= EMaskSelected;
else myFlags &= ~EMaskSelected;
}
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::Rg1Line () const
{ return (myFlags & EMaskRg1Line) != 0; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::Rg1Line (const Standard_Boolean B)
{
if (B) myFlags |= EMaskRg1Line;
else myFlags &= ~EMaskRg1Line;
}
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::RgNLine () const
{ return (myFlags & EMaskRgNLine) != 0; }
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::RgNLine (const Standard_Boolean B)
{
if (B) myFlags |= EMaskRgNLine;
else myFlags &= ~EMaskRgNLine;
}
//=======================================================================
//function : Vertical
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::Vertical () const
{ return (myFlags & EMaskVertical) != 0; }
//=======================================================================
//function : Vertical
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::Vertical(const Standard_Boolean B)
{
if (B) myFlags |= EMaskVertical;
else myFlags &= ~EMaskVertical;
}
//=======================================================================
//function : Simple
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::Simple () const
{ return (myFlags & EMaskSimple) != 0; }
//=======================================================================
//function : Simple
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::Simple (const Standard_Boolean B)
{
if (B) myFlags |= EMaskSimple;
else myFlags &= ~EMaskSimple;
}
//=======================================================================
//function : OutLVSta
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::OutLVSta () const
{ return (myFlags & EMaskOutLVSta) != 0; }
//=======================================================================
//function : OutLVSta
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::OutLVSta (const Standard_Boolean B)
{
if (B) myFlags |= EMaskOutLVSta;
else myFlags &= ~EMaskOutLVSta;
}
//=======================================================================
//function : OutLVEnd
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::OutLVEnd () const
{ return (myFlags & EMaskOutLVEnd) != 0; }
//=======================================================================
//function : OutLVEnd
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::OutLVEnd (const Standard_Boolean B)
{
if (B) myFlags |= EMaskOutLVEnd;
else myFlags &= ~EMaskOutLVEnd;
}
//=======================================================================
//function : CutAtSta
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::CutAtSta () const
{ return (myFlags & EMaskCutAtSta) != 0; }
//=======================================================================
//function : CutAtSta
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::CutAtSta (const Standard_Boolean B)
{
if (B) myFlags |= EMaskCutAtSta;
else myFlags &= ~EMaskCutAtSta;
}
//=======================================================================
//function : CutAtEnd
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::CutAtEnd () const
{ return (myFlags & EMaskCutAtEnd) != 0; }
//=======================================================================
//function : CutAtEnd
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::CutAtEnd (const Standard_Boolean B)
{
if (B) myFlags |= EMaskCutAtEnd;
else myFlags &= ~EMaskCutAtEnd;
}
//=======================================================================
//function : VerAtSta
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::VerAtSta () const
{ return (myFlags & EMaskVerAtSta) != 0; }
//=======================================================================
//function : VerAtSta
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::VerAtSta (const Standard_Boolean B)
{
if (B) myFlags |= EMaskVerAtSta;
else myFlags &= ~EMaskVerAtSta;
}
//=======================================================================
//function : VerAtEnd
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::VerAtEnd () const
{ return (myFlags & EMaskVerAtEnd) != 0; }
//=======================================================================
//function : VerAtEnd
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::VerAtEnd (const Standard_Boolean B)
{
if (B) myFlags |= EMaskVerAtEnd;
else myFlags &= ~EMaskVerAtEnd;
}
//=======================================================================
//function : AutoIntersectionDone
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::AutoIntersectionDone () const
{ return (myFlags & EMaskIntDone) != 0; }
//=======================================================================
//function : AutoIntersectionDone
//purpose :
//=======================================================================
inline void
HLRBRep_EdgeData::AutoIntersectionDone (const Standard_Boolean B)
{
if (B) myFlags |= EMaskIntDone;
else myFlags &= ~EMaskIntDone;
}
//=======================================================================
//function : Used
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_EdgeData::Used () const
{ return (myFlags & EMaskUsed) != 0; }
//=======================================================================
//function : Used
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::Used (const Standard_Boolean B)
{
if (B) myFlags |= EMaskUsed;
else myFlags &= ~EMaskUsed;
}
//=======================================================================
//function : HideCount
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_EdgeData::HideCount () const
{ return myHideCount; }
//=======================================================================
//function : HideCount
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::HideCount (const Standard_Integer I)
{ myHideCount = I; }
//=======================================================================
//function : VSta
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_EdgeData::VSta() const
{ return myVSta; }
//=======================================================================
//function : VSta
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::VSta (const Standard_Integer I)
{ myVSta = I; }
//=======================================================================
//function : VEnd
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_EdgeData::VEnd () const
{ return myVEnd; }
//=======================================================================
//function : VEnd
//purpose :
//=======================================================================
inline void HLRBRep_EdgeData::VEnd (const Standard_Integer I)
{ myVEnd = I; }
//=======================================================================
//function : MinMax
//purpose :
//=======================================================================
inline Standard_Address HLRBRep_EdgeData::MinMax () const
{ return (Standard_Address)&myMinMax; }
//=======================================================================
//function : Status
//purpose :
//=======================================================================
inline HLRAlgo_EdgeStatus & HLRBRep_EdgeData::Status ()
{ return myStatus; }
//=======================================================================
//function : ChangeGeometry
//purpose :
//=======================================================================
inline HLRBRep_Curve & HLRBRep_EdgeData::ChangeGeometry ()
{ return myGeometry; }
//=======================================================================
//function : Geometry
//purpose :
//=======================================================================
inline const HLRBRep_Curve & HLRBRep_EdgeData::Geometry () const
{ return myGeometry; }
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
inline Standard_Address HLRBRep_EdgeData::Curve ()
{ return ((Standard_Address)&myGeometry); }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_ShortReal HLRBRep_EdgeData::Tolerance () const
{ return myTolerance; }

View File

@@ -0,0 +1,36 @@
-- File: HLRBRep_EdgeFaceTool.cdl
-- Created: Mon Oct 18 19:19:43 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class EdgeFaceTool from HLRBRep
---Purpose: The EdgeFaceTool computes the UV coordinates at a
-- given parameter on a Curve and a Surface. It also
-- compute the signed curvature value in a direction
-- at a given u,v point on a surface.
uses
Address from Standard,
Boolean from Standard,
Real from Standard,
Dir from gp
is
CurvatureValue(myclass;
F : Address from Standard; -- as Surface from HLRBRep
U : Real from Standard;
V : Real from Standard;
Tg : Dir from gp) -- as tangent of the edge
returns Real from Standard; -- at U,V point.
UVPoint(myclass;
Par : Real from Standard;
E : Address from Standard; -- as Curve from HLRBRep
F : Address from Standard; -- as Surface from HLRBRep
U,V : out Real from Standard)
---Purpose: return True if U and V are found.
returns Boolean from Standard;
end EdgeFaceTool;

View File

@@ -0,0 +1,99 @@
// File: HLRBRep_EdgeFaceTool.cxx
// Created: Mon Oct 18 19:31:35 1993
// Author: Christophe MARION
// <cma@nonox>
#include <HLRBRep_EdgeFaceTool.ixx>
#include <HLRBRep_Curve.hxx>
#include <HLRBRep_Surface.hxx>
#include <BRepExtrema_ExtPF.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp.hxx>
//=======================================================================
//function : CurvatureDirection
//purpose :
//=======================================================================
Standard_Real HLRBRep_EdgeFaceTool::CurvatureValue
( const Standard_Address F,
const Standard_Real U,
const Standard_Real V,
const gp_Dir& Tg)
{
gp_Pnt P;
gp_Vec D1U,D1V,D2U,D2V,D2UV;
((HLRBRep_Surface*)F)->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
Standard_Real d1ut = D1U*Tg;
Standard_Real d1vt = D1V*Tg;
Standard_Real d1ud1v = D1U*D1V;
Standard_Real nmu2 = D1U*D1U;
Standard_Real nmv2 = D1V*D1V;
Standard_Real det = nmu2 * nmv2 - d1ud1v * d1ud1v;
Standard_Real alfa = ( d1ut * nmv2 - d1vt * d1ud1v ) / det;
Standard_Real beta = ( d1vt * nmu2 - d1ut * d1ud1v ) / det;
gp_Vec Nm = D1U ^ D1V;
if (Nm.Magnitude() > gp::Resolution()) {
Nm.Normalize();
Standard_Real alfa2 = alfa*alfa;
Standard_Real beta2 = beta*beta;
Standard_Real alfabeta = alfa*beta;
Standard_Real N = (Nm*D2U)*alfa2 + 2*(Nm*D2UV)*alfabeta + (Nm*D2V)*beta2;
Standard_Real D = nmu2 *alfa2 + 2*d1ud1v *alfabeta + nmv2 *beta2;
return N/D;
}
else
return 0;
}
//=======================================================================
//function : UVPoint
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeFaceTool::UVPoint(const Standard_Real Par,
const Standard_Address E,
const Standard_Address F,
Standard_Real& U,
Standard_Real& V)
{
Standard_Real pfbid,plbid;
Standard_Boolean done = Standard_True;
if (BRep_Tool::CurveOnSurface
(((HLRBRep_Curve *)E)->Curve().Edge(),
((HLRBRep_Surface*)F)->Surface().Face(),pfbid,plbid).IsNull()) {
BRepExtrema_ExtPF proj
(BRepLib_MakeVertex(((HLRBRep_Curve*)E)->Value3D(Par)),
((HLRBRep_Surface*)F)->Surface().Face());
Standard_Integer index = 0;
Standard_Real dist2 = RealLast();
Standard_Real newdist2;
Standard_Integer n = proj.NbExt();
for (Standard_Integer i = 1; i <= n; i++) {
newdist2 = proj.SquareDistance(i);
if (newdist2 < dist2) {
dist2 = newdist2;
index = i;
}
}
if (index != 0)
proj.Parameter(index,U,V);
else
done = Standard_False;
}
else {
BRepAdaptor_Curve2d PC
(((HLRBRep_Curve *)E)->Curve().Edge(),
((HLRBRep_Surface*)F)->Surface().Face());
gp_Pnt2d P2d;
PC.D0(Par,P2d);
U = P2d.X();
V = P2d.Y();
}
return done;
}

View File

@@ -0,0 +1,26 @@
-- File: HLRBRep_EdgeIList.cdl
-- Created: Thu Apr 17 19:56:30 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class EdgeIList from HLRBRep
uses
Orientation from TopAbs,
Interference from HLRAlgo,
InterferenceList from HLRAlgo,
EdgeInterferenceTool from HLRBRep
is
AddInterference(myclass;
IL : in out InterferenceList from HLRAlgo;
I : Interference from HLRAlgo;
T : EdgeInterferenceTool from HLRBRep);
---Purpose: Add the interference <I> to the list <IL>.
ProcessComplex(myclass;
IL : in out InterferenceList from HLRAlgo;
T : EdgeInterferenceTool from HLRBRep);
---Purpose: Process complex transitions on the list IL.
end EdgeIList;

160
src/HLRBRep/HLRBRep_EdgeIList.cxx Executable file
View File

@@ -0,0 +1,160 @@
// File: HLRBRep_EdgeIList.cxx
// Created: Thu Apr 17 21:26:59 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_EdgeIList.ixx>
#include <TopCnx_EdgeFaceTransition.hxx>
#include <HLRAlgo_ListIteratorOfInterferenceList.hxx>
//=======================================================================
//function : AddInterference
//purpose : insert an interference in a sorted list
//=======================================================================
void HLRBRep_EdgeIList::
AddInterference(HLRAlgo_InterferenceList& IL,
const HLRAlgo_Interference& I,
const HLRBRep_EdgeInterferenceTool& T)
{
HLRAlgo_ListIteratorOfInterferenceList It(IL);
Standard_Real p = T.ParameterOfInterference(I);
while (It.More()) {
if (p < T.ParameterOfInterference(It.Value())) {
IL.InsertBefore(I,It);
return;
}
It.Next();
}
IL.Append(I);
}
//=======================================================================
//function : ProcessComplex
//purpose :
//=======================================================================
static Standard_Boolean SimilarInterference(const HLRAlgo_Interference& I1,
const HLRAlgo_Interference& I2)
{
Standard_Real p1, p2;
Standard_Real eps = 1.e-7;
TopAbs_Orientation or1, or2;
//Standard_Integer l1, l2; //levels
p1 = I1.Intersection().Parameter();
//l1 = I1.Intersection().Level();
or1 = I1.Transition();
p2 = I2.Intersection().Parameter();
//l2 = I2.Intersection().Level();
or2 = I2.Transition();
Standard_Boolean IsSimilar = Abs(p1-p2) <= eps && or1 == or2;
return IsSimilar;
}
void HLRBRep_EdgeIList::
ProcessComplex(HLRAlgo_InterferenceList& IL,
const HLRBRep_EdgeInterferenceTool& T)
{
TopCnx_EdgeFaceTransition transTool;
gp_Dir TgtE, NormE, TgtI, NormI;
const Standard_Real TolAng = 0.0001;
Standard_Real CurvE, CurvI;
HLRAlgo_ListIteratorOfInterferenceList It1(IL);
while (It1.More()) {
HLRAlgo_ListIteratorOfInterferenceList It2(It1);
It2.Next();
if (It2.More()) {
if (T.SameInterferences(It1.Value(),It2.Value())/* ||
SimilarInterference(It1.Value(),It2.Value())*/) {
T.EdgeGeometry(T.ParameterOfInterference(It1.Value()),
TgtE, NormE, CurvE);
transTool.Reset(TgtE,NormE,CurvE);
T.InterferenceBoundaryGeometry(It1.Value(),TgtI,NormI,CurvI);
transTool.AddInterference(TolAng,
TgtI,NormI,CurvI,
It1.Value().Orientation(),
It1.Value().Transition(),
It1.Value().BoundaryTransition());
while (It2.More()) {
if (!(T.SameInterferences(It1.Value(),It2.Value())/* ||
SimilarInterference(It1.Value(),It2.Value())*/)) break;
T.InterferenceBoundaryGeometry(It2.Value(),TgtI,NormI,CurvI);
transTool.AddInterference(TolAng,
TgtI,NormI,CurvI,
It2.Value().Orientation(),
It2.Value().Transition(),
It2.Value().BoundaryTransition());
IL.Remove(It2);
}
// get the cumulated results
It1.Value().Transition(transTool.Transition());
It1.Value().BoundaryTransition(transTool.BoundaryTransition());
}
}
It1.Next();
}
/*
//Removing "coinciding" interference
Standard_Real p1, p2;
Standard_Real eps = 1.e-7;
HLRAlgo_InterferenceList ILNew;
HLRAlgo_Interference I1, I2;
TopAbs_Orientation or1, or2;
Standard_Integer l1, l2; //levels
It1.Initialize(IL);
if(It1.More()) {
I1 = It1.Value();
p1 = I1.Intersection().Parameter();
l1 = I1.Intersection().Level();
or1 = I1.Transition();
ILNew.Append(I1);
HLRAlgo_ListIteratorOfInterferenceList It2(ILNew);
It1.Next();
while(It1.More()) {
I2 = It1.Value();
p2 = I2.Intersection().Parameter();
l2 = I2.Intersection().Level();
or2 = I2.Transition();
if(p2 - p1 <= eps && or1 == or2) {
ILNew.Remove(It2);
if(l2 < l1) {
ILNew.Append(I2);
}
else {
ILNew.Append(I1);
}
}
else {
ILNew.Append(I2);
}
It1.Next();
if(It2.More()) It2.Next();
p1 = p2;
l1 = l2;
or1 = or2;
I1 = I2;
}
IL = ILNew;
}
*/
}

View File

@@ -0,0 +1,104 @@
-- File: HLRBRep_EdgeInterferenceTool.cdl
-- Created: Thu Apr 17 19:45:19 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class EdgeInterferenceTool from HLRBRep
---Purpose: Implements the methods required to instantiates
-- the EdgeInterferenceList from HLRAlgo.
uses
Integer from Standard,
Boolean from Standard,
Real from Standard,
Dir from gp,
Orientation from TopAbs,
Intersection from HLRAlgo,
Interference from HLRAlgo,
Data from HLRBRep
is
Create(DS : Data from HLRBRep) returns EdgeInterferenceTool from HLRBRep;
--- methods to iterate on the Vertices of the Edge
LoadEdge(me : in out)
is static;
InitVertices(me : in out)
---C++: inline
is static;
MoreVertices(me) returns Boolean from Standard
---C++: inline
is static;
NextVertex(me : in out)
---C++: inline
is static;
CurrentVertex(me) returns Intersection from HLRAlgo
---C++: inline
---C++: return const &
is static;
CurrentOrientation(me) returns Orientation from TopAbs
---C++: inline
is static;
CurrentParameter(me) returns Real from Standard
---C++: inline
is static;
-- Data on the Edge
IsPeriodic(me) returns Boolean from Standard
---C++: inline
is static;
EdgeGeometry(me; Param : Real from Standard;
Tgt : out Dir from gp;
Nrm : out Dir from gp;
Curv : out Real from Standard)
---Purpose: Returns local geometric description of the Edge at
-- parameter <Para>. See method Reset of class
-- EdgeFaceTransition from TopCnx for other arguments.
is static;
-- Data on Interferences
ParameterOfInterference(me; I : Interference from HLRAlgo)
returns Real from Standard
---C++: inline
is static;
SameInterferences(me; I1, I2 : Interference from HLRAlgo)
returns Boolean from Standard
---Purpose: True if the two interferences are on the same
-- geometric locus.
is static;
SameVertexAndInterference(me; I : Interference from HLRAlgo)
returns Boolean from Standard
---Purpose: True if the Interference and the current Vertex
-- are on the same geometric locus.
is static;
InterferenceBoundaryGeometry(me; I : Interference from HLRAlgo;
Tang : out Dir from gp;
Norm : out Dir from gp;
Curv : out Real from Standard)
---Purpose: Returns the geometry of the boundary at the
-- interference <I>. See the AddInterference method
-- of the class EdgeFaceTransition from TopCnx for
-- the other arguments.
is static;
fields
myDS : Data from HLRBRep;
inter : Intersection from HLRAlgo [2];
cur : Integer from Standard;
end EdgeInterferenceTool;

View File

@@ -0,0 +1,105 @@
// File: HLRBRep_EdgeInterferenceTool.cxx
// Created: Thu Apr 17 21:22:03 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_EdgeInterferenceTool.ixx>
//=======================================================================
//function : HLRBRep_EdgeInterferenceTool
//purpose :
//=======================================================================
HLRBRep_EdgeInterferenceTool::HLRBRep_EdgeInterferenceTool
(const Handle(HLRBRep_Data)& DS) : myDS(DS)
{
}
//=======================================================================
//function : LoadEdge
//purpose :
//=======================================================================
void HLRBRep_EdgeInterferenceTool::LoadEdge()
{
Standard_Real p1,p2;
Standard_ShortReal t1,t2;
HLRBRep_Array1OfEData& ED = myDS->EDataArray();
HLRBRep_EdgeData& ed = ED(myDS->Edge());
ed.Status().Bounds(p1,t1,p2,t2);
inter[0].Parameter(p1);
inter[0].Tolerance(t1);
inter[0].Index(ed.VSta());
inter[1].Parameter(p2);
inter[1].Tolerance(t2);
inter[1].Index(ed.VEnd());
}
//=======================================================================
//function : EdgeGeometry
//purpose :
//=======================================================================
void HLRBRep_EdgeInterferenceTool::EdgeGeometry
(const Standard_Real Param,
gp_Dir& Tgt,
gp_Dir& Nrm,
Standard_Real& CrLE) const
{
gp_Dir2d TgLE,NmLE;
myDS->LocalLEGeometry2D(Param,TgLE,NmLE,CrLE);
Tgt.SetCoord(TgLE.X(),TgLE.Y(),0);
Nrm.SetCoord(NmLE.X(),NmLE.Y(),0);
}
//=======================================================================
//function : SameInterferences
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeInterferenceTool::SameInterferences
(const HLRAlgo_Interference& I1,
const HLRAlgo_Interference& I2) const
{
Standard_Integer ind1 = I1.Intersection().Index();
Standard_Integer ind2 = I2.Intersection().Index();
if ( ind1 != 0 && ind2 != 0 ) return ind1 == ind2;
return Standard_False;
}
//=======================================================================
//function : SameVertexAndInterference
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_EdgeInterferenceTool::SameVertexAndInterference
(const HLRAlgo_Interference& I) const
{
if (I.Intersection().Index() == inter[cur].Index())
return Standard_True;
return I.Intersection().Orientation() ==
((cur == 0) ? TopAbs_FORWARD : TopAbs_REVERSED);
}
//=======================================================================
//function : InterferenceBoundaryGeometry
//purpose :
//=======================================================================
void HLRBRep_EdgeInterferenceTool::InterferenceBoundaryGeometry
(const HLRAlgo_Interference& I,
gp_Dir& Tang,
gp_Dir& Norm,
Standard_Real& CrFE) const
{
Standard_Integer FE;
Standard_Real Param;
gp_Dir2d TgFE,NmFE;
I.Boundary().Value2D(FE,Param);
myDS->LocalFEGeometry2D(FE,Param,TgFE,NmFE,CrFE);
Tang.SetCoord(TgFE.X(),TgFE.Y(),0);
Norm.SetCoord(NmFE.X(),NmFE.Y(),0);
}

View File

@@ -0,0 +1,83 @@
// File: HLRBRep_EdgeInterferenceTool.lxx
// Created: Thu Apr 17 21:17:06 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRAlgo_Interference.hxx>
//=======================================================================
//function : InitVertices
//purpose :
//=======================================================================
inline void HLRBRep_EdgeInterferenceTool::InitVertices()
{ cur = 0; }
//=======================================================================
//function : MoreVertices
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_EdgeInterferenceTool::MoreVertices() const
{ return cur < 2; }
//=======================================================================
//function : NextVertex
//purpose :
//=======================================================================
inline void HLRBRep_EdgeInterferenceTool::NextVertex()
{ cur++; }
//=======================================================================
//function : CurrentVertex
//purpose :
//=======================================================================
inline const HLRAlgo_Intersection&
HLRBRep_EdgeInterferenceTool::CurrentVertex
() const
{ return inter[cur]; }
//=======================================================================
//function : CurrentOrientation
//purpose :
//=======================================================================
inline TopAbs_Orientation
HLRBRep_EdgeInterferenceTool::CurrentOrientation
() const
{
if (cur == 0) return TopAbs_FORWARD;
else return TopAbs_REVERSED;
}
//=======================================================================
//function : CurrentParameter
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_EdgeInterferenceTool::CurrentParameter() const
{ return inter[cur].Parameter(); }
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean
HLRBRep_EdgeInterferenceTool::IsPeriodic() const
{ return Standard_False; }
//=======================================================================
//function : ParameterOfInterference
//purpose :
//=======================================================================
inline Standard_Real
HLRBRep_EdgeInterferenceTool::ParameterOfInterference
(const HLRAlgo_Interference& I) const
{ return I.Intersection().Parameter(); }

183
src/HLRBRep/HLRBRep_FaceData.cdl Executable file
View File

@@ -0,0 +1,183 @@
-- File: HLRBRep_FaceData.cdl
-- Created: Thu Apr 17 11:55:00 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class FaceData from HLRBRep
uses
Boolean from Standard,
ShortReal from Standard,
Orientation from TopAbs,
WiresBlock from HLRAlgo,
Surface from HLRBRep,
Face from TopoDS
is
Create returns FaceData from HLRBRep;
Set(me : in out; FG : Face from TopoDS;
Or : Orientation from TopAbs;
Cl : Boolean from Standard;
NW : Integer from Standard)
---Purpose: <Or> is the orientation of the face. <Cl> is true
-- if the face belongs to a closed volume. <NW> is
-- the number of wires ( or block of edges ) of the
-- face.
is static;
SetWire(me : in out; WI : Integer from Standard;
NE : Integer from Standard)
---Purpose: Set <NE> the number of edges of the wire number
-- <WI>.
is static;
SetWEdge(me : in out; WI,EWI,EI : Integer from Standard;
Or : Orientation from TopAbs;
OutL,Inte,Dble,IsoL : Boolean from Standard)
---Purpose: Set the edge number <EWI> of the wire <WI>.
is static;
Selected(me) returns Boolean from Standard
---C++: inline
is static;
Selected(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Back(me) returns Boolean from Standard
---C++: inline
is static;
Back(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Side(me) returns Boolean from Standard
---C++: inline
is static;
Side(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Closed(me) returns Boolean from Standard
---C++: inline
is static;
Closed(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Hiding(me) returns Boolean from Standard
---C++: inline
is static;
Hiding(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Simple(me) returns Boolean from Standard
---C++: inline
is static;
Simple(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Cut(me) returns Boolean from Standard
---C++: inline
is static;
Cut(me : in out; B : Boolean from Standard)
---C++: inline
is static;
WithOutL(me) returns Boolean from Standard
---C++: inline
is static;
WithOutL(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Plane(me) returns Boolean from Standard
---C++: inline
is static;
Plane(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Cylinder(me) returns Boolean from Standard
---C++: inline
is static;
Cylinder(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Cone(me) returns Boolean from Standard
---C++: inline
is static;
Cone(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Sphere(me) returns Boolean from Standard
---C++: inline
is static;
Sphere(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Torus(me) returns Boolean from Standard
---C++: inline
is static;
Torus(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Size(me) returns Real from Standard
---C++: inline
is static;
Size(me : in out; S : Real from Standard)
---C++: inline
is static;
Orientation(me) returns Orientation from TopAbs
---C++: inline
is static;
Orientation(me : in out; O : Orientation from TopAbs)
---C++: inline
is static;
Wires(me : in out) returns WiresBlock from HLRAlgo
---C++: inline
---C++: return &
is static;
Geometry(me : in out) returns Surface from HLRBRep
---C++: inline
---C++: return &
is static;
Tolerance(me) returns ShortReal from Standard
---C++: inline
is static;
fields
myFlags : Boolean from Standard;
myWires : WiresBlock from HLRAlgo;
myGeometry : Surface from HLRBRep;
mySize : Real from Standard;
myTolerance : ShortReal from Standard;
end FaceData;

View File

@@ -0,0 +1,68 @@
// File: HLRBRep_FaceData.cxx
// Created: Thu Apr 17 12:02:21 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRBRep_FaceData.ixx>
#include <HLRAlgo_EdgesBlock.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function : FaceData
//purpose :
//=======================================================================
HLRBRep_FaceData::HLRBRep_FaceData () :
myFlags(0),mySize(0)
{ Selected(Standard_True); }
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRBRep_FaceData::Set (const TopoDS_Face& FG,
const TopAbs_Orientation Or,
const Standard_Boolean Cl,
const Standard_Integer NW)
{
Closed(Cl);
Geometry().Surface(FG);
myTolerance = (Standard_ShortReal)(BRep_Tool::Tolerance(FG));
Orientation(Or);
Wires() = new HLRAlgo_WiresBlock(NW);
}
//=======================================================================
//function : SetWire
//purpose :
//=======================================================================
void HLRBRep_FaceData::SetWire (const Standard_Integer WI,
const Standard_Integer NE)
{
Wires()->Set(WI,new HLRAlgo_EdgesBlock(NE));
}
//=======================================================================
//function : SetWEdge
//purpose :
//=======================================================================
void HLRBRep_FaceData::SetWEdge (const Standard_Integer WI,
const Standard_Integer EWI,
const Standard_Integer EI,
const TopAbs_Orientation Or,
const Standard_Boolean OutL,
const Standard_Boolean Inte,
const Standard_Boolean Dble,
const Standard_Boolean IsoL)
{
Wires()->Wire(WI)->Edge (EWI,EI);
Wires()->Wire(WI)->Orientation(EWI,Or);
Wires()->Wire(WI)->OutLine (EWI,OutL);
Wires()->Wire(WI)->Internal (EWI,Inte);
Wires()->Wire(WI)->Double (EWI,Dble);
Wires()->Wire(WI)->IsoLine (EWI,IsoL);
}

326
src/HLRBRep/HLRBRep_FaceData.lxx Executable file
View File

@@ -0,0 +1,326 @@
// File: HLRBRep_FaceData.lxx
// Created: Thu Apr 17 12:00:16 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#define EMaskOrient ((Standard_Boolean)15)
#define FMaskSelected ((Standard_Boolean)16)
#define FMaskBack ((Standard_Boolean)32)
#define FMaskSide ((Standard_Boolean)64)
#define FMaskClosed ((Standard_Boolean)128)
#define FMaskHiding ((Standard_Boolean)256)
#define FMaskSimple ((Standard_Boolean)512)
#define FMaskCut ((Standard_Boolean)1024)
#define FMaskWithOutL ((Standard_Boolean)2048)
#define FMaskPlane ((Standard_Boolean)4096)
#define FMaskCylinder ((Standard_Boolean)8192)
#define FMaskCone ((Standard_Boolean)16384)
#define FMaskSphere ((Standard_Boolean)32768)
#define FMaskTorus ((Standard_Boolean)65536)
//=======================================================================
//function : Selected
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Selected() const
{ return (myFlags & FMaskSelected) != 0; }
//=======================================================================
//function : Selected
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Selected(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSelected;
else myFlags &= ~FMaskSelected;
}
//=======================================================================
//function : Back
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Back() const
{ return (myFlags & FMaskBack) != 0; }
//=======================================================================
//function : Back
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Back(const Standard_Boolean B)
{
if (B) myFlags |= FMaskBack;
else myFlags &= ~FMaskBack;
}
//=======================================================================
//function : Side
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Side() const
{ return (myFlags & FMaskSide) != 0; }
//=======================================================================
//function : Side
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Side(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSide;
else myFlags &= ~FMaskSide;
}
//=======================================================================
//function : Closed
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Closed() const
{ return (myFlags & FMaskClosed) != 0; }
//=======================================================================
//function : Closed
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Closed(const Standard_Boolean B)
{
if (B) myFlags |= FMaskClosed;
else myFlags &= ~FMaskClosed;
}
//=======================================================================
//function : Hiding
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Hiding() const
{ return (myFlags & FMaskHiding) != 0; }
//=======================================================================
//function : Hiding
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Hiding(const Standard_Boolean B)
{
if (B) myFlags |= FMaskHiding;
else myFlags &= ~FMaskHiding;
}
//=======================================================================
//function : Simple
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Simple() const
{ return (myFlags & FMaskSimple) != 0; }
//=======================================================================
//function : Simple
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Simple(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSimple;
else myFlags &= ~FMaskSimple;
}
//=======================================================================
//function : Cut
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cut() const
{ return (myFlags & FMaskCut) != 0; }
//=======================================================================
//function : Cut
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Cut(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCut;
else myFlags &= ~FMaskCut;
}
//=======================================================================
//function : WithOutL
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::WithOutL() const
{ return (myFlags & FMaskWithOutL) != 0; }
//=======================================================================
//function : WithOutL
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::WithOutL(const Standard_Boolean B)
{
if (B) myFlags |= FMaskWithOutL;
else myFlags &= ~FMaskWithOutL;
}
//=======================================================================
//function : Plane
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Plane() const
{ return (myFlags & FMaskPlane) != 0; }
//=======================================================================
//function : Plane
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Plane(const Standard_Boolean B)
{
if (B) myFlags |= FMaskPlane;
else myFlags &= ~FMaskPlane;
}
//=======================================================================
//function : Cylinder
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cylinder() const
{ return (myFlags & FMaskCylinder) != 0; }
//=======================================================================
//function : Cylinder
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Cylinder(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCylinder;
else myFlags &= ~FMaskCylinder;
}
//=======================================================================
//function : Cone
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cone() const
{ return (myFlags & FMaskCone) != 0; }
//=======================================================================
//function : Cone
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Cone(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCone;
else myFlags &= ~FMaskCone;
}
//=======================================================================
//function : Sphere
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Sphere() const
{ return (myFlags & FMaskSphere) != 0; }
//=======================================================================
//function : Sphere
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Sphere(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSphere;
else myFlags &= ~FMaskSphere;
}
//=======================================================================
//function : Torus
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Torus() const
{ return (myFlags & FMaskTorus) != 0; }
//=======================================================================
//function : Torus
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Torus(const Standard_Boolean B)
{
if (B) myFlags |= FMaskTorus;
else myFlags &= ~FMaskTorus;
}
//=======================================================================
//function : Size
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_FaceData::Size() const
{ return mySize; }
//=======================================================================
//function : Size
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Size(const Standard_Real S)
{ mySize = S; }
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline TopAbs_Orientation HLRBRep_FaceData::Orientation() const
{ return ((TopAbs_Orientation)(myFlags & EMaskOrient)); }
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline void HLRBRep_FaceData::Orientation(const TopAbs_Orientation O)
{
myFlags &= ~EMaskOrient;
myFlags |= (((Standard_Boolean)O) & EMaskOrient);
}
//=======================================================================
//function : Wires
//purpose :
//=======================================================================
inline Handle(HLRAlgo_WiresBlock)& HLRBRep_FaceData::Wires()
{ return myWires; }
//=======================================================================
//function : Geometry
//purpose :
//=======================================================================
inline HLRBRep_Surface& HLRBRep_FaceData::Geometry()
{ return myGeometry; }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_ShortReal HLRBRep_FaceData::Tolerance () const
{ return myTolerance; }

View File

@@ -0,0 +1,94 @@
-- File: HLRBRep_FaceIterator.cdl
-- Created: Thu Apr 17 15:55:18 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class FaceIterator from HLRBRep
uses
Integer from Standard,
Boolean from Standard,
Orientation from TopAbs,
WiresBlock from HLRAlgo,
EdgesBlock from HLRAlgo,
FaceData from HLRBRep
is
Create returns FaceIterator from HLRBRep;
InitEdge(me : in out;
fd : out FaceData from HLRBRep)
---Purpose: Begin an exploration of the edges of the face <fd>
is static;
MoreEdge(me) returns Boolean from Standard
---C++: inline
is static;
NextEdge(me : in out)
is static;
BeginningOfWire(me) returns Boolean from Standard
---Purpose: Returns True if the current edge is the first of a
-- wire.
--
---C++: inline
is static;
EndOfWire(me) returns Boolean from Standard
---Purpose: Returns True if the current edge is the last of a
-- wire.
--
---C++: inline
is static;
SkipWire(me : in out)
---Purpose: Skip the current wire in the exploration.
--
---C++: inline
is static;
Wire(me) returns any EdgesBlock from HLRAlgo
---Purpose: Returns the edges of the current wire.
--
---C++: inline
is static;
Edge(me) returns Integer from Standard
---C++: inline
is static;
Orientation(me) returns Orientation from TopAbs
---C++: inline
is static;
OutLine(me)
returns Boolean from Standard
---C++: inline
is static;
Internal(me)
returns Boolean from Standard
---C++: inline
is static;
Double(me)
returns Boolean from Standard
---C++: inline
is static;
IsoLine(me)
returns Boolean from Standard
---C++: inline
is static;
fields
iWire : Integer from Standard;
nbWires : Integer from Standard;
iEdge : Integer from Standard;
nbEdges : Integer from Standard;
myWires : WiresBlock from HLRAlgo;
myEdges : EdgesBlock from HLRAlgo;
end FaceIterator;

View File

@@ -0,0 +1,51 @@
// File: HLRBRep_FaceIterator.cxx
// Created: Thu Apr 17 16:00:19 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_FaceIterator.ixx>
//=======================================================================
//function : FaceIterator
//purpose :
//=======================================================================
HLRBRep_FaceIterator::HLRBRep_FaceIterator()
{}
//=======================================================================
//function : InitEdge
//purpose :
//=======================================================================
void HLRBRep_FaceIterator::InitEdge(HLRBRep_FaceData& fd)
{
iWire = 0;
myWires = fd.Wires();
nbWires = myWires->NbWires();
iEdge = 0;
nbEdges = 0;
NextEdge();
}
//=======================================================================
//function : NextEdge
//purpose :
//=======================================================================
void HLRBRep_FaceIterator::NextEdge()
{
iEdge++;
if (iEdge > nbEdges) {
iWire++;
if (iWire <= nbWires) {
iEdge = 1;
myEdges = myWires->Wire(iWire);
nbEdges = myEdges->NbEdges();
}
}
}

View File

@@ -0,0 +1,99 @@
// File: HLRBRep_FaceIterator.lxx
// Created: Thu Apr 17 16:03:06 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRAlgo_WiresBlock.hxx>
#include <HLRAlgo_EdgesBlock.hxx>
//=======================================================================
//function : MoreEdge
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::MoreEdge () const
{ return iWire <= nbWires;}
//=======================================================================
//function : BeginningOfWire
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::BeginningOfWire () const
{ return iEdge == 1;}
//=======================================================================
//function : EndOfWire
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::EndOfWire () const
{ return iEdge == nbEdges;}
//=======================================================================
//function : SkipWire
//purpose :
//=======================================================================
inline void HLRBRep_FaceIterator::SkipWire ()
{
iEdge = nbEdges;
NextEdge();
}
//=======================================================================
//function : Wire
//purpose :
//=======================================================================
inline Handle(HLRAlgo_EdgesBlock) HLRBRep_FaceIterator::Wire() const
{ return myWires->Wire(iWire); }
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_FaceIterator::Edge () const
{ return myEdges->Edge(iEdge); }
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline TopAbs_Orientation HLRBRep_FaceIterator::Orientation() const
{ return myEdges->Orientation(iEdge); }
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::OutLine() const
{ return myEdges->OutLine(iEdge); }
//=======================================================================
//function : Internal
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::Internal() const
{ return myEdges->Internal(iEdge); }
//=======================================================================
//function : Double
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::Double() const
{ return myEdges->Double(iEdge); }
//=======================================================================
//function : IsoLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_FaceIterator::IsoLine() const
{ return myEdges->IsoLine(iEdge); }

View File

@@ -0,0 +1,168 @@
-- File: HLRBRep_HLRToShape.cdl
-- Created: Mon Oct 11 16:45:31 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class HLRToShape from HLRBRep
---Purpose: A framework for filtering the computation
-- results of an HLRBRep_Algo algorithm by extraction.
-- From the results calculated by the algorithm on
-- a shape, a filter returns the type of edge you
-- want to identify. You can choose any of the following types of output:
-- - visible sharp edges
-- - hidden sharp edges
-- - visible smooth edges
-- - hidden smooth edges
-- - visible sewn edges
-- - hidden sewn edges
-- - visible outline edges
-- - hidden outline edges.
-- - visible isoparameters and
-- - hidden isoparameters.
-- Sharp edges present a C0 continuity (non G1).
-- Smooth edges present a G1 continuity (non G2).
-- Sewn edges present a C2 continuity.
-- The result is composed of 2D edges in the
-- projection plane of the view which the
-- algorithm has worked with. These 2D edges
-- are not included in the data structure of the visualized shape.
-- In order to obtain a complete image, you must
-- combine the shapes given by each of the chosen filters.
-- The construction of the shape does not call a
-- new computation of the algorithm, but only
-- reads its internal results.
-- The methods of this shape are almost identic to those of the HLRBrep_PolyHLRToShape class.
uses
Boolean from Standard,
Integer from Standard,
Real from Standard,
Shape from TopoDS,
Edge from TopoDS,
Curve from HLRBRep,
Algo from HLRBRep,
Data from HLRBRep,
EdgeData from HLRBRep
is
Create(A : Algo from HLRBRep)
returns HLRToShape from HLRBRep;
---Purpose: Constructs a framework for filtering the
--- results of the HLRBRep_Algo algorithm, A.
-- Use the extraction filters to obtain the results you want for A.
VCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
VCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineVCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
RgNLineVCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
RgNLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
OutLineVCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
OutLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
IsoLineVCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
IsoLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
HCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
HCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
RgNLineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
RgNLineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
OutLineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
OutLineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
IsoLineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
IsoLineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
InternalCompound(me : in out; typ : Integer from Standard;
visible : Boolean from Standard;
S : Shape from TopoDS)
returns Shape from TopoDS
is static private;
DrawFace(me; visible : Boolean from Standard;
typ : Integer from Standard;
iface : Integer from Standard;
DS : out Data from HLRBRep;
Result : out Shape from TopoDS;
added : out Boolean from Standard)
is static private;
DrawEdge(me; visible : Boolean from Standard;
inFace : Boolean from Standard;
typ : Integer from Standard;
ed : out EdgeData from HLRBRep;
Result : out Shape from TopoDS;
added : out Boolean from Standard)
is static private;
fields
myAlgo : Algo from HLRBRep;
end HLRToShape;

View File

@@ -0,0 +1,215 @@
// File: HLRBRep_HLRToShape.cxx
// Created: Mon Oct 11 16:55:56 1993
// Author: Christophe MARION
// <cma@nonox>
#include <HLRBRep_HLRToShape.ixx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRep_Builder.hxx>
#include <HLRBRep.hxx>
#include <HLRBRep_Data.hxx>
#include <HLRBRep_ShapeBounds.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
//=======================================================================
//function : HLRBRep_HLRToShape
//purpose :
//=======================================================================
HLRBRep_HLRToShape::HLRBRep_HLRToShape (const Handle(HLRBRep_Algo)& A) :
myAlgo(A)
{}
//=======================================================================
//function : InternalCompound
//purpose :
//=======================================================================
TopoDS_Shape
HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
const Standard_Boolean visible,
const TopoDS_Shape& S)
{
Standard_Boolean added = Standard_False;
TopoDS_Shape Result;
Handle(HLRBRep_Data) DS = myAlgo->DataStructure();
if (!DS.IsNull()) {
DS->Projector().Scaled(Standard_True);
Standard_Integer e1 = 1;
Standard_Integer e2 = DS->NbEdges();
Standard_Integer f1 = 1;
Standard_Integer f2 = DS->NbFaces();
Standard_Boolean explor = Standard_False;
// Standard_Boolean todraw;
if (!S.IsNull()) {
Standard_Integer v1,v2;
Standard_Integer index = myAlgo->Index(S);
if (index == 0) explor = Standard_True;
else myAlgo->ShapeBounds(index).Bounds(v1,v2,e1,e2,f1,f2);
}
BRep_Builder B;
B.MakeCompound(TopoDS::Compound(Result));
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(e1 - 1));
for (Standard_Integer ie = e1; ie <= e2; ie++) {
ed++;
if (ed->Selected() && !ed->Vertical()) {
ed->Used(Standard_False);
ed->HideCount(0);
}
else ed->Used(Standard_True);
}
if (explor) {
TopTools_IndexedMapOfShape& Edges = DS->EdgeMap();
TopTools_IndexedMapOfShape& Faces = DS->FaceMap();
TopExp_Explorer Exp;
for (Exp.Init (S, TopAbs_FACE);
Exp.More();
Exp.Next()) {
Standard_Integer iface = Faces.FindIndex(Exp.Current());
if (iface != 0) DrawFace(visible,typ,iface,DS,Result,added);
}
if (typ >= 3) {
for (Exp.Init (S, TopAbs_EDGE, TopAbs_FACE);
Exp.More();
Exp.Next()) {
Standard_Integer ie = Edges.FindIndex(Exp.Current());
if (ie != 0) {
HLRBRep_EdgeData& ed = DS->EDataArray().ChangeValue(ie);
if (!ed.Used()) {
DrawEdge(visible,Standard_False,typ,ed,Result,added);
ed.Used(Standard_True);
}
}
}
}
}
else {
for (Standard_Integer iface = f1; iface <= f2; iface++)
DrawFace(visible,typ,iface,DS,Result,added);
if (typ >= 3) {
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(e1 - 1));
for (Standard_Integer ie = e1; ie <= e2; ie++) {
ed++;
if (!ed->Used()) {
DrawEdge(visible,Standard_False,typ,*ed,Result,added);
ed->Used(Standard_True);
}
}
}
}
DS->Projector().Scaled(Standard_False);
}
if (!added) Result = TopoDS_Shape();
return Result;
}
//=======================================================================
//function : DrawFace
//purpose :
//=======================================================================
void
HLRBRep_HLRToShape::DrawFace (const Standard_Boolean visible,
const Standard_Integer typ,
const Standard_Integer iface,
Handle(HLRBRep_Data)& DS,
TopoDS_Shape& Result,
Standard_Boolean& added) const
{
HLRBRep_FaceIterator Itf;
for (Itf.InitEdge(DS->FDataArray().ChangeValue(iface));
Itf.MoreEdge();
Itf.NextEdge()) {
Standard_Integer ie = Itf.Edge();
HLRBRep_EdgeData& edf = DS->EDataArray().ChangeValue(ie);
if (!edf.Used()) {
Standard_Boolean todraw;
if (typ == 1) todraw = Itf.IsoLine();
else if (typ == 2) todraw = Itf.Internal();
else if (typ == 3) todraw = edf.Rg1Line() &&
!edf.RgNLine() && !Itf.OutLine();
else if (typ == 4) todraw = edf.RgNLine() && !Itf.OutLine();
else todraw =
!(Itf.IsoLine() ||
Itf.Internal() ||
(edf.Rg1Line() && !Itf.OutLine()));
if (todraw) {
DrawEdge(visible,Standard_True,typ,edf,Result,added);
edf.Used(Standard_True);
}
else {
if(typ > 4 && (edf.Rg1Line() && !Itf.OutLine())) {
Standard_Integer hc = edf.HideCount();
if(hc > 0) {
edf.Used(Standard_True);
}
else {
++hc;
edf.HideCount(hc); //to try with another face
}
}
else {
edf.Used(Standard_True);
}
}
}
}
}
//=======================================================================
//function : DrawEdge
//purpose :
//=======================================================================
void
HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
const Standard_Boolean inFace,
const Standard_Integer typ,
HLRBRep_EdgeData& ed,
TopoDS_Shape& Result,
Standard_Boolean& added) const
{
Standard_Boolean todraw;
if (inFace) todraw = Standard_True;
else if (typ == 3) todraw = ed.Rg1Line() && !ed.RgNLine();
else if (typ == 4) todraw = ed.RgNLine();
else todraw =!ed.Rg1Line();
if (todraw) {
Standard_Real sta,end;
Standard_ShortReal tolsta,tolend;
BRep_Builder B;
HLRAlgo_EdgeIterator It;
if (visible) {
for (It.InitVisible(ed.Status());
It.MoreVisible();
It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
B.Add(Result,HLRBRep::MakeEdge(ed.Geometry(),sta,end));
added = Standard_True;
}
}
else {
for (It.InitHidden(ed.Status());
It.MoreHidden();
It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
B.Add(Result,HLRBRep::MakeEdge(ed.Geometry(),sta,end));
added = Standard_True;
}
}
}
}

View File

@@ -0,0 +1,177 @@
// File: HLRBRep_HLRToShape.lxx
// Created: Tue Nov 2 15:55:51 1993
// Author: Christophe MARION
// <cma@nonox>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function : VCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::VCompound()
{ return InternalCompound(5,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : VCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::VCompound(const TopoDS_Shape& S)
{ return InternalCompound(5,Standard_True,S); }
//=======================================================================
//function : Rg1LineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::Rg1LineVCompound()
{ return InternalCompound(3,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : Rg1LineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::Rg1LineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(3,Standard_True,S); }
//=======================================================================
//function : RgNLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::RgNLineVCompound()
{ return InternalCompound(4,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : RgNLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::RgNLineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(4,Standard_True,S); }
//=======================================================================
//function : OutLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::OutLineVCompound()
{ return InternalCompound(2,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : OutLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::OutLineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(2,Standard_True,S); }
//=======================================================================
//function : IsoLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::IsoLineVCompound()
{ return InternalCompound(1,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : IsoLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::IsoLineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(1,Standard_True,S); }
//=======================================================================
//function : HCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::HCompound()
{ return InternalCompound(5,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : HCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::HCompound(const TopoDS_Shape& S)
{ return InternalCompound(5,Standard_False,S); }
//=======================================================================
//function : Rg1LineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::Rg1LineHCompound()
{ return InternalCompound(3,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : Rg1LineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::Rg1LineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(3,Standard_False,S); }
//=======================================================================
//function : RgNLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::RgNLineHCompound()
{ return InternalCompound(4,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : RgNLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::RgNLineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(4,Standard_False,S); }
//=======================================================================
//function : OutLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::OutLineHCompound()
{ return InternalCompound(2,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : OutLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::OutLineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(2,Standard_False,S); }
//=======================================================================
//function : IsoLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_HLRToShape::IsoLineHCompound()
{ return InternalCompound(1,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : IsoLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_HLRToShape::IsoLineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(1,Standard_False,S); }

38
src/HLRBRep/HLRBRep_Hider.cdl Executable file
View File

@@ -0,0 +1,38 @@
-- File: HLRBRep_Hider.cdl
-- Created: Thu Apr 17 19:43:52 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class Hider from HLRBRep
uses
Integer from Standard,
Boolean from Standard,
Real from Standard,
ShortReal from Standard,
ListOfInteger from TColStd,
MapOfShapeTool from BRepTopAdaptor,
Data from HLRBRep
is
Create(DS : Data from HLRBRep)
returns Hider from HLRBRep;
---Purpose: Creates a Hider processing the set of Edges and
-- hiding faces described by <DS>. Stores the hidden
-- parts in <DS>.
OwnHiding(me : in out; FI : Integer from Standard)
---Purpose: own hiding the side face number <FI>.
is static;
Hide(me : in out; FI : Integer from Standard;
MST: in out MapOfShapeTool from BRepTopAdaptor)
---Purpose: Removes from the edges, the parts hidden by the
-- hiding face number <FI>.
is static;
fields
myDS : Data from HLRBRep;
end Hider;

592
src/HLRBRep/HLRBRep_Hider.cxx Executable file
View File

@@ -0,0 +1,592 @@
// File: HLRBRep_Hider.cxx
// Created: Thu Apr 17 19:33:55 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#define No_Standard_OutOfRange
#include <HLRBRep_Hider.ixx>
#include <HLRAlgo_Coincidence.hxx>
#include <HLRAlgo_Interference.hxx>
#include <HLRAlgo_InterferenceList.hxx>
#include <HLRAlgo_ListIteratorOfInterferenceList.hxx>
#include <HLRAlgo_Intersection.hxx>
#include <HLRBRep_EdgeIList.hxx>
#include <HLRBRep_EdgeBuilder.hxx>
#include <HLRBRep_VertexList.hxx>
#include <HLRBRep_EdgeInterferenceTool.hxx>
#include <Standard_ErrorHandler.hxx>
//=======================================================================
//function : HLRBRep_Hider
//purpose :
//=======================================================================
HLRBRep_Hider::
HLRBRep_Hider (const Handle(HLRBRep_Data)& DS) :
myDS(DS)
{}
//=======================================================================
//function : OwnHiding
//purpose :
//=======================================================================
void HLRBRep_Hider::OwnHiding(const Standard_Integer)
{
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRBRep_Hider::Hide(const Standard_Integer FI,
BRepTopAdaptor_MapOfShapeTool& MST)
{
// *****************************************************************
//
// This algorithm hides a set of edges stored in the data structure <myDS>
// with the hiding face number FI in <myDS>.
//
// Outline of the algorithm
//
// 1. Loop on the Edges (not hidden and not rejected by the face minmax)
//
// The rejections depending of the face are
// - Edge above the face
// - Edge belonging to the face
// - Edge rejected by a wire minmax
//
// Compute interferences with the not rejected edges of the face.
// Store IN and ON interferences in two sorted lists
// ILHidden and ILOn
// If ILOn is not empty
// Resolve ComplexTransitions in ILOn
// Resolve ON Intersections in ILOn
// An On interference may become
// IN : Move it from ILOn to ILHidden
// OUT : Remove it from ILOn
// If ILHidden and ILOn are empty
// intersect the edge with the face and classify the Edge.
// - if inside and under the face hide it.
// Else
// If ILHidden is not empty
// Resolve ComplexTransitions in ILHidden
// Build Hidden parts of the edge
// - Hide them
// Build visible parts of the edge
// Build Parts of the edge under the boundary of the face
// - Hide them as Boundary
// If ILOn is not empty
// Build ON parts of the edge
// - Hide them as ON parts
// Build Parts of the edge on the boundary of the face
// - Hide them as ON parts on Boundary
//
//
// *****************************************************************
myDS->InitEdge(FI,MST);
if (!myDS->MoreEdge()) // there is nothing to do
return; // **********************
HLRBRep_EdgeInterferenceTool EIT(myDS); // List of Intersections
HLRBRep_Array1OfEData& myEData = myDS->EDataArray();
#ifdef DEB
Standard_Integer EToBeChecked = -1;
#endif
for (; myDS->MoreEdge(); myDS->NextEdge()) { // loop on the Edges
Standard_Integer E = myDS->Edge(); // *****************
#ifdef DEB
if(E == EToBeChecked) {
cout << E << endl;
}
#endif
try {
OCC_CATCH_SIGNALS
Standard_Boolean hasOut = Standard_False;
HLRAlgo_InterferenceList ILHidden;
HLRAlgo_InterferenceList ILOn;
EIT.LoadEdge();
for (myDS->InitInterference(); // intersections with face-edges
myDS->MoreInterference(); // *****************************
myDS->NextInterference()) {
if (myDS->RejectedInterference()) {
if (myDS->AboveInterference() &&
myDS->SimpleHidingFace ()) {
hasOut = Standard_True;
}
}
else {
HLRAlgo_Interference& Int = myDS->Interference();
switch (Int.Intersection().State()) {
case TopAbs_IN :
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT); break;
case TopAbs_ON :
HLRBRep_EdgeIList::AddInterference(ILOn ,Int,EIT); break;
case TopAbs_OUT :
case TopAbs_UNKNOWN : break;
}
}
}
//-- ============================================================
Standard_Boolean Modif;
do {
Modif = Standard_False;
HLRAlgo_ListIteratorOfInterferenceList ItSegHidden1(ILHidden);
while(ItSegHidden1.More() && Modif==Standard_False) {
HLRAlgo_Interference& Int1 = ItSegHidden1.Value();
Standard_Integer numseg1=Int1.Intersection().SegIndex();
if(numseg1!=0) {
HLRAlgo_ListIteratorOfInterferenceList ItSegHidden2(ILHidden);
while(ItSegHidden2.More() && Modif==Standard_False) {
HLRAlgo_Interference& Int2 = ItSegHidden2.Value();
Standard_Integer numseg2=Int2.Intersection().SegIndex();
if(numseg1+numseg2 == 0) {
//--printf("\nHidden Traitement du segment %d %d\n",numseg1,numseg2); fflush(stdout);
TopAbs_State stbef1,staft1,stbef2,staft2;
Int1.Boundary().State3D(stbef1,staft1);
Int2.Boundary().State3D(stbef2,staft2);
if(Int1.Orientation() == Int2.Orientation()) {
if(Int1.Transition() == Int2.Transition()) {
if(stbef1==stbef2 && staft1==staft2 && stbef1!=TopAbs_ON && staft1!=TopAbs_ON ) {
//-- printf("\n Index1 = %d Index2 = %d\n",Int1.Intersection().Index(),Int2.Intersection().Index());
Standard_Integer nind=-1;
if(Int1.Intersection().Index()!=0) {
nind=Int1.Intersection().Index();
}
if(Int2.Intersection().Index()!=0) {
if(nind!=-1) {
if(Int1.Intersection().Index() != Int2.Intersection().Index()) {
nind=-1;
}
}
else {
nind=Int2.Intersection().Index();
}
}
if(Int1.Intersection().Index()==0 && Int2.Intersection().Index()==0) nind=0;
if(nind!=-1) {
//-- printf("\n Segment Supprime\n"); fflush(stdout);
HLRAlgo_Intersection& inter = Int1.ChangeIntersection();
inter.SegIndex(nind);
Standard_Real p1 = Int1.Intersection().Parameter();
Standard_Real p2 = Int2.Intersection().Parameter();
inter.Parameter((p1+p2)*0.5);
Int1.BoundaryTransition(TopAbs_EXTERNAL);
ILHidden.Remove(ItSegHidden2);
Modif=Standard_True;
}
}
}
}
}
if(Modif==Standard_False) {
ItSegHidden2.Next();
}
}
}
if(Modif==Standard_False) {
ItSegHidden1.Next();
}
}
}
while(Modif);
//-- ============================================================
if (!ILOn.IsEmpty()) { // process the interferences on ILOn
// *********************************
HLRBRep_EdgeIList::ProcessComplex // complex transition on ILOn
(ILOn,EIT); // **************************
HLRAlgo_ListIteratorOfInterferenceList It(ILOn);
while(It.More()) { // process Intersections on the Face
// *********************************
HLRAlgo_Interference& Int = It.Value();
TopAbs_State stbef, staft; // read the 3d states
Int.Boundary().State3D(stbef,staft); // ******************
switch (Int.Transition()) {
case TopAbs_FORWARD :
switch (staft) {
case TopAbs_OUT :
ILOn.Remove(It); break;
case TopAbs_IN :
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT);
ILOn.Remove(It); break;
case TopAbs_UNKNOWN : cout << "UNKNOWN state staft" << endl;
case TopAbs_ON :
It.Next(); break;
} break;
case TopAbs_REVERSED :
switch (stbef) {
case TopAbs_OUT :
ILOn.Remove(It); break;
case TopAbs_IN :
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT);
ILOn.Remove(It); break;
case TopAbs_UNKNOWN : cout << "UNKNOWN state stbef" << endl;
case TopAbs_ON :
It.Next(); break;
} break;
case TopAbs_EXTERNAL :
ILOn.Remove(It); break;
case TopAbs_INTERNAL :
switch (stbef) {
case TopAbs_IN :
switch (staft) {
case TopAbs_IN :
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT);
ILOn.Remove(It); break;
case TopAbs_ON :
Int.Transition(TopAbs_FORWARD ); // FORWARD in ILOn,
HLRBRep_EdgeIList::AddInterference // REVERSED in ILHidden
(ILHidden,HLRAlgo_Interference
(Int.Intersection(),
Int.Boundary(),
Int.Orientation(),
TopAbs_REVERSED,
Int.BoundaryTransition()),EIT);
It.Next(); break;
case TopAbs_OUT :
Int.Transition(TopAbs_REVERSED); // set REVERSED
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT);
ILOn.Remove(It); break;
case TopAbs_UNKNOWN :
cout << "UNKNOWN state after" << endl;
It.Next(); break;
} break;
case TopAbs_ON :
switch (staft) {
case TopAbs_IN :
Int.Transition(TopAbs_REVERSED); // REVERSED in ILOn,
HLRBRep_EdgeIList::AddInterference // REVERSED in ILHidden
(ILHidden,HLRAlgo_Interference
(Int.Intersection(),
Int.Boundary(),
Int.Orientation(),
TopAbs_FORWARD,
Int.BoundaryTransition()),EIT); break;
case TopAbs_ON : break;
case TopAbs_OUT :
Int.Transition(TopAbs_REVERSED); break;
case TopAbs_UNKNOWN :
cout << "UNKNOWN state after" << endl; break;
}
It.Next(); break;
case TopAbs_OUT :
switch (staft) {
case TopAbs_IN :
Int.Transition(TopAbs_FORWARD); // set FORWARD
HLRBRep_EdgeIList::AddInterference(ILHidden,Int,EIT);
ILOn.Remove(It); break;
case TopAbs_ON :
Int.Transition(TopAbs_FORWARD ); // FORWARD in ILOn
It.Next(); break;
case TopAbs_OUT :
ILOn.Remove(It); break;
case TopAbs_UNKNOWN :
cout << "UNKNOWN state after" << endl;
It.Next(); break;
} break;
case TopAbs_UNKNOWN :
cout << "UNKNOWN state stbef" << endl; break;
}
}
}
}
if (ILHidden.IsEmpty() && ILOn.IsEmpty() && !hasOut) {
HLRBRep_EdgeData& ed = myEData(E);
TopAbs_State st = myDS->Compare(E,ed); // Classification
if (st == TopAbs_IN || st == TopAbs_ON) // **************
ed.Status().HideAll();
}
else {
Standard_Real p1 = 0.,p2 = 0.;
Standard_ShortReal tol1 = 0., tol2 = 0.;
HLRBRep_EdgeData& ed = myEData(E);
HLRAlgo_EdgeStatus& ES = ed.Status();
Standard_Boolean foundHidden = Standard_False;
Standard_Integer aStartLevel;
if (!ILHidden.IsEmpty()) {
HLRBRep_EdgeIList::ProcessComplex // complex transition on ILHidden
(ILHidden,EIT); // ******************************
Standard_Integer level = 0;
if (!myDS->SimpleHidingFace()) // Level at Start
level = myDS->HidingStartLevel(E,ed,ILHidden); // **************
HLRAlgo_ListIteratorOfInterferenceList It(ILHidden);
aStartLevel = level;
while(It.More()) { // suppress multi-inside Intersections
// ***********************************
HLRAlgo_Interference& Int = It.Value();
switch (Int.Transition()) {
case TopAbs_FORWARD :
{
Standard_Integer decal = Int.Intersection().Level();
if (level > 0) ILHidden.Remove(It);
else It.Next();
level = level + decal;
}
break;
case TopAbs_REVERSED :
{
level = level - Int.Intersection().Level();
if (level > 0) ILHidden.Remove(It);
else It.Next();
}
break;
case TopAbs_EXTERNAL :
It.Next();
break;
case TopAbs_INTERNAL :
It.Next();
break;
default :
It.Next();
break;
}
}
if (ILHidden.IsEmpty()) // Edge hidden
ES.HideAll(); // ***********
else
foundHidden = Standard_True;
}
if (!ILHidden.IsEmpty()) {
//IFV
TopAbs_State aBuildIN = TopAbs_IN;
Standard_Boolean IsSuspision = Standard_True;
Standard_Real pmax, pmin;
Standard_Boolean allInt = Standard_False;
Standard_Boolean allFor = Standard_False;
Standard_Boolean allRev = Standard_False;
pmin = RealLast();
pmax = -pmin;
if(ILHidden.Extent() > 1 ) {
allInt = Standard_True;
allFor = Standard_True;
allRev = Standard_True;
HLRAlgo_ListIteratorOfInterferenceList It(ILHidden);
for(;It.More(); It.Next()) {
Standard_Real p = It.Value().Intersection().Parameter();
allFor = allFor && ( It.Value().Transition() == TopAbs_FORWARD);
allRev = allRev && ( It.Value().Transition() == TopAbs_REVERSED);
allInt = allInt && ( It.Value().Transition() == TopAbs_INTERNAL);
if(p < pmin) pmin = p;
if(p > pmax) pmax = p;
}
}
HLRAlgo_ListIteratorOfInterferenceList Itl(ILHidden);
HLRBRep_VertexList IL(EIT,Itl);
HLRBRep_EdgeBuilder EB(IL);
EB.Builds(aBuildIN); // build hidden parts
// ******************
while (EB.MoreEdges()) {
while (EB.MoreVertices()) {
switch (EB.Orientation()) {
case TopAbs_FORWARD :
p1 = EB.Current().Parameter();
tol1 = EB.Current().Tolerance();
break;
case TopAbs_REVERSED :
p2 = EB.Current().Parameter();
tol2 = EB.Current().Tolerance();
break;
case TopAbs_INTERNAL :
case TopAbs_EXTERNAL :
break;
}
EB.NextVertex();
}
if(Abs(p1 - p2) <= 1.e-7) {
EB.NextEdge();
continue;
}
if(allInt) {
if(p1 < pmin) p1 = pmin;
if(p2 > pmax) p2 = pmax;
//HLRBRep_EdgeData& ed = myEData(E);
//TopAbs_State st = myDS->Compare(E,ed); // Classification
}
TopAbs_State aTestState = TopAbs_IN;
if(IsSuspision) {
Standard_Integer aNbp = 1;
aTestState = myDS->SimplClassify(E, ed, aNbp, p1, p2);
}
if(aTestState != TopAbs_OUT) {
ES.Hide(p1,tol1,p2,tol2,
Standard_False, // under the Face
Standard_False); // inside the Face
}
EB.NextEdge();
}
EB.Builds(TopAbs_ON); // build parts under the boundary
// ******************************
while (EB.MoreEdges()) {
while (EB.MoreVertices()) {
switch (EB.Orientation()) {
case TopAbs_FORWARD :
p1 = EB.Current().Parameter();
tol1 = EB.Current().Tolerance();
break;
case TopAbs_REVERSED :
p2 = EB.Current().Parameter();
tol2 = EB.Current().Tolerance();
break;
case TopAbs_INTERNAL :
case TopAbs_EXTERNAL :
break;
}
EB.NextVertex();
}
ES.Hide(p1,tol1,p2,tol2,
Standard_False, // under the Face
Standard_True); // on the boundary
EB.NextEdge();
}
}
if (!ILOn.IsEmpty()) {
Standard_Integer level = 0;
if (!myDS->SimpleHidingFace()) // Level at Start
level = myDS->HidingStartLevel(E,ed,ILOn); // **************
if (level > 0) {
HLRAlgo_ListIteratorOfInterferenceList It(ILOn);
while(It.More()) { // suppress multi-inside Intersections
// ***********************************
HLRAlgo_Interference& Int = It.Value();
switch (Int.Transition()) {
case TopAbs_FORWARD :
{
Standard_Integer decal = Int.Intersection().Level();
if (level > 0) ILOn.Remove(It);
else It.Next();
level = level + decal;
}
break;
case TopAbs_REVERSED :
level = level - Int.Intersection().Level();
if (level > 0) ILOn.Remove(It);
else It.Next();
break;
case TopAbs_EXTERNAL :
case TopAbs_INTERNAL :
default :
It.Next();
break;
}
}
if (ILOn.IsEmpty() && !foundHidden) // Edge hidden
ES.HideAll(); // ***********
}
}
if (!ILOn.IsEmpty()) {
HLRBRep_VertexList IL(EIT,ILOn);
HLRBRep_EdgeBuilder EB(IL);
EB.Builds (TopAbs_IN); // build parts on the Face
// ***********************
while (EB.MoreEdges()) {
while (EB.MoreVertices()) {
switch (EB.Orientation()) {
case TopAbs_FORWARD :
p1 = EB.Current().Parameter();
tol1 = EB.Current().Tolerance();
break;
case TopAbs_REVERSED :
p2 = EB.Current().Parameter();
tol2 = EB.Current().Tolerance();
break;
case TopAbs_INTERNAL :
case TopAbs_EXTERNAL :
break;
}
EB.NextVertex();
}
ES.Hide(p1,tol1,p2,tol2,
Standard_True, // on the Face
Standard_False); // inside the Face
EB.NextEdge();
}
EB.Builds(TopAbs_ON); // build hidden parts under the boundary
// *************************************
while (EB.MoreEdges()) {
while (EB.MoreVertices()) {
switch (EB.Orientation()) {
case TopAbs_FORWARD :
p1 = EB.Current().Parameter();
tol1 = EB.Current().Tolerance();
break;
case TopAbs_REVERSED :
p2 = EB.Current().Parameter();
tol2 = EB.Current().Tolerance();
break;
case TopAbs_INTERNAL :
case TopAbs_EXTERNAL :
break;
}
EB.NextVertex();
}
ES.Hide(p1,tol1,p2,tol2,
Standard_True, // on the Face
Standard_True); // on the boundary
EB.NextEdge();
}
}
}
}
catch(Standard_Failure) {
#ifdef DEB
cout << "An exception was catched when hiding edge " << E;
cout << " by the face " << FI << endl;
Handle(Standard_Failure) fail = Standard_Failure::Caught();
cout << fail << endl;
#endif
}
}
}

View File

@@ -0,0 +1,169 @@
-- File: HLRBRep_InternalAlgo.cdl
-- Created: Thu Apr 17 20:45:25 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class InternalAlgo from HLRBRep inherits TShared from MMgt
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
Projector from HLRAlgo,
Data from HLRBRep,
ShapeBounds from HLRBRep,
SeqOfShapeBounds from HLRBRep,
OutLiner from HLRTopoBRep,
MapOfShapeTool from BRepTopAdaptor,
TShared from MMgt
raises
OutOfRange from Standard
is
Create returns mutable InternalAlgo from HLRBRep;
Create(A : InternalAlgo from HLRBRep)
returns mutable InternalAlgo from HLRBRep;
Projector(me: mutable; P : Projector from HLRAlgo)
---Purpose: set the projector.
is static;
Projector(me: mutable)
returns Projector from HLRAlgo
---Purpose: set the projector.
---C++: return &
is static;
Update(me: mutable)
---Purpose: update the DataStructure.
is static;
Load(me : mutable; S : OutLiner from HLRTopoBRep;
SData : TShared from MMgt;
nbIso : Integer from Standard = 0)
---Purpose: add the shape <S>.
is static;
Load(me : mutable; S : OutLiner from HLRTopoBRep;
nbIso : Integer from Standard = 0)
---Purpose: add the shape <S>.
is static;
Index(me; S : OutLiner from HLRTopoBRep) returns Integer from Standard
---Purpose: return the index of the Shape <S> and return 0 if
-- the Shape <S> is not found.
is static;
Remove(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: remove the Shape of Index <I>.
is static;
ShapeData(me : mutable; I : Integer from Standard;
SData : TShared from MMgt)
raises OutOfRange from Standard
---Purpose: Change the Shape Data of the Shape of index <I>.
is static;
SeqOfShapeBounds(me : mutable) returns SeqOfShapeBounds from HLRBRep
---C++: return &
is static;
NbShapes(me) returns Integer from Standard
is static;
ShapeBounds(me : mutable; I : Integer from Standard)
returns ShapeBounds from HLRBRep
raises OutOfRange from Standard
---C++: return &
is static;
InitEdgeStatus(me : mutable)
---Purpose: init the status of the selected edges depending of
-- the back faces of a closed shell.
is static;
Select(me : mutable)
---Purpose: select all the DataStructure.
is static;
Select(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: select only the Shape of index <I>.
is static;
SelectEdge(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: select only the edges of the Shape <S>.
is static;
SelectFace(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: select only the faces of the Shape <S>.
is static;
ShowAll(me : mutable)
---Purpose: set to visible all the edges.
is static;
ShowAll(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: set to visible all the edges of the Shape <S>.
is static;
HideAll(me : mutable)
---Purpose: set to hide all the edges.
is static;
HideAll(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: set to hide all the edges of the Shape <S>.
is static;
PartialHide(me : mutable)
---Purpose: own hiding of all the shapes of the DataStructure
-- without hiding by each other.
is static;
Hide(me : mutable)
---Purpose: hide all the DataStructure.
is static;
Hide(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: hide the Shape <S> by itself.
is static;
Hide(me : mutable; I,J : Integer from Standard)
raises OutOfRange from Standard
---Purpose: hide the Shape <S1> by the shape <S2>.
is static;
HideSelected(me : mutable; I : Integer from Standard;
SideFace : Boolean from Standard)
---Purpose: first if <SideFace> own hiding of the side faces.
-- After hiding of the selected parts of the
-- DataStructure.
is static private;
Debug(me : mutable; deb : Boolean from Standard)
is static;
Debug(me) returns Boolean from Standard
is static;
DataStructure(me) returns any Data from HLRBRep
is static;
fields
myDS : Data from HLRBRep;
myProj : Projector from HLRAlgo;
myShapes : SeqOfShapeBounds from HLRBRep;
myMapOfShapeTool : MapOfShapeTool from BRepTopAdaptor;
myDebug : Boolean from Standard;
end Algo;

View File

@@ -0,0 +1,977 @@
// File: HLRBRep_InternalAlgo.cxx
// Created: Thu Apr 17 21:49:17 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <Standard_Stream.hxx>
#include <HLRBRep_InternalAlgo.ixx>
#include <Standard_ErrorHandler.hxx>
#include <HLRAlgo.hxx>
#include <HLRBRep_ShapeToHLR.hxx>
#include <HLRBRep_Hider.hxx>
#include <stdio.h>
extern Standard_Integer nbPtIntersection; // total P.I.
extern Standard_Integer nbSegIntersection; // total S.I
extern Standard_Integer nbClassification; // total classification
extern Standard_Integer nbOkIntersection; // pairs of intersecting edges
extern Standard_Integer nbCal1Intersection; // pairs of unrejected edges
extern Standard_Integer nbCal2Intersection; // true intersections (not vertex)
extern Standard_Integer nbCal3Intersection; // curve-surface intersections
static Standard_Integer TRACE = Standard_True;
static Standard_Integer TRACE10 = Standard_True;
#define MinShBI1 MinMaxShBI[ 0]
#define MinShBI2 MinMaxShBI[ 1]
#define MinShBI3 MinMaxShBI[ 2]
#define MinShBI4 MinMaxShBI[ 3]
#define MinShBI5 MinMaxShBI[ 4]
#define MinShBI6 MinMaxShBI[ 5]
#define MinShBI7 MinMaxShBI[ 6]
#define MinShBI8 MinMaxShBI[ 7]
#define MaxShBI1 MinMaxShBI[ 8]
#define MaxShBI2 MinMaxShBI[ 9]
#define MaxShBI3 MinMaxShBI[10]
#define MaxShBI4 MinMaxShBI[11]
#define MaxShBI5 MinMaxShBI[12]
#define MaxShBI6 MinMaxShBI[13]
#define MaxShBI7 MinMaxShBI[14]
#define MaxShBI8 MinMaxShBI[15]
#define MinShBJ1 MinMaxShBJ[ 0]
#define MinShBJ2 MinMaxShBJ[ 1]
#define MinShBJ3 MinMaxShBJ[ 2]
#define MinShBJ4 MinMaxShBJ[ 3]
#define MinShBJ5 MinMaxShBJ[ 4]
#define MinShBJ6 MinMaxShBJ[ 5]
#define MinShBJ7 MinMaxShBJ[ 6]
#define MinShBJ8 MinMaxShBJ[ 7]
#define MaxShBJ1 MinMaxShBJ[ 8]
#define MaxShBJ2 MinMaxShBJ[ 9]
#define MaxShBJ3 MinMaxShBJ[10]
#define MaxShBJ4 MinMaxShBJ[11]
#define MaxShBJ5 MinMaxShBJ[12]
#define MaxShBJ6 MinMaxShBJ[13]
#define MaxShBJ7 MinMaxShBJ[14]
#define MaxShBJ8 MinMaxShBJ[15]
//=======================================================================
//function : HLRBRep_InternalAlgo
//purpose :
//=======================================================================
HLRBRep_InternalAlgo::HLRBRep_InternalAlgo () :
myDebug (Standard_False)
{
}
//=======================================================================
//function : HLRBRep_InternalAlgo
//purpose :
//=======================================================================
HLRBRep_InternalAlgo::
HLRBRep_InternalAlgo (const Handle(HLRBRep_InternalAlgo)& A)
{
myDS = A->DataStructure();
myProj = A->Projector();
myShapes = A->SeqOfShapeBounds();
myDebug = A->Debug();
}
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Projector (const HLRAlgo_Projector& P)
{
myProj = P;
}
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
HLRAlgo_Projector & HLRBRep_InternalAlgo::Projector ()
{ return myProj; }
//=======================================================================
//function : Update
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Update ()
{
if (!myShapes.IsEmpty()) {
Standard_Integer n = myShapes.Length();
Handle(HLRBRep_Data) *DS = new Handle(HLRBRep_Data) [n];
#ifndef DEB
static
#endif
Standard_Integer i,dv,de,df,nv,ne,nf;
nv = 0;
ne = 0;
nf = 0;
for (i = 1; i <= n; i++) {
HLRBRep_ShapeBounds& SB = myShapes(i);
try {
OCC_CATCH_SIGNALS
DS[i-1] = HLRBRep_ShapeToHLR::Load(SB.Shape(),
myProj,
myMapOfShapeTool,
SB.NbOfIso());
dv = DS[i-1]->NbVertices();
de = DS[i-1]->NbEdges ();
df = DS[i-1]->NbFaces ();
}
catch(Standard_Failure) {
cout << "An exception was catched when preparing the Shape " << i;
cout << " and computing its OutLines " << endl;
Handle(Standard_Failure) fail = Standard_Failure::Caught();
cout << fail << endl;
DS[i-1] = new HLRBRep_Data(0,0,0);
dv = 0;
de = 0;
df = 0;
}
SB = HLRBRep_ShapeBounds
(SB.Shape(),SB.ShapeData(),SB.NbOfIso(),1,dv,1,de,1,df);
nv += dv;
ne += de;
nf += df;
}
if (n == 1) myDS = DS[0];
else {
myDS = new HLRBRep_Data(nv,ne,nf);
nv = 0;
ne = 0;
nf = 0;
for (i = 1; i <= n; i++) {
HLRBRep_ShapeBounds& SB = myShapes(i);
SB.Sizes(dv,de,df);
SB.Translate(nv,ne,nf);
myDS->Write(DS[i-1],nv,ne,nf);
nv += dv;
ne += de;
nf += df;
}
}
delete [] DS;
myDS->Update(myProj);
Standard_Integer ShapMin[16],ShapMax[16],MinMaxShap[16];
Standard_Integer TheMin[16],TheMax[16];
for (i = 1; i <= n; i++) {
Standard_Boolean FirstTime = Standard_True;
HLRBRep_ShapeBounds& SB = myShapes(i);
Standard_Integer v1,v2,e1,e2,f1,f2;
SB.Bounds(v1,v2,e1,e2,f1,f2);
HLRBRep_EdgeData* ed = &(myDS->EDataArray (). ChangeValue(e1 - 1));
HLRBRep_FaceData* fd = &(myDS->FDataArray (). ChangeValue(f1 - 1));
ed++;
fd++;
for (Standard_Integer e = e1; e <= e2; e++) {
HLRAlgo::DecodeMinMax(ed->MinMax(),
(Standard_Address)TheMin,
(Standard_Address)TheMax);
if (FirstTime) {
FirstTime = Standard_False;
HLRAlgo::CopyMinMax((Standard_Address)TheMin,
(Standard_Address)TheMax,
(Standard_Address)ShapMin,
(Standard_Address)ShapMax);
}
else
HLRAlgo::AddMinMax((Standard_Address)TheMin,
(Standard_Address)TheMax,
(Standard_Address)ShapMin,
(Standard_Address)ShapMax);
ed++;
}
for (Standard_Integer f = f1; f <= f2; f++) {
HLRAlgo::DecodeMinMax(fd->Wires()->MinMax(),
(Standard_Address)TheMin,
(Standard_Address)TheMax);
HLRAlgo::AddMinMax((Standard_Address)TheMin,
(Standard_Address)TheMax,
(Standard_Address)ShapMin,
(Standard_Address)ShapMax);
fd++;
}
HLRAlgo::EncodeMinMax((Standard_Address)ShapMin,
(Standard_Address)ShapMax,
(Standard_Address)MinMaxShap);
SB.UpdateMinMax((Standard_Address)MinMaxShap);
}
}
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
const Handle(MMgt_TShared)& SData,
const Standard_Integer nbIso)
{
myShapes.Append(HLRBRep_ShapeBounds(S,SData,nbIso,0,0,0,0,0,0));
myDS.Nullify();
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
const Standard_Integer nbIso)
{
myShapes.Append(HLRBRep_ShapeBounds(S,nbIso,0,0,0,0,0,0));
myDS.Nullify();
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer HLRBRep_InternalAlgo::
Index (const Handle(HLRTopoBRep_OutLiner)& S) const
{
Standard_Integer n = myShapes.Length();
for (Standard_Integer i = 1; i <= n; i++)
if (myShapes(i).Shape() == S) return i;
return 0;
}
//=======================================================================
//function : Remove
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Remove (const Standard_Integer I)
{
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::Remove : unknown Shape");
myShapes.Remove(I);
myMapOfShapeTool.Clear();
myDS.Nullify();
}
//=======================================================================
//function : ShapeData
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::ShapeData (const Standard_Integer I,
const Handle(MMgt_TShared)& SData)
{
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::ShapeData : unknown Shape");
myShapes(I).ShapeData(SData);
}
//=======================================================================
//function : SeqOfShapeBounds
//purpose :
//=======================================================================
HLRBRep_SeqOfShapeBounds & HLRBRep_InternalAlgo::SeqOfShapeBounds ()
{
return myShapes;
}
//=======================================================================
//function : NbShapes
//purpose :
//=======================================================================
Standard_Integer HLRBRep_InternalAlgo::NbShapes () const
{ return myShapes.Length(); }
//=======================================================================
//function : ShapeBounds
//purpose :
//=======================================================================
HLRBRep_ShapeBounds & HLRBRep_InternalAlgo::
ShapeBounds (const Standard_Integer I)
{
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::ShapeBounds : unknown Shape");
return myShapes(I);
}
//=======================================================================
//function : InitEdgeStatus
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::InitEdgeStatus ()
{
Standard_Boolean visible;
HLRBRep_FaceIterator faceIt;
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
Standard_Integer nf = myDS->NbFaces();
for (Standard_Integer e = 1; e <= ne; e++) {
if (ed->Selected()) ed->Status().ShowAll();
ed++;
}
// for (Standard_Integer f = 1; f <= nf; f++) {
Standard_Integer f;
for ( f = 1; f <= nf; f++) {
if (fd->Selected()) {
for (faceIt.InitEdge(*fd);
faceIt.MoreEdge();
faceIt.NextEdge()) {
HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(faceIt.Edge()));
if (edf->Selected()) edf->Status().HideAll();
}
}
fd++;
}
fd = &(myDS->FDataArray().ChangeValue(1));
for (f = 1; f <= nf; f++) {
visible = Standard_True;
if (fd->Selected() && fd->Closed()) {
if ( fd->Side()) visible = Standard_False;
else if ( !fd->WithOutL()) {
switch (fd->Orientation()) {
case TopAbs_REVERSED : visible = fd->Back() ; break;
case TopAbs_FORWARD : visible = !fd->Back() ; break;
case TopAbs_EXTERNAL :
case TopAbs_INTERNAL : visible = Standard_True; break;
}
}
}
if (visible) {
for (faceIt.InitEdge(*fd);
faceIt.MoreEdge();
faceIt.NextEdge()) {
Standard_Integer E = faceIt.Edge();
HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(E));
if ( edf->Selected() &&
!edf->Vertical())
edf->Status().ShowAll();
}
}
fd++;
}
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Select ()
{
if (!myDS.IsNull()) {
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
Standard_Integer nf = myDS->NbFaces();
for (Standard_Integer e = 1; e <= ne; e++) {
ed->Selected(Standard_True);
ed++;
}
for (Standard_Integer f = 1; f <= nf; f++) {
fd->Selected(Standard_True);
fd++;
}
}
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Select (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::Select : unknown Shape");
Standard_Integer v1,v2,e1,e2,f1,f2;
myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
Standard_Integer nf = myDS->NbFaces();
for (Standard_Integer e = 1; e <= ne; e++) {
ed->Selected(e >= e1 && e <= e2);
ed++;
}
for (Standard_Integer f = 1; f <= nf; f++) {
fd->Selected(f >= f1 && f <= f2);
fd++;
}
}
}
//=======================================================================
//function : SelectEdge
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::SelectEdge (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::SelectEdge : unknown Shape");
Standard_Integer v1,v2,e1,e2,f1,f2;
myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
for (Standard_Integer e = 1; e <= ne; e++) {
ed->Selected(e >= e1 && e <= e2);
ed++;
}
}
}
//=======================================================================
//function : SelectFace
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::SelectFace (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::SelectFace : unknown Shape");
Standard_Integer v1,v2,e1,e2,f1,f2;
myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
Standard_Integer nf = myDS->NbFaces();
for (Standard_Integer f = 1; f <= nf; f++) {
fd->Selected(f >= f1 && f <= f2);
fd++;
}
}
}
//=======================================================================
//function : ShowAll
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::ShowAll ()
{
if (!myDS.IsNull()) {
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
for (Standard_Integer ie = 1; ie <= ne; ie++) {
ed->Status().ShowAll();
ed++;
}
}
}
//=======================================================================
//function : ShowAll
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::ShowAll (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::ShowAll : unknown Shape");
Select(I);
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
for (Standard_Integer e = 1; e <= ne; e++) {
if (ed->Selected()) ed->Status().ShowAll();
ed++;
}
}
}
//=======================================================================
//function : HideAll
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::HideAll ()
{
if (!myDS.IsNull()) {
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
for (Standard_Integer ie = 1; ie <= ne; ie++) {
ed->Status().HideAll();
ed++;
}
}
}
//=======================================================================
//function : HideAll
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::HideAll (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::HideAll : unknown Shape");
Select(I);
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
for (Standard_Integer e = 1; e <= ne; e++) {
if (ed->Selected()) ed->Status().HideAll();
ed++;
}
}
}
//=======================================================================
//function : PartialHide
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::PartialHide ()
{
if (!myDS.IsNull()) {
Standard_Integer i,n = myShapes.Length();
if (myDebug)
cout << " Partial hiding" << endl << endl;
for (i = 1; i <= n; i++)
Hide(i);
Select();
}
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Hide ()
{
if (!myDS.IsNull()) {
Standard_Integer i,j,n = myShapes.Length();
if (myDebug)
cout << " Total hiding" << endl;
for (i = 1; i <= n; i++)
Hide(i);
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++)
if (i != j) Hide(i,j);
Select();
}
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Hide (const Standard_Integer I)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length(),
"HLRBRep_InternalAlgo::Hide : unknown Shape");
if (myDebug)
cout << " hiding the shape " << I << " by itself" << endl;
Select(I);
InitEdgeStatus();
HideSelected(I,Standard_True);
}
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Hide (const Standard_Integer I,
const Standard_Integer J)
{
if (!myDS.IsNull()) {
Standard_OutOfRange_Raise_if
(I == 0 || I > myShapes.Length() ||
J == 0 || J > myShapes.Length(),
"HLRBRep_InternalAlgo::Hide : unknown Shapes");
if (I == J) Hide(I);
else {
Standard_Integer* MinMaxShBI =
(Standard_Integer*)myShapes(I).MinMax();
Standard_Integer* MinMaxShBJ =
(Standard_Integer*)myShapes(J).MinMax();
if (((MaxShBJ1 - MinShBI1) & 0x80008000) == 0 &&
((MaxShBI1 - MinShBJ1) & 0x80008000) == 0 &&
((MaxShBJ2 - MinShBI2) & 0x80008000) == 0 &&
((MaxShBI2 - MinShBJ2) & 0x80008000) == 0 &&
((MaxShBJ3 - MinShBI3) & 0x80008000) == 0 &&
((MaxShBI3 - MinShBJ3) & 0x80008000) == 0 &&
((MaxShBJ4 - MinShBI4) & 0x80008000) == 0 &&
((MaxShBI4 - MinShBJ4) & 0x80008000) == 0 &&
((MaxShBJ5 - MinShBI5) & 0x80008000) == 0 &&
((MaxShBI5 - MinShBJ5) & 0x80008000) == 0 &&
((MaxShBJ6 - MinShBI6) & 0x80008000) == 0 &&
((MaxShBI6 - MinShBJ6) & 0x80008000) == 0 &&
((MaxShBJ7 - MinShBI7) & 0x80008000) == 0 &&
((MaxShBJ8 - MinShBI8) & 0x80008000) == 0) {
if (myDebug) {
cout << " hiding the shape " << I;
cout << " by the shape : " << J << endl;
}
SelectEdge(I);
SelectFace(J);
HideSelected(I,Standard_False);
}
}
}
}
//=======================================================================
//function : HideSelected
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
const Standard_Boolean SideFace)
{
Standard_Integer e,f,j,nbVisEdges,nbSelEdges,nbSelFaces,nbCache;
Standard_Integer nbFSide,nbFSimp;
#ifdef DEB
if (myDebug) {
nbPtIntersection = 0;
nbSegIntersection = 0;
nbOkIntersection = 0;
nbClassification = 0;
nbCal1Intersection = 0;
nbCal2Intersection = 0;
nbCal3Intersection = 0;
}
#endif
HLRBRep_ShapeBounds& SB = myShapes(I);
Standard_Integer v1,v2,e1,e2,f1,f2;
SB.Bounds(v1,v2,e1,e2,f1,f2);
if (e2 >= e1) {
myDS->InitBoundSort(SB.MinMax(),e1,e2);
HLRBRep_Hider Cache(myDS);
HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
Standard_Integer ne = myDS->NbEdges();
Standard_Integer nf = myDS->NbFaces();
if (myDebug) {
nbVisEdges = 0;
nbSelEdges = 0;
nbSelFaces = 0;
nbCache = 0;
nbFSide = 0;
nbFSimp = 0;
for (e = 1; e <= ne; e++) {
if (ed->Selected()) {
nbSelEdges++;
if (!ed->Status().AllHidden()) nbVisEdges++;
}
ed++;
}
for (f = 1; f <= nf; f++) {
if (fd->Selected()) {
nbSelFaces++;
if (fd->Hiding()) nbCache++;
if (fd->Side ()) nbFSide++;
if (fd->Simple()) nbFSimp++;
}
fd++;
}
cout << endl;
cout << "Vertices : " << setw(5) << myDS->NbVertices() << endl;
cout << "Edges : " << setw(5) << myDS->NbEdges() << " , ";
cout << "Selected : " << setw(5) << nbSelEdges << " , ";
cout << "Visibles : " << setw(5) << nbVisEdges << endl;
cout << "Faces : " << setw(5) << myDS->NbFaces() << " , ";
cout << "Selected : " << setw(5) << nbSelFaces << " , ";
cout << "Simple : " << setw(5) << nbFSimp << endl;
if (SideFace)
cout << "Side : " << setw(5) << nbFSide << " , ";
cout << "Cachantes : " << setw(5) << nbCache << endl << endl;
}
Standard_Integer QWE=0,QWEQWE;
QWEQWE=nf/10;
if (SideFace) {
j = 0;
fd = &(myDS->FDataArray().ChangeValue(1));
for (f = 1; f <= nf; f++) {
if (fd->Selected()) {
if (fd->Side()) {
if(TRACE10) {
if(++QWE>QWEQWE) {
QWE=0;
cout<<"*";
}
}
else {
if (myDebug && TRACE) {
j++;
cout << " OwnHiding " << j << " of face : " << f << endl;
}
}
Cache.OwnHiding(f);
}
}
fd++;
}
}
//--
Standard_Integer *Val = new Standard_Integer [nf+1];
Standard_Real *Size = new Standard_Real [nf+1];
Standard_Integer *Index = new Standard_Integer [nf+1];
fd = &(myDS->FDataArray().ChangeValue(1));
for (f = 1; f <= nf; f++) {
if(fd->Plane()) Val[f]=10;
else if(fd->Cylinder()) Val[f]=9;
else if(fd->Cone()) Val[f]=8;
else if(fd->Sphere()) Val[f]=7;
else if(fd->Torus()) Val[f]=6;
else Val[f]=0;
if(fd->Cut()) Val[f]-=10;
if(fd->Side()) Val[f]-=100;
if(fd->WithOutL()) Val[f]-=20;
Size[f]=fd->Size();
fd++;
}
for(Standard_Integer tt=1;tt<=nf;tt++) {
Index[tt]=tt;
}
//-- ======================================================================
/* Standard_Boolean TriOk; //-- a refaire
do {
Standard_Integer t,tp1;
TriOk=Standard_True;
for(t=1,tp1=2;t<nf;t++,tp1++) {
if(Val[Index[t]]<Val[Index[tp1]]) {
Standard_Integer q=Index[t]; Index[t]=Index[tp1]; Index[tp1]=q;
TriOk=Standard_False;
}
else if(Val[Index[t]]==Val[Index[tp1]]) {
if(Size[Index[t]]<Size[Index[tp1]]) {
Standard_Integer q=Index[t]; Index[t]=Index[tp1]; Index[tp1]=q;
TriOk=Standard_False;
}
}
}
}
while(TriOk==Standard_False);
*/
//-- ======================================================================
if(nf>2) {
Standard_Integer i,ir,j,l;
Standard_Integer rra;
l=(nf>>1)+1;
ir=nf;
for(;;) {
if(l>1) {
rra=Index[--l];
}
else {
rra=Index[ir];
Index[ir]=Index[1];
if(--ir == 1) {
Index[1]=rra;
break;
}
}
i=l;
j=l+l;
while(j<=ir) {
if(j<ir) {
if(Val[Index[j]] > Val[Index[j+1]])
j++;
else if(Val[Index[j]] == Val[Index[j+1]]) {
if(Size[Index[j]] > Size[Index[j+1]])
j++;
}
}
if(Val[rra] > Val[Index[j]]) {
Index[i]=Index[j];
i=j;
j<<=1;
}
else if((Val[rra] == Val[Index[j]]) && (Size[rra] > Size[Index[j]])) {
Index[i]=Index[j];
i=j;
j<<=1;
}
else {
j=ir+1;
}
}
Index[i]=rra;
}
}
j = 0;
HLRBRep_Array1OfFData& FD = myDS->FDataArray();
QWE=0;
for (f = 1; f <= nf; f++) {
Standard_Integer fi = Index[f];
fd=&(FD.ChangeValue(fi));
if (fd->Selected()) {
if (fd->Hiding()) {
if(TRACE10 && TRACE==Standard_False) {
if(++QWE>QWEQWE) {
cout<<".";
QWE=0;
}
}
else if (myDebug && TRACE) {
static int rty=0;
j++;
printf("%6d",fi); fflush(stdout);
if(++rty>25) { rty=0; printf("\n"); }
}
Cache.Hide(fi,myMapOfShapeTool);
}
}
}
delete Val;
delete Size;
delete Index;
#ifdef DEB
if (myDebug) {
fd = &(myDS->FDataArray().ChangeValue(1));
nbFSimp = 0;
for (f = 1; f <= nf; f++) {
if (fd->Selected() && fd->Simple())
nbFSimp++;
fd++;
}
cout << "\n";
cout << "Simple Faces : ";
cout << nbFSimp << "\n";
cout << "Intersections calculees : ";
cout << nbCal2Intersection << "\n";
cout << "Intersections Ok : ";
cout << nbOkIntersection << "\n";
cout << "Points : ";
cout << nbPtIntersection << "\n";
cout << "Segments : ";
cout << nbSegIntersection << "\n";
cout << "Classification : ";
cout << nbClassification << "\n";
cout << "Intersections curve-surface : ";
cout << nbCal3Intersection << "\n";
cout << endl << endl;
}
#endif
}
}
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
void HLRBRep_InternalAlgo::Debug (const Standard_Boolean deb)
{ myDebug = deb; }
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_InternalAlgo::Debug () const
{ return myDebug; }
//=======================================================================
//function : DataStructure
//purpose :
//=======================================================================
Handle(HLRBRep_Data) HLRBRep_InternalAlgo::DataStructure () const
{ return myDS; }

View File

@@ -0,0 +1,127 @@
-- File: Intersector.cdl
-- Created: Wed Aug 26 18:11:37 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class Intersector from HLRBRep
---Purpose: The Intersector computes 2D intersections of the
-- projections of 3D curves.
--
-- It can also computes the intersection of a 3D line
-- and a surface.
uses
Address from Standard,
Integer from Standard,
Boolean from Standard,
Real from Standard,
Lin from gp,
IntersectionPoint from IntRes2d,
IntersectionSegment from IntRes2d,
IntersectionPoint from IntCurveSurface,
IntersectionSegment from IntCurveSurface,
Curve from HLRBRep,
CInter from HLRBRep,
InterCSurf from HLRBRep
raises
UndefinedDerivative from StdFail
is
Create returns Intersector from HLRBRep;
Perform(me : in out;
A1 : Address from Standard; -- as HLRBRep_EDataOfData
da1,db1 : Real from Standard)
---Purpose: Performs the auto intersection of an edge. The
-- edge domain is cutted at start with da1*(b-a) and
-- at end with db1*(b-a).
is static;
Perform(me : in out;
nA : Integer from Standard;
A1 : Address from Standard; -- as HLRBRep_EDataOfData
da1,db1 : Real from Standard;
nB : Integer from Standard;
A2 : Address from Standard; -- as HLRBRep_EDataOfData
da2,db2 : Real from Standard;
NoBound : Boolean from Standard)
---Purpose: Performs the intersection between the two edges.
-- The edges domains are cutted at start with
-- da*(b-a) and at end with db*(b-a).
is static;
SimulateOnePoint(me:in out;
A1 : Address from Standard; -- as HLRBRep_EDataOfData
U : Real from Standard;
A2 : Address from Standard; -- as HLRBRep_EDataOfData
V : Real from Standard)
---Purpose: Create a single IntersectionPoint (U on A1) (V on A2)
-- The point is middle on both curves.
is static;
--
-- Methods used to intersect a line from the eye with a surface
--
Load(me : in out;
A : out Address from Standard) -- as BRepAdaptor_Surface
is static;
Perform(me : in out;
L : Lin from gp;
P : Real from Standard)
is static;
--
-- Methods to get the results
--
IsDone(me) returns Boolean from Standard
is static;
NbPoints(me) returns Integer from Standard
is static;
Point(me; N : Integer from Standard)
---C++: return const &
returns IntersectionPoint from IntRes2d
is static;
CSPoint(me; N : Integer from Standard)
---C++: return const &
returns IntersectionPoint from IntCurveSurface
is static;
NbSegments(me) returns Integer from Standard
is static;
Segment(me; N : Integer)
---C++: return const &
returns IntersectionSegment from IntRes2d
is static;
CSSegment(me; N : Integer)
---C++: return const &
returns IntersectionSegment from IntCurveSurface
is static;
Destroy(me : in out);
---C++: alias ~
fields
mySinglePoint : IntersectionPoint from IntRes2d;
myTypePerform : Integer from Standard;
myIntersector : CInter from HLRBRep;
myCSIntersector : InterCSurf from HLRBRep;
mySurface : Address from Standard;
myPolyhedron : Address from Standard;
end Intersector;

View File

@@ -0,0 +1,731 @@
// File: HLRBRep_Intersector.gxx
// Created: Thu Oct 22 11:37:24 1992
// Author: Christophe MARION
// <cma@sdsun1>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_Intersector.ixx>
#include <HLRBRep_EdgeData.hxx>
#include <HLRBRep_Curve.hxx>
#include <HLRBRep_SurfaceTool.hxx>
#include <HLRBRep_ThePolyhedronOfInterCSurf.hxx>
#include <HLRBRep_ThePolygonOfInterCSurf.hxx>
#include <gp.hxx>
#include <Bnd_Box.hxx>
#include <ElCLib.hxx>
#include <IntImpParGen.hxx>
#include <IntRes2d_Position.hxx>
#include <IntRes2d_Transition.hxx>
#include <HLRBRep_CurveTool.hxx>
#include <stdio.h>
#define PERF 0
#if PERF
static Standard_Integer NbIntersCS=0;
static Standard_Integer NbIntersCSVides=0;
static Standard_Integer NbIntersAuto=0;
static Standard_Integer NbIntersSimulate=0;
static Standard_Integer NbInters=0;
static Standard_Integer NbIntersVides=0;
static Standard_Integer NbInters1Segment=0;
static Standard_Integer NbInters1Point=0;
static Standard_Integer NbIntersNPoints=0;
static Standard_Integer NbIntersNSegments=0;
static Standard_Integer NbIntersPointEtSegment=0;
#endif
//=======================================================================
//function : HLRBRep_Intersector
//purpose :
//=======================================================================
HLRBRep_Intersector::HLRBRep_Intersector () :
myPolyhedron(NULL)
{
#if PERF
if(NbInters) {
printf("\n--------------------------------------");
printf("\nNbIntersSimulate : %6d",NbIntersSimulate);
printf("\nNbIntersCrvSurf : %6d",NbIntersCS);
printf("\n -> vide : %6d",NbIntersCSVides);
printf("\nNbAutoInters : %6d\n",NbIntersAuto);
printf("\nNbInters : %6d",NbInters);
printf("\n Vides : %6d",NbIntersVides);
printf("\n 1 Segment : %6d",NbInters1Segment);
printf("\n 1 Point : %6d",NbInters1Point);
printf("\n >1 Point : %6d",NbIntersNPoints);
printf("\n >1 Segment : %6d",NbIntersNSegments);
printf("\n >1 Pt et Seg : %6d",NbIntersPointEtSegment);
printf("\n--------------------------------------\n");
}
NbIntersSimulate=NbIntersAuto=NbIntersCS
=NbInters=NbIntersVides=NbInters1Segment=NbInters1Point=NbIntersNPoints
= NbIntersNSegments=NbIntersPointEtSegment=NbIntersCSVides=0;
#endif
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void HLRBRep_Intersector::Perform (const Standard_Address A1,
const Standard_Real da1,
const Standard_Real db1)
{
#if PERF
NbIntersAuto++;
#endif
Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
myTypePerform = 1;
gp_Pnt2d pa,pb;//,pa1,pb1;
Standard_Real a,b,d,tol;
Standard_ShortReal ta,tb;
((HLRBRep_EdgeData*) A1)->Status().Bounds(a,ta,b,tb);
d = b - a;
if (da1 != 0) a = a + d * da1;
if (db1 != 0) b = b - d * db1;
((HLRBRep_Curve*)myC1)->D0(a,pa);
((HLRBRep_Curve*)myC1)->D0(b,pb);
a = ((HLRBRep_Curve*)myC1)->Parameter2d(a);
b = ((HLRBRep_Curve*)myC1)->Parameter2d(b);
IntRes2d_Domain D1(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb);
tol = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
myIntersector.Perform(myC1,D1,tol,tol);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void HLRBRep_Intersector::Perform (const Standard_Integer nA,
const Standard_Address A1,
const Standard_Real da1,
const Standard_Real db1,
const Standard_Integer nB,
const Standard_Address A2,
const Standard_Real da2,
const Standard_Real db2,
const Standard_Boolean EnBout)
{
// if(EnBout) {
// myTypePerform=43;
// return;
// }
Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
Standard_Address myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
myTypePerform = 1;
gp_Pnt2d pa1,pb1,pa2,pb2;
gp_Vec2d va1,vb1,va2,vb2;
Standard_Real a1,b1,a2,b2,d,dd,tol,tol1,tol2;
Standard_ShortReal ta,tb;
tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance());
if (tol1 > tol2) tol = tol1;
else tol = tol2;
Standard_Boolean PasBon;
Standard_Real decalagea1=100.0;
Standard_Real decalagea2=100.0;
Standard_Real decalageb1=100.0;
Standard_Real decalageb2=100.0;
do {
PasBon=Standard_False;
((HLRBRep_EdgeData*) A1)->Status().Bounds(a1,ta,b1,tb); //-- -> Parametres 3d
Standard_Real mtol = tol;
if(mtol<ta) mtol=ta;
if(mtol<tb) mtol=tb;
d = b1 - a1;
Standard_Real pdist = tol;
if(pdist<0.0000001) pdist = 0.0000001;
if (da1 != 0) {
//-- a = a + d * da1;
((HLRBRep_Curve*)myC1)->D1(a1,pa1,va1);
Standard_Real qwe=va1.Magnitude();
if(qwe>1e-12) {
dd=pdist*decalagea1/qwe;
if(dd<d*0.4) {
a1+=dd;
}
else {
a1+= d * da1; decalagea1=-1;
}
}
else {
a1+=d * da1; decalagea1=-1;
}
}
if (db1 != 0) {
//-- b = b - d * db1;
((HLRBRep_Curve*)myC1)->D1(b1,pb1,vb1);
Standard_Real qwe=vb1.Magnitude();
if(qwe>1e-12) {
dd=pdist*decalageb1/qwe;
if(dd<d*0.4) {
b1-=dd;
}
else {
b1-= d * db1; decalageb1=-1;
}
}
else {
b1-=d * db1; decalageb1=-1;
}
}
// if(EnBout) { //-- ************************************************************
// Standard_Real d=b1-a1;
// a1+=d*0.45;
// b1-=d*0.45;
// }
((HLRBRep_Curve*)myC1)->D0(a1,pa1);
((HLRBRep_Curve*)myC1)->D0(b1,pb1);
a1 = ((HLRBRep_Curve*)myC1)->Parameter2d(a1);
b1 = ((HLRBRep_Curve*)myC1)->Parameter2d(b1);
if(EnBout) {
ta=tb=-1.;
}
if(ta>tol) ta=(Standard_ShortReal) tol;
if(tb>tol) tb=(Standard_ShortReal) tol;
IntRes2d_Domain D1(pa1,a1,(Standard_Real)ta,pb1,b1,(Standard_Real)tb);
((HLRBRep_EdgeData*) A2)->Status().Bounds(a2,ta,b2,tb);
mtol = tol;
if(mtol<ta) mtol=ta;
if(mtol<tb) mtol=tb;
d = b2-a2;
if (da2 != 0) {
//-- a = a + d * da2;
((HLRBRep_Curve*)myC2)->D1(a2,pa2,va2);
Standard_Real qwe=va2.Magnitude();
if(qwe>1e-12) {
dd=pdist*decalagea2/qwe;
if(dd<d*0.4) {
a2+=dd;
}
else {
a2+= d * da2; decalagea2=-1;
}
}
else {
a2+=d * da2; decalagea2=-1;
}
}
if (db2 != 0) {
//-- b = b - d * db2;
((HLRBRep_Curve*)myC2)->D1(b2,pb2,vb2);
Standard_Real qwe=vb2.Magnitude();
if(qwe>1e-12) {
dd=pdist*decalageb2/qwe;
if(dd<d*0.4) {
b2-=dd;
}
else {
b2-= d * db2; decalageb2=-1;
}
}
else {
b2-=d * db2; decalageb2=-1;
}
}
// if(EnBout) { //-- ************************************************************
// Standard_Real d=b2-a2;
// a2+=d*0.45;
// b2-=d*0.45;
// }
((HLRBRep_Curve*)myC2)->D0(a2,pa2);
((HLRBRep_Curve*)myC2)->D0(b2,pb2);
a2 = ((HLRBRep_Curve*)myC2)->Parameter2d(a2);
b2 = ((HLRBRep_Curve*)myC2)->Parameter2d(b2);
if(EnBout) {
ta=tb=-1.;
}
if(ta>tol) ta=(Standard_ShortReal) tol;
if(tb>tol) tb=(Standard_ShortReal) tol;
IntRes2d_Domain D2(pa2,a2,(Standard_Real)ta,pb2,b2,(Standard_Real)tb);
if(EnBout) {
Standard_Real a1a2 = (da1 || da2)? pa1.Distance(pa2) : RealLast();
Standard_Real a1b2 = (da1 || db2)? pa1.Distance(pb2) : RealLast();
Standard_Real b1a2 = (db1 || da2)? pb1.Distance(pa2) : RealLast();
Standard_Real b1b2 = (db1 || db2)? pb1.Distance(pb2) : RealLast();
Standard_Integer cote=1;
Standard_Real mindist = a1a2; //-- cas 1
if(mindist>a1b2) { mindist = a1b2; cote=2; }
if(mindist>b1a2) { mindist = b1a2; cote=3; }
if(mindist>b1b2) { mindist = b1b2; cote=4; }
//--printf("\n----- Edge %3d %3d [%7.5g %7.5g] [%7.5g %7.5g] Mindist:%8.5g 1000*Tol:%8.5g\n",
//-- nA,nB,decalagea1,decalageb1,decalagea2,decalageb2,mindist,1000.0*tol);
if(mindist < tol*1000) {
PasBon=Standard_True;
switch (cote) {
case 1: { decalagea1*=2; decalagea2*=2; break; }
case 2: { decalagea1*=2; decalageb2*=2; break; }
case 3: { decalageb1*=2; decalagea2*=2; break; }
default: { decalageb1*=2; decalageb2*=2; break; }
}
if(decalagea1<0.0 || decalagea2<0.0 || decalageb1<0.0 || decalageb2<=0.0) {
PasBon=Standard_False;
}
}
}
if(PasBon==Standard_False) {
myIntersector.Perform(myC1,D1,myC2,D2,tol,tol);
}
}
while(PasBon);
#if PERF
NbInters++;
if(myIntersector.NbPoints()==1) {
if(myIntersector.NbSegments()==0) {
NbInters1Point++;
}
else {
NbIntersPointEtSegment++;
}
}
else if(myIntersector.NbPoints()==0) {
if(myIntersector.NbSegments()==0) {
NbIntersVides++;
}
else if(myIntersector.NbSegments()==1) {
NbInters1Segment++;
}
else {
NbIntersNSegments++;
}
}
else {
if(myIntersector.NbSegments()==0) {
NbIntersNPoints++;
}
else {
NbIntersPointEtSegment++;
}
}
#endif
}
//=======================================================================
//function : SimulateOnePoint
//purpose :
//=======================================================================
void HLRBRep_Intersector::SimulateOnePoint(const Standard_Address A1,
const Standard_Real u,
const Standard_Address A2,
const Standard_Real v) {
#if PERF
NbIntersSimulate++;
#endif
Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
Standard_Address myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
Standard_Real u3= ((HLRBRep_Curve*)myC1)->Parameter3d(u);
Standard_Real v3= ((HLRBRep_Curve*)myC2)->Parameter3d(v);
gp_Pnt2d P13,P23;
gp_Vec2d T13,T23;
((HLRBRep_Curve*)myC1)->D1(u3,P13,T13);
((HLRBRep_Curve*)myC2)->D1(v3,P23,T23);
IntRes2d_Transition Tr1,Tr2;
IntRes2d_Position Pos1,Pos2;
Pos1=Pos2=IntRes2d_Middle;
IntImpParGen::DetermineTransition(Pos1,T13,Tr1,Pos2,T23,Tr2,0.0);
myTypePerform = 0;
mySinglePoint.SetValues(P13,u,v,Tr1,Tr2,Standard_False);
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void HLRBRep_Intersector::Load (Standard_Address& A)
{
mySurface = A;
if (myPolyhedron != NULL) {
delete (HLRBRep_ThePolyhedronOfInterCSurf*)myPolyhedron;
myPolyhedron = NULL;
}
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void HLRBRep_Intersector::Perform (const gp_Lin& L,
const Standard_Real P)
{
myTypePerform = 2;
GeomAbs_SurfaceType typ = HLRBRep_SurfaceTool::GetType(mySurface);
switch (typ) {
case GeomAbs_Plane :
case GeomAbs_Cylinder :
case GeomAbs_Cone :
case GeomAbs_Sphere :
case GeomAbs_Torus :
myCSIntersector.Perform(L,mySurface);
break;
default :
{
if (myPolyhedron == NULL) {
Standard_Integer nbsu,nbsv;
Standard_Real u1,v1,u2,v2;
u1 = HLRBRep_SurfaceTool::FirstUParameter(mySurface);
v1 = HLRBRep_SurfaceTool::FirstVParameter(mySurface);
u2 = HLRBRep_SurfaceTool::LastUParameter(mySurface);
v2 = HLRBRep_SurfaceTool::LastVParameter(mySurface);
nbsu = HLRBRep_SurfaceTool::NbSamplesU(mySurface,u1,u2);
nbsv = HLRBRep_SurfaceTool::NbSamplesV(mySurface,v1,v2);
myPolyhedron = (Standard_Address)
(new HLRBRep_ThePolyhedronOfInterCSurf
(mySurface,nbsu,nbsv,u1,v1,u2,v2));
}
Standard_Real x0,y0,z0,x1,y1,z1,pmin,pmax;//,pp;
((HLRBRep_ThePolyhedronOfInterCSurf*)myPolyhedron)
->Bounding().Get(x0,y0,z0,x1,y1,z1);
#if 0
pmax = pmin = ElCLib::Parameter(L, gp_Pnt((x1+x0)*0.5,
(y1+y0)*0.5,
(z1+z0)*0.5));
Standard_Real d = (x1-x0) + (y1-y0) + (z1-z0);
pmin -= d;
pmax += d;
if (pmin > P) pmin = P - d;
if (pmax > P) pmax = P;
HLRBRep_ThePolygonOfInterCSurf Polygon(L,pmin,pmax,3);
myCSIntersector.Perform(L,Polygon,mySurface,
*((HLRBRep_ThePolyhedronOfInterCSurf*)
myPolyhedron));
break;
#else
//-- On va rejeter tous les points de parametres > P
Standard_Real p;
p = ElCLib::Parameter(L, gp_Pnt(x0,y0,z0)); pmin=pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x0,y0,z1)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x1,y0,z0)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x1,y0,z1)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x0,y1,z0)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x0,y1,z1)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x1,y1,z0)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
p = ElCLib::Parameter(L, gp_Pnt(x1,y1,z1)); if(pmin>p) pmin=p; if(pmax<p) pmax=p;
pmin-=0.000001; pmax+=0.000001;
if(pmin>P) { pmin=pmax+1; pmax=pmax+2; } //-- on va rejeter avec les boites
else {
if(pmax>P) pmax=P+0.0000001;
}
HLRBRep_ThePolygonOfInterCSurf Polygon(L,pmin,pmax,3);
myCSIntersector.Perform(L,Polygon,mySurface,
*((HLRBRep_ThePolyhedronOfInterCSurf*)
myPolyhedron));
break;
#endif
}
}
#if PERF
NbIntersCS++;
if(myCSIntersector.NbPoints()==0) {
NbIntersCSVides++;
}
#endif
}
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_Intersector::IsDone () const
{
if(myTypePerform == 1)
return myIntersector .IsDone();
else if(myTypePerform ==2)
return myCSIntersector.IsDone();
else
return(Standard_True);
}
//=======================================================================
//function : NbPoints
//purpose :
//=======================================================================
Standard_Integer HLRBRep_Intersector::NbPoints() const
{
if(myTypePerform==43) return(0);
if (myTypePerform == 1)
return myIntersector .NbPoints();
else if(myTypePerform == 2)
return myCSIntersector.NbPoints();
else
return(1);
}
//=======================================================================
//function : Point
//purpose :
//=======================================================================
const IntRes2d_IntersectionPoint &
HLRBRep_Intersector::Point (const Standard_Integer N) const
{
if(myTypePerform==0)
return(mySinglePoint);
else
return myIntersector.Point(N);
}
//=======================================================================
//function : CSPoint
//purpose :
//=======================================================================
const IntCurveSurface_IntersectionPoint &
HLRBRep_Intersector::CSPoint (const Standard_Integer N) const
{
return myCSIntersector.Point(N);
}
//=======================================================================
//function : NbSegments
//purpose :
//=======================================================================
Standard_Integer HLRBRep_Intersector::NbSegments () const
{
if(myTypePerform == 1)
return myIntersector .NbSegments();
else if(myTypePerform==2)
return myCSIntersector.NbSegments();
else
return(0);
}
//=======================================================================
//function : Segment
//purpose :
//=======================================================================
const IntRes2d_IntersectionSegment &
HLRBRep_Intersector::Segment (const Standard_Integer N) const
{
return myIntersector .Segment(N);
}
//=======================================================================
//function : CSSegment
//purpose :
//=======================================================================
const IntCurveSurface_IntersectionSegment &
HLRBRep_Intersector::CSSegment (const Standard_Integer N) const
{
return myCSIntersector.Segment(N);
}
//=======================================================================
//function : Destroy
//purpose :
//=======================================================================
void HLRBRep_Intersector::Destroy ()
{
if (myPolyhedron != NULL)
delete (HLRBRep_ThePolyhedronOfInterCSurf *)myPolyhedron;
}
/* ********************************************************************************
sauvegarde de l etat du 23 janvier 98
void HLRBRep_Intersector::Perform (const Standard_Integer nA,
const Standard_Address A1,
const Standard_Real da1,
const Standard_Real db1,
const Standard_Integer nB,
const Standard_Address A2,
const Standard_Real da2,
const Standard_Real db2,
const Standard_Boolean EnBout)
{
Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
Standard_Address myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
myTypePerform = 1;
gp_Pnt2d pa,pb;
Standard_Real a,b,d,tol,tol1,tol2;
Standard_ShortReal ta,tb;
tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance());
if (tol1 > tol2) tol = tol1;
else tol = tol2;
((HLRBRep_EdgeData*) A1)->Status().Bounds(a,ta,b,tb); //-- -> Parametres 3d
Standard_Real mtol = tol;
if(mtol<ta) mtol=ta;
if(mtol<tb) mtol=tb;
d = b - a;
if (da1 != 0) a = a + d * da1;
if (db1 != 0) b = b - d * db1;
((HLRBRep_Curve*)myC1)->D0(a,pa);
((HLRBRep_Curve*)myC1)->D0(b,pb);
a = ((HLRBRep_Curve*)myC1)->Parameter2d(a);
b = ((HLRBRep_Curve*)myC1)->Parameter2d(b);
if(EnBout) {
ta=tb=0;
}
if(ta>tol) ta=tol;
if(tb>tol) tb=tol;
IntRes2d_Domain D1(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb);
((HLRBRep_EdgeData*) A2)->Status().Bounds(a,ta,b,tb);
mtol = tol;
if(mtol<ta) mtol=ta;
if(mtol<tb) mtol=tb;
d = b - a;
if (da2 != 0) a = a + d * da2;
if (db2 != 0) b = b - d * db2;
((HLRBRep_Curve*)myC2)->D0(a,pa);
((HLRBRep_Curve*)myC2)->D0(b,pb);
a = ((HLRBRep_Curve*)myC2)->Parameter2d(a);
b = ((HLRBRep_Curve*)myC2)->Parameter2d(b);
if(EnBout) {
ta=tb=0;
}
if(ta>tol) ta=tol;
if(tb>tol) tb=tol;
IntRes2d_Domain D2(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb);
myIntersector.Perform(myC1,D1,myC2,D2,tol,tol);
#if PERF
NbInters++;
if(myIntersector.NbPoints()==1) {
if(myIntersector.NbSegments()==0) {
NbInters1Point++;
}
else {
NbIntersPointEtSegment++;
}
}
else if(myIntersector.NbPoints()==0) {
if(myIntersector.NbSegments()==0) {
NbIntersVides++;
}
else if(myIntersector.NbSegments()==1) {
NbInters1Segment++;
}
else {
NbIntersNSegments++;
}
}
else {
if(myIntersector.NbSegments()==0) {
NbIntersNPoints++;
}
else {
NbIntersPointEtSegment++;
}
}
#endif
}
******************************************************************************** */

274
src/HLRBRep/HLRBRep_LineTool.cdl Executable file
View File

@@ -0,0 +1,274 @@
-- File: HLRBRep_LineTool.cdl
-- Created: Wed Aug 18 14:58:10 1993
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1993
class LineTool from HLRBRep
---Purpose: The LineTool class provides class methods to
-- access the methodes of the Line.
uses
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,
Array1OfPnt from TColgp,
Array1OfReal from TColStd,
HArray1OfReal from TColStd,
Array1OfInteger from TColStd
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
--
-- Global methods - Apply to the whole Line.
--
FirstParameter(myclass; C : Lin from gp) returns Real
---C++: inline
;
LastParameter(myclass; C : Lin from gp) returns Real
---C++: inline
;
Continuity(myclass; C : Lin from gp) returns Shape from GeomAbs
---C++: inline
;
NbIntervals(myclass; C : Lin from gp; S : Shape from GeomAbs) returns Integer
---Purpose: If necessary, breaks the line in intervals of
-- continuity <S>. And returns the number of
-- intervals.
---C++: inline
;
Intervals(myclass; C :Lin from gp; T: out Array1OfReal from TColStd; Sh : Shape from GeomAbs)
---Purpose: Sets the current working interval.
raises
OutOfRange from Standard -- if Index < 1 or Index > NbIntervals
---C++: inline
;
--
-- Local methods - Apply to the current interval.
-- By default the current interval is the first.
--
IntervalFirst(myclass; C : Lin from gp) returns Real
---Purpose: Returns the first parameter of the current
-- interval.
---C++: inline
;
IntervalLast(myclass; C : Lin from gp) returns Real
---Purpose: Returns the last parameter of the current
-- interval.
---C++: inline
;
IntervalContinuity(myclass; C : Lin from gp) returns Shape from GeomAbs
---C++: inline
;
IsClosed(myclass; C : Lin from gp) returns Boolean
---C++: inline
;
IsPeriodic(myclass; C : Lin from gp) returns Boolean
---C++: inline
;
Period(myclass; C : Lin from gp) returns Real
raises
DomainError from Standard -- if the line is not periodic
---C++: inline
;
Value(myclass; C : Lin from gp; U : Real) returns Pnt from gp
--- Purpose : Computes the point of parameter U on the line.
---C++: inline
;
D0 (myclass; C : Lin from gp; U : Real; P : out Pnt from gp)
--- Purpose : Computes the point of parameter U on the line.
---C++: inline
;
D1 (myclass; C : Lin from gp; U : Real; P : out Pnt from gp ; V : out Vec from gp)
--- Purpose : Computes the point of parameter U on the line 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 : Lin from gp; 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 : Lin from gp; 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 : Lin from gp; 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 : Lin from gp; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
;
GetType(myclass; C : Lin from gp) returns CurveType from GeomAbs
---Purpose: Returns the type of the line 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 : Lin from gp) returns Lin from gp
raises
NoSuchObject from Standard
---C++: inline
;
Circle(myclass; C : Lin from gp) returns Circ from gp
raises
NoSuchObject from Standard
---C++: inline
;
Ellipse(myclass; C : Lin from gp) returns Elips from gp
raises
NoSuchObject from Standard
---C++: inline
;
Hyperbola(myclass; C : Lin from gp) returns Hypr from gp
raises
NoSuchObject from Standard
---C++: inline
;
Parabola(myclass; C : Lin from gp) returns Parab from gp
raises
NoSuchObject from Standard
---C++: inline
;
Bezier(myclass; C : Lin from gp) returns BezierCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
BSpline(myclass; C : Lin from gp) returns BSplineCurve from Geom
raises
NoSuchObject from Standard
---C++: inline
;
Degree(myclass; C : Lin from gp) returns Integer
raises
NoSuchObject from Standard
---C++: inline
;
NbPoles(myclass; C : Lin from gp) returns Integer
raises
NoSuchObject from Standard
---C++: inline
;
Poles(myclass; C : Lin from gp; TP : in out Array1OfPnt from TColgp)
raises
NoSuchObject from Standard,
OutOfRange from Standard -- if TP has not length NbPoles
---C++: inline
;
IsRational(myclass; C : Lin from gp) returns Boolean
raises
NoSuchObject from Standard
---C++: inline
;
PolesAndWeights(myclass; C : Lin from gp; TP : in out Array1OfPnt from TColgp;
TW : in out Array1OfReal from TColStd)
raises
NoSuchObject from Standard,
OutOfRange from Standard -- if TW has not length NbPoles
---C++: inline
;
NbKnots(myclass; C : Lin from gp) returns Integer
raises
NoSuchObject from Standard
---C++: inline
;
KnotsAndMultiplicities(myclass; C : Lin from gp;TK : in out Array1OfReal from TColStd;
TM : in out Array1OfInteger from TColStd)
raises
NoSuchObject from Standard,
OutOfRange from Standard -- if TK has not length NbKnots
---C++: inline
;
NbSamples(myclass; C: Lin from gp; U0,U1: Real from Standard)
---C++:inline
returns Integer from Standard;
--modified by NIZHNY-MKK Tue Nov 1 18:49:37 2005
SamplePars(myclass; C: Lin from gp; U0,U1: Real from Standard;
Defl: Real from Standard; NbMin: Integer from Standard;
Pars: in out HArray1OfReal from TColStd);
end LineTool;

View File

@@ -0,0 +1,8 @@
// File: HLRBRep_LineTool.cxx
// Created: Mon Dec 20 16:43:17 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <HLRBRep_LineTool.ixx>

160
src/HLRBRep/HLRBRep_LineTool.lxx Executable file
View File

@@ -0,0 +1,160 @@
// File: HLRBRep_LineTool.lxx
// Created: Wed Aug 18 15:06:22 1993
// Author: Christophe MARION
// <cma@sdsun1>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <gp_Hypr.hxx>
#include <gp_Parab.hxx>
#include <ElCLib.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_Array1OfReal.hxx>
inline Standard_Real HLRBRep_LineTool::FirstParameter(const gp_Lin&)
{ return RealFirst(); }
inline Standard_Real HLRBRep_LineTool::LastParameter(const gp_Lin& )
{ return RealLast(); }
inline GeomAbs_Shape HLRBRep_LineTool::Continuity( const gp_Lin& )
{ return GeomAbs_CN; }
inline Standard_Integer HLRBRep_LineTool::NbIntervals
(const gp_Lin& , const GeomAbs_Shape )
{ return 1; }
inline void HLRBRep_LineTool::Intervals
(const gp_Lin& , TColStd_Array1OfReal& , const GeomAbs_Shape)
{}
inline Standard_Real HLRBRep_LineTool::IntervalFirst(const gp_Lin& )
{ return RealFirst(); }
inline Standard_Real HLRBRep_LineTool::IntervalLast(const gp_Lin& )
{ return RealLast(); }
inline GeomAbs_Shape HLRBRep_LineTool::IntervalContinuity(const gp_Lin& )
{ return GeomAbs_CN; }
inline Standard_Boolean HLRBRep_LineTool::IsClosed( const gp_Lin& )
{ return Standard_False; }
inline Standard_Boolean HLRBRep_LineTool::IsPeriodic( const gp_Lin& )
{ return Standard_False; }
inline Standard_Real HLRBRep_LineTool::Period(const gp_Lin& )
{ return 0.; }
inline gp_Pnt HLRBRep_LineTool::Value(const gp_Lin& C,const Standard_Real U)
{ return ElCLib::Value(U,C); }
inline void HLRBRep_LineTool::D0
(const gp_Lin& C,const Standard_Real U, gp_Pnt& P)
{ P = ElCLib::Value(U,C); }
inline void HLRBRep_LineTool::D1
(const gp_Lin& C,const Standard_Real U,
gp_Pnt& P, gp_Vec& V)
{ ElCLib::D1(U,C,P,V); }
inline void HLRBRep_LineTool::D2
(const gp_Lin& C, const Standard_Real U,
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2)
{
ElCLib::D1(U,C,P,V1);
V2 = gp_Vec(0,0,0);
}
inline void HLRBRep_LineTool::D3
(const gp_Lin& C, const Standard_Real U,
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3)
{
ElCLib::D1(U,C,P,V1);
V2 = V3 = gp_Vec(0,0,0);
}
inline gp_Vec HLRBRep_LineTool::DN
(const gp_Lin& C, const Standard_Real U, const Standard_Integer N)
{ return ElCLib::DN(U,C,N); }
inline Standard_Real HLRBRep_LineTool::Resolution
( const gp_Lin& , const Standard_Real R3D)
{ return R3D; }
inline GeomAbs_CurveType HLRBRep_LineTool::GetType(const gp_Lin& )
{ return GeomAbs_Line; }
inline gp_Lin HLRBRep_LineTool::Line(const gp_Lin& C)
{ return C; }
inline gp_Circ HLRBRep_LineTool::Circle(const gp_Lin&)
{ return gp_Circ(); }
inline gp_Elips HLRBRep_LineTool::Ellipse(const gp_Lin&)
{ return gp_Elips(); }
inline gp_Hypr HLRBRep_LineTool::Hyperbola(const gp_Lin&)
{ return gp_Hypr(); }
inline gp_Parab HLRBRep_LineTool::Parabola(const gp_Lin&)
{ return gp_Parab(); }
inline Handle(Geom_BezierCurve) HLRBRep_LineTool::Bezier(const gp_Lin&)
{
Handle(Geom_BezierCurve) NullCurve;
return NullCurve;
}
inline Handle(Geom_BSplineCurve) HLRBRep_LineTool::BSpline(const gp_Lin&)
{
Handle(Geom_BSplineCurve) NullCurve;
return NullCurve;
}
inline Standard_Integer HLRBRep_LineTool::Degree(const gp_Lin& )
{ return 1; }
inline Standard_Integer HLRBRep_LineTool::NbPoles(const gp_Lin&)
{ return 0; }
inline void HLRBRep_LineTool::Poles(const gp_Lin&, TColgp_Array1OfPnt&)
{}
inline Standard_Boolean HLRBRep_LineTool::IsRational(const gp_Lin&)
{ return Standard_False; }
inline void HLRBRep_LineTool::PolesAndWeights
(const gp_Lin&, TColgp_Array1OfPnt&, TColStd_Array1OfReal&)
{}
inline Standard_Integer HLRBRep_LineTool::NbKnots(const gp_Lin&)
{ return 0; }
inline void HLRBRep_LineTool::KnotsAndMultiplicities
(const gp_Lin&, TColStd_Array1OfReal&, TColStd_Array1OfInteger&)
{}
inline Standard_Integer HLRBRep_LineTool::NbSamples(const gp_Lin&,
const Standard_Real,
const Standard_Real )
{ return 3; }
// modified by NIZHNY-MKK Tue Nov 1 18:49:28 2005
inline void HLRBRep_LineTool::SamplePars (const gp_Lin& C,
const Standard_Real U0,
const Standard_Real U1,
const Standard_Real Defl,
const Standard_Integer NbMin,
Handle(TColStd_HArray1OfReal)& Pars) {
Pars = new TColStd_HArray1OfReal(1, 3);
Pars->SetValue(1, U0);
Pars->SetValue(2, (U0 + U1) * 0.5);
Pars->SetValue(3, U1);
}

571
src/HLRBRep/HLRBRep_PolyAlgo.cdl Executable file
View File

@@ -0,0 +1,571 @@
-- File: PolyAlgo.cdl
-- Created: Tue Feb 18 10:36:07 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class PolyAlgo from HLRBRep inherits TShared from MMgt
---Purpose: A framework to compute the shape as seen in
-- a projection plane. This is done by calculating
-- the visible and the hidden parts of the shape.
-- HLRBRep_PolyAlgo works with three types of entity:
-- - shapes to be visualized (these shapes must
-- have already been triangulated.)
-- - edges in these shapes (these edges are
-- defined as polygonal lines on the
-- triangulation of the shape, and are the basic
-- entities which will be visualized or hidden), and
-- - triangles in these shapes which hide the edges.
-- HLRBRep_PolyAlgo is based on the principle
-- of comparing each edge of the shape to be
-- visualized with each of the triangles produced
-- by the triangulation of the shape, and
-- calculating the visible and the hidden parts of each edge.
-- For a given projection, HLRBRep_PolyAlgo
-- calculates a set of lines characteristic of the
-- object being represented. It is also used in
-- conjunction with the HLRBRep_PolyHLRToShape extraction
-- utilities, which reconstruct a new, simplified
-- shape from a selection of calculation results.
-- This new shape is made up of edges, which
-- represent the shape visualized in the projection.
-- HLRBRep_PolyAlgo works with a polyhedral
-- simplification of the shape whereas
-- HLRBRep_Algo takes the shape itself into
-- account. When you use HLRBRep_Algo, you
-- obtain an exact result, whereas, when you use
-- HLRBRep_PolyAlgo, you reduce computation
-- time but obtain polygonal segments.
-- An HLRBRep_PolyAlgo object provides a framework for:
-- - defining the point of view
-- - identifying the shape or shapes to be visualized
-- - calculating the outlines
-- - calculating the visible and hidden lines of the shape.
-- Warning
-- - Superimposed lines are not eliminated by this algorithm.
-- - There must be no unfinished objects inside the shape you wish to visualize.
-- - Points are not treated.
-- - Note that this is not the sort of algorithm
-- used in generating shading, which calculates
-- the visible and hidden parts of each face in a
-- shape to be visualized by comparing each
-- face in the shape with every other face in the same shape.
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
Real from Standard,
Array1OfInteger from TColStd,
Array1OfTransient from TColStd,
SequenceOfShape from TopTools,
IndexedMapOfShape from TopTools,
MapOfShape from TopTools,
ListOfShape from TopTools,
Shape from GeomAbs,
Edge from TopoDS,
Shape from TopoDS,
Surface from Geom,
Curve2d from BRepAdaptor,
Curve from BRepAdaptor,
Surface from BRepAdaptor,
PolyInternalData from HLRAlgo,
ListOfBPoint from HLRAlgo,
TriangleData from HLRAlgo,
Projector from HLRAlgo,
EdgeStatus from HLRAlgo,
PolyAlgo from HLRAlgo
raises
OutOfRange from Standard
is
Create
returns mutable PolyAlgo from HLRBRep;
---Purpose: Constructs an empty framework for the
-- calculation of the visible and hidden lines of a shape in a projection.
-- Use the functions:
-- - Projector to define the point of view
-- - Load to select the shape or shapes to be visualized
-- - Update to compute the visible and hidden lines of the shape.
-- Warning
-- The shape or shapes to be visualized must have already been triangulated.
Create(A : PolyAlgo from HLRBRep)
returns mutable PolyAlgo from HLRBRep;
Create(S : Shape from TopoDS)
returns mutable PolyAlgo from HLRBRep;
NbShapes(me) returns Integer from Standard
---C++: inline
is static;
Shape(me : mutable; I : Integer from Standard)
returns Shape from TopoDS
raises OutOfRange from Standard
---C++: return &
is static;
Remove(me : mutable; I : Integer from Standard)
raises OutOfRange from Standard
---Purpose: remove the Shape of Index <I>.
is static;
Index(me; S : Shape from TopoDS) returns Integer from Standard
---Purpose: return the index of the Shape <S> and return 0 if
-- the Shape <S> is not found.
is static;
Load(me : mutable; S : Shape from TopoDS)
---Purpose: Loads the shape S into this framework.
-- Warning S must have already been triangulated.
---C++: inline
is static;
Algo(me) returns PolyAlgo from HLRAlgo
is static;
Projector(me) returns Projector from HLRAlgo
---Purpose: Sets the parameters of the view for this framework.
-- These parameters are defined by an HLRAlgo_Projector object,
-- which is returned by the Projector function on a Prs3d_Projector object.
---C++: return const &
---C++: inline
is static;
Projector(me : mutable; P : Projector from HLRAlgo)
---C++: inline
is static;
Angle(me) returns Real from Standard
---C++: inline
is static;
Angle(me : mutable; Ang : Real from Standard)
---C++: inline
is static;
TolAngular(me) returns Real from Standard
---C++: inline
is static;
TolAngular(me : mutable; Tol : Real from Standard)
---C++: inline
is static;
TolCoef(me) returns Real from Standard
---C++: inline
is static;
TolCoef(me : mutable; Tol : Real from Standard)
---C++: inline
is static;
Update(me : mutable)
---Purpose: Launches calculation of outlines of the shape
-- visualized by this framework. Used after setting the point of view and
-- defining the shape or shapes to be visualized.
is static;
MakeShape(me) returns Shape from TopoDS
is static private;
InitShape(me : mutable;
Shape : Shape from TopoDS;
IsoledF : out Boolean from Standard;
IsoledE : out Boolean from Standard)
returns Integer from Standard
is static private;
StoreShell(me : mutable;
Shape : Shape from TopoDS;
iShell : out Integer from Standard;
Shell : out Array1OfTransient from TColStd;
IsoledF,IsoledE : Boolean from Standard;
ES : out Array1OfInteger from TColStd;
PD,PID : out Array1OfTransient from TColStd;
ShapeMap1 : out MapOfShape from TopTools;
ShapeMap2 : out MapOfShape from TopTools)
is static private;
Normal(me;
iNode : Integer from Standard;
Nod1Indices : Address from Standard;
Nod1RValues : Address from Standard;
TData : out Address from Standard;
PISeg : out Address from Standard;
PINod : out Address from Standard;
orient : Boolean from Standard)
returns Boolean from Standard
is static private;
AverageNormal(me; iNode : Integer from Standard;
Nod1Indices : Address from Standard;
TData : out Address from Standard;
PISeg : out Address from Standard;
PINod : out Address from Standard;
X,Y,Z : out Real from Standard)
returns Boolean from Standard
is static private;
AddNormalOnTriangle(me; iTri : Integer from Standard;
iNode : Integer from Standard;
jNode : out Integer from Standard;
TData : out Address from Standard;
PINod : out Address from Standard;
X,Y,Z : out Real from Standard;
OK : out Boolean from Standard)
is static private;
InitBiPointsWithConnexity
(me : mutable;
e : Integer from Standard;
E : out Edge from TopoDS;
List : out ListOfBPoint from HLRAlgo;
PID : out Array1OfTransient from TColStd;
LS : out ListOfShape from TopTools;
connex : Boolean from Standard)
is static private;
Interpolation(me;
List : out ListOfBPoint from HLRAlgo;
X1 ,Y1 ,Z1 : out Real from Standard;
X2 ,Y2 ,Z2 : out Real from Standard;
XTI1,YTI1,ZTI1 : out Real from Standard;
XTI2,YTI2,ZTI2 : out Real from Standard;
e : Integer from Standard;
U1,U2 : out Real from Standard;
Nod11Indices : out Address from Standard;
Nod11RValues : out Address from Standard;
Nod12Indices : out Address from Standard;
Nod12RValues : out Address from Standard;
i1p1,i1p2,i1 : Integer from Standard;
pid1 : PolyInternalData from HLRAlgo;
TData1 : out Address from Standard;
PISeg1 : out Address from Standard;
PINod1 : out Address from Standard)
is static private;
Interpolation(me;
List : out ListOfBPoint from HLRAlgo;
X1 ,Y1 ,Z1 : out Real from Standard;
X2 ,Y2 ,Z2 : out Real from Standard;
XTI1,YTI1,ZTI1 : out Real from Standard;
XTI2,YTI2,ZTI2 : out Real from Standard;
e : Integer from Standard;
U1,U2 : out Real from Standard;
rg : Shape from GeomAbs;
Nod11Indices : out Address from Standard;
Nod11RValues : out Address from Standard;
Nod12Indices : out Address from Standard;
Nod12RValues : out Address from Standard;
i1p1,i1p2,i1 : Integer from Standard;
pid1 : PolyInternalData from HLRAlgo;
TData1 : out Address from Standard;
PISeg1 : out Address from Standard;
PINod1 : out Address from Standard;
Nod21Indices : out Address from Standard;
Nod21RValues : out Address from Standard;
Nod22Indices : out Address from Standard;
Nod22RValues : out Address from Standard;
i2p1,i2p2,i2 : Integer from Standard;
pid2 : PolyInternalData from HLRAlgo;
TData2 : out Address from Standard;
PISeg2 : out Address from Standard;
PINod2 : out Address from Standard)
is static private;
Interpolation(me;
U1,U2 : Real from Standard;
Nod1RValues : Address from Standard;
Nod2RValues : Address from Standard;
X3,Y3,Z3 : out Real from Standard;
XT3,YT3,ZT3 : out Real from Standard;
coef3,U3 : out Real from Standard;
mP3P1 : out Boolean from Standard)
returns Boolean from Standard
is static private;
MoveOrInsertPoint(me;
List : out ListOfBPoint from HLRAlgo;
X1 ,Y1 ,Z1 : out Real from Standard;
X2 ,Y2 ,Z2 : out Real from Standard;
XTI1,YTI1,ZTI1 : out Real from Standard;
XTI2,YTI2,ZTI2 : out Real from Standard;
e : Integer from Standard;
U1,U2 : out Real from Standard;
Nod11Indices : out Address from Standard;
Nod11RValues : out Address from Standard;
Nod12Indices : out Address from Standard;
Nod12RValues : out Address from Standard;
i1p1,i1p2,i1 : Integer from Standard;
pid1 : PolyInternalData from HLRAlgo;
TData1 : out Address from Standard;
PISeg1 : out Address from Standard;
PINod1 : out Address from Standard;
X3,Y3,Z3 : Real from Standard;
XT3,YT3,ZT3 : Real from Standard;
coef3 : Real from Standard;
U3 : Real from Standard;
insP3,mP3P1 : Boolean from Standard;
flag : Boolean from Standard)
is static private;
MoveOrInsertPoint(me;
List : out ListOfBPoint from HLRAlgo;
X1 ,Y1 ,Z1 : out Real from Standard;
X2 ,Y2 ,Z2 : out Real from Standard;
XTI1,YTI1,ZTI1 : out Real from Standard;
XTI2,YTI2,ZTI2 : out Real from Standard;
e : Integer from Standard;
U1,U2 : out Real from Standard;
Nod11Indices : out Address from Standard;
Nod11RValues : out Address from Standard;
Nod12Indices : out Address from Standard;
Nod12RValues : out Address from Standard;
i1p1,i1p2,i1 : Integer from Standard;
pid1 : PolyInternalData from HLRAlgo;
TData1 : out Address from Standard;
PISeg1 : out Address from Standard;
PINod1 : out Address from Standard;
Nod21Indices : out Address from Standard;
Nod21RValues : out Address from Standard;
Nod22Indices : out Address from Standard;
Nod22RValues : out Address from Standard;
i2p1,i2p2,i2 : Integer from Standard;
pid2 : PolyInternalData from HLRAlgo;
TData2 : out Address from Standard;
PISeg2 : out Address from Standard;
PINod2 : out Address from Standard;
X3,Y3,Z3 : Real from Standard;
XT3,YT3,ZT3 : Real from Standard;
coef3 : Real from Standard;
U3 : Real from Standard;
insP3,mP3P1 : Boolean from Standard;
flag : Boolean from Standard)
is static private;
MoveOrInsertPoint(me;
List : out ListOfBPoint from HLRAlgo;
X1 ,Y1 ,Z1 : out Real from Standard;
X2 ,Y2 ,Z2 : out Real from Standard;
XTI1,YTI1,ZTI1 : out Real from Standard;
XTI2,YTI2,ZTI2 : out Real from Standard;
e : Integer from Standard;
U1,U2 : out Real from Standard;
Nod11Indices : out Address from Standard;
Nod11RValues : out Address from Standard;
Nod12Indices : out Address from Standard;
Nod12RValues : out Address from Standard;
i1p1,i1p2,i1 : Integer from Standard;
pid1 : PolyInternalData from HLRAlgo;
TData1 : out Address from Standard;
PISeg1 : out Address from Standard;
PINod1 : out Address from Standard;
Nod21Indices : out Address from Standard;
Nod21RValues : out Address from Standard;
Nod22Indices : out Address from Standard;
Nod22RValues : out Address from Standard;
i2p1,i2p2,i2 : Integer from Standard;
pid2 : PolyInternalData from HLRAlgo;
TData2 : out Address from Standard;
PISeg2 : out Address from Standard;
PINod2 : out Address from Standard;
X3,Y3,Z3 : Real from Standard;
XT3,YT3,ZT3 : Real from Standard;
coef3 : Real from Standard;
U3 : Real from Standard;
insP3,mP3P1 : Boolean from Standard;
X4,Y4,Z4 : Real from Standard;
XT4,YT4,ZT4 : Real from Standard;
coef4 : Real from Standard;
U4 : Real from Standard;
insP4,mP4P1 : Boolean from Standard;
flag : Boolean from Standard)
is static private;
InsertOnOutLine(me : mutable;
PID : out Array1OfTransient from TColStd)
is static private;
CheckFrBackTriangles(me : mutable;
List : out ListOfBPoint from HLRAlgo;
PID : out Array1OfTransient from TColStd)
is static private;
FindEdgeOnTriangle(me;
Tri1Indices : Address from Standard;
ip1,ip2 : Integer from Standard;
jtrouv : out Integer from Standard;
isDirect : out Boolean from Standard)
is static private;
ChangeNode(me;
ip1,ip2 : Integer from Standard;
Nod1Indices : Address from Standard;
Nod1RValues : Address from Standard;
Nod2Indices : Address from Standard;
Nod2RValues : Address from Standard;
coef1 : Real from Standard;
X3,Y3,Z3 : Real from Standard;
first : Boolean from Standard;
TData : out Address from Standard;
PISeg : out Address from Standard;
PINod : out Address from Standard)
is static private;
UpdateAroundNode(me;
iNode : Integer from Standard;
Nod1Indices : Address from Standard;
TData : Address from Standard;
PISeg : Address from Standard;
PINod : Address from Standard)
is static private;
OrientTriangle(me ;iTri : Integer from Standard;
Tri1Indices : Address from Standard;
Nod1Indices : Address from Standard;
Nod1RValues : Address from Standard;
Nod2Indices : Address from Standard;
Nod2RValues : Address from Standard;
Nod3Indices : Address from Standard;
Nod3RValues : Address from Standard)
is static private;
Triangles(me; ip1,ip2 : Integer from Standard;
Nod1Indices : Address from Standard;
PISeg : out Address from Standard;
iTri1,iTri2 : out Integer from Standard)
returns Boolean from Standard
is static private;
NewNode(me;
Nod1RValues : Address from Standard;
Nod2RValues : Address from Standard;
coef1 : out Real from Standard;
moveP1 : out Boolean from Standard)
returns Boolean from Standard
is static private;
UVNode(me;
Nod1RValues : Address from Standard;
Nod2RValues : Address from Standard;
coef1 : Real from Standard;
U3,V3 : out Real from Standard)
is static private;
CheckDegeneratedSegment(me;
Nod1Indices : Address from Standard;
Nod1RValues : Address from Standard;
Nod2Indices : Address from Standard;
Nod2RValues : Address from Standard)
is static private;
UpdateOutLines(me : mutable;
List : out ListOfBPoint from HLRAlgo;
PID : out Array1OfTransient from TColStd)
is static private;
UpdateEdgesBiPoints(me : mutable;
List : out ListOfBPoint from HLRAlgo;
PID : Array1OfTransient from TColStd;
closed : Boolean from Standard)
is static private;
UpdatePolyData(me : mutable;
PD,PID : out Array1OfTransient from TColStd;
closed : Boolean from Standard)
is static private;
TMultiply(me;
X,Y,Z : out Real from Standard;
VecPartOnly : Boolean from Standard = Standard_False)
is static private;
TTMultiply(me;
X,Y,Z : out Real from Standard;
VecPartOnly : Boolean from Standard = Standard_False)
is static private;
TIMultiply(me;
X,Y,Z : out Real from Standard;
VecPartOnly : Boolean from Standard = Standard_False)
is static private;
InitHide(me : mutable)
---C++: inline
is static;
MoreHide(me) returns Boolean from Standard
---C++: inline
is static;
NextHide(me : mutable)
---C++: inline
is static;
Hide(me : mutable; Coordinates : out Address from Standard;
status : out EdgeStatus from HLRAlgo;
S : out Shape from TopoDS;
reg1,regn : out Boolean from Standard;
outl,intl : out Boolean from Standard)
is static;
InitShow(me : mutable)
---C++: inline
is static;
MoreShow(me) returns Boolean from Standard
---C++: inline
is static;
NextShow(me : mutable)
---C++: inline
is static;
Show(me : mutable; Coordinates : out Address from Standard;
S : out Shape from TopoDS;
reg1,regn : out Boolean from Standard;
outl,intl : out Boolean from Standard)
is static;
OutLinedShape(me; S : Shape from TopoDS)
returns Shape from TopoDS
---Purpose: Make a shape with the internal outlines in each
-- face.
is static;
Debug(me) returns Boolean from Standard
---C++: inline
is static;
Debug(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
fields
myProj : Projector from HLRAlgo;
TMat : Real from Standard[3,3];
TLoc : Real from Standard[3];
TTMa : Real from Standard[3,3];
TTLo : Real from Standard[3];
TIMa : Real from Standard[3,3];
TILo : Real from Standard[3];
myShapes : SequenceOfShape from TopTools;
myEMap : IndexedMapOfShape from TopTools;
myFMap : IndexedMapOfShape from TopTools;
myAlgo : PolyAlgo from HLRAlgo;
myHide : Integer from Standard;
myDebug : Boolean from Standard;
myAngle : Real from Standard;
myTolSta : Real from Standard;
myTolEnd : Real from Standard;
myTolAngular : Real from Standard;
myGSurf : Surface from Geom;
myBSurf : Surface from BRepAdaptor;
myBCurv : Curve from BRepAdaptor;
myPC : Curve2d from BRepAdaptor;
end PolyAlgo;

3824
src/HLRBRep/HLRBRep_PolyAlgo.cxx Executable file

File diff suppressed because it is too large Load Diff

153
src/HLRBRep/HLRBRep_PolyAlgo.lxx Executable file
View File

@@ -0,0 +1,153 @@
// File: HLRBRep_PolyAlgo.lxx
// Created: Thu Jun 15 16:17:43 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <HLRAlgo_PolyAlgo.hxx>
//=======================================================================
//function : NbShapes
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_PolyAlgo::NbShapes () const
{ return myShapes.Length(); }
//=======================================================================
//function : Load
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::Load (const TopoDS_Shape& S)
{ myShapes.Append(S); }
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline const HLRAlgo_Projector & HLRBRep_PolyAlgo::Projector () const
{ return myProj; }
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::Projector (const HLRAlgo_Projector& P)
{ myProj = P; }
//=======================================================================
//function : Angle
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_PolyAlgo::Angle () const
{ return myAngle; }
//=======================================================================
//function : Angle
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::Angle (const Standard_Real Ang)
{ myAngle = Ang; }
//=======================================================================
//function : TolAngular
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_PolyAlgo::TolAngular () const
{ return myTolAngular; }
//=======================================================================
//function : TolAngular
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::TolAngular (const Standard_Real Tol)
{ myTolAngular = Tol; }
//=======================================================================
//function : TolCoef
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_PolyAlgo::TolCoef () const
{ return myTolSta; }
//=======================================================================
//function : TolCoef
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::TolCoef (const Standard_Real Tol)
{ myTolSta = Tol; myTolEnd = 1 - Tol;}
//=======================================================================
//function : InitHide
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::InitHide ()
{
myAlgo->InitHide();
}
//=======================================================================
//function : MoreHide
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_PolyAlgo::MoreHide () const
{ return myAlgo->MoreHide(); }
//=======================================================================
//function : NextHide
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::NextHide ()
{ myAlgo->NextHide(); }
//=======================================================================
//function : InitShow
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::InitShow ()
{ myAlgo->InitShow(); }
//=======================================================================
//function : MoreShow
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_PolyAlgo::MoreShow () const
{ return myAlgo->MoreShow(); }
//=======================================================================
//function : NextShow
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::NextShow ()
{ myAlgo->NextShow(); }
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_PolyAlgo::Debug () const
{ return myDebug; }
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
inline void HLRBRep_PolyAlgo::Debug (const Standard_Boolean B)
{ myDebug = B; }

View File

@@ -0,0 +1,153 @@
-- File: HLRBRep_PolyHLRToShape.cdl
-- Created: Mon Oct 11 16:45:31 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class PolyHLRToShape from HLRBRep
--- Purpose: A framework for filtering the computation
-- results of an HLRBRep_Algo algorithm by extraction.
-- From the results calculated by the algorithm on
-- a shape, a filter returns the type of edge you
-- want to identify. You can choose any of the following types of output:
-- - visible sharp edges
-- - hidden sharp edges
-- - visible smooth edges
-- - hidden smooth edges
-- - visible sewn edges
-- - hidden sewn edges
-- - visible outline edges
-- - hidden outline edges.
-- - visible isoparameters and
-- - hidden isoparameters.
-- Sharp edges present a C0 continuity (non G1).
-- Smooth edges present a G1 continuity (non G2).
-- Sewn edges present a C2 continuity.
-- The result is composed of 2D edges in the
-- projection plane of the view which the
-- algorithm has worked with. These 2D edges
-- are not included in the data structure of the visualized shape.
-- In order to obtain a complete image, you must
-- combine the shapes given by each of the chosen filters.
-- The construction of the shape does not call a
-- new computation of the algorithm, but only
-- reads its internal results.
uses
Boolean from Standard,
Integer from Standard,
Shape from TopoDS,
ListOfBPnt2D from HLRBRep,
PolyAlgo from HLRBRep
is
Create
returns PolyHLRToShape from HLRBRep;
---Purpose: Constructs a framework for filtering the results
-- of the HLRBRep_Algo algorithm, A.
-- Use the extraction filters to obtain the results you want for A.
Update(me : in out; A : PolyAlgo from HLRBRep)
is static;
Show(me : in out)
---C++: inline
is static;
Hide(me : in out)
---C++: inline
is static;
VCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
VCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineVCompound(me : in out) returns Shape from TopoDS
---Purpose: Sets the extraction filter for visible smooth edges.
---C++: inline
is static;
Rg1LineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
RgNLineVCompound(me : in out) returns Shape from TopoDS
--- Purpose: Sets the extraction filter for visible sewn edges.
---C++: inline
is static;
RgNLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
OutLineVCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
OutLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---Purpose: Sets the extraction filter for visible outlines.
---C++: inline
is static;
HCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
HCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
Rg1LineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
--- Purpose: Sets the extraction filter for hidden smooth edges.
is static;
RgNLineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
RgNLineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---Purpose: Sets the extraction filter for hidden sewn edges.
---C++: inline
is static;
OutLineHCompound(me : in out) returns Shape from TopoDS
---C++: inline
is static;
OutLineHCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---Purpose: Sets the extraction filter for hidden outlines.
-- Hidden outlines occur, for instance, in tori. In
-- this case, the inner outlines of the torus seen on its side are hidden.
---C++: inline
is static;
InternalCompound(me : in out; typ : Integer from Standard;
visible : Boolean from Standard;
S : Shape from TopoDS)
returns Shape from TopoDS
is static private;
fields
myAlgo : PolyAlgo from HLRBRep;
myBiPntVis : ListOfBPnt2D from HLRBRep;
myBiPntHid : ListOfBPnt2D from HLRBRep;
myHideMode : Boolean from Standard;
end PolyHLRToShape;

View File

@@ -0,0 +1,175 @@
// File: HLRBRep_PolyHLRToShape.cxx
// Created: Mon Oct 11 16:55:56 1993
// Author: Christophe MARION
// <cma@nonox>
// Modified by cma, Fri Nov 10 17:36:13 1995
#include <HLRBRep_PolyHLRToShape.ixx>
#include <BRep_Builder.hxx>
#include <BRepLib_MakeEdge2d.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <HLRBRep_BiPnt2D.hxx>
#include <HLRBRep_ListIteratorOfListOfBPnt2D.hxx>
#include <HLRAlgo_EdgeStatus.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
#define PntX1 ((Standard_Real*)Coordinates)[0]
#define PntY1 ((Standard_Real*)Coordinates)[1]
#define PntZ1 ((Standard_Real*)Coordinates)[2]
#define PntX2 ((Standard_Real*)Coordinates)[3]
#define PntY2 ((Standard_Real*)Coordinates)[4]
#define PntZ2 ((Standard_Real*)Coordinates)[5]
//=======================================================================
//function : HLRBRep_PolyHLRToShape
//purpose :
//=======================================================================
HLRBRep_PolyHLRToShape::HLRBRep_PolyHLRToShape ()
{}
//=======================================================================
//function : Update
//purpose :
//=======================================================================
void HLRBRep_PolyHLRToShape::Update (const Handle(HLRBRep_PolyAlgo)& A)
{
myAlgo = A;
myHideMode = Standard_True;
Standard_Real sta,end,XSta,YSta,ZSta,XEnd,YEnd,ZEnd,dx,dy;
Standard_ShortReal tolsta,tolend;
HLRAlgo_EdgeIterator It;
myBiPntVis.Clear();
myBiPntHid.Clear();
TopoDS_Shape S;
Standard_Boolean reg1,regn,outl,intl;
const gp_Trsf& T = myAlgo->Projector().Transformation();
HLRAlgo_EdgeStatus status;
Standard_Address Coordinates;
for (myAlgo->InitHide(); myAlgo->MoreHide(); myAlgo->NextHide()) {
myAlgo->Hide(Coordinates,status,S,reg1,regn,outl,intl);
XSta = PntX1;
YSta = PntY1;
ZSta = PntZ1;
XEnd = PntX2;
YEnd = PntY2;
ZEnd = PntZ2;
T.Transforms(XSta,YSta,ZSta);
T.Transforms(XEnd,YEnd,ZEnd);
dx = XEnd - XSta;
dy = YEnd - YSta;
if (sqrt(dx * dx + dy * dy) > 1.e-10) {
for (It.InitVisible(status);
It.MoreVisible();
It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
myBiPntVis.Append
(HLRBRep_BiPnt2D
(XSta + sta * dx,YSta + sta * dy,
XSta + end * dx,YSta + end * dy,
S,reg1,regn,outl,intl));
}
for (It.InitHidden(status);
It.MoreHidden();
It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
myBiPntHid.Append
(HLRBRep_BiPnt2D
(XSta + sta * dx,YSta + sta * dy,
XSta + end * dx,YSta + end * dy,
S,reg1,regn,outl,intl));
}
}
}
}
//=======================================================================
//function : InternalCompound
//purpose :
//=======================================================================
TopoDS_Shape
HLRBRep_PolyHLRToShape::InternalCompound (const Standard_Integer typ,
const Standard_Boolean visible,
const TopoDS_Shape& S)
{
TopTools_MapOfShape Map;
if (!S.IsNull()) {
TopExp_Explorer ex;
for (ex.Init(S,TopAbs_EDGE); ex.More(); ex.Next())
Map.Add(ex.Current());
for (ex.Init(S,TopAbs_FACE); ex.More(); ex.Next())
Map.Add(ex.Current());
}
Standard_Boolean todraw,reg1,regn,outl,intl;
Standard_Boolean added = Standard_False;
TopoDS_Shape Result;
BRep_Builder B;
B.MakeCompound(TopoDS::Compound(Result));
if (myHideMode) {
HLRBRep_ListIteratorOfListOfBPnt2D It;
if (visible) It.Initialize(myBiPntVis);
else It.Initialize(myBiPntHid);
for (; It.More(); It.Next()) {
const HLRBRep_BiPnt2D& BP = It.Value();
reg1 = BP.Rg1Line();
regn = BP.RgNLine();
outl = BP.OutLine();
intl = BP.IntLine();
if (typ == 1) todraw = intl;
else if (typ == 2) todraw = reg1 && !regn && !outl;
else if (typ == 3) todraw = regn && !outl;
else todraw = !(intl || (reg1 && !outl));
if (todraw)
if (!S.IsNull()) todraw = Map.Contains(BP.Shape());
if (todraw) {
B.Add(Result,BRepLib_MakeEdge2d(BP.P1(),BP.P2()));
added = Standard_True;
}
}
}
else {
const gp_Trsf& T = myAlgo->Projector().Transformation();
TopoDS_Shape SBP;
Standard_Real XSta,YSta,ZSta,XEnd,YEnd,ZEnd,dx,dy;
Standard_Address Coordinates;
for (myAlgo->InitShow(); myAlgo->MoreShow(); myAlgo->NextShow()) {
myAlgo->Show(Coordinates,SBP,reg1,regn,outl,intl);
if (typ == 1) todraw = intl;
else if (typ == 2) todraw = reg1 && !regn && !outl;
else if (typ == 3) todraw = regn && !outl;
else todraw = !(intl || (reg1 && !outl));
if (todraw)
if (!S.IsNull()) todraw = Map.Contains(SBP);
if (todraw) {
XSta = PntX1;
YSta = PntY1;
ZSta = PntZ1;
XEnd = PntX2;
YEnd = PntY2;
ZEnd = PntZ2;
T.Transforms(XSta,YSta,ZSta);
T.Transforms(XEnd,YEnd,ZEnd);
dx = XEnd - XSta;
dy = YEnd - YSta;
if (sqrt(dx * dx + dy * dy) > 1.e-10) {
B.Add(Result,BRepLib_MakeEdge2d(gp_Pnt2d(XSta,YSta),
gp_Pnt2d(XEnd,YEnd)));
added = Standard_True;
}
}
}
}
if (!added) Result = TopoDS_Shape();
return Result;
}

View File

@@ -0,0 +1,159 @@
// File: HLRBRep_PolyHLRToShape.lxx
// Created: Tue Nov 2 15:55:51 1993
// Author: Christophe MARION
// <cma@nonox>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function : Show
//purpose :
//=======================================================================
inline void HLRBRep_PolyHLRToShape::Show()
{ myHideMode = Standard_False; }
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
inline void HLRBRep_PolyHLRToShape::Hide()
{ myHideMode = Standard_True; }
//=======================================================================
//function : VCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::VCompound()
{ return InternalCompound(4,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : VCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::VCompound(const TopoDS_Shape& S)
{ return InternalCompound(4,Standard_True,S); }
//=======================================================================
//function : Rg1LineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::Rg1LineVCompound()
{ return InternalCompound(2,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : Rg1LineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::Rg1LineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(2,Standard_True,S); }
//=======================================================================
//function : RgNLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::RgNLineVCompound()
{ return InternalCompound(3,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : RgNLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::RgNLineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(3,Standard_True,S); }
//=======================================================================
//function : OutLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::OutLineVCompound()
{ return InternalCompound(1,Standard_True,TopoDS_Shape()); }
//=======================================================================
//function : OutLineVCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::OutLineVCompound(const TopoDS_Shape& S)
{ return InternalCompound(1,Standard_True,S); }
//=======================================================================
//function : HCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::HCompound()
{ return InternalCompound(4,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : HCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::HCompound(const TopoDS_Shape& S)
{ return InternalCompound(4,Standard_False,S); }
//=======================================================================
//function : Rg1LineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::Rg1LineHCompound()
{ return InternalCompound(2,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : Rg1LineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::Rg1LineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(2,Standard_False,S); }
//=======================================================================
//function : RgNLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::RgNLineHCompound()
{ return InternalCompound(3,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : RgNLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::RgNLineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(3,Standard_False,S); }
//=======================================================================
//function : OutLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape HLRBRep_PolyHLRToShape::OutLineHCompound()
{ return InternalCompound(1,Standard_False,TopoDS_Shape()); }
//=======================================================================
//function : OutLineHCompound
//purpose :
//=======================================================================
inline TopoDS_Shape
HLRBRep_PolyHLRToShape::OutLineHCompound(const TopoDS_Shape& S)
{ return InternalCompound(1,Standard_False,S); }

View File

@@ -0,0 +1,62 @@
-- File: HLRBRep_SLPropsATool.cdl
-- Created: Fri Apr 23 13:56:45 1993
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1993
class SLPropsATool from HLRBRep
uses
Address from Standard,
Pnt from gp,
Vec from gp
is
Value(myclass; A : Address from Standard;
U, V : Real from Standard;
P : out Pnt from gp);
---Purpose: Computes the point <P> of parameter <U> and <V>
-- on the Surface <A>.
--
---C++: inline
D1 (myclass; A : Address from Standard;
U, V : Real from Standard;
P : out Pnt from gp;
D1U, D1V : out Vec from gp);
---Purpose: Computes the point <P> and first derivative <D1*>
-- of parameter <U> and <V> on the Surface <A>.
--
---C++: inline
D2 (myclass; A : Address from Standard;
U, V : Real from Standard;
P : out Pnt; D1U, D1V, D2U, D2V, DUV : out Vec);
---Purpose: Computes the point <P>, the first derivative <D1*>
-- and second derivative <D2*> of parameter <U> and
-- <V> on the Surface <A>.
--
---C++: inline
DN (myclass; A : Address from Standard;
U, V : Real from Standard;
Nu, Nv : Integer from Standard)
returns Vec from gp;
Continuity(myclass; A : Address from Standard)
returns Integer from Standard;
---Purpose: returns the order of continuity of the Surface
-- <A>. returns 1 : first derivative only is
-- computable returns 2 : first and second derivative
-- only are computable.
--
---C++: inline
Bounds(myclass; A : Address from Standard;
U1, V1, U2, V2 : out Real from Standard);
---Purpose: returns the bounds of the Surface.
--
---C++: inline
end SLPropsATool;

View File

@@ -0,0 +1,6 @@
// File: HLRBRep_SLPropsATool.cxx
// Created: Tue Aug 18 15:16:03 1992
// Author: Herve LEGRAND
// <hl@bravox>
#include <HLRBRep_SLPropsATool.ixx>

View File

@@ -0,0 +1,90 @@
// File: HLRBRep_SLPropsATool.lxx
// Created: Tue Aug 18 15:16:03 1992
// Author: Herve LEGRAND
// <hl@bravox>
#include <HLRBRep_Surface.hxx>
#include <GeomAbs_Shape.hxx>
#include <gp_Pnt.hxx>
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline void HLRBRep_SLPropsATool::Value
(const Standard_Address A,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P)
{ P = ((HLRBRep_Surface*)A)->Value(U, V); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void HLRBRep_SLPropsATool::D1
(const Standard_Address A,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V)
{ ((HLRBRep_Surface*)A)->D1(U, V, P, D1U, D1V); }
//=======================================================================
//function : D2
//purpose :
//=======================================================================
inline void HLRBRep_SLPropsATool::D2
(const Standard_Address A,
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& DUV)
{ ((HLRBRep_Surface*)A)->D2(U, V, P, D1U, D1V, D2U, D2V, DUV); }
//=======================================================================
//function : DN
//purpose :
//=======================================================================
inline gp_Vec HLRBRep_SLPropsATool::DN
(const Standard_Address A,
const Standard_Real U,
const Standard_Real V,
const Standard_Integer Nu,
const Standard_Integer Nv)
{ return ((HLRBRep_Surface*)A)->DN(U, V, Nu, Nv); }
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_SLPropsATool::Continuity
(const Standard_Address)
{ return 2; } // et boum ! cky le 27 - 04 - 1993
//=======================================================================
//function : Bounds
//purpose :
//=======================================================================
inline void HLRBRep_SLPropsATool::Bounds
(const Standard_Address,
Standard_Real& U1,
Standard_Real& V1,
Standard_Real& U2,
Standard_Real& V2)
{
U1 = V1 = RealFirst();
U2 = V2 = RealLast();
}

View File

@@ -0,0 +1,86 @@
-- File: HLRBRep_ShapeBounds.cdl
-- Created: Thu Apr 17 17:51:44 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class ShapeBounds from HLRBRep
---Purpose: Contains a Shape and the bounds of its vertices,
-- edges and faces in the DataStructure.
uses
Integer from Standard,
OutLiner from HLRTopoBRep,
TShared from MMgt
is
Create returns ShapeBounds from HLRBRep;
---C++: inline
Create(S : OutLiner from HLRTopoBRep;
SData : TShared from MMgt;
nbIso : Integer from Standard;
V1,V2,E1,E2,F1,F2 : Integer from Standard)
returns ShapeBounds from HLRBRep;
Create(S : OutLiner from HLRTopoBRep;
nbIso : Integer from Standard;
V1,V2,E1,E2,F1,F2 : Integer from Standard)
returns ShapeBounds from HLRBRep;
Translate(me : in out; NV,NE,NF : Integer from Standard)
is static;
Shape(me : in out; S : OutLiner from HLRTopoBRep)
---C++: inline
is static;
Shape(me) returns OutLiner from HLRTopoBRep
---C++: inline
---C++: return const &
is static;
ShapeData(me : in out; SD : TShared from MMgt)
---C++: inline
is static;
ShapeData(me) returns TShared from MMgt
---C++: inline
---C++: return const &
is static;
NbOfIso(me : in out;nbIso : Integer from Standard)
---C++: inline
is static;
NbOfIso(me) returns Integer from Standard
---C++: inline
is static;
Sizes(me; NV,NE,NF : out Integer from Standard)
is static;
Bounds(me; V1,V2,E1,E2,F1,F2 : out Integer from Standard)
is static;
UpdateMinMax(me : in out; TotMinMax : Address from Standard)
is static;
MinMax(me) returns Address from Standard
---C++: inline
is static;
fields
myShape : OutLiner from HLRTopoBRep;
myShapeData : TShared from MMgt;
myNbIso : Integer from Standard;
myVertStart : Integer from Standard;
myVertEnd : Integer from Standard;
myEdgeStart : Integer from Standard;
myEdgeEnd : Integer from Standard;
myFaceStart : Integer from Standard;
myFaceEnd : Integer from Standard;
myMinMax : Integer from Standard[16];
end ShapeBounds from HLRBRep;

View File

@@ -0,0 +1,114 @@
// File: HLRBRep_ShapeBounds.cxx
// Created: Thu Apr 17 18:35:42 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRBRep_ShapeBounds.ixx>
//=======================================================================
//function : HLRBRep_ShapeBounds
//purpose :
//=======================================================================
HLRBRep_ShapeBounds::
HLRBRep_ShapeBounds (const Handle(HLRTopoBRep_OutLiner)& S,
const Handle(MMgt_TShared)& SData,
const Standard_Integer nbIso,
const Standard_Integer V1,
const Standard_Integer V2,
const Standard_Integer E1,
const Standard_Integer E2,
const Standard_Integer F1,
const Standard_Integer F2) :
myShape(S),
myShapeData(SData),
myNbIso(nbIso),
myVertStart(V1),myVertEnd(V2),
myEdgeStart(E1),myEdgeEnd(E2),
myFaceStart(F1),myFaceEnd(F2)
{}
//=======================================================================
//function : HLRBRep_ShapeBounds
//purpose :
//=======================================================================
HLRBRep_ShapeBounds::
HLRBRep_ShapeBounds (const Handle(HLRTopoBRep_OutLiner)& S,
const Standard_Integer nbIso,
const Standard_Integer V1,
const Standard_Integer V2,
const Standard_Integer E1,
const Standard_Integer E2,
const Standard_Integer F1,
const Standard_Integer F2) :
myShape(S),
myNbIso(nbIso),
myVertStart(V1),myVertEnd(V2),
myEdgeStart(E1),myEdgeEnd(E2),
myFaceStart(F1),myFaceEnd(F2)
{}
//=======================================================================
//function : Translate
//purpose :
//=======================================================================
void HLRBRep_ShapeBounds::Translate (const Standard_Integer NV,
const Standard_Integer NE,
const Standard_Integer NF)
{
myVertStart += NV;
myVertEnd += NV;
myEdgeStart += NE;
myEdgeEnd += NE;
myFaceStart += NF;
myFaceEnd += NF;
}
//=======================================================================
//function : Sizes
//purpose :
//=======================================================================
void HLRBRep_ShapeBounds::Sizes (Standard_Integer& NV,
Standard_Integer& NE,
Standard_Integer& NF) const
{
NV = myVertEnd + 1 - myVertStart;
NE = myEdgeEnd + 1 - myEdgeStart;
NF = myFaceEnd + 1 - myFaceStart;
}
//=======================================================================
//function : Bounds
//purpose :
//=======================================================================
void HLRBRep_ShapeBounds::Bounds (Standard_Integer& V1,
Standard_Integer& V2,
Standard_Integer& E1,
Standard_Integer& E2,
Standard_Integer& F1,
Standard_Integer& F2) const
{
V1 = myVertStart;
V2 = myVertEnd;
E1 = myEdgeStart;
E2 = myEdgeEnd;
F1 = myFaceStart;
F2 = myFaceEnd;
}
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
void HLRBRep_ShapeBounds::UpdateMinMax (const Standard_Address TotMinMax)
{
for (Standard_Integer i = 0; i <= 15; i++)
myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
}

View File

@@ -0,0 +1,72 @@
// File: HLRBRep_ShapeBounds.lxx
// Created: Thu Apr 17 18:34:31 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
//=======================================================================
//function : HLRBRep_ShapeBounds
//purpose :
//=======================================================================
inline HLRBRep_ShapeBounds::HLRBRep_ShapeBounds ()
{}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline void
HLRBRep_ShapeBounds::Shape (const Handle(HLRTopoBRep_OutLiner)& S)
{ myShape = S; }
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const Handle(HLRTopoBRep_OutLiner) &
HLRBRep_ShapeBounds::Shape () const
{ return myShape; }
//=======================================================================
//function : ShapeData
//purpose :
//=======================================================================
inline void HLRBRep_ShapeBounds::
ShapeData (const Handle(MMgt_TShared)& SD)
{ myShapeData = SD; }
//=======================================================================
//function : ShapeData
//purpose :
//=======================================================================
inline const Handle(MMgt_TShared) & HLRBRep_ShapeBounds::ShapeData () const
{ return myShapeData; }
//=======================================================================
//function : NbOfIso
//purpose :
//=======================================================================
inline void HLRBRep_ShapeBounds::NbOfIso (const Standard_Integer nbIso)
{ myNbIso = nbIso; }
//=======================================================================
//function : NbOfIso
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_ShapeBounds::NbOfIso () const
{ return myNbIso; }
//=======================================================================
//function : MinMax
//purpose :
//=======================================================================
inline Standard_Address HLRBRep_ShapeBounds::MinMax () const
{ return (Standard_Address)&myMinMax; }

View File

@@ -0,0 +1,48 @@
-- File: HLRBRep_ShapeToHLR.cdl
-- Created: Tue May 4 16:52:14 1993
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1993
class ShapeToHLR from HLRBRep
---Purpose: compute the OutLinedShape of a Shape with an
-- OutLiner, a Projector and create the Data
-- Structure of a Shape.
uses
Shape from TopoDS,
Face from TopoDS,
IndexedMapOfShape from TopTools,
OutLiner from HLRTopoBRep,
Projector from HLRAlgo,
Data from HLRBRep,
MapOfShapeTool from BRepTopAdaptor
is
Load(myclass; S : OutLiner from HLRTopoBRep;
P : Projector from HLRAlgo;
MST : in out MapOfShapeTool from BRepTopAdaptor;
nbIso : Integer from Standard = 0)
returns Data from HLRBRep;
---Purpose: Creates a DataStructure containing the OutLiner
-- <S> depending on the projector <P> and nbIso.
ExploreFace(myclass;
S : OutLiner from HLRTopoBRep;
DS : mutable Data from HLRBRep;
FM : IndexedMapOfShape from TopTools;
EM : IndexedMapOfShape from TopTools;
i : in out Integer from Standard;
F : Face from TopoDS;
closed : Boolean from Standard)
is private;
ExploreShape(myclass;
S : OutLiner from HLRTopoBRep;
DS : mutable Data from HLRBRep;
FM : IndexedMapOfShape from TopTools;
EM : IndexedMapOfShape from TopTools)
is private;
end ShapeToHLR;

View File

@@ -0,0 +1,284 @@
// File: HLRBRep_ShapeToHLR.cxx
// Created: Thu Aug 27 12:33:14 1992
// Author: Christophe MARION
// <cma@sdsun2>
#ifndef No_Exception
// #define No_Exception
#endif
#include <HLRBRep_ShapeToHLR.ixx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <HLRBRep.hxx>
#include <BRepTopAdaptor_MapOfShapeTool.hxx>
//=======================================================================
// Function : Load
// Purpose :
//=======================================================================
Handle(HLRBRep_Data)
HLRBRep_ShapeToHLR::Load(const Handle(HLRTopoBRep_OutLiner)& S,
const HLRAlgo_Projector& P,
BRepTopAdaptor_MapOfShapeTool& MST,
const Standard_Integer nbIso)
{
S->Fill(P,MST,nbIso);
HLRTopoBRep_Data& TopDS = S->DataStructure();
TopTools_IndexedMapOfShape FM;
TopTools_IndexedMapOfShape EM;
TopTools_IndexedDataMapOfShapeListOfShape VerticesToEdges;
TopTools_IndexedDataMapOfShapeListOfShape EdgesToFaces;
TopExp_Explorer exshell,exface;
for (exshell.Init(S->OutLinedShape(), TopAbs_SHELL);
exshell.More();
exshell.Next()) { // faces in a shell
for (exface.Init(exshell.Current(), TopAbs_FACE);
exface.More();
exface.Next()) {
if (!FM.Contains(exface.Current()))
FM.Add(exface.Current());
}
}
for (exface.Init(S->OutLinedShape(), TopAbs_FACE, TopAbs_SHELL);
exface.More();
exface.Next()) { // faces not in a shell
if (!FM.Contains(exface.Current()))
FM.Add(exface.Current());
}
TopExp::MapShapes(S->OutLinedShape(),TopAbs_EDGE,EM);
Standard_Integer i;
Standard_Integer nbEdge = EM.Extent ();
for (i = 1; i <= nbEdge; i++) // vertices back to edges
TopExp::MapShapesAndAncestors
(EM(i), TopAbs_VERTEX, TopAbs_EDGE, VerticesToEdges);
Standard_Integer nbVert = VerticesToEdges.Extent();
Standard_Integer nbFace = FM.Extent();
TopoDS_Vertex VF, VL;
TopTools_ListIteratorOfListOfShape itn;
Standard_Integer i1, i2;
Standard_Boolean o1, o2;
Standard_Boolean c1, c2;
Standard_Real pf, pl;
Standard_ShortReal tf, tl;
// Create the data structure
Handle(HLRBRep_Data) DS = new HLRBRep_Data (nbVert, nbEdge, nbFace);
#ifdef DEB
HLRBRep_Array1OfEData& ED =
#endif
DS->EDataArray ();
HLRBRep_EdgeData* ed;
if(nbEdge != 0) ed = &(DS->EDataArray().ChangeValue(1));
// ed++;
for (i = 1; i <= nbFace; i++) { // test of Double edges
TopExp::MapShapesAndAncestors
(FM(i),TopAbs_EDGE, TopAbs_FACE, EdgesToFaces);
}
for (i = 1; i <= nbEdge; i++) { // load the Edges
const TopoDS_Edge& Edg = TopoDS::Edge (EM(i));
TopExp::Vertices (Edg, VF, VL);
BRep_Tool::Range (Edg, pf, pl);
Standard_Boolean reg1 = Standard_False;
Standard_Boolean regn = Standard_False;
Standard_Integer inde = EdgesToFaces.FindIndex(Edg);
if (inde > 0) {
if (EdgesToFaces(inde).Extent() == 2) {
itn = EdgesToFaces(inde);
const TopoDS_Face& F1 = TopoDS::Face(itn.Value());
itn.Next();
const TopoDS_Face& F2 = TopoDS::Face(itn.Value());
GeomAbs_Shape rg = BRep_Tool::Continuity(Edg,F1,F2);
reg1 = rg >= GeomAbs_G1;
regn = rg >= GeomAbs_G2;
}
}
if (VF.IsNull()) {
i1 = 0;
o1 = Standard_False;
c1 = Standard_False;
pf = RealFirst();
tf = (Standard_ShortReal) Epsilon(pf);
}
else {
i1 = VerticesToEdges.FindIndex(VF);
o1 = TopDS.IsOutV(VF);
c1 = TopDS.IsIntV(VF);
tf = (Standard_ShortReal) BRep_Tool::Tolerance(VF);
}
if (VL.IsNull()) {
i2 = 0;
o2 = Standard_False;
c2 = Standard_False;
pl = RealLast();
tl = (Standard_ShortReal) Epsilon (pl);
}
else {
i2 = VerticesToEdges.FindIndex(VL);
o2 = TopDS.IsOutV(VL);
c2 = TopDS.IsIntV(VL);
tl = (Standard_ShortReal) BRep_Tool::Tolerance(VL);
}
ed->Set (reg1,regn, Edg, i1, i2, o1, o2, c1, c2, pf, tf, pl, tl);
DS->EdgeMap().Add(Edg);
ed++;
}
ExploreShape(S,DS,FM,EM);
return DS;
}
//=======================================================================
// Function : ExploreFace
// Purpose :
//=======================================================================
void
HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM,
Standard_Integer& i,
const TopoDS_Face& F,
const Standard_Boolean closed)
{
i++;
TopExp_Explorer Ex1,Ex2;
HLRTopoBRep_Data& TopDS = S->DataStructure();
TopAbs_Orientation orient = FM(i).Orientation();
TopoDS_Face theFace = TopoDS::Face(FM(i));
theFace.Orientation (TopAbs_FORWARD);
HLRBRep_FaceData& fd = DS->FDataArray().ChangeValue(i);
Standard_Integer nw = 0;
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next())
nw++;
fd.Set (theFace, orient, closed, nw);
nw = 0;
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next()) {
nw++;
Standard_Integer ne = 0;
for (Ex2.Init(Ex1.Current(), TopAbs_EDGE); Ex2.More(); Ex2.Next())
ne++;
fd.SetWire (nw, ne);
ne = 0;
for (Ex2.Init(Ex1.Current(), TopAbs_EDGE);
Ex2.More();
Ex2.Next()) {
ne++;
const TopoDS_Edge& E = TopoDS::Edge(Ex2.Current());
Standard_Integer ie = EM.FindIndex(E);
TopAbs_Orientation orient = E.Orientation();
Standard_Boolean Int = TopDS.IsIntLFaceEdge(F,E);
Standard_Boolean Iso = TopDS.IsIsoLFaceEdge(F,E);
Standard_Boolean Out = TopDS.IsOutLFaceEdge(F,E);
Standard_Boolean Dbl = BRepTools::IsReallyClosed(TopoDS::Edge(E),theFace);
fd.SetWEdge(nw, ne, ie, orient, Out, Int, Dbl, Iso);
}
}
DS->FaceMap().Add(theFace);
}
//=======================================================================
//function : ExploreShape
//purpose :
//=======================================================================
void
HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM)
{
TopTools_MapOfShape ShapeMap;
TopExp_Explorer exshell, exface, exedge;
Standard_Integer i = 0;
for (exshell.Init (S->OriginalShape(), TopAbs_SHELL);
exshell.More ();
exshell.Next ()) { // faces in a shell (open or close)
Standard_Boolean closed = exshell.Current().Closed();
if (!closed) {
Standard_Integer ie;
Standard_Integer nbEdge = EM.Extent ();
Standard_Integer *flag = new Standard_Integer[nbEdge + 1];
for(ie = 1; ie<=nbEdge; ie++)
flag[ie] = 0;
for (exedge.Init(exshell.Current(), TopAbs_EDGE);
exedge.More();
exedge.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exedge.Current());
ie = EM.FindIndex(E);
TopAbs_Orientation orient = E.Orientation();
if (!BRep_Tool::Degenerated(E)) {
if (orient == TopAbs_FORWARD ) flag[ie] += 1;
else if (orient == TopAbs_REVERSED) flag[ie] -= 1;
}
}
closed = Standard_True;
for (ie = 1; ie <= nbEdge && closed; ie++)
closed = (flag[ie] == 0);
delete [] flag;
flag = NULL;
}
for (exface.Init(exshell.Current(), TopAbs_FACE);
exface.More();
exface.Next()) {
if (ShapeMap.Add(exface.Current())) {
ExploreFace(S,DS,FM,EM,i,
TopoDS::Face(exface.Current()),
closed);
}
}
}
for (exface.Init(S->OriginalShape(), TopAbs_FACE, TopAbs_SHELL);
exface.More();
exface.Next()) { // faces not in a shell
if (ShapeMap.Add(exface.Current())) {
ExploreFace(S,DS,FM,EM,i,
TopoDS::Face(exface.Current()),
Standard_False);
}
}
}

289
src/HLRBRep/HLRBRep_Surface.cdl Executable file
View File

@@ -0,0 +1,289 @@
-- File: HLRBRep_Surface.cdl
-- Created: Wed Apr 14 19:48:14 1993
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1993
class Surface from HLRBRep
uses
Address from Standard,
Real from Standard,
Integer from Standard,
Boolean from Standard,
Shape from GeomAbs,
SurfaceType from GeomAbs,
Ax1 from gp,
Pnt from gp,
Dir from gp,
Vec from gp,
Pln from gp,
Cylinder from gp,
Sphere from gp,
Torus from gp,
Cone from gp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Array2OfReal from TColStd,
Array2OfPnt from TColgp,
Face from TopoDS,
Surface from BRepAdaptor
raises
OutOfRange from Standard,
NoSuchObject from Standard,
DomainError from Standard
is
Create returns Surface from HLRBRep;
---Purpose: Creates an undefined surface with no face loaded.
Projector(me : in out; Proj : Address from Standard)
---C++: inline
is static;
Surface(me : in out) returns Surface from BRepAdaptor
---Purpose: Returns the 3D Surface.
---C++: return &
---C++: inline
is static;
Surface(me : in out; F : Face from TopoDS)
---Purpose: Sets the 3D Surface to be projected.
is static;
SideRowsOfPoles(me; tol : Real from Standard;
nbuPoles : Integer from Standard;
nbvPoles : Integer from Standard;
Pnt : out Array2OfPnt from TColgp)
returns Boolean from Standard
---Purpose: returns true if it is a side face
is static private;
IsSide(me; tolf,toler : Real from Standard)
returns Boolean from Standard
---Purpose: returns true if it is a side face
is static;
IsAbove(me; back : Boolean from Standard;
A : Address from Standard; -- as TheCurve
tolC : Real from Standard)
returns Boolean from Standard
is static;
--
-- Global methods - Apply to the whole surface.
--
FirstUParameter(me) returns Real from Standard
---C++: inline
is static;
LastUParameter(me) returns Real from Standard
---C++: inline
is static;
FirstVParameter(me) returns Real from Standard
---C++: inline
is static;
LastVParameter(me) returns Real from Standard
---C++: inline
is static;
UContinuity(me) returns Shape from GeomAbs
---C++: inline
is static;
VContinuity(me) returns Shape from GeomAbs
---C++: inline
is static;
NbUIntervals(me : in out; S : Shape from GeomAbs)
returns Integer from Standard
---Purpose: If necessary, breaks the surface in U intervals of
-- continuity <S>. And returns the number of
-- intervals.
---C++: inline
is static;
NbVIntervals(me : in out; S : Shape from GeomAbs)
returns Integer from Standard
---Purpose: If necessary, breaks the surface in V intervals of
-- continuity <S>. And returns the number of
-- intervals.
---C++: inline
is static;
UIntervalContinuity(me) returns Shape from GeomAbs
---C++: inline
is static;
VIntervalContinuity(me) returns Shape from GeomAbs
---C++: inline
is static;
IsUClosed(me) returns Boolean from Standard
---C++: inline
is static;
IsVClosed(me) returns Boolean from Standard
---C++: inline
is static;
IsUPeriodic(me) returns Boolean from Standard
---C++: inline
is static;
UPeriod(me) returns Real from Standard
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
is static;
IsVPeriodic(me) returns Boolean from Standard
---C++: inline
is static;
VPeriod(me) returns Real from Standard
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
is static;
Value (me; U, V : Real from Standard) returns Pnt from gp
--- Purpose : Computes the point of parameters U,V on the surface.
is static;
D0 (me; U, V : Real from Standard;
P : out Pnt from gp)
--- Purpose : Computes the point of parameters U,V on the surface.
---C++: inline
is static;
D1 (me; U, V : Real from Standard;
P : out Pnt from gp;
D1U, D1V : out Vec from gp)
--- Purpose : Computes the point and the first derivatives on
-- the surface.
raises DomainError from Standard
--- Purpose : Raised if the continuity of the current
-- intervals is not C1.
---C++: inline
is static;
D2 (me; U, V : Real from Standard;
P : out Pnt from gp;
D1U, D1V, D2U, D2V, D2UV : out Vec from gp)
--- Purpose : Computes the point, the first and second
-- derivatives on the surface.
raises DomainError from Standard
--- Purpose : Raised if the continuity of the current
-- intervals is not C2.
---C++: inline
is static;
D3 (me; U, V : Real from Standard;
P : out Pnt from gp;
D1U, D1V, D2U, D2V, D2UV : out Vec from gp;
D3U, D3V, D3UUV, D3UVV : out Vec from gp)
--- Purpose : Computes the point, the first, second and third
-- derivatives on the surface.
raises DomainError from Standard
--- Purpose : Raised if the continuity of the current
-- intervals is not C3.
---C++: inline
is static;
DN (me; U, V : Real from Standard;
Nu, Nv : Integer from Standard)
returns Vec from gp
--- Purpose : Computes the derivative of order Nu in the
-- direction U and Nv in the direction V at the point P(U,
-- V).
raises DomainError from Standard,
--- Purpose : Raised if the current U interval is not not CNu
-- and the current V interval is not CNv.
OutOfRange from Standard
--- Purpose : Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
---C++: inline
is static;
GetType(me) returns SurfaceType from GeomAbs
---Purpose: Returns the type of the surface : Plane, Cylinder,
-- Cone, Sphere, Torus, BezierSurface,
-- BSplineSurface, SurfaceOfRevolution,
-- SurfaceOfExtrusion, OtherSurface
---C++: inline
is static;
--
-- The following methods must be called when GetType returned
-- the corresponding type.
--
Plane(me) returns Pln from gp
raises NoSuchObject from Standard
is static;
Cylinder(me) returns Cylinder from gp
raises NoSuchObject from Standard
---C++: inline
is static;
Cone(me) returns Cone from gp
raises NoSuchObject from Standard
---C++: inline
is static;
Sphere(me) returns Sphere from gp
raises NoSuchObject from Standard
---C++: inline
is static;
Torus(me) returns Torus from gp
raises NoSuchObject from Standard
---C++: inline
is static;
UDegree(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
NbUPoles(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
VDegree(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
NbVPoles(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
NbUKnots(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
NbVKnots(me) returns Integer from Standard
raises NoSuchObject from Standard
---C++: inline
is static;
Axis(me) returns Ax1 from gp
raises NoSuchObject from Standard -- only for SurfaceOfRevolution
---C++: inline
is static;
fields
mySurf : Surface from BRepAdaptor;
myType : SurfaceType from GeomAbs;
myProj : Address from Standard;
end Surface;

276
src/HLRBRep/HLRBRep_Surface.cxx Executable file
View File

@@ -0,0 +1,276 @@
// File: HLRBRep_Surface.cxx
// Created: Fri Mar 13 11:08:32 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRBRep_Surface.ixx>
#include <HLRBRep_BSurfaceTool.hxx>
#include <gp_Pln.hxx>
#include <GProp_PEquation.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <HLRAlgo_Projector.hxx>
#include <HLRBRep_Curve.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierSurface.hxx>
//=======================================================================
//function : HLRBRep_Surface
//purpose :
//=======================================================================
HLRBRep_Surface::HLRBRep_Surface ()
{
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
void HLRBRep_Surface::Surface (const TopoDS_Face& F)
{
mySurf.Initialize(F,Standard_False);
GeomAbs_SurfaceType typ = HLRBRep_BSurfaceTool::GetType(mySurf);
switch (typ) {
case GeomAbs_Plane :
case GeomAbs_Cylinder :
case GeomAbs_Cone :
case GeomAbs_Sphere :
case GeomAbs_Torus :
// unchanged type
myType = typ;
break;
case GeomAbs_BezierSurface :
if (HLRBRep_BSurfaceTool::UDegree(mySurf) == 1 &&
HLRBRep_BSurfaceTool::VDegree(mySurf) == 1) {
myType = GeomAbs_Plane;
}
else
myType = typ;
break;
default :
myType = GeomAbs_OtherSurface;
break;
}
}
//=======================================================================
//function : SideRowsOfPoles
//purpose :
//=======================================================================
Standard_Boolean
HLRBRep_Surface::SideRowsOfPoles (const Standard_Real tol,
const Standard_Integer nbuPoles,
const Standard_Integer nbvPoles,
TColgp_Array2OfPnt& Pnt) const
{
Standard_Integer iu,iv;
Standard_Real x0,y0,x,y,z;
Standard_Boolean result;
Standard_Real tole = (Standard_Real)tol;
const gp_Trsf& T = ((HLRAlgo_Projector*) myProj)->Transformation();
for (iu = 1; iu <= nbuPoles; iu++) {
for (iv = 1; iv <= nbvPoles; iv++)
Pnt(iu,iv).Transform(T);
}
result = Standard_True;
for (iu = 1; iu <= nbuPoles && result; iu++) { // Side iso u ?
Pnt(iu,1).Coord(x0,y0,z);
for (iv = 2; iv <= nbvPoles && result; iv++) {
Pnt(iu,iv).Coord(x,y,z);
result = Abs(x-x0) < tole && Abs(y-y0) < tole;
}
}
if (result) return result;
result = Standard_True;
for (iv = 1; iv <= nbvPoles && result; iv++) { // Side iso v ?
Pnt(1,iv).Coord(x0,y0,z);
for (iu = 2; iu <= nbuPoles && result; iu++) {
Pnt(iu,iv).Coord(x,y,z);
result = Abs(x-x0) < tole && Abs(y-y0) < tole;
}
}
if (result) return result;
// Are the Poles in a Side Plane ?
TColgp_Array1OfPnt p(1,nbuPoles*nbvPoles);
Standard_Integer i = 0;
for (iu = 1; iu <= nbuPoles; iu++) {
for (iv = 1; iv <= nbvPoles; iv++) {
i++;
p(i) = Pnt(iu,iv);
}
}
GProp_PEquation Pl(p,(Standard_Real)tol);
if (Pl.IsPlanar())
result = Abs(Pl.Plane().Axis().Direction().Z()) < 0.0001;
return result;
}
//=======================================================================
//function : IsSide
//purpose :
//=======================================================================
Standard_Boolean
HLRBRep_Surface::IsSide (const Standard_Real tolF,
const Standard_Real toler) const
{
gp_Pnt Pt;
gp_Vec D;
Standard_Real r;
if (myType == GeomAbs_Plane) {
gp_Pln Pl = Plane();
gp_Ax1 A = Pl.Axis();
Pt = A.Location();
D = A.Direction();
Pt.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
if (((HLRAlgo_Projector*) myProj)->Perspective()) {
r = D.Z() * ((HLRAlgo_Projector*) myProj)->Focus() -
( D.X() * Pt.X() + D.Y() * Pt.Y() + D.Z() * Pt.Z() );
}
else r= D.Z();
return Abs(r) < toler;
}
else if (myType == GeomAbs_Cylinder) {
if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
gp_Cylinder Cyl = HLRBRep_BSurfaceTool::Cylinder(mySurf);
gp_Ax1 A = Cyl.Axis();
D = A.Direction();
D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
r = Sqrt(D.X() * D.X() + D.Y() * D.Y());
return r < toler;
}
else if (myType == GeomAbs_Cone) {
if (!((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
gp_Cone Con = HLRBRep_BSurfaceTool::Cone(mySurf);
Pt = Con.Apex();
Pt.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
Standard_Real tol = 0.001;
return Pt.IsEqual(gp_Pnt(0,0,((HLRAlgo_Projector*) myProj)->Focus()),tol);
}
else if (myType == GeomAbs_BezierSurface) {
if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
Standard_Integer nu = HLRBRep_BSurfaceTool::NbUPoles(mySurf);
Standard_Integer nv = HLRBRep_BSurfaceTool::NbVPoles(mySurf);
TColgp_Array2OfPnt Pnt(1,nu,1,nv);
HLRBRep_BSurfaceTool::Bezier(mySurf)->Poles(Pnt);
return SideRowsOfPoles (tolF,nu,nv,Pnt);
}
else if (myType == GeomAbs_BSplineSurface) {
if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
Standard_Integer nu = HLRBRep_BSurfaceTool::NbUPoles(mySurf);
Standard_Integer nv = HLRBRep_BSurfaceTool::NbVPoles(mySurf);
TColgp_Array2OfPnt Pnt(1,nu,1,nv);
TColStd_Array2OfReal W(1,nu,1,nv);
HLRBRep_BSurfaceTool::BSpline(mySurf)->Poles(Pnt);
HLRBRep_BSurfaceTool::BSpline(mySurf)->Weights(W);
return SideRowsOfPoles (tolF,nu,nv,Pnt);
}
else return Standard_False;
}
//=======================================================================
//function : IsAbove
//purpose :
//=======================================================================
Standard_Boolean
HLRBRep_Surface::IsAbove (const Standard_Boolean back,
const Standard_Address A,
const Standard_Real tol) const
{
Standard_Boolean planar = (myType == GeomAbs_Plane);
if (planar) {
gp_Pln Pl = Plane();
Standard_Real a,b,c,d;
Pl.Coefficients(a,b,c,d);
Standard_Real u,u1,u2,dd,x,y,z;
gp_Pnt P;
u1 = ((HLRBRep_Curve*)A)->Parameter3d
(((HLRBRep_Curve*)A)->FirstParameter());
u2 = ((HLRBRep_Curve*)A)->Parameter3d
(((HLRBRep_Curve*)A)->LastParameter());
u=u1;
((HLRBRep_Curve*)A)->D0(u,P);
P.Coord(x,y,z);
dd = a*x + b*y + c*z + d;
if (back) dd = -dd;
if (dd < -tol) return Standard_False;
if (((HLRBRep_Curve*)A)->GetType() != GeomAbs_Line) {
Standard_Integer nbPnt = 30;
Standard_Real step = (u2-u1)/(nbPnt+1);
for (Standard_Integer i = 1; i <= nbPnt; i++) {
u += step;
((HLRBRep_Curve*)A)->D0(u,P);
P.Coord(x,y,z);
dd = a*x + b*y + c*z + d;
if (back) dd = -dd;
if (dd < -tol) return Standard_False;
}
}
u = u2;
((HLRBRep_Curve*)A)->D0(u,P);
P.Coord(x,y,z);
dd = a*x + b*y + c*z + d;
if (back) dd = -dd;
if (dd < -tol) return Standard_False;
return Standard_True;
}
else return Standard_False;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
gp_Pnt HLRBRep_Surface::Value (const Standard_Real U,
const Standard_Real V) const
{
gp_Pnt P;
D0(U,V,P);
return P;
}
//=======================================================================
//function : Plane
//purpose :
//=======================================================================
gp_Pln HLRBRep_Surface::Plane () const
{
GeomAbs_SurfaceType typ = HLRBRep_BSurfaceTool::GetType(mySurf);
switch (typ) {
case GeomAbs_BezierSurface :
{
gp_Pnt P;
gp_Vec D1U;
gp_Vec D1V;
D1(0.5,0.5,P,D1U,D1V);
return gp_Pln(P,gp_Dir(D1U.Crossed(D1V)));
}
default :
return HLRBRep_BSurfaceTool::Plane(mySurf);
}
}

305
src/HLRBRep/HLRBRep_Surface.lxx Executable file
View File

@@ -0,0 +1,305 @@
// File: HLRBRep_Surface.lxx
// Created: Fri Mar 13 11:08:32 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <BRepAdaptor_Surface.hxx>
#include <HLRBRep_BSurfaceTool.hxx>
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline void
HLRBRep_Surface::Projector(const Standard_Address Proj)
{ myProj = Proj; }
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
inline BRepAdaptor_Surface & HLRBRep_Surface::Surface()
{ return mySurf; }
//=======================================================================
//function : FirstUParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::FirstUParameter()const
{ return HLRBRep_BSurfaceTool::FirstUParameter(mySurf); }
//=======================================================================
//function : LastUParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::LastUParameter()const
{ return HLRBRep_BSurfaceTool::LastUParameter(mySurf); }
//=======================================================================
//function : FirstVParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::FirstVParameter()const
{ return HLRBRep_BSurfaceTool::FirstVParameter(mySurf); }
//=======================================================================
//function : LastVParameter
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::LastVParameter()const
{ return HLRBRep_BSurfaceTool::LastVParameter(mySurf); }
//=======================================================================
//function : UContinuity
//purpose :
//=======================================================================
inline GeomAbs_Shape HLRBRep_Surface::UContinuity()const
{ return HLRBRep_BSurfaceTool::UContinuity(mySurf); }
//=======================================================================
//function : VContinuity
//purpose :
//=======================================================================
inline GeomAbs_Shape HLRBRep_Surface::VContinuity()const
{ return HLRBRep_BSurfaceTool::VContinuity(mySurf); }
//=======================================================================
//function : NbUIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_Surface::NbUIntervals(const GeomAbs_Shape S)
{ return HLRBRep_BSurfaceTool::NbUIntervals(mySurf,S); }
//=======================================================================
//function : NbVIntervals
//purpose :
//=======================================================================
inline Standard_Integer
HLRBRep_Surface::NbVIntervals(const GeomAbs_Shape S)
{ return HLRBRep_BSurfaceTool::NbVIntervals(mySurf,S); }
//=======================================================================
//function : IsUClosed
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Surface::IsUClosed()const
{ return HLRBRep_BSurfaceTool::IsUClosed(mySurf); }
//=======================================================================
//function : IsVClosed
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Surface::IsVClosed()const
{ return HLRBRep_BSurfaceTool::IsVClosed(mySurf); }
//=======================================================================
//function : IsUPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Surface::IsUPeriodic()const
{ return HLRBRep_BSurfaceTool::IsUPeriodic(mySurf); }
//=======================================================================
//function : UPeriod
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::UPeriod()const
{ return HLRBRep_BSurfaceTool::UPeriod(mySurf); }
//=======================================================================
//function : IsVPeriodic
//purpose :
//=======================================================================
inline Standard_Boolean HLRBRep_Surface::IsVPeriodic()const
{ return HLRBRep_BSurfaceTool::IsVPeriodic(mySurf); }
//=======================================================================
//function : VPeriod
//purpose :
//=======================================================================
inline Standard_Real HLRBRep_Surface::VPeriod()const
{ return HLRBRep_BSurfaceTool::VPeriod(mySurf); }
//=======================================================================
//function : D0
//purpose :
//=======================================================================
inline void HLRBRep_Surface::D0(const Standard_Real U,
const Standard_Real V,
gp_Pnt& P) const
{ HLRBRep_BSurfaceTool::D0(mySurf,U,V,P); }
//=======================================================================
//function : D1
//purpose :
//=======================================================================
inline void HLRBRep_Surface::D1(const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V) const
{ HLRBRep_BSurfaceTool::D1(mySurf,U,V,P,D1U,D1V); }
//=======================================================================
//function : D2
//purpose :
//=======================================================================
inline void HLRBRep_Surface::D2(const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V,
gp_Vec& D2U,
gp_Vec& D2V,
gp_Vec& D2UV) const
{ HLRBRep_BSurfaceTool::D2(mySurf,U,V,P,D1U,D1V,D2U,D2V,D2UV); }
//=======================================================================
//function : D3
//purpose :
//=======================================================================
inline void HLRBRep_Surface::D3(const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V,
gp_Vec& D2U,
gp_Vec& D2V,
gp_Vec& D2UV,
gp_Vec& D3U,
gp_Vec& D3V,
gp_Vec& D3UUV,
gp_Vec& D3UVV) const
{ HLRBRep_BSurfaceTool::D3
(mySurf,U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV); }
//=======================================================================
//function : DN
//purpose :
//=======================================================================
inline gp_Vec HLRBRep_Surface::DN(const Standard_Real U,
const Standard_Real V,
const Standard_Integer Nu,
const Standard_Integer Nv) const
{ return HLRBRep_BSurfaceTool::DN(mySurf,U,V,Nu,Nv); }
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
inline GeomAbs_SurfaceType HLRBRep_Surface::GetType()const
{ return myType; }
//=======================================================================
//function : Cylinder
//purpose :
//=======================================================================
inline gp_Cylinder HLRBRep_Surface::Cylinder()const
{ return HLRBRep_BSurfaceTool::Cylinder(mySurf); }
//=======================================================================
//function : Cone
//purpose :
//=======================================================================
inline gp_Cone HLRBRep_Surface::Cone()const
{ return HLRBRep_BSurfaceTool::Cone(mySurf); }
//=======================================================================
//function : Sphere
//purpose :
//=======================================================================
inline gp_Sphere HLRBRep_Surface::Sphere()const
{ return HLRBRep_BSurfaceTool::Sphere(mySurf); }
//=======================================================================
//function : Torus
//purpose :
//=======================================================================
inline gp_Torus HLRBRep_Surface::Torus()const
{ return HLRBRep_BSurfaceTool::Torus(mySurf); }
//=======================================================================
//function : UDegree
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::UDegree()const
{ return HLRBRep_BSurfaceTool::UDegree(mySurf); }
//=======================================================================
//function : NbUPoles
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::NbUPoles()const
{ return HLRBRep_BSurfaceTool::NbUPoles(mySurf); }
//=======================================================================
//function : VDegree
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::VDegree()const
{ return HLRBRep_BSurfaceTool::VDegree(mySurf); }
//=======================================================================
//function : NbVPoles
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::NbVPoles()const
{ return HLRBRep_BSurfaceTool::NbVPoles(mySurf); }
//=======================================================================
//function : NbUKnots
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::NbUKnots()const
{ return HLRBRep_BSurfaceTool::NbUKnots(mySurf); }
//=======================================================================
//function : NbVKnots
//purpose :
//=======================================================================
inline Standard_Integer HLRBRep_Surface::NbVKnots()const
{ return HLRBRep_BSurfaceTool::NbVKnots(mySurf); }
//=======================================================================
//function : Axis
//purpose :
//=======================================================================
inline gp_Ax1 HLRBRep_Surface::Axis()const
{ return HLRBRep_BSurfaceTool::AxeOfRevolution(mySurf); }

View File

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

View File

@@ -0,0 +1,127 @@
//-- File : HLRBRep_SurfaceTool.gxx
//-- Created : Wed Jui 7 18:00:00 1c93
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#include <HLRBRep_SurfaceTool.ixx>
#include <BRepAdaptor_Surface.hxx>
Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface *)S)->GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + ((BRepAdaptor_Surface *)S)->NbUPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = ((BRepAdaptor_Surface *)S)->NbUKnots();
nbs*= ((BRepAdaptor_Surface *)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 HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S) {
Standard_Integer nbs;
GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface *)S)->GetType();
switch(typS) {
case GeomAbs_Plane:
{
nbs = 2;
}
break;
case GeomAbs_BezierSurface:
{
nbs = 3 + ((BRepAdaptor_Surface *)S)->NbVPoles();
}
break;
case GeomAbs_BSplineSurface:
{
nbs = ((BRepAdaptor_Surface *)S)->NbVKnots();
nbs*= ((BRepAdaptor_Surface *)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 HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address 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 HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address 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,231 @@
//-- File : HLRBRep_SurfaceTool.lxx
//-- Created : Wed Jui 7 18:00:00 1993
//-- Author : Laurent BUCHARD
//-- <lbr@nonox>
//-- Copyright: Matra Datavision 1993
#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>
#include <BRepAdaptor_Surface.hxx>
inline Standard_Real HLRBRep_SurfaceTool::FirstUParameter(const Standard_Address Surf){ return ((BRepAdaptor_Surface *)Surf)->FirstUParameter(); }
inline Standard_Real HLRBRep_SurfaceTool::FirstVParameter(const Standard_Address Surf){ return ((BRepAdaptor_Surface *)Surf)->FirstVParameter();}
inline Standard_Real HLRBRep_SurfaceTool::LastUParameter(const Standard_Address Surf){ return ((BRepAdaptor_Surface *)Surf)->LastUParameter();}
inline Standard_Real HLRBRep_SurfaceTool::LastVParameter(const Standard_Address Surf){ return ((BRepAdaptor_Surface *)Surf)->LastVParameter();}
inline Standard_Integer HLRBRep_SurfaceTool::NbUIntervals(const Standard_Address Surf,
const GeomAbs_Shape S){
return ((BRepAdaptor_Surface *)Surf)->NbUIntervals(S);
}
inline Standard_Integer HLRBRep_SurfaceTool::NbVIntervals(const Standard_Address Surf,
const GeomAbs_Shape S){
return ((BRepAdaptor_Surface *)Surf)->NbVIntervals(S);
}
inline void HLRBRep_SurfaceTool::UIntervals(const Standard_Address Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S){
((BRepAdaptor_Surface *)Surf)->UIntervals(Tab,S);
}
inline void HLRBRep_SurfaceTool::VIntervals(const Standard_Address Surf,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape S){
((BRepAdaptor_Surface *)Surf)->VIntervals(Tab,S);
}
inline Handle_Adaptor3d_HSurface HLRBRep_SurfaceTool::UTrim(const Standard_Address Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol) {
return ((BRepAdaptor_Surface *)Surf)->UTrim(F,L,Tol);
}
inline Handle_Adaptor3d_HSurface HLRBRep_SurfaceTool::VTrim(const Standard_Address Surf,
const Standard_Real F,
const Standard_Real L,
const Standard_Real Tol) {
return ((BRepAdaptor_Surface *)Surf)->VTrim(F,L,Tol);
}
inline Standard_Boolean HLRBRep_SurfaceTool::IsUClosed(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->IsUClosed();
}
inline Standard_Boolean HLRBRep_SurfaceTool::IsVClosed(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->IsVClosed();
}
inline Standard_Boolean HLRBRep_SurfaceTool::IsUPeriodic(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->IsUPeriodic();
}
inline Standard_Real HLRBRep_SurfaceTool::UPeriod(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->UPeriod();
}
inline Standard_Boolean HLRBRep_SurfaceTool::IsVPeriodic(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->IsVPeriodic();
}
inline Standard_Real HLRBRep_SurfaceTool::VPeriod(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->VPeriod();
}
inline gp_Pnt HLRBRep_SurfaceTool::Value(const Standard_Address S,
const Standard_Real U,
const Standard_Real V )
{
return ((BRepAdaptor_Surface *)S)->Value(U,V);
}
inline void HLRBRep_SurfaceTool::D0(const Standard_Address S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P)
{
((BRepAdaptor_Surface *)S)->D0(U,V,P);
}
inline void HLRBRep_SurfaceTool::D1(const Standard_Address S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& D1U,
gp_Vec& D1V)
{
((BRepAdaptor_Surface *)S)->D1(U,V,P,D1U,D1V);
}
inline void HLRBRep_SurfaceTool::D2(const Standard_Address 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)
{
((BRepAdaptor_Surface *)S)->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
}
inline void HLRBRep_SurfaceTool::D3(const Standard_Address 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)
{
((BRepAdaptor_Surface *)S)->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
}
inline gp_Vec HLRBRep_SurfaceTool::DN(const Standard_Address S,
const Standard_Real U,
const Standard_Real V,
const Standard_Integer Nu,
const Standard_Integer Nv)
{
return ((BRepAdaptor_Surface *)S)->DN(U,V,Nu,Nv);
}
inline Standard_Real HLRBRep_SurfaceTool::UResolution(const Standard_Address S,
const Standard_Real R3d)
{
return ((BRepAdaptor_Surface *)S)->UResolution(R3d);
}
inline Standard_Real HLRBRep_SurfaceTool::VResolution(const Standard_Address S,
const Standard_Real R3d)
{
return ((BRepAdaptor_Surface *)S)->VResolution(R3d);
}
inline GeomAbs_SurfaceType HLRBRep_SurfaceTool::GetType(const Standard_Address S )
{
return ((BRepAdaptor_Surface *)S)->GetType();
}
inline gp_Pln HLRBRep_SurfaceTool::Plane(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->Plane();
}
inline gp_Cylinder HLRBRep_SurfaceTool::Cylinder(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->Cylinder();
}
inline gp_Cone HLRBRep_SurfaceTool::Cone(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->Cone();
}
inline gp_Sphere HLRBRep_SurfaceTool::Sphere(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->Sphere();
}
inline gp_Torus HLRBRep_SurfaceTool::Torus(const Standard_Address S)
{
return ((BRepAdaptor_Surface *)S)->Torus();
}
inline Handle(Geom_BezierSurface) HLRBRep_SurfaceTool::Bezier(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->Bezier());
}
inline Handle(Geom_BSplineSurface) HLRBRep_SurfaceTool::BSpline(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->BSpline());
}
inline gp_Ax1 HLRBRep_SurfaceTool::AxeOfRevolution(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->AxeOfRevolution());
}
inline gp_Dir HLRBRep_SurfaceTool::Direction(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->Direction());
}
inline Handle(Adaptor3d_HCurve) HLRBRep_SurfaceTool::BasisCurve(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->BasisCurve());
}
inline Handle(Adaptor3d_HSurface) HLRBRep_SurfaceTool::BasisSurface(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->BasisSurface());
}
inline Standard_Real HLRBRep_SurfaceTool::OffsetValue(const Standard_Address S) {
return(((BRepAdaptor_Surface *)S)->OffsetValue());
}

View File

@@ -0,0 +1,72 @@
-- File: HLRBRep_VertexList.cdl
-- Created: Thu Apr 17 20:04:00 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class VertexList from HLRBRep
uses
Orientation from TopAbs,
Intersection from HLRAlgo,
Interference from HLRAlgo,
ListIteratorOfInterferenceList from HLRAlgo,
EdgeInterferenceTool from HLRBRep
is
Create(T : EdgeInterferenceTool from HLRBRep;
I : ListIteratorOfInterferenceList from HLRAlgo)
returns VertexList from HLRBRep;
IsPeriodic(me) returns Boolean from Standard
---Purpose: Returns True when the curve is periodic.
is static;
More(me) returns Boolean from Standard
---Purpose: Returns True when there are more vertices.
is static;
Next(me : in out)
---Purpose: Proceeds to the next vertex.
is static;
Current(me) returns Intersection from HLRAlgo
---Purpose: Returns the current vertex
--
---C++: return const &
is static;
IsBoundary(me) returns Boolean from Standard
---Purpose: Returns True if the current vertex is is on the
-- boundary of the edge.
is static;
IsInterference(me) returns Boolean from Standard
---Purpose: Returns True if the current vertex is an
-- interference.
is static;
Orientation(me) returns Orientation from TopAbs
---Purpose: Returns the orientation of the current vertex if
-- it is on the boundary of the edge.
is static;
Transition(me) returns Orientation from TopAbs
---Purpose: Returns the transition of the current vertex if
-- it is an interference.
is static;
BoundaryTransition(me) returns Orientation from TopAbs
---Purpose: Returns the transition of the current vertex
-- relative to the boundary if it is an interference.
is static;
fields
myIterator : ListIteratorOfInterferenceList from HLRAlgo;
myTool : EdgeInterferenceTool from HLRBRep;
fromEdge : Boolean from Standard;
fromInterf : Boolean from Standard;
end VertexList;

View File

@@ -0,0 +1,154 @@
// File: HLRBRep_VertexList.cxx
// Created: Thu Apr 17 21:25:08 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_VertexList.ixx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_DomainError.hxx>
//=======================================================================
//function : HLRBRep_VertexList
//purpose :
//=======================================================================
HLRBRep_VertexList::
HLRBRep_VertexList(const HLRBRep_EdgeInterferenceTool& T,
const HLRAlgo_ListIteratorOfInterferenceList& I) :
myIterator(I),
myTool(T),
fromEdge(Standard_False),
fromInterf(Standard_False)
{
myTool.InitVertices();
Next();
}
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_VertexList::IsPeriodic()const
{
return myTool.IsPeriodic();
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_VertexList::More()const
{
return (fromEdge || fromInterf);
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void HLRBRep_VertexList::Next()
{
if (fromInterf)
myIterator.Next();
if (fromEdge)
myTool.NextVertex();
fromInterf = myIterator.More();
fromEdge = myTool.MoreVertices();
if (fromEdge && fromInterf) {
if (!myTool.SameVertexAndInterference( myIterator.Value())) {
if (myTool.CurrentParameter() <
myTool.ParameterOfInterference(myIterator.Value())) {
fromInterf = Standard_False;
}
else {
fromEdge = Standard_False;
}
}
}
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
const HLRAlgo_Intersection & HLRBRep_VertexList::Current() const
{
if (fromEdge)
return myTool.CurrentVertex();
else if (fromInterf)
return myIterator.Value().Intersection();
else
Standard_NoSuchObject::Raise("HLRBRep_VertexList::Current");
return myTool.CurrentVertex(); // only for WNT.
}
//=======================================================================
//function : IsBoundary
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_VertexList::IsBoundary() const
{
return fromEdge;
}
//=======================================================================
//function : IsInterference
//purpose :
//=======================================================================
Standard_Boolean HLRBRep_VertexList::IsInterference() const
{
return fromInterf;
}
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
TopAbs_Orientation HLRBRep_VertexList::Orientation() const
{
if (fromEdge)
return myTool.CurrentOrientation();
else
Standard_DomainError::Raise("HLRBRep_VertexList::Orientation");
return TopAbs_EXTERNAL; // only for WNT.
}
//=======================================================================
//function : Transition
//purpose :
//=======================================================================
TopAbs_Orientation HLRBRep_VertexList::Transition() const
{
if (fromInterf)
return myIterator.Value().Transition();
else
Standard_DomainError::Raise("HLRBRep_VertexList::Transition");
return TopAbs_EXTERNAL; // only for WNT.
}
//=======================================================================
//function : BoundaryTransition
//purpose :
//=======================================================================
TopAbs_Orientation HLRBRep_VertexList::BoundaryTransition() const
{
if (fromInterf)
return myIterator.Value().BoundaryTransition();
else
Standard_DomainError::Raise("HLRBRep_VertexList::BoundaryTransition");
return TopAbs_EXTERNAL; // only for WNT.
}