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

91
src/MAT/MAT.cdl Executable file
View File

@@ -0,0 +1,91 @@
-- File: MAT.cdl
-- Created: Tue Sep 22 15:04:08 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@bravox>
---Copyright: Matra Datavision 1992
package MAT
uses
MMgt,
TCollection,
TColStd
is
generic class Tool;
--- Purpose: The template class used in Mat.
generic class Mat;
--- Purpose: The Algorithm of Computation of the Map of
-- bisecting locus.
--------------------------------------------------
-- Classes of exploration of the Bisecting Locus.
--------------------------------------------------
enumeration Side is Left,Right end Side;
--- Purpose: Definition on the Left and the Right on the Fig.
class Graph;
--- Purpose: Graph of exploration of the Bisecting Locus.
class Arc;
--- Purpose: Arc of Graph.
class Node;
--- Purpose: Node of Graph.
class BasicElt;
--- Purpose: BasicElt of Graph.
class Zone;
--- Purpose: Class Zone contains the frontiere of the Zone of proximity
-- of a BasicElt.
class SequenceOfBasicElt instantiates Sequence from TCollection
(BasicElt from MAT);
class SequenceOfArc instantiates Sequence from TCollection
(Arc from MAT) ;
class DataMapOfIntegerArc instantiates
DataMap from TCollection(Integer from Standard,
Arc from MAT ,
MapIntegerHasher from TColStd);
class DataMapOfIntegerBasicElt instantiates
DataMap from TCollection(Integer from Standard,
BasicElt from MAT ,
MapIntegerHasher from TColStd);
class DataMapOfIntegerNode instantiates
DataMap from TCollection(Integer from Standard,
Node from MAT ,
MapIntegerHasher from TColStd);
---------------------------------------------------
-- Classes used for the computation of the Mat.
---------------------------------------------------
generic class TList, TListNode;
class Bisector;
class DataMapOfIntegerBisector instantiates
DataMap from TCollection(Integer from Standard,
Bisector from MAT ,
MapIntegerHasher from TColStd);
class ListOfBisector instantiates TList from MAT (Bisector from MAT);
class Edge;
class ListOfEdge instantiates TList from MAT (Edge from MAT);
end MAT;

140
src/MAT/MAT_Arc.cdl Executable file
View File

@@ -0,0 +1,140 @@
-- File: MAT_Arc.cdl
-- Created: Fri Apr 30 17:24:12 1993
-- Author: Yves FRICAUD
-- <yfr@phylox>
---Copyright: Matra Datavision 1993
class Arc from MAT
inherits
TShared from MMgt
---Purpose: An Arc is associated to each Bisecting of the mat.
uses
BasicElt from MAT,
Node from MAT,
Side from MAT,
Address from Standard
raises
DomainError from Standard
is
Create ( ArcIndex : Integer;
GeomIndex : Integer;
FirstElement : BasicElt from MAT;
SecondElement : BasicElt from MAT )
--- Purpose :
returns mutable Arc;
Index (me)
--- Purpose : Returns the index of <me> in Graph.theArcs.
returns Integer
is static;
GeomIndex(me)
--- Purpose : Returns the index associated of the geometric
-- representation of <me>.
returns Integer
is static;
FirstElement(me)
--- Purpose : Returns one of the BasicElt equidistant from <me>.
returns BasicElt from MAT
is static;
SecondElement(me)
--- Purpose : Returns the other BasicElt equidistant from <me>.
returns BasicElt from MAT
is static;
FirstNode (me)
--- Purpose : Returns one Node extremity of <me>.
returns mutable Node from MAT
is static;
SecondNode (me)
--- Purpose : Returns the other Node extremity of <me>.
returns mutable Node from MAT
is static;
TheOtherNode (me ; aNode : Node)
returns Node from MAT
--- Purpose : an Arc has two Node, if <aNode> egal one
-- Returns the other.
--
raises
DomainError from Standard
---Purpose: if <aNode> is not oh <me>
is static;
HasNeighbour(me ; aNode : Node ; aSide : Side)
--- Purpose : Returnst True is there is an arc linked to
-- the Node <aNode> located on the side <aSide> of <me>;
returns Boolean from Standard
raises
DomainError from Standard
---Purpose: if <aNode> is not on <me>
is static;
Neighbour(me ; aNode : Node ; aSide : Side)
--- Purpose : Returns the first arc linked to the Node <aNode>
-- located on the side <aSide> of <me>;
returns Arc from MAT
raises
DomainError from Standard
---Purpose: if HasNeighbour() returns FALSE.
is static;
SetIndex (me : mutable ; anInteger : Integer)
is static;
SetGeomIndex(me : mutable ; anInteger : Integer)
is static;
SetFirstElement (me : mutable ; aBasicElt : BasicElt from MAT)
is static;
SetSecondElement (me : mutable ; aBasicElt : BasicElt from MAT)
is static;
SetFirstNode (me : mutable ; aNode : Node from MAT)
is static;
SetSecondNode (me : mutable ; aNode : Node from MAT)
is static;
SetFirstArc (me : mutable ; aSide : Side ; anArc : Arc)
is static;
SetSecondArc (me : mutable ; aSide : Side ; anArc : Arc)
is static;
SetNeighbour (me : mutable ; aSide : Side ; aNode : Node ; anArc : Arc)
is static;
fields
arcIndex : Integer;
geomIndex : Integer;
firstElement : BasicElt from MAT;
secondElement : BasicElt from MAT;
firstNode : Node from MAT;
secondNode : Node from MAT;
firstArcLeft : Address from Standard;
firstArcRight : Address from Standard;
secondArcRight : Address from Standard;
secondArcLeft : Address from Standard;
firstParameter : Real;
secondParameter : Real;
end Arc;

258
src/MAT/MAT_Arc.cxx Executable file
View File

@@ -0,0 +1,258 @@
// File: MAT_Arc.cxx
// Created: Tue May 4 18:11:04 1993
// Author: Yves FRICAUD
// <yfr@phylox>
#include <MAT_Arc.ixx>
#include <Standard_DomainError.hxx>
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Arc::MAT_Arc (const Standard_Integer ArcIndex,
const Standard_Integer GeomIndex,
const Handle(MAT_BasicElt)& FirstElement,
const Handle(MAT_BasicElt)& SecondElement)
: arcIndex(ArcIndex),
geomIndex(GeomIndex),
firstArcLeft (0),
firstArcRight (0),
secondArcRight (0),
secondArcLeft (0)
{
firstElement = FirstElement;
secondElement = SecondElement;
}
//========================================================================
// function: Index
// purpose :
//========================================================================
Standard_Integer MAT_Arc::Index() const
{
return arcIndex;
}
//========================================================================
// function: GeomIndex
// purpose :
//========================================================================
Standard_Integer MAT_Arc::GeomIndex() const
{
return geomIndex;
}
//========================================================================
// function: FirstElement
// purpose :
//========================================================================
Handle(MAT_BasicElt) MAT_Arc::FirstElement() const
{
return firstElement;
}
//========================================================================
// function: SecondElement
// purpose :
//========================================================================
Handle(MAT_BasicElt) MAT_Arc::SecondElement() const
{
return secondElement;
}
//========================================================================
// function: FirstNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::FirstNode() const
{
return firstNode;
}
//========================================================================
// function: SecondNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::SecondNode() const
{
return secondNode;
}
//========================================================================
// function: TheOtherNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::TheOtherNode(const Handle(MAT_Node)& aNode)const
{
if (FirstNode() == aNode)
return SecondNode();
else if (SecondNode() == aNode)
return FirstNode();
else {
Standard_DomainError::Raise("MAT_Arc::TheOtherNode");
return aNode;
}
}
//========================================================================
// function: HasNeighbour
// purpose :
//========================================================================
Standard_Boolean MAT_Arc::HasNeighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide ) const
{
if (aSide == MAT_Left) {
// if (aNode == FirstNode()) return (!firstArcLeft == NULL);
if (aNode == FirstNode()) return (!firstArcLeft == 0);
// if (aNode == SecondNode()) return (!secondArcLeft == NULL);
if (aNode == SecondNode()) return (!secondArcLeft == 0);
}
else {
// if (aNode == FirstNode()) return (!firstArcRight == NULL);
if (aNode == FirstNode()) return (!firstArcRight == 0);
// if (aNode == SecondNode()) return (!secondArcRight == NULL);
if (aNode == SecondNode()) return (!secondArcRight == 0);
}
Standard_DomainError::Raise("MAT_Arc::HasNeighbour");
return Standard_False;
}
//========================================================================
// function: Neighbour
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_Arc::Neighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide )
const
{
if (aSide == MAT_Left) {
if (aNode == FirstNode()) return (MAT_Arc*)firstArcLeft;
if (aNode == SecondNode()) return (MAT_Arc*)secondArcLeft;
}
else {
if (aNode == FirstNode()) return (MAT_Arc*)firstArcRight;
if (aNode == SecondNode()) return (MAT_Arc*)secondArcRight;
}
Standard_DomainError::Raise("MAT_Arc::Neighbour");
return (MAT_Arc*)firstArcLeft;
}
//========================================================================
// function: SetIndex
// purpose :
//========================================================================
void MAT_Arc::SetIndex(const Standard_Integer anInteger)
{
arcIndex = anInteger;
}
//========================================================================
// function: SetGeomIndex
// purpose :
//========================================================================
void MAT_Arc::SetGeomIndex(const Standard_Integer anInteger)
{
geomIndex = anInteger;
}
//========================================================================
// function: SetFirstElement
// purpose :
//========================================================================
void MAT_Arc::SetFirstElement(const Handle(MAT_BasicElt)& aBasicElt)
{
firstElement = aBasicElt;
}
//========================================================================
// function: SetSecondElement
// purpose :
//========================================================================
void MAT_Arc::SetSecondElement(const Handle(MAT_BasicElt)& aBasicElt)
{
secondElement = aBasicElt;
}
//========================================================================
// function: SetFirstNode
// purpose :
//========================================================================
void MAT_Arc::SetFirstNode(const Handle(MAT_Node)& aNode)
{
firstNode = aNode;
}
//========================================================================
// function: SetSecondNode
// purpose :
//========================================================================
void MAT_Arc::SetSecondNode(const Handle_MAT_Node& aNode)
{
secondNode = aNode;
}
//========================================================================
// function: SetFirstArc
// purpose :
//========================================================================
void MAT_Arc::SetFirstArc(const MAT_Side aSide ,
const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left)
firstArcLeft = anArc.operator->();
else
firstArcRight = anArc.operator->();
}
//========================================================================
// function: SetSecondArc
// purpose :
//========================================================================
void MAT_Arc::SetSecondArc(const MAT_Side aSide ,
const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left)
secondArcLeft = anArc.operator->();
else
secondArcRight = anArc.operator->();
}
//========================================================================
// function: SetNeighbour
// purpose :
//========================================================================
void MAT_Arc::SetNeighbour(const MAT_Side aSide,
const Handle(MAT_Node)& aNode,
const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left) {
if (aNode == FirstNode())
firstArcLeft = anArc.operator->();
else if (aNode == SecondNode())
secondArcLeft = anArc.operator->();
else
Standard_DomainError::Raise("MAT_Arc::SetNeighbour");
}
else {
if (aNode == FirstNode())
firstArcRight = anArc.operator->();
else if (aNode == SecondNode())
secondArcRight = anArc.operator->();
else
Standard_DomainError::Raise("MAT_Arc::SetNeighbour");
}
}

69
src/MAT/MAT_BasicElt.cdl Executable file
View File

@@ -0,0 +1,69 @@
-- File: MAT_BasicElt.cdl
-- Created: Fri Apr 30 12:10:31 1993
-- Author: Yves FRICAUD
-- <yfr@phylox>
---Copyright: Matra Datavision 1993
class BasicElt from MAT
---Purpose: A BasicELt is associated to each elemtary
-- constituant of the figure.
inherits
TShared from MMgt
uses
Arc from MAT,
Side from MAT,
Address from Standard
is
Create (anInteger : Integer)
--- Purpose : Constructor, <anInteger> is the <index> of <me>.
returns mutable BasicElt from MAT;
StartArc(me)
--- Purpose : Return <startArcLeft> or <startArcRight> corresponding
-- to <aSide>.
returns Arc is static;
EndArc(me)
--- Purpose : Return <endArcLeft> or <endArcRight> corresponding
-- to <aSide>.
returns Arc is static;
Index (me)
--- Purpose : Return the <index> of <me> in Graph.TheBasicElts.
returns Integer is static;
GeomIndex(me)
--- Purpose : Return the <GeomIndex> of <me>.
returns Integer is static;
SetStartArc (me : mutable ; anArc : Arc)
is static;
SetEndArc (me : mutable ; anArc : Arc)
is static;
SetIndex (me : mutable ; anInteger : Integer)
is static;
SetGeomIndex(me : mutable ; anInteger : Integer)
is static;
fields
startLeftArc : Address from Standard;
endLeftArc : Address from Standard;
index : Integer;
geomIndex : Integer;
end BasicElt;

99
src/MAT/MAT_BasicElt.cxx Executable file
View File

@@ -0,0 +1,99 @@
// File: MAT_BasicElt.cxx
// Created: Wed May 5 10:11:24 1993
// Author: Yves FRICAUD
// <yfr@phylox>
#include <MAT_BasicElt.ixx>
#include <MAT_SequenceOfArc.hxx>
#include <MAT_Node.hxx>
//========================================================================
// function:
// purpose :
//========================================================================
MAT_BasicElt::MAT_BasicElt(const Standard_Integer anInteger)
: startLeftArc (0),
endLeftArc (0),
index(anInteger)
{
}
//========================================================================
// function: StartArc
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_BasicElt::StartArc() const
{
return (MAT_Arc*)startLeftArc;
}
//========================================================================
// function: EndArc
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_BasicElt::EndArc() const
{
return (MAT_Arc*)endLeftArc;
}
//========================================================================
// function: Index
// purpose :
//========================================================================
Standard_Integer MAT_BasicElt::Index() const
{
return index;
}
//========================================================================
// function: GeomIndex
// purpose :
//========================================================================
Standard_Integer MAT_BasicElt::GeomIndex() const
{
return geomIndex;
}
//========================================================================
// function: SetStartArc
// purpose :
//========================================================================
void MAT_BasicElt::SetStartArc(const Handle_MAT_Arc& anArc)
{
startLeftArc = anArc.operator->();
}
//========================================================================
// function: SetEndArc
// purpose :
//========================================================================
void MAT_BasicElt::SetEndArc(const Handle_MAT_Arc& anArc)
{
endLeftArc = anArc.operator->();
}
//========================================================================
// function: SetIndex
// purpose :
//========================================================================
void MAT_BasicElt::SetIndex(const Standard_Integer anInteger)
{
index = anInteger;
}
//========================================================================
// function: SetGeomIndex
// purpose :
//========================================================================
void MAT_BasicElt::SetGeomIndex(const Standard_Integer anInteger)
{
geomIndex = anInteger;
}

159
src/MAT/MAT_Bisector.cdl Executable file
View File

@@ -0,0 +1,159 @@
-- File: Bisector.cdl
-- Created: Wed Sep 30 10:57:34 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@bravox>
---Copyright: Matra Datavision 1992
class Bisector from MAT
---Purpose:
inherits
TShared from MMgt
uses
ListOfBisector from MAT,
Edge from MAT
is
Create
---Purpose:
returns mutable Bisector from MAT;
AddBisector(me ; abisector : any Bisector from MAT)
is static;
List(me) returns any ListOfBisector from MAT
is static;
FirstBisector(me) returns any Bisector from MAT
is static;
LastBisector(me) returns any Bisector from MAT
is static;
BisectorNumber(me : mutable ; anumber : Integer)
is static;
IndexNumber(me : mutable ; anumber : Integer)
is static;
FirstEdge(me : mutable ; anedge : any Edge from MAT)
is static;
SecondEdge(me : mutable ; anedge : any Edge from MAT)
is static;
IssuePoint(me : mutable ; apoint : Integer)
is static;
EndPoint(me : mutable ; apoint : Integer)
is static;
DistIssuePoint(me : mutable ; areal : Real)
is static;
FirstVector(me : mutable ; avector : Integer)
is static;
SecondVector(me : mutable ; avector : Integer)
is static;
Sense(me : mutable ; asense : Real)
is static;
FirstParameter(me : mutable ; aparameter : Real)
is static;
SecondParameter(me : mutable ; aparameter : Real)
is static;
BisectorNumber(me) returns Integer
is static;
IndexNumber(me) returns Integer
is static;
FirstEdge(me) returns any Edge from MAT
is static;
SecondEdge(me) returns any Edge from MAT
is static;
IssuePoint(me) returns Integer
is static;
EndPoint(me) returns Integer
is static;
DistIssuePoint(me) returns Real
is static;
FirstVector(me) returns Integer
is static;
SecondVector(me) returns Integer
is static;
Sense(me) returns Real
is static;
FirstParameter(me) returns Real
is static;
SecondParameter(me) returns Real
is static;
Dump(me ; ashift , alevel : Integer)
is static;
fields
thebisectornumber : Integer;
theindexnumber : Integer;
thefirstedge : Edge from MAT;
thesecondedge : Edge from MAT;
thelistofbisectors : ListOfBisector from MAT;
theissuepoint : Integer;
theendpoint : Integer;
thefirstvector : Integer;
thesecondvector : Integer;
thesense : Real;
thefirstparameter : Real;
thesecondparameter : Real;
distissuepoint : Real;
end Bisector;

179
src/MAT/MAT_Bisector.cxx Executable file
View File

@@ -0,0 +1,179 @@
// File: MAT_Bisector.cxx
// Created: Wed Sep 30 11:18:42 1992
// Author: Gilles DEBARBOUILLE
// <gde@bravox>
#include <MAT_Bisector.ixx>
#include <Precision.hxx>
MAT_Bisector::MAT_Bisector()
{
thebisectornumber = -1;
thefirstparameter = Precision::Infinite();
thesecondparameter = Precision::Infinite();
thelistofbisectors = new MAT_ListOfBisector();
}
void MAT_Bisector::AddBisector(const Handle(MAT_Bisector)& abisector) const
{
thelistofbisectors->BackAdd(abisector);
}
Handle(MAT_ListOfBisector) MAT_Bisector::List() const
{
return thelistofbisectors;
}
Handle(MAT_Bisector) MAT_Bisector::FirstBisector() const
{
return thelistofbisectors->FirstItem();
}
Handle(MAT_Bisector) MAT_Bisector::LastBisector() const
{
return thelistofbisectors->LastItem();
}
void MAT_Bisector::BisectorNumber(const Standard_Integer anumber)
{
thebisectornumber = anumber;
}
void MAT_Bisector::IndexNumber(const Standard_Integer anumber)
{
theindexnumber = anumber;
}
void MAT_Bisector::FirstEdge(const Handle(MAT_Edge)& anedge)
{
thefirstedge = anedge;
}
void MAT_Bisector::SecondEdge(const Handle(MAT_Edge)& anedge)
{
thesecondedge = anedge;
}
void MAT_Bisector::IssuePoint(const Standard_Integer apoint)
{
theissuepoint = apoint;
}
void MAT_Bisector::EndPoint(const Standard_Integer apoint)
{
theendpoint = apoint;
}
void MAT_Bisector::DistIssuePoint(const Standard_Real areal)
{
distissuepoint = areal;
}
void MAT_Bisector::FirstVector(const Standard_Integer avector)
{
thefirstvector = avector;
}
void MAT_Bisector::SecondVector(const Standard_Integer avector)
{
thesecondvector = avector;
}
void MAT_Bisector::Sense(const Standard_Real asense)
{
thesense = asense;
}
void MAT_Bisector::FirstParameter(const Standard_Real aparameter)
{
thefirstparameter = aparameter;
}
void MAT_Bisector::SecondParameter(const Standard_Real aparameter)
{
thesecondparameter = aparameter;
}
Standard_Integer MAT_Bisector::BisectorNumber() const
{
return thebisectornumber;
}
Standard_Integer MAT_Bisector::IndexNumber() const
{
return theindexnumber;
}
Handle(MAT_Edge) MAT_Bisector::FirstEdge() const
{
return thefirstedge;
}
Handle(MAT_Edge) MAT_Bisector::SecondEdge() const
{
return thesecondedge;
}
Standard_Integer MAT_Bisector::IssuePoint() const
{
return theissuepoint;
}
Standard_Integer MAT_Bisector::EndPoint() const
{
return theendpoint;
}
Standard_Real MAT_Bisector::DistIssuePoint() const
{
return distissuepoint;
}
Standard_Integer MAT_Bisector::FirstVector() const
{
return thefirstvector;
}
Standard_Integer MAT_Bisector::SecondVector() const
{
return thesecondvector;
}
Standard_Real MAT_Bisector::Sense() const
{
return thesense;
}
Standard_Real MAT_Bisector::FirstParameter() const
{
return thefirstparameter;
}
Standard_Real MAT_Bisector::SecondParameter() const
{
return thesecondparameter;
}
void MAT_Bisector::Dump(const Standard_Integer ashift,
const Standard_Integer alevel) const
{
Standard_Integer i;
for(i=0; i<ashift; i++)cout<<" ";
cout<<" BISECTOR : "<<thebisectornumber<<endl;
for(i=0; i<ashift; i++)cout<<" ";
cout<<" First edge : "<<thefirstedge->EdgeNumber()<<endl;
for(i=0; i<ashift; i++)cout<<" ";
cout<<" Second edge : "<<thesecondedge->EdgeNumber()<<endl;
for(i=0; i<ashift; i++)cout<<" ";
if(alevel)
{
if(!thelistofbisectors->More())
{
cout<<" Bisectors List : "<<endl;
thelistofbisectors->Dump(ashift+1,1);
}
}
cout<<endl;
}

79
src/MAT/MAT_Edge.cdl Executable file
View File

@@ -0,0 +1,79 @@
-- File: Edge.cdl
-- Created: Wed Oct 14 10:16:07 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@bravox>
---Copyright: Matra Datavision 1992
class Edge from MAT
---Purpose:
inherits
TShared from MMgt
uses
Bisector from MAT,
ListOfEdge from MAT
--raises
is
Create returns mutable Edge from MAT;
EdgeNumber(me : mutable ; anumber : Integer)
is static;
FirstBisector(me : mutable ; abisector : any Bisector from MAT)
is static;
SecondBisector(me : mutable ; abisector : any Bisector from MAT)
is static;
Distance(me : mutable ; adistance : Real)
is static;
IntersectionPoint(me : mutable ; apoint : Integer)
is static;
EdgeNumber(me) returns Integer
is static;
FirstBisector(me) returns any Bisector from MAT
is static;
SecondBisector(me) returns any Bisector from MAT
is static;
Distance(me) returns Real
is static;
IntersectionPoint(me) returns Integer
is static;
Dump(me ; ashift , alevel : Integer)
is static;
fields
theedgenumber : Integer;
thefirstbisector : Bisector from MAT;
thesecondbisector : Bisector from MAT;
thedistance : Real;
theintersectionpoint : Integer;
end Edge;

67
src/MAT/MAT_Edge.cxx Executable file
View File

@@ -0,0 +1,67 @@
// File: MAT_Edge.cxx
// Created: Wed Oct 14 10:30:09 1992
// Author: Gilles DEBARBOUILLE
// <gde@bravox>
#include <MAT_Edge.ixx>
MAT_Edge::MAT_Edge()
{
}
void MAT_Edge::EdgeNumber(const Standard_Integer anumber)
{
theedgenumber = anumber;
}
void MAT_Edge::FirstBisector(const Handle(MAT_Bisector)& abisector)
{
thefirstbisector = abisector;
}
void MAT_Edge::SecondBisector(const Handle(MAT_Bisector)& abisector)
{
thesecondbisector = abisector;
}
void MAT_Edge::Distance(const Standard_Real adistance)
{
thedistance = adistance;
}
void MAT_Edge::IntersectionPoint(const Standard_Integer apoint)
{
theintersectionpoint = apoint;
}
Standard_Integer MAT_Edge::EdgeNumber() const
{
return theedgenumber;
}
Handle(MAT_Bisector) MAT_Edge::FirstBisector() const
{
return thefirstbisector;
}
Handle(MAT_Bisector) MAT_Edge::SecondBisector() const
{
return thesecondbisector;
}
Standard_Real MAT_Edge::Distance() const
{
return thedistance;
}
Standard_Integer MAT_Edge::IntersectionPoint() const
{
return theintersectionpoint;
}
void MAT_Edge::Dump(const Standard_Integer,
const Standard_Integer) const
{
}

156
src/MAT/MAT_Graph.cdl Executable file
View File

@@ -0,0 +1,156 @@
-- File: MAT_Graph.cdl
-- Created: Thu Apr 29 18:49:39 1993
-- Author: Yves FRICAUD
-- <yfr@phylox>
---Copyright: Matra Datavision 1993
class Graph from MAT
inherits
TShared from MMgt
---Purpose: The Class Graph permits the exploration of the
-- Bisector Locus.
uses BasicElt from MAT,
Node from MAT,
Arc from MAT,
DataMapOfIntegerArc from MAT,
DataMapOfIntegerBasicElt from MAT,
DataMapOfIntegerNode from MAT,
ListOfBisector from MAT
is
Create returns mutable Graph from MAT;
--- Purpose : Empty constructor.
---Category: Computation
Perform(me : mutable ;
SemiInfinite : Boolean ;
TheRoots : ListOfBisector from MAT;
NbBasicElts : Integer ;
NbArcs : Integer )
--- Purpose : Construct <me> from the result of the method
-- <CreateMat> of the class <MAT> from <MAT>.
--
-- <SemiInfinite> : if some bisector are infinites.
-- <TheRoots> : Set of the bisectors.
-- <NbBasicElts> : Number of Basic Elements.
-- <NbArcs> : Number of Arcs = Number of Bisectors.
is static;
---Category: Querying
Arc(me ; Index : Integer)
--- Purpose : Return the Arc of index <Index> in <theArcs>.
returns Arc from MAT
is static;
BasicElt(me ; Index : Integer)
--- Purpose : Return the BasicElt of index <Index> in <theBasicElts>.
returns BasicElt from MAT
is static;
Node(me ; Index : Integer)
--- Purpose : Return the Node of index <Index> in <theNodes>.
returns Node from MAT
is static;
NumberOfArcs (me)
--- Purpose : Return the number of arcs of <me>.
returns Integer
is static;
NumberOfNodes (me)
--- Purpose : Return the number of nodes of <me>.
returns Integer
is static;
NumberOfBasicElts (me)
--- Purpose : Return the number of basic elements of <me>.
returns Integer
is static;
NumberOfInfiniteNodes (me)
--- Purpose : Return the number of infinites nodes of <me>.
returns Integer
is static;
---Category: Modification
FusionOfBasicElts (me : mutable;
IndexElt1 : Integer from Standard;
IndexElt2 : Integer from Standard;
MergeArc1 : out Boolean from Standard;
GeomIndexArc1 : out Integer from Standard;
GeomIndexArc2 : out Integer from Standard;
MergeArc2 : out Boolean from Standard;
GeomIndexArc3 : out Integer from Standard;
GeomIndexArc4 : out Integer from Standard)
---Purpose: Merge two BasicElts. The End of the BasicElt Elt1
-- of IndexElt1 becomes The End of the BasicElt Elt2
-- of IndexElt2. Elt2 is replaced in the arcs by
-- Elt1, Elt2 is eliminated.
--
-- <MergeArc1> is True if the fusion of the BasicElts =>
-- a fusion of two Arcs which separated the same elements.
-- In this case <GeomIndexArc1> and <GeomIndexArc2> are the
-- Geometric Index of this arcs.
--
-- If the BasicElt corresponds to a close line ,
-- the StartArc and the EndArc of Elt1 can separate the same
-- elements .
-- In this case there is a fusion of this arcs, <MergeArc2>
-- is true and <GeomIndexArc3> and <GeomIndexArc4> are the
-- Geometric Index of this arcs.
is static;
FusionOfArcs (me : mutable;
Arc1 : mutable Arc from MAT;
Arc2 : mutable Arc from MAT)
---Purpose: Merge two Arcs. the second node of <Arc2> becomes
-- the first node of <Arc1>. Update of the first
-- node and the neighbours of <Arc1>.
-- <Arc2> is eliminated.
is static private;
CompactArcs (me : mutable )
is static ;
CompactNodes(me : mutable )
is static ;
ChangeBasicElts(me : mutable ;
NewMap : DataMapOfIntegerBasicElt from MAT)
is static;
ChangeBasicElt(me : mutable ; Index : Integer)
returns mutable BasicElt from MAT
is static;
UpDateNodes(me : mutable ; Index : in out Integer)
is static private;
fields
theArcs : DataMapOfIntegerArc from MAT;
theBasicElts : DataMapOfIntegerBasicElt from MAT;
theNodes : DataMapOfIntegerNode from MAT;
numberOfArcs : Integer;
numberOfNodes : Integer;
numberOfBasicElts : Integer;
numberOfInfiniteNodes : Integer;
end Graph;

565
src/MAT/MAT_Graph.cxx Executable file
View File

@@ -0,0 +1,565 @@
// File: MAT_Graph.cxx
// Created: Thu May 6 19:42:01 1993
// Author: Yves FRICAUD
// <yfr@phylox>
# include <MAT_Graph.ixx>
# include <MAT_SequenceOfArc.hxx>
# include <MAT_Arc.hxx>
# include <MAT_Node.hxx>
# include <MAT_BasicElt.hxx>
# include <MAT_Zone.hxx>
# include <MAT_DataMapOfIntegerBasicElt.hxx>
# include <MAT_DataMapIteratorOfDataMapOfIntegerBasicElt.hxx>
# include <MAT_DataMapOfIntegerArc.hxx>
# include <MAT_SequenceOfArc.hxx>
# include <MAT_Bisector.hxx>
# include <MAT_Edge.hxx>
# include <Precision.hxx>
//------------------
// functions static.
//-------------------
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs);
// =====================================================================
// Constructeur vide.
// =====================================================================
MAT_Graph::MAT_Graph() {}
// =====================================================================
// function : Perform
// purpose : Creation du graphe contenant le resultat.
// =====================================================================
void MAT_Graph::Perform(const Standard_Boolean SemiInfinite,
const Handle(MAT_ListOfBisector)& TheRoots,
const Standard_Integer NbBasicElts,
const Standard_Integer NbArcs)
{
Standard_Integer NbRoots;
Handle(MAT_Arc) FirstArc;
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Node) Extremite;
Standard_Integer IndTabArcs = 1;
Standard_Integer IndTabNodes;
Standard_Integer i;
Standard_Real DistExt;
Standard_Integer IndExt;
Handle(MAT_Arc) PreviousArc = CurrentArc;
//------------------------
// Construction du graphe.
//------------------------
if (SemiInfinite) {
NbRoots = TheRoots->Number();
numberOfInfiniteNodes = NbRoots;
}
else {
NbRoots = 1;
numberOfInfiniteNodes = 0;
}
numberOfArcs = NbArcs;
numberOfBasicElts = NbBasicElts;
numberOfNodes = NbRoots + NbArcs;
IndTabNodes = numberOfNodes;
//---------------------------
//... Creation des BasicElts.
//---------------------------
for (i = 1; i <= NbBasicElts; i++) {
theBasicElts.Bind(i,new MAT_BasicElt(i));
theBasicElts(i)->SetGeomIndex(i);
}
//--------------------------------------------------------------------
// ... Creation des ARCS et des NODES.
// Construction des arbres d arcs a partir des <Bisector> racines.
//--------------------------------------------------------------------
if (SemiInfinite) {
// Plusieurs points d entree a l infini.
//--------------------------------------
TheRoots->First();
while (TheRoots->More()) {
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
Extremite = new MAT_Node (0,CurrentArc,Precision::Infinite());
Extremite ->SetIndex (IndTabNodes);
CurrentArc->SetSecondNode(Extremite);
theNodes.Bind(IndTabNodes,Extremite);
TheRoots->Next();
IndTabNodes--;
}
}
else {
// -----------------------------------------------
// Un seul point d entree .
// Creation d un premier ARC et du NODE racine.
// -----------------------------------------------
NbRoots = 1;
TheRoots->First();
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
DistExt = TheRoots->Current()->FirstEdge()->Distance();
IndExt = TheRoots->Current()->EndPoint();
Extremite = new MAT_Node(IndExt,CurrentArc,DistExt);
Extremite ->SetIndex (IndTabNodes);
CurrentArc->SetSecondNode(Extremite);
theNodes.Bind(IndTabNodes,Extremite);
IndTabNodes--;
// -----------------------------------------------------------
// ...Creation des ARCs issues de la racine.
// Codage des voisinages sur ces arcs et mise a jour de la
// sequence des arcs issue du Node racine.
// -----------------------------------------------------------
FirstArc = CurrentArc;
PreviousArc = FirstArc;
TheRoots->Next();
while (TheRoots->More()) {
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
CurrentArc ->SetSecondNode(Extremite);
CurrentArc ->SetNeighbour (MAT_Left,Extremite ,PreviousArc);
PreviousArc->SetNeighbour (MAT_Right,Extremite,CurrentArc);
PreviousArc = CurrentArc;
TheRoots->Next();
}
FirstArc ->SetNeighbour (MAT_Left ,Extremite,CurrentArc);
CurrentArc->SetNeighbour (MAT_Right,Extremite,FirstArc);
}
// ----------------------------------------------------
// Les sequence des Arcs des Nodes racines sont a jour.
// Mise a jour des sequences des autres Nodes.
// ----------------------------------------------------
UpDateNodes(IndTabNodes);
}
//=============================================================================
//function : Arc
//Purpose :
//=============================================================================
Handle(MAT_Arc) MAT_Graph::Arc(const Standard_Integer Index) const
{
return theArcs(Index);
}
//=============================================================================
//function : BasicElt
//Purpose :
//=============================================================================
Handle(MAT_BasicElt) MAT_Graph::BasicElt(const Standard_Integer Index) const
{
return theBasicElts(Index);
}
//=============================================================================
//function : Node
//Purpose :
//=============================================================================
Handle(MAT_Node) MAT_Graph::Node(const Standard_Integer Index) const
{
return theNodes(Index);
}
//=============================================================================
//function : NumberOfArcs
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfArcs() const
{
return numberOfArcs;
}
//=============================================================================
//function : NumberOfNodes
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfNodes() const
{
return numberOfNodes;
}
//=============================================================================
//function : NumberOfInfiniteNodes
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfInfiniteNodes() const
{
return numberOfInfiniteNodes;
}
//=============================================================================
//function : NumberOfBasicElts
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfBasicElts() const
{
return numberOfBasicElts;
}
//=============================================================================
//function : FusionOfBasicElts
//Purpose :
//=============================================================================
void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
const Standard_Integer IndexElt2,
Standard_Boolean& MergeArc1,
Standard_Integer& IGeomArc1,
Standard_Integer& IGeomArc2,
Standard_Boolean& MergeArc2,
Standard_Integer& IGeomArc3,
Standard_Integer& IGeomArc4)
{
Handle(MAT_BasicElt) Elt1 = theBasicElts(IndexElt1);
Handle(MAT_BasicElt) Elt2 = theBasicElts(IndexElt2);
if (Elt1 == Elt2) return;
Standard_Integer i;
Handle(MAT_Zone) Zone2 = new MAT_Zone(Elt2);
//--------------------------------------------------------------------
// Les arcs de la zone de Elt2 ne separent plus Elt2 et qq chose mais
// Elt1 et qq chose.
//--------------------------------------------------------------------
for (i = 1; i <= Zone2->NumberOfArcs(); i++) {
if (Zone2->ArcOnFrontier(i)->FirstElement() == Elt2) {
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetFirstElement(Elt1);
}
else {
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetSecondElement(Elt1);
}
}
//-------------------------------------------------------------------
// le EndArc de Elt1 et le StartArc de Elt2 peuvent separes les memes
// elements de base => Fusion des deux arcs et mise a jour des noeuds.
//-------------------------------------------------------------------
Handle(MAT_Arc) EA1 = Elt1->EndArc();
Handle(MAT_Arc) SA2 = Elt2->StartArc();
Handle(MAT_BasicElt) E1 = EA1->FirstElement();
Handle(MAT_BasicElt) E2 = EA1->SecondElement();
Handle(MAT_BasicElt) E3 = SA2->FirstElement();
Handle(MAT_BasicElt) E4 = SA2->SecondElement();
MergeArc1 = Standard_False;
if ( (E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4)) {
FusionOfArcs(theArcs(EA1->Index()),theArcs(SA2->Index()));
MergeArc1 = Standard_True;
IGeomArc1 = EA1->GeomIndex();
IGeomArc2 = SA2->GeomIndex();
}
//-------------------------------------------------
// La fin de Elt1 devient la fin de Elt2.
//-------------------------------------------------
Elt1->SetEndArc(Elt2->EndArc());
//-------------------------------------------------------------------
// le EndArc de Elt1 et le StartArc de Elt1 peuvent separer les memes
// elements de base.
// si les noeuds des arcs ne sont pas sur le contour
// => fusion des arcs.(contour ferme compose d un seul BasicElt)
// sinon rien (contour ferme compose de deux BasicElts)
//-------------------------------------------------------------------
Handle(MAT_Arc) SA1 = Elt1->StartArc();
EA1 = Elt1->EndArc();
if ( EA1 != SA1 ) {
Handle(MAT_BasicElt) E1 = EA1->FirstElement ();
Handle(MAT_BasicElt) E2 = EA1->SecondElement();
Handle(MAT_BasicElt) E3 = SA1->FirstElement ();
Handle(MAT_BasicElt) E4 = SA1->SecondElement();
Standard_Boolean OnFig = (EA1->FirstNode() ->OnBasicElt() ||
EA1->SecondNode()->OnBasicElt() ||
SA1->FirstNode() ->OnBasicElt() ||
SA1->SecondNode()->OnBasicElt() );
MergeArc2 = Standard_False;
if ((E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4) && !OnFig) {
FusionOfArcs(theArcs(EA1->Index()),theArcs(SA1->Index()));
MergeArc2 = Standard_True;
IGeomArc3 = EA1->GeomIndex();
IGeomArc4 = SA1->GeomIndex();
}
}
//----------------------------------------------------
// un element de base a ete elimine.
//----------------------------------------------------
theBasicElts.UnBind(Elt2->Index());
numberOfBasicElts--;
}
//=============================================================================
// function : FusionOfArcs
// purpose : Fusion de deux arcs separant les memes elements.
// l <Arc1> ira du Second noeud de <Arc2> au second Noeud de <Arc1>.
//=============================================================================
void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1,
const Handle(MAT_Arc)& Arc2)
{
Handle(MAT_Node) OldNode1 = Arc1->FirstNode();
Handle(MAT_Node) OldNode2 = Arc2->FirstNode();
Arc1->SetFirstNode(Arc2->SecondNode());
//--------------------------------------------------------------------
// Mise a jour des voisinages autour du nouveau premier noeud de Arc1.
//--------------------------------------------------------------------
if (!Arc2->SecondNode()->Infinite()) {
Handle(MAT_Arc) LNeighbour = Arc2->Neighbour(Arc2->SecondNode(),MAT_Left);
Handle(MAT_Arc) RNeighbour = Arc2->Neighbour(Arc2->SecondNode(),MAT_Right);
Arc1->SetFirstArc(MAT_Left,LNeighbour);
Arc1->SetFirstArc(MAT_Right,RNeighbour);
theArcs(LNeighbour->Index())->SetNeighbour(MAT_Right,
Arc2->SecondNode(),
Arc1);
theArcs(RNeighbour->Index())->SetNeighbour(MAT_Left,
Arc2->SecondNode(),
Arc1);
}
else {
Handle(MAT_Arc) EmptyArc;
Arc1->SetFirstArc(MAT_Left ,EmptyArc);
Arc1->SetFirstArc(MAT_Right,EmptyArc);
}
//-------------------------------------------------------------------
// Mise a jour du premier noeud Arc1.
//-----------------------------------------------------------------
Arc1->FirstNode()->SetLinkedArc(Arc1);
//------------------------------------
// Elimination de Arc2 et des OldNode
//------------------------------------
if (theNodes.IsBound(OldNode1->Index())) {
theNodes.UnBind(OldNode1->Index());
numberOfNodes--;
}
if (theNodes.IsBound(OldNode2->Index())) {
theNodes.UnBind(OldNode2->Index());
numberOfNodes--;
}
// Note: the Arc2 is actually a reference to a handle contained in theArcs map;
// it is necessary to create copy of that handle and use only it to access
// that object, since the handle contained in the map is destroyed by UnBind()
Handle(MAT_Arc) anArc2 = Arc2;
theArcs .UnBind(Arc2->Index());
numberOfArcs--;
for (Standard_Integer i = 1; i <= 2; i++){
Handle(MAT_BasicElt) BE;
if (i == 1)
BE = theBasicElts(anArc2->FirstElement ()->Index());
else
BE = theBasicElts(anArc2->SecondElement ()->Index());
if (BE->StartArc() == anArc2) { BE->SetStartArc(Arc1);}
if (BE->EndArc () == anArc2) { BE->SetEndArc (Arc1);}
}
}
//=============================================================================
// function : CompactArcs
// purpose : Decalage des Arcs pour boucher les trous.
//=============================================================================
void MAT_Graph::CompactArcs()
{
Standard_Integer IFind = 0;
Standard_Integer i = 1;
Standard_Boolean YaDecalage = Standard_False;
while (IFind < numberOfArcs) {
if (!theArcs.IsBound(i)) {
YaDecalage = Standard_True;
}
else {
IFind++;
if (YaDecalage) {
theArcs(i)->SetIndex(IFind);
theArcs.Bind(IFind,theArcs(i));
theArcs.UnBind(i);
}
}
i++;
}
}
//=============================================================================
// function : CompactNodes
// purpose : Decalage des Nodes pour boucher les trous.
//=============================================================================
void MAT_Graph::CompactNodes()
{
Standard_Integer IFind = 0;
Standard_Integer i = 1;
Standard_Boolean YaDecalage = Standard_False;
while (IFind < numberOfNodes) {
if (!theNodes.IsBound(i)) {
YaDecalage = Standard_True;
}
else {
IFind++;
if (YaDecalage) {
theNodes(i)->SetIndex(IFind);
theNodes.Bind(IFind,theNodes(i));
theNodes.UnBind(i);
}
}
i++;
}
}
//=============================================================================
// function : ChangeBasicElts
// purpose :
//=============================================================================
void MAT_Graph::ChangeBasicElts(const MAT_DataMapOfIntegerBasicElt& NewMap)
{
theBasicElts = NewMap;
MAT_DataMapIteratorOfDataMapOfIntegerBasicElt Ite;
for (Ite.Initialize(theBasicElts); Ite.More(); Ite.Next()) {
Ite.Value()->SetIndex(Ite.Key());
}
}
//=============================================================================
//function : ChangeBasicElt
//Purpose :
//=============================================================================
Handle(MAT_BasicElt) MAT_Graph::ChangeBasicElt(const Standard_Integer Index)
{
return theBasicElts(Index);
}
//=============================================================================
// function : UpDateNodes
// purpose : Mise a jour des sequence d'ARC de chaque FirstNode de chaque arc.
// et stockage de chaque noeud dans la table des noeuds.
// Les noeuds racines sont traites dans PERFORM.
//=============================================================================
void MAT_Graph::UpDateNodes (Standard_Integer& IndTabNodes)
{
Standard_Integer i;
Handle(MAT_Node) Bout;
Handle(MAT_Arc) CurrentArc;
for (i = 1; i <= numberOfArcs; i++) {
Bout = theArcs(i)->FirstNode();
theNodes.Bind(IndTabNodes,Bout);
Bout->SetIndex(IndTabNodes);
IndTabNodes--;
Bout->SetLinkedArc(theArcs(i));
}
}
//=============================================================================
// function : MakeArc
// purpose : Creation des <ARCS> en parcourant l'arbre issue de <aBisector>.
//=============================================================================
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs)
{
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Arc) PrevArc;
Handle(MAT_Arc) NextArc;
Handle(MAT_Node) Extremite;
Handle(MAT_ListOfBisector) BisectorList;
Standard_Real DistExt;
#ifdef DEBUG_Graph
cout<<"Construction Arc : Index"<<aBisector->IndexNumber()<<endl;
cout<<"Construction Arc : Bisector"<<aBisector->BisectorNumber()<<endl;
#endif
CurrentArc = new MAT_Arc(IndTabArcs,
aBisector->BisectorNumber(),
TheBasicElts(aBisector->FirstEdge()->EdgeNumber()),
TheBasicElts(aBisector->SecondEdge()->EdgeNumber())
);
DistExt = aBisector->DistIssuePoint();
if (DistExt == Precision::Infinite()) {
DistExt = 1.0;
#ifdef DEBUG_Graph
cout<<"PB:RECUPERATION DISTANCE SUR ISSUEPOINT."<<endl;
#endif
}
Extremite = new MAT_Node(aBisector->IssuePoint(),CurrentArc,DistExt);
CurrentArc->SetFirstNode(Extremite);
BisectorList = aBisector->List();
BisectorList->First();
if (!BisectorList->More()) {
// -------------------
// Arc sur le contour.
// -------------------
TheBasicElts(aBisector->SecondEdge()->EdgeNumber())
->SetStartArc(CurrentArc);
TheBasicElts(aBisector->FirstEdge()->EdgeNumber())
->SetEndArc(CurrentArc);
}
else {
PrevArc = CurrentArc;
while (BisectorList->More()) {
NextArc = MakeArc(BisectorList->Current(),
TheBasicElts,
TheArcs,
IndTabArcs);
NextArc->SetSecondNode(Extremite);
NextArc->SetNeighbour (MAT_Left ,Extremite,PrevArc);
PrevArc->SetNeighbour (MAT_Right,Extremite,NextArc);
PrevArc = NextArc;
BisectorList->Next();
}
CurrentArc->SetNeighbour(MAT_Left ,Extremite,NextArc);
NextArc ->SetNeighbour(MAT_Right,Extremite,CurrentArc);
}
#ifdef DEBUG_Graph
cout<<"IndTabArcs = "<<IndTabArcs<<endl;
cout<<"ArcIndex = "<<CurrentArc->ArcIndex()<<endl;
#endif
CurrentArc->SetIndex(IndTabArcs);
TheArcs.Bind(IndTabArcs,CurrentArc);
IndTabArcs = IndTabArcs + 1;
return CurrentArc;
}

98
src/MAT/MAT_Mat.cdl Executable file
View File

@@ -0,0 +1,98 @@
-- File: MAT_Mat.cdl
-- Created: Tue Sep 22 15:06:57 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@bravox>
---Copyright: Matra Datavision 1992
generic class Mat from MAT (Tool as any)
---Purpose: this class contains the generic algoritm of
-- computation of the bisecting locus.
uses
Side from MAT,
Bisector from MAT,
ListOfEdge from MAT,
ListOfBisector from MAT,
DataMapOfIntegerBisector from MAT,
DataMapOfIntegerInteger from TColStd
is
Create
---Purpose: Empty construtor.
returns Mat from MAT;
--- Category : Computation.
CreateMat(me : in out ; aTool : in out Tool)
---Purpose: Algoritm of computation of the bisecting locus.
is static;
IsDone(me) returns Boolean from Standard
---Purpose: Returns <TRUE> if CreateMat has succeeded.
is static;
LoadBisectorsToRemove(me : in out ;
noofbisectorstoremove : in out Integer;
distance1 : Real;
distance2 : Real;
bisector1 : Bisector from MAT;
bisector2 : Bisector from MAT;
bisector3 : Bisector from MAT;
bisector4 : Bisector from MAT)
is static private;
Intersect( me : in out ;
atool : in out Tool ;
aside : Integer ;
noofbisectorstoremove: in out Integer ;
bisector1 : mutable Bisector from MAT;
bisector2 : mutable Bisector from MAT)
is static private;
--- Category : Querying.
Init(me : in out)
--- Purpose : Initialize an iterator on the set of the roots
-- of the trees of bisectors.
is static;
More(me) returns Boolean
--- Purpose : Return False if there is no more roots.
is static;
Next(me : in out)
--- Purpose : Move to the next root.
is static;
Bisector(me) returns any Bisector from MAT
--- Purpose : Returns the current root.
is static;
SemiInfinite(me) returns Boolean from Standard
--- Purpose : Returns True if there are semi_infinite bisectors.
-- So there is a tree for each semi_infinte bisector.
is static;
NumberOfBisectors(me) returns Integer from Standard
--- Purpose : Returns the total number of bisectors.
is static;
fields
thenumberofbisectors : Integer;
thenumberofedges : Integer;
semiInfinite : Boolean;
theedgelist : ListOfEdge from MAT;
typeofbisectortoremove: DataMapOfIntegerInteger from TColStd;
bisectoronetoremove : DataMapOfIntegerBisector from MAT;
bisectortwotoremove : DataMapOfIntegerBisector from MAT;
bisectormap : DataMapOfIntegerBisector from MAT;
roots : ListOfBisector from MAT;
thecurrentindex : Integer;
isDone : Boolean;
end Mat;

1000
src/MAT/MAT_Mat.gxx Executable file

File diff suppressed because it is too large Load Diff

93
src/MAT/MAT_Node.cdl Executable file
View File

@@ -0,0 +1,93 @@
-- File: MAT_Node.cdl
-- Created: Fri Apr 30 18:39:46 1993
-- Author: Yves FRICAUD
-- <yfr@phylox>
---Copyright: Matra Datavision 1993
class Node from MAT
---Purpose :
inherits
TShared from MMgt
uses
Arc from MAT,
BasicElt from MAT,
SequenceOfArc from MAT,
SequenceOfBasicElt from MAT,
Address from Standard
is
Create (GeomIndex : Integer;
LinkedArc : Arc from MAT;
Distance : Real)
returns mutable Node from MAT;
GeomIndex (me)
---Purpose: Returns the index associated of the geometric
-- representation of <me>.
returns Integer
is static;
Index (me)
---Purpose: Returns the index associated of the node
returns Integer
is static;
LinkedArcs (me ; S : in out SequenceOfArc)
---Purpose: Returns in <S> the Arcs linked to <me>.
is static;
NearElts (me ; S : in out SequenceOfBasicElt)
---Purpose: Returns in <S> the BasicElts equidistant
-- to <me>.
is static;
Distance (me)
--Purpose: Returns the distance between <me> and the figure.
returns Real
is static;
PendingNode (me)
--- Purpose:Returns True if <me> is a pending Node.
-- (ie : the number of Arc Linked = 1)
returns Boolean from Standard
is static;
OnBasicElt (me)
---Purpose: Returns True if <me> belongs to the figure.
returns Boolean from Standard
is static;
Infinite (me)
---Purpose: Returns True if the distance of <me> is Infinite
returns Boolean from Standard
is static;
SetIndex (me : mutable ; anIndex : Integer from Standard)
--- Purpose : Set the index associated of the node
is static;
SetLinkedArc(me : mutable ; anArc : Arc from MAT)
is static;
fields
nodeIndex : Integer from Standard;
geomIndex : Integer from Standard;
aLinkedArc : Address from Standard;
distance : Real from Standard;
end Node;

158
src/MAT/MAT_Node.cxx Executable file
View File

@@ -0,0 +1,158 @@
// File: MAT_Node.cxx
// Created: Thu May 6 18:34:58 1993
// Author: Yves FRICAUD
// <yfr@phylox>
#include <MAT_Node.ixx>
#include <MAT_BasicElt.hxx>
#include <MAT_Arc.hxx>
#include <Precision.hxx>
//=============================================================================
//function :
//Purpose :
//=============================================================================
MAT_Node::MAT_Node(const Standard_Integer GeomIndex,
const Handle(MAT_Arc)& LinkedArc,
const Standard_Real Distance)
: geomIndex(GeomIndex),
distance(Distance)
{
aLinkedArc = LinkedArc.operator->();
}
//=============================================================================
//function : GeomIndex
//Purpose :
//=============================================================================
Standard_Integer MAT_Node::GeomIndex() const
{
return geomIndex;
}
//=============================================================================
//function : Index
//Purpose :
//=============================================================================
Standard_Integer MAT_Node::Index() const
{
return nodeIndex;
}
//=============================================================================
//function : LinkedArcs
//Purpose :
//=============================================================================
void MAT_Node::LinkedArcs(MAT_SequenceOfArc& S) const
{
S.Clear();
Handle(MAT_Node) Me = this;
Handle(MAT_Arc) LA((MAT_Arc*)aLinkedArc);
S.Append(LA);
if (LA->HasNeighbour(Me, MAT_Left)) {
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
while (CA != LA) {
S.Append(CA);
CA = CA->Neighbour(Me, MAT_Left);
}
}
}
//=============================================================================
//function : NearElts
//Purpose :
//=============================================================================
void MAT_Node::NearElts(MAT_SequenceOfBasicElt& S) const
{
S.Clear();
Handle(MAT_Node) Me = this;
Handle(MAT_Arc) LA((MAT_Arc*)aLinkedArc);
S.Append(LA->FirstElement());
S.Append(LA->SecondElement());
if (LA->HasNeighbour(Me, MAT_Left)) {
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
Standard_Boolean Pair = Standard_False;
//---------------------------------------------------------
// Recuperation des deux elements separes pour un arc sur
// deux.
//---------------------------------------------------------
while (CA != LA) {
if (Pair) {
S.Append(CA->FirstElement());
S.Append(CA->SecondElement());
}
else {
Pair = Standard_True;
}
CA = CA->Neighbour(Me, MAT_Left);
}
}
}
//=============================================================================
//function : Distance
//Purpose :
//=============================================================================
Standard_Real MAT_Node::Distance() const
{
return distance;
}
//=============================================================================
//function : PendingNode
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::PendingNode() const
{
Handle(MAT_Node) Me = this;
return (!((MAT_Arc*)aLinkedArc)->HasNeighbour(Me,MAT_Left));
}
//=============================================================================
//function : NodeOnFig
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::OnBasicElt() const
{
return (Distance() == 0.0);
}
//=============================================================================
//function : NodeInfinite
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::Infinite() const
{
return (Distance() == Precision::Infinite());
}
//=============================================================================
//function : SetLinkedArcs
//Purpose :
//=============================================================================
void MAT_Node::SetLinkedArc (const Handle(MAT_Arc)& LinkedArc)
{
aLinkedArc = LinkedArc.operator->();
}
//=============================================================================
//function : SetIndex
//Purpose :
//=============================================================================
void MAT_Node::SetIndex (const Standard_Integer anIndex)
{
nodeIndex = anIndex;
}

205
src/MAT/MAT_TList.cdl Executable file
View File

@@ -0,0 +1,205 @@
-- File: MAT_TList.cdl
-- Created: Tue Jun 23 12:39:10 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@phobox>
---Copyright: Matra Datavision 1992
generic class TList from MAT (Item as any)
---Purpose:
inherits
TShared
--uses
--raises
class TListNode from MAT
---Purpose:
inherits
TShared
--uses
--raises
is
Create returns mutable TListNode from MAT;
---C++: inline
Create(anitem : Item) returns mutable TListNode from MAT;
---C++: inline
GetItem(me) returns any Item
-- C++: return &
---C++: inline
is static;
Next(me) returns mutable TListNode from MAT
---C++: inline
is static;
Previous(me) returns mutable TListNode from MAT
---C++: inline
is static;
SetItem(me : mutable ; anitem : any Item)
---C++: inline
is static;
Next(me : mutable ; atlistnode : mutable TListNode from MAT)
---C++: inline
is static;
Previous(me : mutable ; atlistnode : mutable TListNode from MAT)
---C++: inline
is static;
Dummy(me)
is static;
fields
thenext : TListNode from MAT;
theprevious : TListNode from MAT;
theitem : Item;
end TListNode;
is
Create returns mutable TList from MAT;
First(me : mutable)
is static;
Last(me : mutable)
is static;
Init(me : mutable ; aniten : any Item)
is static;
Next(me : mutable)
is static;
Previous(me : mutable)
is static;
More(me) returns Boolean
is static;
Current(me) returns any Item
is static;
Current(me ; anitem : any Item)
is static;
FirstItem(me) returns any Item
is static;
LastItem(me) returns any Item
is static;
PreviousItem(me) returns any Item
is static;
NextItem(me) returns any Item
is static;
Number(me) returns Integer
---C++: inline
is static;
Index(me) returns Integer
---C++: inline
is static;
Brackets(me : mutable ; anindex : Integer) returns any Item
-- C++: return &
---C++: alias operator()
is static;
Unlink(me : mutable)
is static;
LinkBefore(me : mutable ; anitem : any Item)
is static;
LinkAfter(me : mutable ; anitem : any Item)
is static;
FrontAdd(me : mutable ; anitem : any Item)
is static;
BackAdd(me : mutable ; anitem : any Item)
is static;
Permute(me : mutable)
is static;
Loop(me)
is static;
IsEmpty(me) returns Boolean
is static;
Dump(me : mutable ; ashift , alevel : Integer);
fields
thefirstnode : TListNode from MAT;
thelastnode : TListNode from MAT;
thecurrentnode : TListNode from MAT;
thecurrentindex : Integer;
thenumberofitems : Integer;
end TList;

374
src/MAT/MAT_TList.gxx Executable file
View File

@@ -0,0 +1,374 @@
// File: MAT_TList.gxx
// Created: Wed Jun 24 12:47:46 1992
// Author: Gilles DEBARBOUILLE
// <gde@phobox>
//=======================================================================
//function : MAT_TList
//purpose :
//=======================================================================
MAT_TList::MAT_TList()
{
thecurrentindex = 0;
thenumberofitems = 0;
}
//=======================================================================
//function : First
//purpose :
//=======================================================================
void MAT_TList::First()
{
thecurrentnode = thefirstnode;
thecurrentindex = 1;
}
//=======================================================================
//function : Last
//purpose :
//=======================================================================
void MAT_TList::Last()
{
thecurrentnode = thelastnode;
thecurrentindex = thenumberofitems;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void MAT_TList::Init(const Item& anitem)
{
First();
while(More())
{
if(anitem == thecurrentnode->GetItem()) break;
Next();
}
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void MAT_TList::Next()
{
if(!IsEmpty())
{
thecurrentnode = thecurrentnode->Next();
thecurrentindex = (thecurrentindex % thenumberofitems) + 1;
}
}
//=======================================================================
//function : Previous
//purpose :
//=======================================================================
void MAT_TList::Previous()
{
if(!IsEmpty())
{
thecurrentnode = thecurrentnode->Previous();
thecurrentindex = ((thecurrentindex+thenumberofitems-2)%thenumberofitems)+1;
}
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean MAT_TList::More() const
{
return (!thecurrentnode.IsNull());
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
Item MAT_TList::Current() const
{
return thecurrentnode->GetItem();
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
void MAT_TList::Current(const Item& anitem) const
{
thecurrentnode->SetItem(anitem);
}
//=======================================================================
//function : FirstItem
//purpose :
//=======================================================================
Item MAT_TList::FirstItem() const
{
return thefirstnode->GetItem();
}
//=======================================================================
//function : LastItem
//purpose :
//=======================================================================
Item MAT_TList::LastItem() const
{
return thelastnode->GetItem();
}
//=======================================================================
//function : PreviousItem
//purpose :
//=======================================================================
Item MAT_TList::PreviousItem() const
{
return thecurrentnode->Previous()->GetItem();
}
//=======================================================================
//function : NextItem
//purpose :
//=======================================================================
Item MAT_TList::NextItem() const
{
return thecurrentnode->Next()->GetItem();
}
//=======================================================================
//function : Brackets
//purpose :
//=======================================================================
Item MAT_TList::Brackets (const Standard_Integer anindex)
{
if(thecurrentindex > anindex)
{
while(thecurrentindex != anindex)
{
thecurrentindex--;
thecurrentnode = thecurrentnode->Previous();
}
}
else if(thecurrentindex < anindex)
{
while(thecurrentindex != anindex)
{
thecurrentindex++;
thecurrentnode = thecurrentnode->Next();
}
}
return thecurrentnode->GetItem();
}
//=======================================================================
//function : Unlink
//purpose :
//=======================================================================
void MAT_TList::Unlink()
{
Standard_Boolean previousisnull = thecurrentnode->Previous().IsNull();
Standard_Boolean nextisnull = thecurrentnode->Next().IsNull();
if(thecurrentindex)
{
if(!nextisnull && !previousisnull)
{
thecurrentnode->Next()->Previous(thecurrentnode->Previous());
thecurrentnode->Previous()->Next(thecurrentnode->Next());
}
if(thecurrentindex == 1)
{
thefirstnode = thecurrentnode->Next();
}
else if(thecurrentindex == thenumberofitems)
{
thelastnode = thecurrentnode->Previous();
}
}
thenumberofitems--;
thecurrentindex--;
}
//=======================================================================
//function : LinkBefore
//purpose :
//=======================================================================
void MAT_TList::LinkBefore(const Item& anitem)
{
thenumberofitems++;
if(thecurrentindex)thecurrentindex++;
Handle(MAT_TListNode) previous;
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
if(!(thecurrentnode->Previous()).IsNull())
{
previous = thecurrentnode->Previous();
previous->Next(node);
node->Previous(previous);
}
if(thecurrentindex == 2)
{
thefirstnode = node;
}
thecurrentnode->Previous(node);
node->Next(thecurrentnode);
}
//=======================================================================
//function : LinkAfter
//purpose :
//=======================================================================
void MAT_TList::LinkAfter(const Item& anitem)
{
thenumberofitems++;
Handle(MAT_TListNode) next;
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
if(!(thecurrentnode->Next()).IsNull())
{
next = thecurrentnode->Next();
next->Previous(node);
node->Next(next);
}
if(thecurrentindex+1 ==thenumberofitems)
{
thelastnode = node;
}
thecurrentnode->Next(node);
node->Previous(thecurrentnode);
}
//=======================================================================
//function : FrontAdd
//purpose :
//=======================================================================
void MAT_TList::FrontAdd(const Item& anitem)
{
thenumberofitems++;
if(thecurrentindex)thecurrentindex++;
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
if(!thefirstnode.IsNull())
{
thefirstnode->Previous(node);
node->Next(thefirstnode);
}
else
{
thelastnode = node;
}
thefirstnode = node;
}
//=======================================================================
//function : BackAdd
//purpose :
//=======================================================================
void MAT_TList::BackAdd(const Item& anitem)
{
thenumberofitems++;
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
if(!thelastnode.IsNull())
{
thelastnode->Next(node);
node->Previous(thelastnode);
}
else
{
thefirstnode = node;
}
thelastnode = node;
}
//=======================================================================
//function : Permute
//purpose :
//=======================================================================
void MAT_TList::Permute()
{
Handle(MAT_TListNode) previous = thecurrentnode->Previous();
Handle(MAT_TListNode) current = thecurrentnode;
Handle(MAT_TListNode) next = thecurrentnode->Next();
Handle(MAT_TListNode) nextnext = next->Next();
Handle(MAT_TListNode) null;
if(!previous.IsNull())
{
previous->Next(next);
next->Previous(previous);
}
else
{
next->Previous(null);
}
next->Next(current);
current->Previous(next);
if(!nextnext.IsNull())
{
current->Next(nextnext);
nextnext->Previous(current);
}
else
{
current->Next(null);
}
if(thefirstnode == current) thefirstnode = next;
if(thelastnode == next) thelastnode = current;
thecurrentindex++;
}
//=======================================================================
//function : Loop
//purpose :
//=======================================================================
void MAT_TList::Loop() const
{
thelastnode->Next(thefirstnode);
thefirstnode->Previous(thelastnode);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void MAT_TList::Dump(const Standard_Integer ashift,
const Standard_Integer alevel)
{
for(First(); More(); Next()) Current()->Dump(ashift,alevel);
}

35
src/MAT/MAT_TList.lxx Executable file
View File

@@ -0,0 +1,35 @@
// File: MAT_TList.lxx
// Created: Wed Jun 24 12:47:58 1992
// Author: Gilles DEBARBOUILLE
// <gde@phobox>
//=======================================================================
//function : Number
//purpose :
//=======================================================================
inline Standard_Integer MAT_TList::Number() const
{
return thenumberofitems;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
inline Standard_Integer MAT_TList::Index() const
{
return thecurrentindex;
}
//=======================================================================
//function : IsEmpty
//purpose :
//=======================================================================
inline Standard_Boolean MAT_TList::IsEmpty() const
{
return thenumberofitems == 0;
}

13
src/MAT/MAT_TListNode.gxx Executable file
View File

@@ -0,0 +1,13 @@
// File: MAT_TListNode.gxx
// Created: Wed Jun 24 12:47:46 1992
// Author: Gilles DEBARBOUILLE
// <gde@phobox>
//=======================================================================
//function : Dummy
//purpose :
//=======================================================================
void MAT_TListNode::Dummy()const {}

84
src/MAT/MAT_TListNode.lxx Executable file
View File

@@ -0,0 +1,84 @@
// File: MAT_TListNode.lxx
// Created: Wed Jun 24 12:47:58 1992
// Author: Gilles DEBARBOUILLE
// <gde@phobox>
//=======================================================================
//function : MAT_TListNode
//purpose :
//=======================================================================
inline MAT_TListNode::MAT_TListNode() {}
//=======================================================================
//function : MAT_TListNode
//purpose :
//=======================================================================
inline MAT_TListNode::MAT_TListNode(const Item& anitem)
{
theitem = anitem;
}
//=======================================================================
//function : GetItem
//purpose :
//=======================================================================
inline Item MAT_TListNode::GetItem() const
{
return theitem;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
inline Handle(MAT_TListNode) MAT_TListNode::Next() const
{
return thenext;
}
//=======================================================================
//function : Previous
//purpose :
//=======================================================================
inline Handle(MAT_TListNode) MAT_TListNode::Previous() const
{
return theprevious;
}
//=======================================================================
//function : SetItem
//purpose :
//=======================================================================
inline void MAT_TListNode::SetItem(const Item& anitem)
{
theitem=anitem;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
inline void MAT_TListNode::Next
(const Handle(MAT_TListNode)& atlistnode)
{
thenext=atlistnode;
}
//=======================================================================
//function : Previous
//purpose :
//=======================================================================
inline void MAT_TListNode::Previous
(const Handle(MAT_TListNode)& atlistnode)
{
theprevious=atlistnode;
}

116
src/MAT/MAT_Tool.cdl Executable file
View File

@@ -0,0 +1,116 @@
-- File: MAT_Tool.cdl
-- Created: Wed Sep 23 16:38:49 1992
-- Author: Gilles DEBARBOUILLE
-- <gde@bravox>
---Copyright: Matra Datavision 1992
generic class Tool from MAT (Item as any)
--- Purpose : Set of the methods useful for the MAT's computation.
-- Warning : To use the algorithm MAT, it's necessary to use four
-- indexed sets (Array,Sequence ...)
-- One set contains the geometric definitions of
-- the simple composants of the Figure.
-- An other set contains the geometric definitions of
-- the bisectors.
-- An other set contains the geometric definitions of
-- the points created during the MAT's computation.
-- An other set contains the geometric definitions of
-- the Tangent Vectors to the edge's extremitis.
--
uses
Bisector from MAT
is
Create returns Tool from MAT;
NumberOfItems(me) returns Integer
--- Purpose : Returns the Number of Items .
is static;
ToleranceOfConfusion(me) returns Real
---Purpose: Returns tolerance to test the confusion of two points.
is static;
FirstPoint(me ; anitem : Integer;
dist : out Real ) returns Integer
--- Purpose : Creates the point at the origin of the bisector between
-- anitem and the previous item.
-- dist is the distance from the FirstPoint to <anitem>.
-- Returns an index.
is static;
TangentBefore(me ; anitem : Integer) returns Integer
--- Purpose : Create the Tangent at the end of the Item defined
-- by <anitem>. Returns the index of this vector in
-- <theGeomVecs>
is static;
TangentAfter(me ; anitem : Integer) returns Integer
--- Purpose : Create the Reversed Tangent at the origin of the Item
-- defined by <anitem>. Returns the index of this vector in
-- <theGeomVecs>
is static;
Tangent(me ; bisector : Integer ) returns Integer
--- Purpose : Create the Tangent at the end of the bisector defined
-- by <bisector>. Returns the index of this vector in
-- <theGeomVecs>
is static;
CreateBisector(me : in out ; abisector : mutable Bisector from MAT)
--- Purpose : Create the geometric bisector defined by <abisector>.
is static;
TrimBisector(me : in out ;
abisector : mutable Bisector from MAT)
--- Purpose : Trim the geometric bisector by the <firstparameter>
-- of <abisector>.
-- If the parameter is out of the bisector, Return False.
-- else Return True.
returns Boolean is static;
TrimBisector(me : in out ;
abisector : mutable Bisector from MAT ;
apoint : Integer)
--- Purpose : Trim the geometric bisector by the point of index
-- <apoint> in <theGeomPnts>.
-- If the point is out of the bisector, Return False
-- else Return True.
returns Boolean is static;
IntersectBisector(me : in out ;
bisectorone : mutable Bisector from MAT ;
bisectortwo : mutable Bisector from MAT ;
intpnt : in out Integer)
--- Purpose : Computes the point of intesection between the
-- bisectors defined by <bisectorone> and
-- <bisectortwo> .
-- If this point exists, <intpnt> is its index
-- in <theGeomPnts> and Return the distance of the point
-- from the edges separated by the bisectors else
-- Returns <RealLast>.
returns Real is static;
Distance(me;
abisector : Bisector from MAT;
param1 : Real;
param2 : Real)
---Purpose: Returns the distance between the two points designed
-- by their parameters on <abisector>.
returns Real is static;
Dump(me ;
bisector : Integer ;
erease : Integer)
--- Purpose : display informations about the bisector defined by
-- <bisector>.
is static;
end Tool;

4
src/MAT/MAT_Tool.gxx Executable file
View File

@@ -0,0 +1,4 @@
// File: MAT_Tool.gxx
// Created: Thu Jul 1 12:48:03 1993
// Author: Gilles DEBARBOUILLE
// <gde@meteox>

71
src/MAT/MAT_Zone.cdl Executable file
View File

@@ -0,0 +1,71 @@
-- File: MAT_Zone.cdl
-- Created: Thu May 27 11:12:20 1993
-- Author: Yves FRICAUD
-- <yfr@phylox>
---Copyright: Matra Datavision 1993
class Zone from MAT
---Purpose:
-- Definition of Zone of Proximity of a BasicElt :
-- ----------------------------------------------
-- A Zone of proximity is the set of the points which are
-- more near from the BasicElt than any other.
--
inherits
TShared from MMgt
uses
Arc from MAT,
Side from MAT,
SequenceOfArc from MAT,
BasicElt from MAT,
Node from MAT
is
Create returns mutable Zone from MAT;
Create(aBasicElt : BasicElt from MAT)
--- Purpose: Compute the frontier of the Zone of proximity.
returns mutable Zone from MAT;
Perform(me : mutable ; aBasicElt : BasicElt from MAT)
--- Purpose: Compute the frontier of the Zone of proximity.
is static;
NumberOfArcs(me)
--- Purpose: Return the number Of Arcs On the frontier of <me>.
returns Integer
is static;
ArcOnFrontier (me ; Index : Integer)
--- Purpose: Return the Arc number <Index> on the frontier.
-- of <me>.
returns Arc
is static;
NoEmptyZone (me)
--- Purpose: Return TRUE if <me> is not empty .
returns Boolean
is static;
Limited(me)
--- Purpose: Return TRUE if <me> is Limited.
returns Boolean
is static;
NodeForTurn(me ;
anArc : Arc from MAT ;
aBasicElt : BasicElt from MAT ;
aSide : Side from MAT )
returns Node from MAT
is static private;
fields
frontier : SequenceOfArc from MAT;
limited : Boolean from Standard;
end Zone;

170
src/MAT/MAT_Zone.cxx Executable file
View File

@@ -0,0 +1,170 @@
// File: MAT_BasicElt.cxx
// Created: Wed May 5 10:11:24 1993
// Author: Yves FRICAUD
// <yfr@phylox>
#include <MAT_Zone.ixx>
#include <MAT_BasicElt.hxx>
#include <MAT_SequenceOfArc.hxx>
#include <MAT_Node.hxx>
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Zone::MAT_Zone ()
{}
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Zone::MAT_Zone(const Handle(MAT_BasicElt)& aBasicElt)
{
Perform (aBasicElt);
}
//========================================================================
// function: Perform
// purpose :
//========================================================================
void MAT_Zone::Perform (const Handle(MAT_BasicElt)& aBasicElt)
{
Handle (MAT_Node) NextNode, StartNode;
Handle (MAT_Arc) CurrentArc;
limited = Standard_True;
frontier.Clear();
// ------------------------------------------------------------------------
// Si le premier arc correspondant a la zone est Null => Sequence vide.
// ------------------------------------------------------------------------
if (aBasicElt->EndArc().IsNull()) return;
// ----------------------------
// Angle rentrant => Zone Vide.
// ----------------------------
// if(aBasicElt->EndArc() == aBasicElt->StartArc()) return;
// --------------------------------
// Initialisation de la frontier.
// --------------------------------
CurrentArc = aBasicElt->EndArc();
frontier.Append(CurrentArc);
// --------------------------------------------------------------------------
// Determination du premier noeud qui permet de construire la zone en tournant
// surla gauche.
// --------------------------------------------------------------------------
NextNode = NodeForTurn(CurrentArc,aBasicElt,MAT_Left);
StartNode = CurrentArc->TheOtherNode(NextNode);
// -------------------------------------------------------------------------
// Exploration du Graph toujours sur les arcs voisins a gauche jusqu'a
// - retour sur la Figure .
// - l acces a un noeud infini .
// (Ces deux cas correspondent a des noeuds pendants.)
// - retour sur l arc de depart si le basicElt est ferme.
// -------------------------------------------------------------------------
while (!NextNode->PendingNode() && (NextNode != StartNode)) {
CurrentArc = CurrentArc->Neighbour(NextNode,MAT_Left);
frontier.Append(CurrentArc);
NextNode = CurrentArc->TheOtherNode(NextNode);
}
// -----------------------------------------------------------------------
// Si NextNode est a l infini : exploration du graph a partir du StartArc
// sur <aBasicElt>.
// exploration sur les arcs voisins a droite.
// Sinon => Fin.
// -----------------------------------------------------------------------
if (NextNode->Infinite()) {
limited = Standard_False;
CurrentArc = aBasicElt->StartArc();
frontier.Append(CurrentArc);
// --------------------------------------------------------------------------
// Determination du premier noeud qui permet de construire la zone en
//tournan surla droite.
// --------------------------------------------------------------------------
NextNode = NodeForTurn(CurrentArc,aBasicElt,MAT_Right);
// -----------------------------------------------------
// Cette branche est aussi terminee par un noeud infini.
// -----------------------------------------------------
while (!NextNode->Infinite()) {
CurrentArc = CurrentArc->Neighbour(NextNode,MAT_Right);
frontier.Append(CurrentArc);
NextNode = CurrentArc->TheOtherNode(NextNode);
}
}
}
//========================================================================
// function: NumberOfArcs
// purpose :
//========================================================================
Standard_Integer MAT_Zone::NumberOfArcs()const
{
return frontier.Length();
}
//========================================================================
// function: ArcOnFrontier
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_Zone::ArcOnFrontier(const Standard_Integer Index)const
{
return frontier.Value(Index);
}
//========================================================================
// function: NoEmptyZone
// purpose :
//========================================================================
Standard_Boolean MAT_Zone::NoEmptyZone()const
{
return (!frontier.IsEmpty());
}
//========================================================================
// function: Limited
// purpose :
//========================================================================
Standard_Boolean MAT_Zone::Limited()const
{
return limited;
}
//========================================================================
// function:
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Zone::NodeForTurn (const Handle(MAT_Arc)& anArc,
const Handle(MAT_BasicElt)& aBE,
const MAT_Side aSide)
const
{
Handle(MAT_Arc) NeighbourArc;
Handle(MAT_Node) NodeSol ;
NodeSol = anArc->FirstNode();
NeighbourArc = anArc->Neighbour(NodeSol,aSide);
if (NeighbourArc.IsNull()) {
NodeSol = anArc->SecondNode();
NeighbourArc = anArc->Neighbour(NodeSol,aSide);
}
if (NeighbourArc.IsNull()) {
return NodeSol;
}
if (NeighbourArc->FirstElement() == aBE) {
return NodeSol;
}
else if (NeighbourArc->SecondElement() == aBE) {
return NodeSol;
}
else {
return anArc->TheOtherNode(NodeSol);
}
}