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

124
src/Intf/Intf.cdl Executable file
View File

@@ -0,0 +1,124 @@
-- File: Intf.cdl
-- Created: Thu May 23 11:21:00 1991
-- Author: Didier PIFFAULT
-- <dpf@topsn3>
---Copyright: Matra Datavision 1991, 1992
package Intf
---Purpose: Interference computation between polygons, lines and
-- polyhedra with only triangular facets. These objects
-- are polygonal representations of complex curves and
-- triangulated representations of complex surfaces.
uses Standard, TCollection, TColStd, gp, Bnd, IntAna2d
is
-- Enumeration :
enumeration PIType is EXTERNAL, FACE, EDGE, VERTEX;
---Purpose: Describes the different intersection point types for this
-- application.
-- Classes input data :
generic class ToolPolygon; -- Signature
---Purpose: Describes the necessary polygon information to compute the
-- interferences.
generic class ToolPolyhedron; -- Signature
---Purpose: Describes the necessary polyhedron information to compute
-- the interferences.
class Array1OfLin instantiates Array1 from TCollection
(Lin from gp);
---Purpose: Describes a set of Straight Lines to intersect with the
-- Polyhedron.
-- Classes output data :
class SectionPoint;
---Purpose: Describes a common point between two polygons or between a
-- polygon and a polyhedron.
class SeqOfSectionPoint instantiates Sequence from TCollection
(SectionPoint);
class SectionLine;
---Purpose: Describes a common line between two polyhedrons.
class SeqOfSectionLine instantiates Sequence from TCollection
(SectionLine);
class TangentZone;
---Purpose: Describes a zone of tangence between two polygons or two
-- polyhedrons.
class SeqOfTangentZone instantiates Sequence from TCollection
(TangentZone);
deferred class Interference;
---Purpose: Describes the Interference computation result as three
-- sequences of points of intersection , polylines of
-- intersection and zones de tangence.
-- Algorithms :
class Tool;
---Purpose: The class tool provide methods to create Box or
-- Box2d in particular contex.
generic class InterferencePolygon2d;
---Purpose: Computes the interference between two polygons in 2d.
-- Result : points of intersections and zones of tangence.
generic class InterferencePolygon3d;
---Purpose: Computes the interference between two polygon in 3d.
-- Section points, common perpendicular and projections.
generic class InterferencePolygonPolyhedron;
---Purpose: Computes the interference between a polygon or a straight
-- line and a polyhedron. Points of intersection and zones
-- of tangence.
generic class InterferencePolyhedron;
---Purpose: Compute the interference between two polyhedron. Points
-- of intersection , polylines of intersection and zones of
-- tangence.
--- Package Methods :
--
PlaneEquation (P1 : in Pnt from gp;
P2 : in Pnt from gp;
P3 : in Pnt from gp;
NormalVector : out XYZ from gp;
PolarDistance : out Real from Standard);
---Purpose: Give the plane equation of the triangle <P1> <P2> <P3>.
Contain (P1 : in Pnt from gp;
P2 : in Pnt from gp;
P3 : in Pnt from gp;
ThePnt : in Pnt from gp)
returns Boolean;
---Purpose: Compute if the triangle <P1> <P2> <P3> contain <ThePnt>.
end Intf;

43
src/Intf/Intf.cxx Executable file
View File

@@ -0,0 +1,43 @@
// File: Intf.cxx
// Created: Wed Jan 20 11:41:33 1993
// Author: Didier PIFFAULT
// <dpf@phylox>
#include <Intf.ixx>
//=======================================================================
//function : PlaneEquation
//purpose :
//=======================================================================
void Intf::PlaneEquation (const gp_Pnt& P1,
const gp_Pnt& P2,
const gp_Pnt& P3,
gp_XYZ& NormalVector,
Standard_Real& PolarDistance)
{
gp_XYZ v1=P2.XYZ()-P1.XYZ();
gp_XYZ v2=P3.XYZ()-P2.XYZ();
gp_XYZ v3=P1.XYZ()-P3.XYZ();
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
NormalVector.Normalize();
PolarDistance = NormalVector * P1.XYZ();
}
//=======================================================================
//function : Contain
//purpose :
//=======================================================================
Standard_Boolean Intf::Contain (const gp_Pnt& P1,
const gp_Pnt& P2,
const gp_Pnt& P3,
const gp_Pnt& ThePnt)
{
gp_XYZ v1=(P2.XYZ()-P1.XYZ())^(ThePnt.XYZ()-P1.XYZ());
gp_XYZ v2=(P3.XYZ()-P2.XYZ())^(ThePnt.XYZ()-P2.XYZ());
gp_XYZ v3=(P1.XYZ()-P3.XYZ())^(ThePnt.XYZ()-P3.XYZ());
if (v1*v2 >= 0. && v2*v3 >= 0. && v3*v1>=0.) return Standard_True;
else return Standard_False;
}

120
src/Intf/Intf_Interference.cdl Executable file
View File

@@ -0,0 +1,120 @@
-- File: Interference.cdl
-- Created: Mon Jun 24 10:15:49 1991
-- Author: Didier PIFFAULT
-- <dpf@phobox>
---Copyright: Matra Datavision 1991, 1992
deferred class Interference from Intf
---Purpose: Describes the Interference computation result
-- between polygon2d or polygon3d or polyhedron.
uses SectionPoint from Intf,
SeqOfSectionPoint from Intf,
SectionLine from Intf,
SeqOfSectionLine from Intf,
TangentZone from Intf,
SeqOfTangentZone from Intf
raises OutOfRange from Standard
is Initialize(Self : Boolean from Standard);
SelfInterference(me : in out;
Self : Boolean from Standard) is protected;
---Purpose: Only one argument for the intersection.
NbSectionPoints(me)
returns Integer is static;
---Purpose: Gives the number of points of intersection in the
-- interference.
PntValue (me;
Index : in Integer)
returns SectionPoint from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the point of intersection of address Index in
-- the interference.
--
---C++: return const &
NbSectionLines (me)
returns Integer is static;
---Purpose: Gives the number of polylines of intersection in the
-- interference.
LineValue (me;
Index : in Integer)
returns SectionLine from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the polyline of intersection at address <Index> in
-- the interference.
--
---C++: return const &
NbTangentZones (me)
returns Integer is static;
---Purpose: Gives the number of zones of tangence in the interference.
ZoneValue (me;
Index : in Integer)
returns TangentZone from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the zone of tangence at address Index in the
-- interference.
--
---C++: return const &
GetTolerance (me)
returns Real
is static;
---Purpose: Gives the tolerance used for the calculation.
-- Implementation functions :
Contains (me;
ThePnt : in SectionPoint from Intf)
returns Boolean
is static;
---Purpose: Tests if the polylines of intersection or the zones of
-- tangence contain the point of intersection <ThePnt>.
Insert (me : in out;
TheZone : in TangentZone from Intf)
returns Boolean
is static;
---Purpose: Inserts a new zone of tangence in the current list of
-- tangent zones of the interference and returns True
-- when done.
Insert (me : in out;
pdeb : in SectionPoint from Intf;
pfin : in SectionPoint from Intf)
is static;
---Purpose: Insert a new segment of intersection in the current list of
-- polylines of intersection of the interference.
Dump (me) is static;
fields mySPoins : SeqOfSectionPoint from Intf is protected;
mySLines : SeqOfSectionLine from Intf is protected;
myTZones : SeqOfTangentZone from Intf is protected;
SelfIntf : Boolean from Standard is protected;
Tolerance : Real from Standard is protected;
end Interference;

344
src/Intf/Intf_Interference.cxx Executable file
View File

@@ -0,0 +1,344 @@
// File: Intf_Interference.cxx
// Created: Mon Jun 24 11:52:34 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_Interference.ixx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
//=======================================================================
//function : Intf_Interference
//purpose : Initialize for a deferred interference.
//=======================================================================
static Standard_Integer debug=0;
Intf_Interference::Intf_Interference (const Standard_Boolean Self)
: SelfIntf(Self)
{}
//=======================================================================
//function : SelfInterference
//purpose : Reset interference before perform with a new...
//=======================================================================
void Intf_Interference::SelfInterference (const Standard_Boolean Self)
{
SelfIntf=Self;
mySPoins.Clear();
mySLines.Clear();
myTZones.Clear();
}
//---------------------------------------------------------
// Return the number of sections points in an interference.
//---------------------------------------------------------
Standard_Integer Intf_Interference::NbSectionPoints () const
{
return mySPoins.Length();
}
//-----------------------------------------------------------
// Give the section point of range Index in the interference.
//-----------------------------------------------------------
const Intf_SectionPoint& Intf_Interference::PntValue
(const Standard_Integer Index) const
{
return mySPoins(Index);
}
//--------------------------------------------------------
// Return the number of sections lines in an interference.
//--------------------------------------------------------
Standard_Integer Intf_Interference::NbSectionLines () const
{
return mySLines.Length();
}
//----------------------------------------------------------
// Give the section line of range Index in the interference.
//----------------------------------------------------------
const Intf_SectionLine& Intf_Interference::LineValue
(const Standard_Integer Index) const
{
return mySLines(Index);
}
//---------------------------------------------------------------
// Return the number of sections TangentZones in an interference.
//---------------------------------------------------------------
Standard_Integer Intf_Interference::NbTangentZones () const
{
return myTZones.Length();
}
//---------------------------------------------------------
// Give the tangentzone of range Index in the interference.
//---------------------------------------------------------
const Intf_TangentZone& Intf_Interference::ZoneValue
(const Standard_Integer Index) const
{
return myTZones(Index);
}
//=======================================================================
//function : GetTolerance
//purpose :
//=======================================================================
Standard_Real Intf_Interference::GetTolerance () const
{
return Tolerance;
}
//=======================================================================
//function : Insert
//purpose : Insert a tangent zone in the list of the interference
//=======================================================================
Standard_Boolean Intf_Interference::Insert(const Intf_TangentZone& LaZone)
{
if (myTZones.Length()<=0) return Standard_False;
Standard_Integer lzin=0; // Index in the list of the zone of interest.
Standard_Integer lunp=0; // Index of the 1st stop point in this zone.
Standard_Integer lotp=0; // Index of the 2nd stop point in this zone.
Standard_Integer lunl=0; // Index of the 1st point of the new zone.
Standard_Integer lotl=0; // Index of the 2nd point of the new zone.
Standard_Boolean same=Standard_False; // Search direction of the stop of the new zone.
Standard_Boolean Inserted=Standard_True; // Has the insertion succeeded ?
Standard_Integer npcz=-1; // Number of points in the current zone
Standard_Integer nplz=LaZone.NumberOfPoints(); // in the new zone
if (debug>0) {
cout << "Zone of insertion : \n";
LaZone.Dump(2);
cout << endl;
}
// Loop on TangentZone :
for (Standard_Integer Iz=1; Iz<=myTZones.Length(); Iz++) {
if (debug>0) {
cout << "Zone : "<< Iz << "\n";
myTZones(Iz).Dump(2);
cout << endl;
}
// Loop on edges of the TangentZone :
npcz=myTZones(Iz).NumberOfPoints();
Standard_Integer Ipz0, Ipz1, Ipz2;
for (Ipz1=1; Ipz1<=npcz; Ipz1++) {
Ipz0=Ipz1-1;
if (Ipz0<=0) Ipz0=npcz;
Ipz2=(Ipz1%npcz)+1;
// Loop on edges of the new TangentZone and search of the
// corresponding point or edge:
Standard_Integer Ilz1, Ilz2;
for (Ilz1=1; Ilz1<=nplz; Ilz1++) {
Ilz2=(Ilz1%nplz)+1;
if ((myTZones(Iz).GetPoint(Ipz1)).IsEqual
(LaZone.GetPoint(Ilz1))) {
if ((myTZones(Iz).GetPoint(Ipz0)).IsEqual
(LaZone.GetPoint(Ilz2))) {
lzin=Iz;
lunp=Ipz0;
lotp=Ipz1;
lunl=Ilz1;
lotl=Ilz2;
same=Standard_False;
break;
}
else if ((myTZones(Iz).GetPoint(Ipz2)).IsEqual
(LaZone.GetPoint(Ilz2))) {
lzin=Iz;
lunp=Ipz1;
lotp=Ipz2;
lunl=Ilz1;
lotl=Ilz2;
same=Standard_True;
break;
}
else {
lzin=Iz;
lunp=Ipz1;
lunl=Ilz1;
}
}
}
if (lotp!=0) break;
}
if (lotp!=0) break;
}
Standard_Integer Ilc;
if (lotp!=0) {
for (Ilc=lotl+1; (((Ilc-1)%nplz)+1)!=lunl; Ilc++) {
myTZones(lzin).InsertBefore
(lotp, LaZone.GetPoint(((Ilc-1)%nplz)+1));
if (!same) lotp++;
}
}
else if (lunp>0) {
Standard_Boolean loop=Standard_False;
for (Ilc=lunl; ; Ilc++) {
myTZones(lzin).InsertBefore(lunp,
LaZone.GetPoint((((Ilc-1)%nplz)+1)));
lunp++;
if (loop && (((Ilc-1)%nplz)+1)==lunl) break;
loop=Standard_True;
}
}
else {
Inserted =Standard_False;
}
if (debug>0) {
if (Inserted) {
cout << "Zone agrandie : "<< lzin <<" \n";
myTZones(lzin).Dump(2);
cout << endl;
}
}
if (Inserted) {
Intf_TangentZone theNew=myTZones(lzin);
myTZones.Remove(lzin);
if (!Insert(theNew))
myTZones.Append(theNew);
}
return Inserted;
}
//=======================================================================
//function : Insert
//purpose :
//=======================================================================
void Intf_Interference::Insert(const Intf_SectionPoint& pdeb,
const Intf_SectionPoint& pfin)
{
Standard_Boolean Inserted=Standard_False;
Standard_Integer TheLS=0;
Standard_Boolean Begin=Standard_False;
Intf_SectionPoint TheBout(pfin);
Standard_Integer ils, nd, nf;
for (ils=1; ils<=mySLines.Length(); ils++) {
Intf_SectionLine& SL=mySLines(ils);
nd=SL.IsEnd(pdeb);
nf=SL.IsEnd(pfin);
if (nd==1) {
if (nf>1) SL.Close();
Inserted=Standard_True;
TheLS=ils;
Begin=Standard_True;
break;
}
else if (nd>1) {
if (nf==1) SL.Close();
Inserted=Standard_True;
TheLS=ils;
Begin=Standard_False;
break;
}
else if (nf==1) {
Inserted=Standard_True;
TheLS=ils;
Begin=Standard_True;
TheBout=pdeb;
break;
}
else if (nf>1) {
Inserted=Standard_True;
TheLS=ils;
Begin=Standard_False;
TheBout=pdeb;
break;
}
}
if (!Inserted) {
Intf_SectionLine LaLS;
LaLS.Append(pdeb);
LaLS.Append(pfin);
mySLines.Append(LaLS);
}
else {
nd=0;
for (ils=1; ils<=mySLines.Length(); ils++) {
if (ils != TheLS) {
nd=mySLines(ils).IsEnd(TheBout);
if (nd==1) {
if (Begin) {
mySLines(TheLS).Reverse();
}
mySLines(ils).Prepend(mySLines(TheLS));
break;
}
else if (nd>1) {
if (!Begin) {
mySLines(TheLS).Reverse();
}
mySLines(ils).Append(mySLines(TheLS));
break;
}
}
}
if (nd>0) {
mySLines.Remove(TheLS);
}
else {
if (Begin)
mySLines(TheLS).Prepend(TheBout);
else
mySLines(TheLS).Append(TheBout);
}
}
}
//----------------------------------------------------
//
//----------------------------------------------------
Standard_Boolean Intf_Interference::Contains
(const Intf_SectionPoint& LePnt) const
{
//-- LePnt.Dump(0);
for (Standard_Integer l=1; l<=mySLines.Length(); l++) {
if (mySLines(l).Contains(LePnt)) return Standard_True;
}
for (Standard_Integer t=1; t<=myTZones.Length(); t++) {
//-- myTZones(t).Dump(2);
if (myTZones(t).Contains(LePnt)) return Standard_True;
}
return Standard_False;
}
//----------------------------------------------------
//
//----------------------------------------------------
void Intf_Interference::Dump() const
{
cout << "Mes SectionPoint :" << endl;
for (Standard_Integer p=1; p<=mySPoins.Length(); p++) {
mySPoins(p).Dump(2);
}
cout << "Mes SectionLine :" << endl;
for (Standard_Integer l=1; l<=mySLines.Length(); l++) {
mySLines(l).Dump(2);
}
cout << "Mes TangentZone :" << endl;
for (Standard_Integer t=1; t<=myTZones.Length(); t++) {
myTZones(t).Dump(2);
}
}

View File

@@ -0,0 +1,89 @@
-- File: InterferencePolygon2d.cdl
-- Created: Mon Sep 28 17:09:45 1992
-- Author: Didier PIFFAULT
-- <dpf@phylox>
---Copyright: Matra Datavision 1992
generic class InterferencePolygon2d from Intf
(Polygon2d1 as any;
ToolPolygon2d1 as any; -- as ToolPolygon(Pnt2d, Polygon2d1, Box2d)
Polygon2d2 as any;
ToolPolygon2d2 as any) -- as ToolPolygon(Pnt2d, Polygon2d2, Box2d)
inherits Interference from Intf
---Purpose: Computes the interference between two polygons or
-- the self intersection of a polygon in two
-- dimensions.
uses Pnt2d from gp,
SectionPoint from Intf,
SeqOfSectionPoint from Intf,
TangentZone from Intf,
SeqOfTangentZone from Intf
raises OutOfRange from Standard
is
-- Interface :
Create returns InterferencePolygon2d from Intf;
---Purpose: Constructs an empty interference of Polygon.
Create (Obje1: in Polygon2d1 ;Obje2 : in Polygon2d2)
returns InterferencePolygon2d from Intf;
---Purpose: Constructs and computes an interference between two Polygons.
Create (Obje : in Polygon2d1)
returns InterferencePolygon2d from Intf;
---Purpose: Constructs and computes the auto interference of a Polygon.
Perform (me : in out;
Obje1: Polygon2d1 ;Obje2 : in Polygon2d2);
---Purpose: Computes an interference between two Polygons.
Perform (me : in out;
Obje : in Polygon2d1);
---Purpose: Computes the self interference of a Polygon.
Pnt2dValue (me;
Index : in Integer)
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
---Purpose: Gives the geometrical 2d point of the intersection
-- point at address <Index> in the interference.
-- Implementation :
Interference (me : in out;
Obje1 : in Polygon2d1;
Obje2 : in Polygon2d2)
is private;
Interference (me : in out;
Obje : in Polygon2d1)
is private;
Clean (me : in out) is private;
Intersect (me : in out;
BegO : in Pnt2d from gp;
EndO : in Pnt2d from gp;
BegT : in Pnt2d from gp;
EndT : in Pnt2d from gp)
is private;
---Purpose: Computes the intersection between two segments
-- <BegO><EndO> et <BegT><EndT>.
end InterferencePolygon2d;

View File

@@ -0,0 +1,687 @@
// File: Intf_InterferencePolygon2d.gxx
// Created: Mon Jun 24 11:52:34 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <gp_Pnt2d.hxx>
#include <Bnd_Box2d.hxx>
#include <Intf_SectionPoint.hxx>
#include <Intf_SeqOfSectionPoint.hxx>
#include <Intf_TangentZone.hxx>
#include <Intf_SeqOfTangentZone.hxx>
#include <Precision.hxx>
#include <TColStd_ListOfInteger.hxx>
static Standard_Integer debug=0;
// Angular precision (sinus) below that value two right segments
// are considered as having a potential zone of tangency.
static Standard_Real PRCANG=Precision::Angular();
//=======================================================================
//function : Intf_InterferencePolygon2d
//purpose : constructor empty
//=======================================================================
Intf_InterferencePolygon2d::Intf_InterferencePolygon2d()
: Intf_Interference(Standard_False)
{}
//=======================================================================
//function : Intf_InterferencePolygon2d
//purpose : Constructor of the interference beetween two Polygon.
//=======================================================================
static Standard_Boolean oClos, tClos;
static Standard_Integer iObje1, iObje2, nbso;
Intf_InterferencePolygon2d::Intf_InterferencePolygon2d
(const Polygon2d1& Obje1, const Polygon2d2& Obje2)
: Intf_Interference(Standard_False)
{
if (!ToolPolygon2d1::Bounding(Obje1).IsOut
(ToolPolygon2d2::Bounding(Obje2))) {
Tolerance=ToolPolygon2d1::DeflectionOverEstimation(Obje1)+
ToolPolygon2d2::DeflectionOverEstimation(Obje2);
if (Tolerance==0.)
Tolerance=Epsilon(1000.);
nbso=ToolPolygon2d1::NbSegments(Obje1);
oClos=ToolPolygon2d1::Closed(Obje1);
tClos=ToolPolygon2d2::Closed(Obje2);
Interference(Obje1, Obje2);
Clean();
}
}
//=======================================================================
//function : Intf_InterferencePolygon2d
//purpose : Constructor of the auto interference of a Polygon.
//=======================================================================
Intf_InterferencePolygon2d::Intf_InterferencePolygon2d
(const Polygon2d1& Obje)
: Intf_Interference(Standard_True)
{
Tolerance=ToolPolygon2d1::DeflectionOverEstimation(Obje)*2;
if (Tolerance==0.)
Tolerance=Epsilon(1000.);
oClos=ToolPolygon2d1::Closed(Obje);
tClos=oClos;
Interference(Obje);
Clean();
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void Intf_InterferencePolygon2d::Perform
(const Polygon2d1& Obje1, const Polygon2d2& Obje2)
{
SelfInterference(Standard_False);
if (!ToolPolygon2d1::Bounding(Obje1).IsOut(ToolPolygon2d2::Bounding(Obje2))) {
Tolerance=ToolPolygon2d1::DeflectionOverEstimation(Obje1)+
ToolPolygon2d2::DeflectionOverEstimation(Obje2);
if (Tolerance==0.)
Tolerance=Epsilon(1000.);
nbso=ToolPolygon2d1::NbSegments(Obje1);
oClos=ToolPolygon2d1::Closed(Obje1);
tClos=ToolPolygon2d2::Closed(Obje2);
Interference(Obje1, Obje2);
Clean();
}
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void Intf_InterferencePolygon2d::Perform
(const Polygon2d1& Obje)
{
SelfInterference(Standard_True);
Tolerance=ToolPolygon2d1::DeflectionOverEstimation(Obje)*2;
if (Tolerance==0.)
Tolerance=Epsilon(1000.);
oClos=ToolPolygon2d1::Closed(Obje);
tClos=oClos;
Interference(Obje);
Clean();
}
//=======================================================================
//function : Pnt2dValue
//purpose : Give the section point of range Index in the interference.
//=======================================================================
gp_Pnt2d Intf_InterferencePolygon2d::Pnt2dValue
(const Standard_Integer Index) const
{
return gp_Pnt2d((mySPoins(Index)).Pnt().X(),
(mySPoins(Index)).Pnt().Y());
}
//=======================================================================
//function : Interference
//purpose :
//=======================================================================
static Standard_Boolean BeginOfNotClosedObje1;
static Standard_Boolean BeginOfNotClosedObje2;
void Intf_InterferencePolygon2d::Interference
(const Polygon2d1& Obje1,
const Polygon2d2& Obje2)
{
Bnd_Box2d bSO;
Bnd_Box2d bST;
BeginOfNotClosedObje1=!oClos;
for (iObje1=1; iObje1<=ToolPolygon2d1::NbSegments(Obje1); iObje1++) {
bSO.SetVoid();
bSO.Add(ToolPolygon2d1::BeginOfSeg(Obje1, iObje1));
bSO.Add(ToolPolygon2d1::EndOfSeg(Obje1, iObje1));
bSO.Enlarge(ToolPolygon2d1::DeflectionOverEstimation(Obje1));
if (!ToolPolygon2d2::Bounding(Obje2).IsOut(bSO)) {
BeginOfNotClosedObje2=!tClos;
for (iObje2=1; iObje2<=ToolPolygon2d2::NbSegments(Obje2); iObje2++) {
bST.SetVoid();
bST.Add(ToolPolygon2d2::BeginOfSeg(Obje2, iObje2));
bST.Add(ToolPolygon2d2::EndOfSeg(Obje2, iObje2));
bST.Enlarge(ToolPolygon2d2::DeflectionOverEstimation(Obje2));
if (!bSO.IsOut(bST))
Intersect(ToolPolygon2d1::BeginOfSeg(Obje1, iObje1),
ToolPolygon2d1::EndOfSeg(Obje1, iObje1),
ToolPolygon2d2::BeginOfSeg(Obje2, iObje2),
ToolPolygon2d2::EndOfSeg(Obje2, iObje2));
}
BeginOfNotClosedObje2=Standard_False;
}
BeginOfNotClosedObje1=Standard_False;
}
}
//=======================================================================
//function : Interference
//purpose :
//=======================================================================
void Intf_InterferencePolygon2d::Interference
(const Polygon2d1& Obje)
{
Bnd_Box2d bSO;
Bnd_Box2d bST;
BeginOfNotClosedObje1=!oClos;
for (iObje1=1; iObje1<=ToolPolygon2d1::NbSegments(Obje); iObje1++) {
bSO.SetVoid();
bSO.Add(ToolPolygon2d1::BeginOfSeg(Obje, iObje1));
bSO.Add(ToolPolygon2d1::EndOfSeg(Obje, iObje1));
bSO.Enlarge(ToolPolygon2d1::DeflectionOverEstimation(Obje));
if (!ToolPolygon2d1::Bounding(Obje).IsOut(bSO)) {
BeginOfNotClosedObje2=!tClos;
for (iObje2=iObje1+1;iObje2<=ToolPolygon2d1::NbSegments(Obje);iObje2++){
bST.SetVoid();
bST.Add(ToolPolygon2d1::BeginOfSeg(Obje, iObje2));
bST.Add(ToolPolygon2d1::EndOfSeg(Obje, iObje2));
bST.Enlarge(ToolPolygon2d1::DeflectionOverEstimation(Obje));
if (!bSO.IsOut(bST))
Intersect(ToolPolygon2d1::BeginOfSeg(Obje, iObje1),
ToolPolygon2d1::EndOfSeg(Obje, iObje1),
ToolPolygon2d1::BeginOfSeg(Obje, iObje2),
ToolPolygon2d1::EndOfSeg(Obje, iObje2));
}
BeginOfNotClosedObje2=Standard_False;
}
BeginOfNotClosedObje1=Standard_False;
}
}
//=======================================================================
//function : Clean
//purpose :
//=======================================================================
void Intf_InterferencePolygon2d::Clean()
{
// The zones of tangency that concerns only one couple of segments are
// conserved if the angle between the segments is less than <PRCANG> and
// if there is no real point of intersection EDGE/EDGE:
Standard_Integer nbIt=myTZones.Length();
Standard_Integer decal=0;
Standard_Integer addr1, addr2;
Intf_PIType dim1, dim2;
Standard_Real par;
Standard_Integer tsp, tsps;
Standard_Integer lpi, ltz;
Standard_Boolean Only1Seg=Standard_False;
#define PI1 (myTZones(ltz-decal).GetPoint(lpi))
#define PI2 (myTZones(ltz-decal).GetPoint(tsp))
for (ltz=1; ltz<=nbIt; ltz++) {
tsp=tsps=0;
Standard_Real pr1mi,pr1ma,pr2mi,pr2ma,delta1,delta2;
myTZones(ltz-decal).ParamOnFirst(pr1mi,pr1ma);
delta1=pr1ma-pr1mi;
myTZones(ltz-decal).ParamOnSecond(pr2mi,pr2ma);
delta2=pr2ma-pr2mi;
if (delta1<1. && delta2<1.) Only1Seg=Standard_True;
if (delta1==0. || delta2==0.) Only1Seg=Standard_True;
if (debug==1) {
cout<<"\n tz("<<ltz<<") Avant retrait First("<<pr1mi<<","<<pr1ma<<") "
<<"Second("<<pr2mi<<","<<pr2ma<<")\n";
myTZones(ltz-decal).Dump(2);
}
for (lpi=1; lpi<=myTZones(ltz-decal).NumberOfPoints(); lpi++) {
if (PI1.Incidence()<=PRCANG) {tsp=tsps=0;break;}
PI1.InfoFirst(dim1,addr1,par);
PI1.InfoSecond(dim2,addr2,par);
if (dim1==Intf_EDGE && dim2==Intf_EDGE) {
tsps=0;
if (tsp>0) {
tsp=0;
Only1Seg=Standard_False;
break;
}
tsp=lpi;
}
else if (dim1!=Intf_EXTERNAL && dim2!=Intf_EXTERNAL) {
tsps=lpi;
}
}
if (tsp>0) {
mySPoins.Append(myTZones(ltz-decal).GetPoint(tsp));
myTZones.Remove(ltz-decal);
decal++;
}
else if (Only1Seg && tsps!=0) {
mySPoins.Append(myTZones(ltz-decal).GetPoint(tsps));
myTZones.Remove(ltz-decal);
decal++;
}
}
// The points of intersection located in the tangency zone are
// removed from the list :
nbIt=mySPoins.Length();
decal=0;
for (lpi=1; lpi<=nbIt; lpi++) {
for (ltz=1; ltz<=myTZones.Length(); ltz++) {
if (myTZones(ltz).RangeContains(mySPoins(lpi-decal))) {
mySPoins.Remove(lpi-decal);
decal++;
break;
}
}
}
}
//=======================================================================
//function : Intersect
//purpose :
//=======================================================================
void Intf_InterferencePolygon2d::Intersect
(const gp_Pnt2d& BegO, const gp_Pnt2d& EndO,
const gp_Pnt2d& BegT, const gp_Pnt2d& EndT)
{
if(SelfIntf) {
if(Abs(iObje1-iObje2)<=1) return; //-- Ajout du 15 jan 98
}
Standard_Integer nbpi=0;
Standard_Real parO[8];
Standard_Real parT[8];
Intf_SeqOfSectionPoint thePi;
gp_XY segT =EndT.XY()-BegT.XY();
gp_XY segO =EndO.XY()-BegO.XY();
// If the length of segment is zero, nothing is done
Standard_Real lgT =Sqrt(segT*segT);
if (lgT<=0.) return;
Standard_Real lgO =Sqrt(segO*segO);
if (lgO<=0.) return;
// Direction of parsing of segments
Standard_Real sigPS=(segO*segT)>0.0 ? 1.0 : -1.0;
// Precision of calculation
Standard_Real floatgap=Epsilon(lgO+lgT);
// Angle between two straight lines and radius of interference
Standard_Real sinTeta=(segO.CrossMagnitude(segT)/lgO)/lgT;
Standard_Real rayIntf=0.;
if (sinTeta>0.) rayIntf=Tolerance/sinTeta;
// Interference <begO> <segT>
Standard_Real dbOT=((BegO.XY()-BegT.XY())^segT)/lgT;
Standard_Real dbObT=BegO.Distance(BegT);
Standard_Real dbOeT=BegO.Distance(EndT);
if (Abs(dbOT)<=Tolerance) {
if (dbObT<=Tolerance) {
nbpi++;
parO[nbpi]=0.;parT[nbpi]=0.;
thePi.Append(Intf_SectionPoint(BegO,Intf_VERTEX,iObje1,0.,
Intf_VERTEX,iObje2,0.,sinTeta));
}
if (dbOeT<=Tolerance) {
nbpi++;
parO[nbpi]=0.;parT[nbpi]=1.;
thePi.Append(Intf_SectionPoint(BegO,Intf_VERTEX,iObje1,0.,
Intf_VERTEX,iObje2+1,0.,sinTeta));
}
if (dbObT>Tolerance && dbOeT>Tolerance &&
dbObT+dbOeT<=(lgT+Tolerance)) {
nbpi++;
parO[nbpi]=0.;parT[nbpi]=dbObT/lgT;
thePi.Append(Intf_SectionPoint(BegO,Intf_VERTEX,iObje1,0.,
Intf_EDGE,iObje2,parT[nbpi],sinTeta));
}
}
// Interference <endO> <segT>
Standard_Real deOT=((EndO.XY()-BegT.XY())^segT)/lgT;
Standard_Real deObT=EndO.Distance(BegT);
Standard_Real deOeT=EndO.Distance(EndT);
if (Abs(deOT)<=Tolerance) {
if (deObT<=Tolerance) {
nbpi++;
parO[nbpi]=1.;parT[nbpi]=0.;
thePi.Append(Intf_SectionPoint(EndO,Intf_VERTEX,iObje1+1,0.,
Intf_VERTEX,iObje2,0.,sinTeta));
}
if (deOeT<=Tolerance) {
nbpi++;
parO[nbpi]=1.;parT[nbpi]=1.;
thePi.Append(Intf_SectionPoint(EndO,Intf_VERTEX,iObje1+1,0.,
Intf_VERTEX,iObje2+1,0.,sinTeta));
}
if (deObT>Tolerance && deOeT>Tolerance &&
deObT+deOeT<=(lgT+Tolerance)) {
nbpi++;
parO[nbpi]=1.;parT[nbpi]=deObT/lgT;
thePi.Append(Intf_SectionPoint(EndO,Intf_VERTEX,iObje1+1,0.,
Intf_EDGE,iObje2,parT[nbpi],sinTeta));
}
}
// Interference <begT> <segO>
Standard_Real dbTO=((BegT.XY()-BegO.XY())^segO)/lgO;
if (Abs(dbTO)<=Tolerance) {
if (dbObT>Tolerance && deObT>Tolerance &&
dbObT+deObT<=(lgO+Tolerance)) {
nbpi++;
parO[nbpi]=dbObT/lgO;parT[nbpi]=0.;
thePi.Append(Intf_SectionPoint(BegT,Intf_EDGE,iObje1,parO[nbpi],
Intf_VERTEX,iObje2,0.,sinTeta));
}
}
// Interference <endT> <segO>
Standard_Real deTO=((EndT.XY()-BegO.XY())^segO)/lgO;
if (Abs(deTO)<=Tolerance) {
if (dbOeT>Tolerance && deOeT>Tolerance &&
dbOeT+deOeT<=(lgO+Tolerance)) {
nbpi++;
parO[nbpi]=dbOeT/lgO;parT[nbpi]=1.;
thePi.Append(Intf_SectionPoint(EndT,Intf_EDGE,iObje1,parO[nbpi],
Intf_VERTEX,iObje2+1,0.,sinTeta));
}
}
Standard_Boolean edgeSP=Standard_False;
Standard_Real parOSP=0, parTSP=0;
if (Abs(dbOT-deOT)>floatgap && Abs(dbTO-deTO)>floatgap) {
parOSP=dbOT/(dbOT-deOT);
parTSP=dbTO/(dbTO-deTO);
if (dbOT*deOT<=0. && dbTO*deTO<=0.) {
edgeSP=Standard_True;
}
else if (nbpi==0) return;
// If there is no interference it is necessary to take the points segment by segment
if (nbpi==0 && sinTeta>PRCANG) {
nbpi++;
parO[nbpi]=parOSP;
parT[nbpi]=parTSP;
thePi.Append(Intf_SectionPoint(gp_Pnt2d (BegO.X()+ (segO.X()*parOSP),
BegO.Y()+ (segO.Y()*parOSP)),
Intf_EDGE,iObje1,parOSP,
Intf_EDGE,iObje2,parTSP,sinTeta));
}
// Otherwise it is required to check if there is no other
else if (rayIntf>=Tolerance) {
Standard_Real deltaO=rayIntf/lgO;
Standard_Real deltaT=rayIntf/lgT;
Standard_Real x, y;
Standard_Real parOdeb=parOSP-deltaO;
Standard_Real parOfin=parOSP+deltaO;
Standard_Real parTdeb=parTSP-sigPS*deltaT;
Standard_Real parTfin=parTSP+sigPS*deltaT;
if (nbpi==0) {
parO[1]=parOdeb;
parO[2]=parOfin;
parT[1]=parTdeb;
parT[2]=parTfin;
while (nbpi<2) {
nbpi++;
x=BegO.X()+ (segO.X()*parO[nbpi]);
y=BegO.Y()+ (segO.Y()*parO[nbpi]);
thePi.Append(Intf_SectionPoint(gp_Pnt2d(x, y),
Intf_EXTERNAL, iObje1, parO[nbpi],
Intf_EXTERNAL, iObje2, parT[nbpi],
sinTeta));
}
}
else { //nbpi>0
if (nbpi==1) {
Standard_Boolean ok=Standard_True;
if (0.<parOdeb && parOdeb<1. && 0.<parTdeb && parTdeb<1. ) {
parO[nbpi+1]=parOdeb;
parT[nbpi+1]=parTdeb;
}
else if (0.<parOfin && parOfin<1. && 0.<parTfin && parTfin<1. ) {
parO[nbpi+1]= parOfin;
parT[nbpi+1]= parTfin;
}
else {
ok=Standard_False;
}
if (ok) {
x=BegO.X()+ (segO.X()*parO[nbpi+1]);
y=BegO.Y()+ (segO.Y()*parO[nbpi+1]);
if (thePi(1).Pnt().Distance(gp_Pnt(x, y, 0)) >= (Tolerance/4.)) {
nbpi++;
thePi.Append(Intf_SectionPoint(gp_Pnt2d(x, y),
Intf_EXTERNAL, iObje1, parO[nbpi],
Intf_EXTERNAL, iObje2, parT[nbpi],
sinTeta));
}
}
}
else { // plus d une singularite
Standard_Real parOmin=parO[1];
Standard_Real parOmax=parO[1];
Standard_Real parTmin=parT[1];
Standard_Real parTmax=parT[1];
for (Standard_Integer i=2; i<=nbpi; i++) {
parOmin=Min(parOmin, parO[i]);
parOmax=Max(parOmax, parO[i]);
parTmin=Min(parTmin, parT[i]);
parTmax=Max(parTmax, parT[i]);
}
Standard_Real delta;
if (parOdeb<0.) {
delta=-parOdeb;
parOdeb=0.;
parTdeb=parTdeb+sigPS*(delta*(deltaT/deltaO));
}
if (parOfin>1.) {
delta=parOfin-1.;
parOfin=1.;
parTfin=parTfin-sigPS*(delta*(deltaT/deltaO));
}
if (sigPS>0.) {
if (parTdeb<0.) {
delta=-parTdeb;
parTdeb=0.;
parOdeb=parOdeb+delta*(deltaO/deltaT);
}
if (parTfin>1.) {
delta=parTfin-1.;
parTfin=1.;
parOfin=parOfin-delta*(deltaO/deltaT);
}
}
else {
if (parTdeb>1.) {
delta=parTdeb-1.;
parTdeb=1.;
parOdeb=parOdeb+delta*(deltaO/deltaT);
}
if (parTfin<0.) {
delta=-parTfin;
parTfin=0.;
parOfin=parOfin-delta*(deltaO/deltaT);
}
}
if ((parOdeb<parOmin && parOmin>0.) ||
(sigPS>0. && parTdeb<parTmin && parTmin>0.) ||
(sigPS<0. && parTdeb>parTmax && parTmax<1.)) {
nbpi++;
parO[nbpi]=Max(0., Min(1., parOdeb));
parT[nbpi]=Max(0., Min(1., parTdeb));
x=BegO.X()+ (segO.X()*parO[nbpi]);
y=BegO.Y()+ (segO.Y()*parO[nbpi]);
thePi.Append(Intf_SectionPoint(gp_Pnt2d(x, y),
Intf_EXTERNAL, iObje1, parO[nbpi],
Intf_EXTERNAL, iObje2, parT[nbpi],
sinTeta));
}
if ((parOfin>parOmax && parOmax<1.) ||
(sigPS<0. && parTfin<parTmin && parTmin>0.) ||
(sigPS>0. && parTfin>parTmax && parTmax<1.)) {
nbpi++;
parO[nbpi]=Min(1., Max(0., parOfin));
parT[nbpi]=Min(1., Max(0., parTfin));
x=BegO.X()+ (segO.X()*parO[nbpi]);
y=BegO.Y()+ (segO.Y()*parO[nbpi]);
thePi.Append(Intf_SectionPoint(gp_Pnt2d(x, y),
Intf_EXTERNAL, iObje1, parO[nbpi],
Intf_EXTERNAL, iObje2, parT[nbpi],
sinTeta));
}
}
}
}
}
//-- lbr : The points too close to each other are suspended
Standard_Boolean suppr;
do {
suppr=Standard_False;
for(Standard_Integer i=2; suppr==Standard_False && i<=nbpi; i++) {
const gp_Pnt& Pim1 = thePi(i-1).Pnt();
const gp_Pnt& Pi = thePi(i).Pnt();
Standard_Real d=Pi.Distance(Pim1);
d*=50.0;
if(d<lgT && d<lgO) {
for(Standard_Integer j=i; j<nbpi; j++) {
thePi(j)=thePi(j+1);
}
nbpi--;
suppr=Standard_True;
}
}
}
while(suppr==Standard_True);
if (nbpi==1) {
if (edgeSP) {
thePi(1)=Intf_SectionPoint(gp_Pnt2d (BegO.X()+ (segO.X()*parOSP),
BegO.Y()+ (segO.Y()*parOSP)),
Intf_EDGE,iObje1,parOSP,
Intf_EDGE,iObje2,parTSP,sinTeta);
parO[1]=parOSP;
parT[1]=parTSP;
}
if (!SelfIntf) {
// if ((BeginOfNotClosedObje1 && parO[1]==0.) ||
// (BeginOfNotClosedObje2 && parT[1]==0.) ||
// (parO[1]>0. && parT[1]>0.)) {
{
Standard_Boolean contains = Standard_False;
for (Standard_Integer i = 1; i <= mySPoins.Length(); i++)
if (thePi(1).IsEqual(mySPoins(i))) {
contains = Standard_True;
break;
}
if (!contains)
mySPoins.Append(thePi(1));
}
}
else if (iObje2-iObje1!=1 &&
(!oClos || (iObje1!=1 && iObje2!=nbso))) {
mySPoins.Append(thePi(1));
}
}
else if (nbpi>=2) {
Intf_TangentZone TheTZ;
if (nbpi==2) {
TheTZ.PolygonInsert(thePi(1));
TheTZ.PolygonInsert(thePi(2));
}
else {
Standard_Integer lpj;
Standard_Integer lmin=1;
Standard_Integer lmax=1;
for (lpj=2; lpj<=nbpi; lpj++) {
if (parO[lpj]<parO[lmin]) lmin=lpj;
else if (parO[lpj]>parO[lmax]) lmax=lpj;
}
TheTZ.PolygonInsert(thePi(lmin));
TheTZ.PolygonInsert(thePi(lmax));
Standard_Integer ltmin=1;
Standard_Integer ltmax=1;
for (lpj=2; lpj<=nbpi; lpj++) {
if (parT[lpj]<parT[ltmin]) ltmin=lpj;
else if (parT[lpj]>parT[ltmax]) ltmax=lpj;
}
if (ltmin!=lmin && ltmin!=lmax) TheTZ.PolygonInsert(thePi(ltmin));
if (ltmax!=lmin && ltmax!=lmax) TheTZ.PolygonInsert(thePi(ltmax));
}
if (edgeSP) TheTZ.PolygonInsert(Intf_SectionPoint
(gp_Pnt2d (BegO.X()+ (segO.X()*parOSP),
BegO.Y()+ (segO.Y()*parOSP)),
Intf_EDGE,iObje1,parOSP,
Intf_EDGE,iObje2,parTSP,sinTeta));
Standard_Integer nbtz=myTZones.Length();
#if 0
Standard_Integer decaltz=0;
for (Standard_Integer ltz=1; ltz<=nbtz; ltz++) {
if (TheTZ.HasCommonRange(myTZones(ltz-decaltz))) {
TheTZ.Append(myTZones(ltz-decaltz));
myTZones.Remove(ltz-decaltz);
decaltz++;
}
}
myTZones.Append(TheTZ);
#else
TColStd_ListOfInteger LIndex;
for (Standard_Integer ltz=1; ltz<=nbtz; ltz++) {
if (TheTZ.HasCommonRange(myTZones(ltz))) {
LIndex.Append(ltz);
}
}
//------------------------------------------------------------------------
//-- The list is parsed in ascending order by index, zone and tg
//--
if(LIndex.IsEmpty()) {
myTZones.Append(TheTZ);
}
else {
Standard_Integer indexfirst = LIndex.First();
LIndex.RemoveFirst();
Standard_Integer decal = 0;
myTZones(indexfirst).Append(TheTZ);
while(!LIndex.IsEmpty()) {
Standard_Integer index = LIndex.First();
LIndex.RemoveFirst();
myTZones(indexfirst).Append(myTZones(index-decal));
myTZones.Remove(index-decal);
decal++;
}
}
#endif
}
}
// EOF File: Intf_InterferencePolygon2d.gxx

View File

@@ -0,0 +1,135 @@
-- File: InterferencePolygon3d.cdl
-- Created: Tue Sep 29 11:57:14 1992
-- Author: Didier PIFFAULT
-- <dpf@phylox>
---Copyright: Matra Datavision 1992
generic class InterferencePolygon3d from Intf
(Polygon3d1 as any;
ToolPolygon3d1 as any; -- as ToolPolygon(Pnt,Polygon3d1,Box)
Polygon3d2 as any;
ToolPolygon3d2 as any) -- as ToolPolygon(Pnt,Polygon3d2,Box)
inherits Interference from Intf
---Purpose: Computes the interference between two polygons or the
-- self interference of a polygon in 3 dimensions . In 3
-- dimensions the result can be a common perpendicular ,
-- an orthogonal projection or a real intersections.
-- There are two different instantiation arguments to
-- authorize an interference between two polygons from
-- differents origin. Ex : to intersect a curve polygon
-- with an algorithmic curve from numerical walking
-- between two surfaces.
uses Pnt from gp,
SectionPoint from Intf,
SeqOfSectionPoint from Intf,
SectionLine from Intf,
SeqOfSectionLine from Intf
raises OutOfRange from Standard
is
-- Interface :
Create returns InterferencePolygon3d from Intf;
---Purpose: Constructs an empty interference of 3d Polygon.
Create (Obje1 : in Polygon3d1 ;Obje2 : in Polygon3d2)
returns InterferencePolygon3d from Intf;
---Purpose: Constructs and computes an interference between two Polygons.
Create (Obje : in Polygon3d1)
returns InterferencePolygon3d from Intf;
---Purpose: Constructs and computes the self interference of a Polygon.
Perform (me : in out;
Obje1 : in Polygon3d1 ;Obje2 : in Polygon3d2);
---Purpose: Computes an interference between two Polygons.
Perform (me : in out;
Obje : in Polygon3d1);
---Purpose: Computes the auto interference of a Polygon.
NbResults (me)
returns Integer is static;
---Purpose: Gives the number of common Perpendiculars or orthogonal
-- projections between the two polygons.
ResultLine (me;
Index : in Integer)
returns SectionLine from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the segment of address <Index> in the interference
-- representing the perpendicular or the orthogonal
-- projection .
--
---C++: return const &
ResultValue (me;
Index : in Integer)
returns Real from Standard
raises OutOfRange from Standard
is static;
---Purpose: Gives the distance between the two polygons
MinimalDistance(me)
returns Real from Standard
is static;
---Purpose: Gives the distance between the two polygon3d at the
-- perpendicular or projection of minimal length.
MinimalResult (me)
returns Integer from Standard
is static;
---Purpose: Give the perpendicular or projection of minimal length.
-- WARNING : if there are points of intersection the minimal
-- result is one of them and this function is unusuable.
-- Implementation :
Interference (me : in out;
Obje1 : in Polygon3d1;
Obje2 : in Polygon3d2)
is private;
Interference (me : in out;
Obje : in Polygon3d1)
is private;
CommonPerpen (me : in out;
BegO : in Pnt from gp;
EndO : in Pnt from gp;
BegT : in Pnt from gp;
EndT : in Pnt from gp)
is private;
---Purpose: Computes the common perpendicular between the two
-- segments <BegO><EndO> and <BegT><EndT>.
Projections (me : in out;
BegO : in Pnt from gp;
EndO : in Pnt from gp;
BegT : in Pnt from gp;
EndT : in Pnt from gp)
is private;
---Purpose: Computes the different orthogonal projections between
-- segment <BegO><EndO> and points <BegT>,<EndT> and segment
-- <BegT><EndT> and points <BegO>,<EndO>.
fields IndexMin : Integer from Standard;
MinimalDist : Real from Standard;
end InterferencePolygon3d;

View File

@@ -0,0 +1,299 @@
// File: Intf_InterferencePolygon3d.gxx
// Created: Fri Oct 9 10:28:57 1992
// Author: Didier PIFFAULT
// <dpf@sdsun1>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Intf_SectionPoint.hxx>
#include <Intf_SeqOfSectionPoint.hxx>
#include <Intf_SectionLine.hxx>
#include <Intf_SeqOfSectionLine.hxx>
#include <Intf_SeqOfTangentZone.hxx>
#include <Intf_TangentZone.hxx>
//=======================================================================
//function : Intf_InterferencePolygon3d
//purpose : Empty constructor.
//=======================================================================
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d()
: Intf_Interference(Standard_False), IndexMin(0)
{}
//=======================================================================
//function : Intf_InterferencePolygon3d
//purpose : Constructor of the interference beetween two Polygon.
//=======================================================================
static Standard_Integer iObje1, iObje2;
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d
(const Polygon3d1& Obje1, const Polygon3d2& Obje2)
: Intf_Interference(Standard_False), IndexMin(0)
{
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje1)+
ToolPolygon3d2::DeflectionOverEstimation(Obje2);
if (Tolerance<=0.) Tolerance=Epsilon(1000.);
Interference(Obje1, Obje2);
}
//=======================================================================
//function : Intf_InterferencePolygon3d
//purpose : Constructor of the auto interference of a Polygon.
//=======================================================================
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d
(const Polygon3d1& Obje)
: Intf_Interference(Standard_True), IndexMin(0)
{
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje)*2;
Interference(Obje);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void Intf_InterferencePolygon3d::Perform
(const Polygon3d1& Obje1, const Polygon3d2& Obje2)
{
SelfInterference(Standard_False);
IndexMin=0;
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje1)+
ToolPolygon3d2::DeflectionOverEstimation(Obje2);
if (Tolerance<=0.) Tolerance=Epsilon(1000.);
Interference(Obje1, Obje2);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void Intf_InterferencePolygon3d::Perform
(const Polygon3d1& Obje)
{
SelfInterference(Standard_True);
IndexMin=0;
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje)*2;
Interference(Obje);
}
//--------------------------------------------------------
// Return the number of singularity in the interference.
//--------------------------------------------------------
Standard_Integer Intf_InterferencePolygon3d::NbResults () const
{
return mySLines.Length();
}
//----------------------------------------------------------
// Give the result of range Index in the interference.
//----------------------------------------------------------
const Intf_SectionLine& Intf_InterferencePolygon3d::ResultLine
(const Standard_Integer Index) const
{
return mySLines(Index);
}
//=======================================================================
//function : ResultValue
//purpose : give the distance beetween the two polygons for this result.
//=======================================================================
Standard_Real Intf_InterferencePolygon3d::ResultValue
(const Standard_Integer Index) const
{
return mySLines(Index).GetPoint(1).Pnt().Distance
(mySLines(Index).GetPoint(2).Pnt());
}
//=======================================================================
//function : MinimalDistance
//purpose :
//=======================================================================
Standard_Real Intf_InterferencePolygon3d::MinimalDistance () const
{
return MinimalDist;
}
//=======================================================================
//function : MinimalResult
//purpose : give the result of minimal distance.
//=======================================================================
Standard_Integer Intf_InterferencePolygon3d::MinimalResult () const
{
return IndexMin;
}
//=======================================================================
//function : Interference
//purpose :
//=======================================================================
static Standard_Boolean beginOfNotClosedFirst=Standard_True;
static Standard_Boolean beginOfNotClosedSecon=Standard_True;
void Intf_InterferencePolygon3d::Interference
(const Polygon3d1& Obje1,
const Polygon3d2& Obje2)
{
beginOfNotClosedFirst=!ToolPolygon3d1::Closed(Obje1);
for (iObje1=1; iObje1<=ToolPolygon3d1::NbSegments(Obje1); iObje1++) {
beginOfNotClosedSecon=!ToolPolygon3d2::Closed(Obje2);
for (iObje2=1; iObje2<=ToolPolygon3d2::NbSegments(Obje2); iObje2++) {
CommonPerpen(ToolPolygon3d1::BeginOfSeg(Obje1, iObje1),
ToolPolygon3d1::EndOfSeg(Obje1, iObje1),
ToolPolygon3d2::BeginOfSeg(Obje2, iObje2),
ToolPolygon3d2::EndOfSeg(Obje2, iObje2));
Projections(ToolPolygon3d1::BeginOfSeg(Obje1, iObje1),
ToolPolygon3d1::EndOfSeg(Obje1, iObje1),
ToolPolygon3d2::BeginOfSeg(Obje2, iObje2),
ToolPolygon3d2::EndOfSeg(Obje2, iObje2));
beginOfNotClosedSecon=Standard_False;
}
beginOfNotClosedFirst=Standard_False;
}
}
//=======================================================================
//function : Interference
//purpose :
//=======================================================================
void Intf_InterferencePolygon3d::Interference
(const Polygon3d1& Obje)
{
beginOfNotClosedFirst=!ToolPolygon3d1::Closed(Obje);
beginOfNotClosedSecon=Standard_False;
for (iObje1=1; iObje1<=ToolPolygon3d1::NbSegments(Obje); iObje1++) {
for (iObje2=iObje1+1; iObje2<=ToolPolygon3d1::NbSegments(Obje); iObje2++) {
CommonPerpen(ToolPolygon3d1::BeginOfSeg(Obje, iObje1),
ToolPolygon3d1::EndOfSeg(Obje, iObje1),
ToolPolygon3d1::BeginOfSeg(Obje, iObje2),
ToolPolygon3d1::EndOfSeg(Obje, iObje2));
Projections(ToolPolygon3d1::BeginOfSeg(Obje, iObje1),
ToolPolygon3d1::EndOfSeg(Obje, iObje1),
ToolPolygon3d1::BeginOfSeg(Obje, iObje2),
ToolPolygon3d1::EndOfSeg(Obje, iObje2));
}
beginOfNotClosedFirst=Standard_False;
}
}
//=======================================================================
//function : CommonPerpen
//purpose :
//=======================================================================
void Intf_InterferencePolygon3d::CommonPerpen
(const gp_Pnt& BegO, const gp_Pnt& EndO,
const gp_Pnt& BegT, const gp_Pnt& EndT)
{
gp_XYZ segT=EndT.XYZ()-BegT.XYZ();
gp_XYZ segO=EndO.XYZ()-BegO.XYZ();
gp_XYZ refPlane=segT^segO;
Standard_Real lgsO=Sqrt(segT*segT);
Standard_Real lgsT=Sqrt(segO*segO);
if (lgsO<=Tolerance || lgsT<=Tolerance) {
// Un des segments n a pas une longueur significative
}
else if (refPlane.Modulus()<Tolerance) {
// Les deux segments sont paralleles
}
else {
// Les deux segments ne sont pas parralleles
Standard_Real distOP=(BegT.XYZ()*refPlane)/refPlane.Modulus();
Standard_Real distTP=(BegO.XYZ()*refPlane)/refPlane.Modulus();
Standard_Real lgPC=distOP-distTP;
if (Abs(lgPC)< Tolerance) {
// Les deux segments sont dans le meme plan
}
else {
// Les deux segments ne sont pas dans le meme plan
gp_XYZ pO=refPlane^segO; // Plan contenant segO normal a refPlane
pO.Normalize();
Standard_Real dpO=pO*BegO.XYZ();
Standard_Real distBegTpO=(pO*BegT.XYZ())-dpO;
Standard_Real distEndTpO=(pO*EndT.XYZ())-dpO;
Standard_Real parT=-1.;
if (distBegTpO*distEndTpO<0.)
parT=distBegTpO/(distBegTpO-distEndTpO);
else if (Abs(distBegTpO)<=Tolerance)
parT=0.;
else if (Abs(distEndTpO)<=Tolerance)
parT=1.;
if (parT>=0.) {
gp_XYZ pT=refPlane^segT; // Plan contenant segT normal a refPlane
pT.Normalize();
Standard_Real dpT=pT*BegT.XYZ();
Standard_Real distBegOpT=(pT*BegO.XYZ())-dpT;
Standard_Real distEndOpT=(pT*EndO.XYZ())-dpT;
Standard_Real parO=-1.;
if (distBegOpT*distEndOpT<0.)
parO=distBegOpT/(distBegOpT-distEndOpT);
else if (Abs(distBegOpT)<=Tolerance)
parO=0.;
else if (Abs(distEndOpT)<=Tolerance)
parO=1.;
if (parO>=0.) {
// Il y a une perpendiculaire commune interessante
Intf_SectionLine PC;
PC.Append(Intf_SectionPoint
(BegO.Translated(gp_Vec(segO*parO)),
Intf_EDGE, iObje1, 0, parO,
Intf_EXTERNAL, 0, 0, 0., 0));
PC.Append(Intf_SectionPoint
(BegT.Translated(gp_Vec(segT*parT)),
Intf_EXTERNAL, 0, 0, 0.,
Intf_EDGE, iObje2, 0, parT, 0.));
mySLines.Append(PC);
Standard_Real dist=PC.GetPoint(1).Pnt().Distance
(PC.GetPoint(2).Pnt());
if (dist< MinimalDist) {
MinimalDist=dist;
IndexMin=mySLines.Length();
}
}
}
}
}
}
//=======================================================================
//function : Projections
//purpose :
//=======================================================================
void Intf_InterferencePolygon3d::Projections
(const gp_Pnt& BegO, const gp_Pnt& EndO,
const gp_Pnt& BegT, const gp_Pnt& EndT)
{
}
// EOF File: Intf_InterferencePolygon3d.gxx

View File

@@ -0,0 +1,173 @@
-- File: InterferencePolygonPolyhedron.cdl
-- Created: Tue Sep 29 12:00:14 1992
-- Author: Didier PIFFAULT
-- <dpf@phylox>
---Copyright: Matra Datavision 1992
generic class InterferencePolygonPolyhedron from Intf
(Polygon3d as any;
ToolPolygon3d as any; -- as ToolPolygon(Pnt,Polygon3d,Box)
Polyhedron as any;
ToolPolyh as any) -- as ToolPolyhedron(Polyhedron)
inherits Interference from Intf
---Purpose: Computes the interference between a polygon and a
-- Polyhedron.
uses Pnt from gp,
Lin from gp,
XYZ from gp,
Array1OfLin from Intf,
SectionPoint from Intf,
SeqOfSectionPoint from Intf,
TangentZone from Intf,
SeqOfTangentZone from Intf,
BoundSortBox from Bnd
is
-- Interface :
Create returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs an empty interference between Polygon and
-- Polyhedron.
Create (thePolyg : in Polygon3d;
thePolyh : in Polyhedron)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the Polygon
-- and the Polyhedron.
Create (theLin : in Lin from gp;
thePolyh : in Polyhedron)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the
-- Straight Line and the Polyhedron.
Create (theLins : in Array1OfLin from Intf;
thePolyh : in Polyhedron)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the
-- Straight Lines and the Polyhedron.
Perform (me : in out;
thePolyg : in Polygon3d;
thePolyh : in Polyhedron)
---Purpose: Computes an interference between the Polygon and the
-- Polyhedron.
is static;
Perform (me : in out;
theLin : in Lin from gp;
thePolyh : Polyhedron)
---Purpose: Computes an interference between the Straight Line and the
-- Polyhedron.
is static;
Perform (me : in out;
theLins : in Array1OfLin from Intf;
thePolyh : in Polyhedron)
---Purpose: Computes an interference between the Straight Lines and
-- the Polyhedron.
is static;
--------------- Optimisation : On Passe le Bnd_BoundSortBox
Create (thePolyg : in Polygon3d;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the Polygon
-- and the Polyhedron.
Create (theLin : in Lin from gp;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the
-- Straight Line and the Polyhedron.
Create (theLins : in Array1OfLin from Intf;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
returns InterferencePolygonPolyhedron from Intf;
---Purpose: Constructs and computes an interference between the
-- Straight Lines and the Polyhedron.
Perform (me : in out;
thePolyg : in Polygon3d;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
---Purpose: Computes an interference between the Polygon and the
-- Polyhedron.
is static;
Perform (me : in out;
theLin : in Lin from gp;
thePolyh : Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
---Purpose: Computes an interference between the Straight Line and the
-- Polyhedron.
is static;
Perform (me : in out;
theLins : in Array1OfLin from Intf;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
---Purpose: Computes an interference between the Straight Lines and
-- the Polyhedron.
is static;
Interference (me : in out;
thePolyg : in Polygon3d;
thePolyh : in Polyhedron;
theBoundSB : in out BoundSortBox from Bnd)
is static;
---Purpose: Compares the boundings between the segment of <thePolyg> and
-- the facets of <thePolyh>.
-- Implementation :
Interference (me : in out;
thePolyg : in Polygon3d;
thePolyh : in Polyhedron)
is static;
---Purpose: Compares the boundings between the segment of <thePolyg> and
-- the facets of <thePolyh>.
Intersect (me : in out;
BegO : in Pnt from gp;
EndO : in Pnt from gp;
Infinite : Boolean from Standard;
TTri : in Integer from Standard;
thePolyh : in Polyhedron)
is static private;
---Purpose: Computes the intersection between the segment <BegO><EndO>
-- and the triangle <TTri> of <thePolyh>.
Intersect (me : in out;
BegO : in Pnt from gp;
EndO : in Pnt from gp;
Infinite : Boolean from Standard;
TTri : in Integer from Standard;
thePolyh : in Polyhedron;
TriNormal: in XYZ from gp;
TriDp : in Real from Standard;
dBegTri : in Real from Standard;
dEndTri : in Real from Standard)
is static private;
---Purpose: Computes the intersection between the segment <BegO><EndO>
-- and the triangle <TTri> of <thePolyh>.
end InterferencePolygonPolyhedron;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
-- File: InterferencePolyhedron.cdl
-- Created: Tue Sep 29 12:13:15 1992
-- Author: Didier PIFFAULT
-- <dpf@phylox>
---Copyright: Matra Datavision 1992
generic class InterferencePolyhedron from Intf
(Polyhedron1 as any;
ToolPolyhe1 as any;
Polyhedron2 as any;
ToolPolyhe2 as any) -- as ToolPolyhedron(Polyhedron)
inherits Interference from Intf
---Purpose: Computes the interference between two polyhedra or the
-- self interference of a polyhedron.
uses Pnt from gp,
Box from Bnd,
SectionPoint from Intf,
SeqOfSectionPoint from Intf,
SectionLine from Intf,
SeqOfSectionLine from Intf,
TangentZone from Intf,
SeqOfTangentZone from Intf
is
-- Interface :
Create returns InterferencePolyhedron from Intf;
---Purpose: Constructs an empty interference of Polyhedron.
Create (Obje1 : in Polyhedron1;
Obje2 : in Polyhedron2)
returns InterferencePolyhedron from Intf;
---Purpose: Constructs and computes an interference between the two
-- Polyhedra.
Create (Obje : in Polyhedron1)
returns InterferencePolyhedron from Intf;
---Purpose: Constructs and computes the self interference of a
-- Polyhedron.
Perform (me : in out;
Obje1 : in Polyhedron1;
Obje2 : in Polyhedron2);
---Purpose: Computes the interference between the two Polyhedra.
Perform (me : in out;
Obje : in Polyhedron1);
---Purpose: Computes the self interference of a Polyhedron.
-- Implementation :
Interference (me : in out;
Obje1 : in Polyhedron1)
is private;
Interference (me : in out;
Obje1 : in Polyhedron1;
Obje2 : in Polyhedron2)
is private;
---Purpose: Compares the bounding volumes between the facets of <Obje1>
-- and the facets of <Obje2> and intersects the facets when the
-- bounding volumes have a common part.
Intersect (me : in out;
TriF : in Integer from Standard;
Obje1 : in Polyhedron1;
TriS : in Integer from Standard;
Obje2 : in Polyhedron2)
is private;
---Purpose: Computes the intersection between the facet <Tri1> of
-- <FirstPol> and the facet <Tri2> of <SecondPol>.
TangentZoneValue
(me;
TheTZ : in out TangentZone from Intf;
Obje1 : Polyhedron1;
Tri1 : Integer from Standard;
Obje2 : Polyhedron2;
Tri2 : Integer from Standard)
returns Boolean from Standard
is private;
---Purpose: Computes the zone of tangence between the facet <Tri1> of
-- <FirstPol> and the facet <Tri2> of <SecondPol>.
end InterferencePolyhedron;

File diff suppressed because it is too large Load Diff

120
src/Intf/Intf_SectionLine.cdl Executable file
View File

@@ -0,0 +1,120 @@
-- File: SectionLine.cdl
-- Created: Tue Jun 18 10:04:18 1991
-- Author: Didier PIFFAULT
-- <dpf@phobox>
---Copyright: Matra Datavision 1991, 1992
class SectionLine from Intf
---Purpose: Describe a polyline of intersection between two
-- polyhedra as a sequence of points of intersection.
uses SectionPoint from Intf,
SeqOfSectionPoint from Intf
raises OutOfRange from Standard
is
-- User Interface :
NumberOfPoints (me)
returns Integer is static;
---Purpose: Returns number of points in this SectionLine.
---C++: inline
GetPoint (me;
Index : in Integer)
returns SectionPoint from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the point of intersection of address <Index> in the
-- SectionLine.
--
---C++: return const &
IsClosed (me)
returns Boolean is static;
---Purpose: Returns True if the SectionLine is closed.
Contains (me;
ThePI : in SectionPoint from Intf)
returns Boolean is static;
---Purpose: Returns True if ThePI is in the SectionLine <me>.
IsEnd (me;
ThePI : in SectionPoint from Intf)
returns Integer is static;
---Purpose: Checks if <ThePI> is an end of the SectionLine. Returns 1
-- for the beginning, 2 for the end, otherwise 0.
IsEqual (me;
Other : in SectionLine from Intf) -- in like me);
returns Boolean is static;
---Purpose: Compares two SectionLines.
--
---C++: alias operator ==
-- Builder :
Create returns SectionLine;
---Purpose: Constructs an empty SectionLine.
Create (Other : SectionLine)
returns SectionLine;
---Purpose: Copies a SectionLine.
Append (me : in out;
Pi : in SectionPoint from Intf)
is static;
---Purpose: Adds a point at the end of the SectionLine.
Append (me : in out;
LS : in out SectionLine from Intf)
is static;
---Purpose: Concatenates the SectionLine <LS> at the end of the
-- SectionLine <me>.
Prepend (me : in out;
Pi : in SectionPoint from Intf)
is static;
---Purpose: Adds a point to the beginning of the SectionLine <me>.
Prepend (me : in out;
LS : in out SectionLine from Intf)
is static;
---Purpose: Concatenates a SectionLine <LS> at the beginning of the
-- SectionLine <me>.
Reverse (me : in out)
is static;
---Purpose: Reverses the order of the elements of the SectionLine.
Close (me : in out)
is static;
---Purpose: Closes the SectionLine.
Dump (me;
Indent : in Integer) is static;
fields
myPoints : SeqOfSectionPoint from Intf;
closed : Boolean;
end SectionLine;

176
src/Intf/Intf_SectionLine.cxx Executable file
View File

@@ -0,0 +1,176 @@
// File: SectionLine.cxx
// Created: Fri Jun 21 16:50:14 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_SectionLine.ixx>
//=======================================================================
//function : Intf_SectionLine
//purpose : Construct
//=======================================================================
Intf_SectionLine::Intf_SectionLine ()
: closed(Standard_False)
{}
//=======================================================================
//function : Intf_SectionLine
//purpose : Copy
//=======================================================================
Intf_SectionLine::Intf_SectionLine (const Intf_SectionLine& Other)
: closed(Standard_False)
{
myPoints=Other.myPoints;
}
//=======================================================================
//function : Append
//purpose :
//=======================================================================
void Intf_SectionLine::Append (const Intf_SectionPoint& Pi)
{
myPoints.Append(Pi);
}
//=======================================================================
//function : Append
//purpose :
//=======================================================================
void Intf_SectionLine::Append (Intf_SectionLine& LS)
{
myPoints.Append(LS.myPoints);
}
//=======================================================================
//function : Prepend
//purpose :
//=======================================================================
void Intf_SectionLine::Prepend (const Intf_SectionPoint& Pi)
{
myPoints.Prepend(Pi);
}
//=======================================================================
//function : Prepend
//purpose :
//=======================================================================
void Intf_SectionLine::Prepend (Intf_SectionLine& LS)
{
myPoints.Prepend(LS.myPoints);
}
//=======================================================================
//function : Reverse
//purpose :
//=======================================================================
void Intf_SectionLine::Reverse ()
{
myPoints.Reverse();
}
//=======================================================================
//function : Close
//purpose :
//=======================================================================
void Intf_SectionLine::Close ()
{
closed=Standard_True;
}
//=======================================================================
//function : GetPoint
//purpose :
//=======================================================================
const Intf_SectionPoint& Intf_SectionLine::GetPoint
(const Standard_Integer index) const
{
return myPoints.Value(index);
}
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
Standard_Boolean Intf_SectionLine::IsClosed () const
{
//return closed;
// On ne peut fermer une ligne de section inseree dans une liste car
// la fonction Value() copie l'element avant d'appeler la fonction.
// C'est donc la copie qui est modifiee.
// Pour la sequence myPoints on a un pointeur donc le pb ne se pose pas.
return (myPoints.First()==myPoints.Last());
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
Standard_Boolean Intf_SectionLine::Contains
(const Intf_SectionPoint& ThePI) const
{
for (Standard_Integer i = 1; i <= myPoints.Length();i++)
if (ThePI.IsEqual(myPoints(i))) return Standard_True;
return Standard_False;
}
//=======================================================================
//function : IsEnd
//purpose :
//=======================================================================
Standard_Integer Intf_SectionLine::IsEnd
(const Intf_SectionPoint& ThePI) const
{
if (myPoints.First().IsEqual(ThePI)) return 1;
if (myPoints.Last().IsEqual(ThePI)) return myPoints.Length();
return 0;
}
//=======================================================================
//function : IsEqual
//purpose :
//=======================================================================
Standard_Boolean Intf_SectionLine::IsEqual
(const Intf_SectionLine& Other) const
{
if (myPoints.Length() != Other.myPoints.Length())
return Standard_False;
for (Standard_Integer i = 1; i <= myPoints.Length(); i++)
if (!myPoints(i).IsEqual(Other.myPoints(i))) return Standard_False;
return Standard_True;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void Intf_SectionLine::Dump
(const Standard_Integer Indent) const
{
for (Standard_Integer id=0; id<Indent; id++) cout << " ";
cout << "LS ";
if (IsClosed()) cout << "Closed :" << endl;
else cout << "Open :" << endl;
for (Standard_Integer p=1; p<=myPoints.Length(); p++) {
myPoints.Value(p).Dump(Indent+2);
}
}

16
src/Intf/Intf_SectionLine.lxx Executable file
View File

@@ -0,0 +1,16 @@
// File: Intf_SectionLine.lxx
// Created: Tue Jun 25 10:05:35 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_SeqOfSectionPoint.hxx>
//=======================================================================
//function : NumberOfPoint
//purpose :
//=======================================================================
inline Standard_Integer Intf_SectionLine::NumberOfPoints () const
{
return myPoints.Length();
}

166
src/Intf/Intf_SectionPoint.cdl Executable file
View File

@@ -0,0 +1,166 @@
-- File: SectionPoint.cdl
-- Created: Tue Jun 18 10:08:56 1991
-- Author: Didier PIFFAULT
-- <dpf@phobox>
---Copyright: Matra Datavision 1991, 1992
class SectionPoint from Intf
---Purpose: Describes an intersection point between polygons and
-- polyedra.
uses Boolean from Standard,
Integer from Standard,
Real from Standard,
Pnt from gp,
Pnt2d from gp,
PIType from Intf
is
-- User Interface :
Pnt (me)
returns Pnt from gp is static;
---Purpose: Returns the location of the SectionPoint.
---C++: return const &
ParamOnFirst (me)
returns Real from Standard is static;
---Purpose: Returns the cumulated Parameter of the SectionPoint on the
-- first element.
--
---C++: inline
ParamOnSecond (me)
returns Real from Standard is static;
---Purpose: Returns the cumulated Parameter of the section point on the
-- second element.
--
---C++: inline
TypeOnFirst (me)
returns PIType is static;
---Purpose: Returns the type of the section point on the first element.
--
---C++: inline
TypeOnSecond (me)
returns PIType is static;
---Purpose: Returns the type of the section point on the second
-- element.
--
---C++: inline
InfoFirst (me;
Dim : out PIType;
Add1 : out Integer;
Add2 : out Integer;
Param : out Real) is static;
InfoFirst (me;
Dim : out PIType;
Addr : out Integer;
Param : out Real) is static;
---Purpose: Gives the datas about the first argument of the
-- Interference.
InfoSecond (me;
Dim : out PIType;
Add1 : out Integer;
Add2 : out Integer;
Param : out Real) is static;
InfoSecond (me;
Dim : out PIType;
Addr : out Integer;
Param : out Real) is static;
---Purpose: Gives the datas about the second argument of the
-- Interference.
Incidence (me)
returns Real is static;
---Purpose: Gives the incidence at this section point. The incidence
-- between the two triangles is given by the cosine. The best
-- incidence is 0. (PI/2). The worst is 1. (null angle).
IsEqual (me;
Other : in SectionPoint from Intf) -- in like me);
returns Boolean is static;
---Purpose: Returns True if the two SectionPoint have the same logical
-- informations.
--
---C++: alias operator==
---C++: inline
IsOnSameEdge (me;
Other : in SectionPoint from Intf) -- in like me);
returns Boolean is static;
---Purpose: Returns True if the two SectionPoints are on the same edge
-- of the first or the second element.
-- Constructor :
Create;
Create (Where : in Pnt from gp;
DimeO : in PIType;
AddrO1 : in Integer;
AddrO2 : in Integer;
ParamO : in Real;
DimeT : in PIType;
AddrT1 : in Integer;
AddrT2 : in Integer;
ParamT : in Real;
Incid : in Real)
returns SectionPoint;
---Purpose: Builds a SectionPoint with the respective dimensions
-- (vertex edge or face) of the concerned arguments and their
-- addresses in the Topological structure.
Create (Where : in Pnt2d from gp;
DimeO : in PIType;
AddrO1 : in Integer;
ParamO : in Real;
DimeT : in PIType;
AddrT1 : in Integer;
ParamT : in Real;
Incid : in Real)
returns SectionPoint;
---Purpose: Builds a SectionPoint 2d with the respective dimensions
-- (vertex or edge) of the concerned arguments and their
-- addresses in the Topological structure.
Merge (me : in out;
Other : in out SectionPoint from Intf)
-- in out like me
is static;
---Purpose: Merges two SectionPoints.
-- Test needings :
Dump (me;
Indent : in Integer) is static;
fields
myPnt : Pnt from gp;
DimenObje : PIType from Intf;
IndexO1 : Integer from Standard;
IndexO2 : Integer from Standard;
ParamObje : Real from Standard;
DimenTool : PIType from Intf;
IndexT1 : Integer from Standard;
IndexT2 : Integer from Standard;
ParamTool : Real from Standard;
Incide : Real from Standard;
end SectionPoint;

258
src/Intf/Intf_SectionPoint.cxx Executable file
View File

@@ -0,0 +1,258 @@
// File: SectionPoint.cxx
// Created: Mon Jun 24 09:57:32 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_SectionPoint.ixx>
#define DEBUG_INTFSECTIONPOINT 0
//=======================================================================
//function : Pnt
//purpose :
//=======================================================================
const gp_Pnt& Intf_SectionPoint::Pnt () const {return myPnt;}
//=======================================================================
//function : GetElemO
//purpose :
//=======================================================================
void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
Standard_Integer& Add1,
Standard_Integer& Add2,
Standard_Real& Param) const
{
Dim =DimenObje;
Add1=IndexO1;
Add2=IndexO2;
Param=ParamObje;
}
//=======================================================================
//function : GetElemO
//purpose :
//=======================================================================
void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
Standard_Integer& Add,
Standard_Real& Param) const
{
Dim =DimenObje;
Add=IndexO2;
Param=ParamObje;
}
//=======================================================================
//function : GetElemT
//purpose :
//=======================================================================
void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
Standard_Integer& Add1,
Standard_Integer& Add2,
Standard_Real& Param) const
{
Dim =DimenTool;
Add1=IndexT1;
Add2=IndexT2;
Param=ParamTool;
}
//=======================================================================
//function : GetElemT
//purpose :
//=======================================================================
void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
Standard_Integer& Add,
Standard_Real& Param) const
{
Dim =DimenTool;
Add=IndexT2;
Param=ParamTool;
}
//=======================================================================
//function : GetIncidence
//purpose :
//=======================================================================
Standard_Real Intf_SectionPoint::Incidence () const
{return Incide;}
//=======================================================================
//function : IsOnSameEdge
//purpose :
//=======================================================================
Standard_Boolean Intf_SectionPoint::IsOnSameEdge
(const Intf_SectionPoint& Other) const
{
Standard_Boolean isOn=Standard_False;
if (DimenObje==Intf_EDGE) {
if (Other.DimenObje==Intf_EDGE) {
isOn=(IndexO1==Other.IndexO1 && IndexO2==Other.IndexO2);
}
else if (Other.DimenObje==Intf_VERTEX) {
isOn=(IndexO1==Other.IndexO1 || IndexO2==Other.IndexO1);
}
}
else if (DimenObje == Intf_VERTEX) {
if (Other.DimenObje==Intf_EDGE) {
isOn=(IndexO1==Other.IndexO1 || IndexO1==Other.IndexO2);
}
else if (Other.DimenObje==Intf_VERTEX) {
#if DEBUG_INTFSECTIONPOINT
cout << " IsOnSameEdge on Intersection VERTEX VERTEX Obje !" << endl;
#endif
isOn=(IndexT1==Other.IndexT1);
}
}
if (!isOn) {
if (DimenTool==Intf_EDGE) {
if (Other.DimenTool==Intf_EDGE) {
isOn=(IndexT1==Other.IndexT1 && IndexT2==Other.IndexT2);
}
else if (Other.DimenTool==Intf_VERTEX) {
isOn=(IndexT1==Other.IndexT1 || IndexT2==Other.IndexT1);
}
}
else if (DimenTool == Intf_VERTEX) {
if (Other.DimenTool==Intf_EDGE) {
isOn=(IndexT1==Other.IndexT1 || IndexT1==Other.IndexT2);
}
else if (Other.DimenTool==Intf_VERTEX) {
#if DEBUG_INTFSECTIONPOINT
cout << " IsOnSameEdge on Intersection VERTEX VERTEX Tool !" << endl;
#endif
isOn=(IndexT1==Other.IndexT1);
}
}
}
return isOn;
}
//=======================================================================
//function : Intf_SectionPoint
//purpose :
//=======================================================================
Intf_SectionPoint::Intf_SectionPoint ()
: myPnt(0.,0.,0.),
DimenObje(Intf_EXTERNAL), IndexO1(0), IndexO2(0), ParamObje(0.),
DimenTool(Intf_EXTERNAL), IndexT1(0), IndexT2(0), ParamTool(0.),
Incide(0.)
{
}
//=======================================================================
//function : Intf_SectionPoint
//purpose :
//=======================================================================
Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt& Where,
const Intf_PIType Dim1,
const Standard_Integer Addr1,
const Standard_Integer Addr2,
const Standard_Real Param1,
const Intf_PIType Dim2,
const Standard_Integer Addr3,
const Standard_Integer Addr4,
const Standard_Real Param2,
const Standard_Real Incid)
: myPnt(Where),
DimenObje(Dim1), IndexO1(Addr1), IndexO2(Addr2), ParamObje(Param1),
DimenTool(Dim2), IndexT1(Addr3), IndexT2(Addr4), ParamTool(Param2),
Incide(Incid)
{
}
//=======================================================================
//function : Intf_SectionPoint
//purpose :
//=======================================================================
Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt2d& Where,
const Intf_PIType Dim1,
const Standard_Integer Addr1,
const Standard_Real Param1,
const Intf_PIType Dim2,
const Standard_Integer Addr2,
const Standard_Real Param2,
const Standard_Real Incid)
: myPnt(Where.X(),Where.Y(),0.),
DimenObje(Dim1), IndexO1(0), IndexO2(Addr1), ParamObje(Param1),
DimenTool(Dim2), IndexT1(0), IndexT2(Addr2), ParamTool(Param2),
Incide(Incid)
{
}
//=======================================================================
//function : Merge
//purpose :
//=======================================================================
void Intf_SectionPoint::Merge (Intf_SectionPoint& Other) {
Other.myPnt=myPnt;
if (DimenObje >= Other.DimenObje) {
Other.DimenObje=DimenObje;
Other.IndexO1=IndexO1;
Other.IndexO2=IndexO2;
Other.ParamObje=ParamObje;
}
else {
DimenObje=Other.DimenObje;
IndexO1=Other.IndexO1;
IndexO2=Other.IndexO2;
ParamObje=Other.ParamObje;
}
if (DimenTool >= Other.DimenTool) {
Other.DimenTool=DimenTool;
Other.IndexT1=IndexT1;
Other.IndexT2=IndexT2;
Other.ParamTool=ParamTool;
}
else {
DimenTool=Other.DimenTool;
IndexT1=Other.IndexT1;
IndexT2=Other.IndexT2;
ParamTool=Other.ParamTool;
}
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void Intf_SectionPoint::Dump (const Standard_Integer
#if DEBUG_INTFSECTIONPOINT
Indent
#endif
) const
{
#if DEBUG_INTFSECTIONPOINT
for (Standard_Integer id=0; id<Indent; id++) cout << " ";
cout << "PIType(" << DimenObje << "," << DimenTool << ") entre("
<< IndexO1 << "," << IndexO2 << ") par(" << ParamObje
<< ") et ("
<< IndexT1 << "," << IndexT2 << ") par(" << ParamTool
<< ")" << endl;
for (id=0; id<Indent; id++) cout << " ";
cout << " Lieu(" << myPnt.X() << ","
<< myPnt.Y() << ","
<< myPnt.Z() <<
") Incidence(" << Incide << ")" << endl;
#endif
}

27
src/Intf/Intf_SectionPoint.lxx Executable file
View File

@@ -0,0 +1,27 @@
// File: Intf_SectionPoint.lxx
// Created: Tue Jun 25 10:05:51 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
inline Standard_Real Intf_SectionPoint::ParamOnFirst() const
{return (IndexO2-1)+ParamObje;}
inline Standard_Real Intf_SectionPoint::ParamOnSecond() const
{return (IndexT2-1)+ParamTool;}
inline Intf_PIType Intf_SectionPoint::TypeOnFirst() const
{return DimenObje;}
inline Intf_PIType Intf_SectionPoint::TypeOnSecond() const
{return DimenTool;}
inline Standard_Boolean Intf_SectionPoint::IsEqual
(const Intf_SectionPoint& Other) const
{
return (DimenObje==Other.DimenObje &&
IndexO1==Other.IndexO1 &&
IndexO2==Other.IndexO2 &&
DimenTool==Other.DimenTool &&
IndexT1==Other.IndexT1 &&
IndexT2==Other.IndexT2);
}

160
src/Intf/Intf_TangentZone.cdl Executable file
View File

@@ -0,0 +1,160 @@
-- File: TangentZone.cdl
-- Created: Tue Jun 18 13:58:15 1991
-- Author: Didier PIFFAULT
-- <dpf@phobox>
---Copyright: Matra Datavision 1991, 1992
class TangentZone from Intf
---Purpose: Describes a zone of tangence between polygons or
-- polyhedra as a sequence of points of intersection.
uses SectionPoint from Intf,
SeqOfSectionPoint from Intf
raises OutOfRange from Standard
is
-- User Interface :
NumberOfPoints (me)
returns Integer is static;
---Purpose: Returns number of SectionPoint in this TangentZone.
---C++: inline
GetPoint (me;
Index : in Integer)
returns SectionPoint from Intf
raises OutOfRange from Standard
is static;
---Purpose: Gives the SectionPoint of address <Index> in the
-- TangentZone.
--
---C++: return const &
IsEqual (me;
Other : in TangentZone from Intf)
returns Boolean is static;
---Purpose: Compares two TangentZones.
--
---C++: alias operator ==
Contains (me;
ThePI : in SectionPoint from Intf)
returns Boolean is static;
---Purpose: Checks if <ThePI> is in TangentZone.
ParamOnFirst (me;
paraMin : in out Real from Standard;
paraMax : in out Real from Standard) is static;
---C++: inline
---Purpose: Gives the parameter range of the TangentZone on the first
-- argument of the Interference. (Usable only for polygon)
ParamOnSecond (me;
paraMin : in out Real from Standard;
paraMax : in out Real from Standard) is static;
---C++: inline
---Purpose: Gives the parameter range of the TangentZone on the second
-- argument of the Interference. (Usable only for polygon)
InfoFirst (me;
segMin : in out Integer from Standard;
paraMin : in out Real from Standard;
segMax : in out Integer from Standard;
paraMax : in out Real from Standard) is static;
---Purpose: Gives information about the first argument of the
-- Interference. (Usable only for polygon)
InfoSecond (me;
segMin : in out Integer from Standard;
paraMin : in out Real from Standard;
segMax : in out Integer from Standard;
paraMax : in out Real from Standard) is static;
---Purpose: Gives informations about the second argument of the
-- Interference. (Usable only for polygon)
RangeContains (me;
ThePI : in SectionPoint from Intf)
returns Boolean is static;
---Purpose: Returns True if <ThePI> is in the parameter range of the
-- TangentZone.
HasCommonRange (me;
Other : in TangentZone from Intf)
returns Boolean is static;
---Purpose: Returns True if the TangentZone <Other> has a common part
-- with <me>.
-- Builder :
Create returns TangentZone;
---Purpose: Builds an empty tangent zone.
Create (Other : TangentZone)
returns TangentZone;
---Purpose: Copies a Tangent zone.
Append (me : in out;
Pi : SectionPoint from Intf)
is static;
---Purpose: Adds a SectionPoint to the TangentZone.
Append (me : in out;
Tzi : TangentZone from Intf)
is static;
---Purpose: Adds the TangentZone <Tzi> to <me>.
Insert (me : in out;
Pi : SectionPoint from Intf)
returns Boolean
is static;
---Purpose: Inserts a SectionPoint in the TangentZone.
PolygonInsert (me : in out;
Pi : SectionPoint from Intf)
is static;
---Purpose: Inserts a point in the polygonal TangentZone.
InsertBefore (me : in out;
Index : in Integer;
Pi : SectionPoint from Intf)
is static;
---Purpose: Inserts a SectionPoint before <Index> in the TangentZone.
InsertAfter (me : in out;
Index : in Integer;
Pi : SectionPoint from Intf)
is static;
---Purpose: Inserts a SectionPoint after <Index> in the TangentZone.
Dump (me;
Indent : in Integer) is static;
fields
Result : SeqOfSectionPoint;
ParamOnFirstMin : Real from Standard;
ParamOnFirstMax : Real from Standard;
ParamOnSecondMin : Real from Standard;
ParamOnSecondMax : Real from Standard;
end TangentZone;

333
src/Intf/Intf_TangentZone.cxx Executable file
View File

@@ -0,0 +1,333 @@
// File: TangentZone.cxx
// Created: Mon Jun 24 10:07:47 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_TangentZone.ixx>
#define DEBUG_TANGENTZONE 0
//=======================================================================
//function : Intf_TangentZone
//purpose : Constructor of an empty tangent zone.
//=======================================================================
Intf_TangentZone::Intf_TangentZone ()
{
ParamOnFirstMin = ParamOnSecondMin = RealLast();
ParamOnFirstMax = ParamOnSecondMax = RealFirst();
}
//=======================================================================
//function : Intf_TangentZone
//purpose : Copy
//=======================================================================
Intf_TangentZone::Intf_TangentZone (const Intf_TangentZone& Other)
{
Result=Other.Result;
ParamOnFirstMin = Other.ParamOnFirstMin;
ParamOnFirstMax = Other.ParamOnFirstMax;
ParamOnSecondMin = Other.ParamOnSecondMin;
ParamOnSecondMax = Other.ParamOnSecondMax;
}
//=======================================================================
//function : Append
//purpose : Append the section point to the tangent zone.
//=======================================================================
void Intf_TangentZone::Append (const Intf_SectionPoint& Pi)
{
Result.Append(Pi);
if(ParamOnFirstMin > Pi.ParamOnFirst()) ParamOnFirstMin = Pi.ParamOnFirst();
if(ParamOnSecondMin > Pi.ParamOnSecond()) ParamOnSecondMin = Pi.ParamOnSecond();
if(ParamOnFirstMax < Pi.ParamOnFirst()) ParamOnFirstMax = Pi.ParamOnFirst();
if(ParamOnSecondMax < Pi.ParamOnSecond()) ParamOnSecondMax = Pi.ParamOnSecond();
}
//=======================================================================
//function : Append
//purpose : Merge the TangentZone to the tangent zone.
//=======================================================================
void Intf_TangentZone::Append (const Intf_TangentZone& Tzi)
{
Standard_Integer Tzi_NumberOfPoints = Tzi.NumberOfPoints();
for (Standard_Integer ipi=1; ipi<=Tzi_NumberOfPoints; ipi++) {
PolygonInsert(Tzi.GetPoint(ipi));
}
}
//=======================================================================
//function : Insert
//purpose : Insert the section point at his place in the tangent zone.
//=======================================================================
//Standard_Boolean Intf_TangentZone::Insert (const Intf_SectionPoint& Pi)
Standard_Boolean Intf_TangentZone::Insert (const Intf_SectionPoint& )
{
#if DEBUG_TANGENTZONE
cout<<" Standard_Boolean Intf_TangentZone::Insert (const Intf_SectionPoint& Pi) ???? "<<endl;
#endif
Standard_Boolean Inserted=Standard_False;
/*
Standard_Integer lpon=0;
if (Result.Length()<1) {
Append(Pi);
Inserted=Standard_True;
}
else if (Result.Length()==1) {
if (Pi.IsOnSameEdge(Result(1))) {
InsertAfter(1, Pi);
Inserted=Standard_True;
}
}
else {
Standard_Integer lp1, lp2;
Standard_Integer nbptz=NumberOfPoints();
for (lp1=1; lp1<=nbptz; lp1++) {
lp2=(lp1%nbptz)+1;
if (Pi.IsOnSameEdge(Result(lp1))) {
lpon=lp1;
if (Pi.IsOnSameEdge(Result(lp2))) {
InsertAfter(lp1, Pi);
Inserted=Standard_True;
break;
}
}
}
}
if (!Inserted && lpon>0) {
InsertAfter(lpon, Pi);
Inserted=Standard_True;
}
*/
return Inserted;
}
//=======================================================================
//function : PolygonInsert
//purpose : Insert the point at his place in the polygonal tangent zone.
//=======================================================================
void Intf_TangentZone::PolygonInsert (const Intf_SectionPoint& Pi)
{
// Standard_Boolean Inserted=Standard_False;
Standard_Integer nbpTz=NumberOfPoints();
// Standard_Integer lpi;
if(nbpTz==0) {
Append(Pi);
return;
}
if(Pi.ParamOnFirst() >= ParamOnFirstMax) {
Append(Pi);
}
else if(Pi.ParamOnFirst() >= ParamOnFirstMin) {
InsertBefore(1,Pi);
}
else {
/*----- Trop Long lbr le 13 mai 97
Standard_Real PiParamOnFirst = Pi.ParamOnFirst();
Standard_Real PiParamOnSecond = Pi.ParamOnSecond();
for (lpi=1; lpi<=nbpTz; lpi++) {
const Intf_SectionPoint& Resultlpi = Result(lpi);
if (PiParamOnFirst<Resultlpi.ParamOnFirst()) {
InsertBefore(lpi, Pi);
Inserted=Standard_True;
break;
}
else if (PiParamOnFirst==Resultlpi.ParamOnFirst()) {
if (PiParamOnSecond==Resultlpi.ParamOnSecond()) {
Inserted=Standard_True;
break;
}
}
}
if (!Inserted) {
Append(Pi);
}
------ */
Append(Pi); //-- On met les points sans les classer
//-- si on veut on pourra les reclasser
//-- ensuite avec un TRI.
}
}
//=======================================================================
//function : InsertAfter
//purpose :
//=======================================================================
void Intf_TangentZone::InsertAfter(const Standard_Integer Index,
const Intf_SectionPoint& Pi)
{
Result.InsertAfter(Index, Pi);
if(ParamOnFirstMin > Pi.ParamOnFirst()) ParamOnFirstMin = Pi.ParamOnFirst();
if(ParamOnSecondMin > Pi.ParamOnSecond()) ParamOnSecondMin = Pi.ParamOnSecond();
if(ParamOnFirstMax < Pi.ParamOnFirst()) ParamOnFirstMax = Pi.ParamOnFirst();
if(ParamOnSecondMax < Pi.ParamOnSecond()) ParamOnSecondMax = Pi.ParamOnSecond();
}
//=======================================================================
//function : InsertBefore
//purpose :
//=======================================================================
void Intf_TangentZone::InsertBefore(const Standard_Integer Index,
const Intf_SectionPoint& Pi)
{
Result.InsertBefore(Index, Pi);
if(ParamOnFirstMin > Pi.ParamOnFirst()) ParamOnFirstMin = Pi.ParamOnFirst();
if(ParamOnSecondMin > Pi.ParamOnSecond()) ParamOnSecondMin = Pi.ParamOnSecond();
if(ParamOnFirstMax < Pi.ParamOnFirst()) ParamOnFirstMax = Pi.ParamOnFirst();
if(ParamOnSecondMax < Pi.ParamOnSecond()) ParamOnSecondMax = Pi.ParamOnSecond();
}
//=======================================================================
//function : GetPoint
//purpose : Return the section point of range index in the tangent zone.
//=======================================================================
const Intf_SectionPoint& Intf_TangentZone::GetPoint
(const Standard_Integer Index) const
{
return Result(Index);
}
//=======================================================================
//function : IsEqual
//purpose : Compare two tangent zone.
//=======================================================================
Standard_Boolean Intf_TangentZone::IsEqual
(const Intf_TangentZone& Other) const
{
if (Result.Length() != Other.Result.Length())
return Standard_False;
Standard_Integer i;
for (i = 1; i <= Result.Length(); i++) {
if (!Result(i).IsEqual(Other.Result(i)))
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
Standard_Boolean Intf_TangentZone::Contains
(const Intf_SectionPoint& ThePI) const
{
Standard_Integer i;
for (i = 1; i <= Result.Length(); i++)
if (ThePI.IsEqual(Result(i)))
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : InfoFirst
//purpose :
//=======================================================================
void Intf_TangentZone::InfoFirst(Standard_Integer& segMin,
Standard_Real& paraMin,
Standard_Integer& segMax,
Standard_Real& paraMax) const
{
ParamOnFirst(paraMin, paraMax);
segMin = (Standard_Integer)(IntegerPart(paraMin));
paraMin = paraMin-(Standard_Real)segMin;
segMax = (Standard_Integer)(IntegerPart(paraMax));
paraMax = paraMax-(Standard_Real)segMax;
}
//=======================================================================
//function : InfoSecond
//purpose :
//=======================================================================
void Intf_TangentZone::InfoSecond(Standard_Integer& segMin,
Standard_Real& paraMin,
Standard_Integer& segMax,
Standard_Real& paraMax) const
{
ParamOnSecond(paraMin, paraMax);
segMin = (Standard_Integer)(IntegerPart(paraMin));
paraMin = paraMin-(Standard_Real)segMin;
segMax = (Standard_Integer)(IntegerPart(paraMax));
paraMax = paraMax-(Standard_Real)segMax;
}
//=======================================================================
//function : RangeContains
//purpose :
//=======================================================================
Standard_Boolean Intf_TangentZone::RangeContains
(const Intf_SectionPoint& ThePI) const
{
Standard_Real a, b, c, d;
ParamOnFirst(a, b);
ParamOnSecond(c, d);
if (a<=ThePI.ParamOnFirst() && ThePI.ParamOnFirst()<=b &&
c<=ThePI.ParamOnSecond()&& ThePI.ParamOnSecond()<=d )
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : HasCommonRange
//purpose :
//=======================================================================
Standard_Boolean Intf_TangentZone::HasCommonRange
(const Intf_TangentZone& Other) const
{
Standard_Real a1,b1,c1,d1;
Standard_Real a2,b2,c2,d2;
ParamOnFirst(a1, b1);
ParamOnSecond(a2, b2);
Other.ParamOnFirst(c1, d1);
Other.ParamOnSecond(c2, d2);
if ((c1<=a1 && a1<=d1 || c1<=b1 && b1<=d1 || a1<=c1 && c1<=b1) &&
(c2<=a2 && a2<=d2 || c2<=b2 && b2<=d2 || a2<=c2 && c2<=b2))
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : Dump
//purpose : Dump the TangentZone.
//=======================================================================
void Intf_TangentZone::Dump (const Standard_Integer
Indent
) const
{
#if DEBUG_TANGENTZONE
for (Standard_Integer id=0; id<Indent; id++) cout << " ";
cout << "TZ \n" ;
cout<<" ParamOnFirstMin Max : "<<ParamOnFirstMin<<" "<<ParamOnFirstMax<<endl;
cout<<" ParamOnSecondMin Max : "<<ParamOnSecondMin<<" "<<ParamOnSecondMax<<endl;
for (Standard_Integer p=1; p<=Result.Length(); p++) {
Result(p).Dump(Indent+2);
}
#endif
}

41
src/Intf/Intf_TangentZone.lxx Executable file
View File

@@ -0,0 +1,41 @@
// File: Intf_TangentZone.lxx
// Created: Tue Jun 25 10:06:14 1991
// Author: Didier PIFFAULT
// <dpf@phobox>
#include <Intf_SeqOfSectionPoint.hxx>
//=======================================================================
//function : NumberOfPoint
//purpose : Return the points number of the tangent zone.
//=======================================================================
inline Standard_Integer Intf_TangentZone::NumberOfPoints () const
{
return Result.Length();
}
//=======================================================================
//function : ParamOnFirst
//purpose :
//=======================================================================
inline void Intf_TangentZone::ParamOnFirst(Standard_Real& paraMin,
Standard_Real& paraMax) const
{
paraMin = ParamOnFirstMin;
paraMax = ParamOnFirstMax;
}
//=======================================================================
//function : ParamOnSecond
//purpose :
//=======================================================================
inline void Intf_TangentZone::ParamOnSecond(Standard_Real& paraMin,
Standard_Real& paraMax) const
{
paraMin = ParamOnSecondMin;
paraMax = ParamOnSecondMax;
}

110
src/Intf/Intf_Tool.cdl Executable file
View File

@@ -0,0 +1,110 @@
-- File: Intf_Tool.cdl
-- Created: Wed Jun 23 18:17:43 1993
-- Author: Didier PIFFAULT
-- <dpf@zerox>
---Copyright: Matra Datavision 1993
class Tool from Intf
---Purpose: Provides services to create box for infinites
-- lines in a given contexte.
uses Integer from Standard,
Real from Standard,
Box2d from Bnd,
Lin2d from gp,
Hypr2d from gp,
Parab2d from gp,
Conic from IntAna2d,
Box from Bnd,
Lin from gp,
Hypr from gp,
Parab from gp
raises OutOfRange from Standard
is Create returns Tool from Intf;
Lin2dBox (me : in out;
theLin2d : in Lin2d from gp;
bounding : in Box2d from Bnd;
boxLin : out Box2d from Bnd)
is static;
Hypr2dBox (me : in out;
theHypr2d : in Hypr2d from gp;
bounding : in Box2d from Bnd;
boxHypr : out Box2d from Bnd)
is static;
Inters2d (me : in out;
theCurve : in Hypr2d from gp;
Domain : in Box2d from Bnd)
returns Integer from Standard is static private;
Parab2dBox (me : in out;
theParab2d : in Parab2d from gp;
bounding : in Box2d from Bnd;
boxHypr : out Box2d from Bnd)
is static;
Inters2d (me : in out;
theCurve : in Parab2d from gp;
Domain : in Box2d from Bnd)
returns Integer from Standard is static private;
LinBox (me : in out;
theLin : in Lin from gp;
bounding : in Box from Bnd;
boxLin : out Box from Bnd)
is static;
HyprBox (me : in out;
theHypr : in Hypr from gp;
bounding : in Box from Bnd;
boxHypr : out Box from Bnd)
is static;
Inters3d (me : in out;
theCurve : in Hypr from gp;
Domain : in Box from Bnd)
returns Integer from Standard is static private;
ParabBox (me : in out;
theParab : in Parab from gp;
bounding : in Box from Bnd;
boxHypr : out Box from Bnd)
is static;
Inters3d (me : in out;
theCurve : in Parab from gp;
Domain : in Box from Bnd)
returns Integer from Standard is static private;
NbSegments (me)
returns Integer from Standard
is static;
BeginParam (me;
SegmentNum : Integer from Standard)
returns Real from Standard
raises OutOfRange from Standard
is static;
EndParam (me;
SegmentNum : Integer from Standard)
returns Real from Standard
raises OutOfRange from Standard
is static;
fields nbSeg : Integer from Standard;
beginOnCurve : Real from Standard [6];
endOnCurve : Real from Standard [6];
end Tool;

1032
src/Intf/Intf_Tool.cxx Executable file

File diff suppressed because it is too large Load Diff

50
src/Intf/Intf_ToolPolygon.cdl Executable file
View File

@@ -0,0 +1,50 @@
-- File: ToolPolygon.cdl
-- Created: Fri Aug 2 08:18:37 1991
-- Author: Didier PIFFAULT
-- <dpf@sdsun2>
---Copyright: Matra Datavision 1991, 1992
generic class ToolPolygon from Intf
(Point as any; -- as Pnt2d, Pnt from gp
Polygon as any;
BoundingBox as any) -- as Box2d, Box from Bnd
---Purpose: Describes the necessary information about a polyline to
-- compute the interference between two polylines.
raises OutOfRange from Standard
is Bounding (myclass; thePolyg : Polygon)
returns BoundingBox;
---Purpose: Returns the bounding box of the polygon.
DeflectionOverEstimation
(myclass; thePolyg : Polygon)
returns Real from Standard;
---Purpose: Returns the tolerance of the polygon.
Closed (myclass; thePolyg : Polygon)
returns Boolean from Standard;
---Purpose: Returns True if the polyline is closed.
NbSegments (myclass; thePolyg : Polygon)
returns Integer;
---Purpose: Returns the number of Segments in the polyline.
BeginOfSeg (myclass; thePolyg : Polygon;
Index : in Integer)
returns Point
raises OutOfRange from Standard;
---Purpose: Returns the first point of segment of range <Index> in the
-- Polygon.
EndOfSeg (myclass; thePolyg : Polygon;
Index : in Integer)
returns Point
raises OutOfRange from Standard;
---Purpose: Returns the Second point of the segment of range Index in
-- the Polygon.
end ToolPolygon;

0
src/Intf/Intf_ToolPolygon.gxx Executable file
View File

View File

@@ -0,0 +1,80 @@
-- File: ToolPolyhedron.cdl
-- Created: Wed Sep 18 08:44:42 1991
-- Author: Didier PIFFAULT
-- <dpf@sdsun1>
---Copyright: Matra Datavision 1991, 1992
generic class ToolPolyhedron from Intf (Polyhedron as any)
---Purpose: Describes the signature of a polyedral surface with only
-- triangular facets and the information necessary to compute
-- the interferences.
uses XYZ from gp,
Pnt from gp,
Box from Bnd,
HArray1OfBox from Bnd
raises OutOfRange from Standard
is Bounding (myclass; thePolyh : Polyhedron)
returns Box from Bnd;
---Purpose: Returns the bounding box of the ToolPolyhedron.
ComponentsBounding
(myclass; thePolyh : Polyhedron)
returns HArray1OfBox from Bnd;
---Purpose: Returns the array of boxes. The box <n> corresponding
-- to the triangle <n>.
DeflectionOverEstimation
(myclass; thePolyh : Polyhedron)
returns Real from Standard;
---Purpose: Returns the tolerance of the polygon.
-- Structure needings :
NbTriangles (myclass; thePolyh : Polyhedron)
returns Integer from Standard;
---Purpose: Returns the number of triangles in this polyedron.
Triangle (myclass; thePolyh : Polyhedron;
Index : in Integer from Standard;
P1,P2,P3 : out Integer from Standard)
raises OutOfRange from Standard;
---Purpose: Returns the indices of the 3 points of the triangle of
-- address Index in the ToolPolyhedron.
Point (myclass; thePolyh : Polyhedron;
Index : in Integer)
returns Pnt from gp
raises OutOfRange from Standard;
---Purpose: Returns the point of index i in the polyedron.
TriConnex (myclass; thePolyh : Polyhedron;
Triang : in Integer;
Pivot,Pedge : in Integer;
TriCon : out Integer;
OtherPedge : out Integer)
returns Integer
raises OutOfRange from Standard;
---Purpose: Returns the triangle <Tricon> connected to the triangle
-- <Triang> by the edge <Pivot><Pedge>. The third point of
-- the connected triangle is returned in <OtherPedge> (Used to
-- turn around a vertex). When the edge <Pivot><Pedge> is
-- free (no connected triangle) <Tricon> is null. In this
-- case the function returns the triangle on the free bound of
-- the polyhedron connected to <Triang> by vertex <Pivot>.
end ToolPolyhedron;

View File