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

3
src/IntPolyh/FILES Executable file
View File

@@ -0,0 +1,3 @@
IntPolyh_Intersection_1.cxx
IntPolyh_MaillageAffinage_1.cxx

109
src/IntPolyh/IntPolyh.cdl Executable file
View File

@@ -0,0 +1,109 @@
-- File: IntPolyh.cdl
-- Created: Wed Mar 3 11:13:59 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
-- Modified by skv - Thu Sep 25 18:04:05 2003 OCC567
-- Definition of new pointer to MaillageAffinage
-- which is used in Intersection class.
package IntPolyh
---Purpose: This package provides algorithms to compute
-- starting points for the surface surface
-- intersection packages. Those starting points are
-- used if the two surfaces are bi-parametric
-- surfaces (bezier, nurbs, algorithm surfaces ...)
--
-- This package provides methods
--
-- to compute meshes on the two surfaces. The meshes can
-- be refined if necessary. It is the major improvement
-- to the Intf package which gives the same kind of
-- ressources.
--
-- to intersect the two meshes
--
-- to give approximated starting-points. Those points are
-- organised in lines, when the points belong to a same
-- section line, or returned as isolated points when they
-- can neither define a new line nor be linked to an
-- existant line.
--
-- A starting-point contains 3d information, parametric
-- ionformation and quality criterion. (i.e. X,Y,Z, U1,V1,
-- U2,V2, Incidence). Incidence is a real wich gives an
-- estimated angle between the two surfaces near the
-- intersection point.
--
--
uses
TCollection,
TColStd,
gp,
Bnd,
Adaptor3d
is
class Intersection;
---Purpose: the main algorithm. Algorythm outputs are --
-- lines and points like discribe in the last
-- paragraph. The Algorythm provides direct acces to
-- the elements of those lines and points. Other
-- classes of this package are for internal use and
-- only concern the algorithmic part.
------------------------------------------------------------
---- Internal classes and algorithms
------------------------------------------------------------
class Couple;
---Purpose: couple of triangles
class ArrayOfCouples;
class Point;
class ArrayOfPoints;
class StartPoint;
class ArrayOfStartPoints;
class SeqOfStartPoints instantiates Sequence from TCollection
(StartPoint from IntPolyh);
class Edge;
class ArrayOfEdges;
class Triangle;
class ArrayOfTriangles;
class MaillageAffinage;
---Purpose: Provide the algorythms used in the package
class SectionLine;
class ArrayOfSectionLines;
-- class TangentZone; For the moment we use the StartPoint Class
class ArrayOfTangentZones;
-- Modified by skv - Thu Sep 25 18:04:05 2003 OCC567 End
pointer PMaillageAffinage to MaillageAffinage from IntPolyh;
-- Modified by skv - Thu Sep 25 18:04:07 2003 OCC567 Begin
end;

View File

@@ -0,0 +1,58 @@
-- File: IntPolyh_ArrayOfCouples.cdl
-- Created: Thu Apr 8 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfCouples from IntPolyh
uses
Couple from IntPolyh
is
Create;
Create(nn: Integer from Standard);
Init(me: in out; nn: Integer from Standard)
is static;
NbCouples(me)
returns Integer from Standard
is static;
SetNbCouples(me: in out; fint: Integer from Standard)
is static;
IncNbCouples(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Couple from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Couple from IntPolyh
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,eoa : Integer from Standard;
ptr :Address from Standard;
end ArrayOfCouples from IntPolyh;

View File

@@ -0,0 +1,88 @@
// File: IntPolyh_ArrayOfCouples.cxx
// Created: Thu Apr 8 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_ArrayOfCouples.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfCouples::IntPolyh_ArrayOfCouples() : n(0),eoa(0),ptr(0){
}
IntPolyh_ArrayOfCouples::IntPolyh_ArrayOfCouples(const Standard_Integer N) : n(N),eoa(0){
Init(N);
}
void IntPolyh_ArrayOfCouples::Init(const Standard_Integer N) {
Destroy();
ptr = (void *) (new IntPolyh_Couple [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfCouples::NbCouples() const {
return(eoa);
}
void IntPolyh_ArrayOfCouples::SetNbCouples(const Standard_Integer fint) {
eoa=fint;
}
void IntPolyh_ArrayOfCouples::IncNbCouples() {
eoa++;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Couple& IntPolyh_ArrayOfCouples::Value(const Standard_Integer Index) const {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur4 "<<endl;
printf("Value() from IntPolyh_ArrayOfCouples : value out of array\n");
}
#endif
return(ptrCouple[Index]);
}
IntPolyh_Couple& IntPolyh_ArrayOfCouples::ChangeValue(const Standard_Integer Index) {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur4"<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfCouples : value out of array\n");
}
#endif
return(ptrCouple[Index]);
}
void IntPolyh_ArrayOfCouples::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
delete [] ptrCouple;
ptrCouple=0;
ptr=0;
n=0;
}
}
}
void IntPolyh_ArrayOfCouples::Dump() const{
printf("\n ArrayOfCouples 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,73 @@
-- File: IntPolyh_ArrayOfEdges.cdl
-- Created: Tue Mar 9 17:53:12 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfEdges from IntPolyh
uses
Edge from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
GetN(me)
returns Integer from Standard
---C++: return const
is static;
NbEdges(me)
returns Integer from Standard
---C++: return const
is static;
SetNbEdges(me: in out; endaof: Integer from Standard)
is static;
IncNbEdges(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Edge from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Edge from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfEdges from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfEdges from IntPolyh
is static;
Destroy(me:in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,finte : Integer from Standard;
ptr : Address from Standard;
end ArrayOfEdges from IntPolyh;

View File

@@ -0,0 +1,97 @@
// File: IntPolyh_ArrayOfEdges.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_ArrayOfEdges.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges() : n(0),finte(0),ptr(0) { }
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges(const Standard_Integer N) : n(N),finte(0) {
Init(N);
}
void IntPolyh_ArrayOfEdges::Init(const Standard_Integer N) {
Destroy();
n=N;
ptr = (void*) (new IntPolyh_Edge [n]);
}
const Standard_Integer IntPolyh_ArrayOfEdges::GetN() const {
return(n);
}
const Standard_Integer IntPolyh_ArrayOfEdges::NbEdges() const {
return(finte);
}
void IntPolyh_ArrayOfEdges::SetNbEdges(const Standard_Integer endaoe) {
finte = endaoe;
}
void IntPolyh_ArrayOfEdges::IncNbEdges(){
finte++;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Edge& IntPolyh_ArrayOfEdges::Value(const Standard_Integer Index) const {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 value"<<endl;
printf("Value() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
IntPolyh_Edge& IntPolyh_ArrayOfEdges::ChangeValue(const Standard_Integer Index) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 chgVal"<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
void IntPolyh_ArrayOfEdges::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
delete [] ptredge;
ptredge=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfEdges & IntPolyh_ArrayOfEdges::Copy(const IntPolyh_ArrayOfEdges& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void*) (new IntPolyh_Edge[n]);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfEdges::Dump() const{
printf("\n ArrayOfEdges 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,69 @@
-- File: IntPolyh_ArrayOfPoints.cdl
-- Created: Mon Mar 8 08:12:34 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfPoints from IntPolyh
uses
Point from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Point from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Point from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfPoints from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfPoints from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbPoints(me)
returns Integer from Standard
is static;
IncNbPoints(me: in out)
is static;
SetNbPoints(me: in out; END: Integer from Standard)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,fintp : Integer from Standard;
ptr :Address from Standard;
end ArrayOfPoints from IntPolyh;

View File

@@ -0,0 +1,103 @@
// File: IntPolyh_ArrayOfPoints.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_ArrayOfPoints.ixx>
#include <stdio.h>
IntPolyh_ArrayOfPoints::IntPolyh_ArrayOfPoints() : n(0),fintp(0),ptr(0) { }
IntPolyh_ArrayOfPoints::IntPolyh_ArrayOfPoints(const Standard_Integer N): fintp(0){
Init(N);
}
void IntPolyh_ArrayOfPoints::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_Point [N]);
n = N;
}
Standard_Integer IntPolyh_ArrayOfPoints::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfPoints::NbPoints() const {
return(fintp);
}
void IntPolyh_ArrayOfPoints::IncNbPoints() {
fintp++;
}
void IntPolyh_ArrayOfPoints::SetNbPoints(const Standard_Integer endaop) {
fintp = endaop;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Point& IntPolyh_ArrayOfPoints::Value(const Standard_Integer Index) const {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfPoints : ERROR value outside of the array\n");
}
#endif
return(ptrpoint[Index]);
}
IntPolyh_Point& IntPolyh_ArrayOfPoints::ChangeValue(const Standard_Integer Index) {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfPoints : ERROR value outside of the array\n");
}
#endif
return(ptrpoint[Index]);
}
void IntPolyh_ArrayOfPoints::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
delete [] ptrpoint;
ptrpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfPoints & IntPolyh_ArrayOfPoints::Copy(const IntPolyh_ArrayOfPoints& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_Point[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfPoints::Dump() const{
printf("\n ArrayOfPoints 0-> %d\n",fintp-1);
printf("size %d, room left%d", n, n-fintp);
for(Standard_Integer i=0;i<fintp;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,65 @@
-- File: IntPolyh_ArrayOfSectionLines.cdl
-- Created: Tue Apr 6 11:05:48 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfSectionLines from IntPolyh
uses
SectionLine from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns SectionLine from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns SectionLine from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfSectionLines from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfSectionLines from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbSectionLines(me)
returns Integer from Standard
is static;
IncrementNbSectionLines(me: in out)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,nbsectionlines : Integer from Standard;
ptr : Address from Standard;
end ArrayOfSectionLines from IntPolyh;

View File

@@ -0,0 +1,85 @@
// File: IntPolyh_ArrayOfSectionLines.cxx
// Created: Tue Apr 6 11:05:39 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfSectionLines.ixx>
#include <stdio.h>
IntPolyh_ArrayOfSectionLines::IntPolyh_ArrayOfSectionLines() : n(0),nbsectionlines(0),ptr(0) { }
IntPolyh_ArrayOfSectionLines::IntPolyh_ArrayOfSectionLines(const Standard_Integer N) : nbsectionlines(0){
Init(N);
}
void IntPolyh_ArrayOfSectionLines::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_SectionLine [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfSectionLines::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfSectionLines::NbSectionLines() const {
return(nbsectionlines);
}
void IntPolyh_ArrayOfSectionLines::IncrementNbSectionLines() {
nbsectionlines++;
}
#define BORNES1
const IntPolyh_SectionLine& IntPolyh_ArrayOfSectionLines::Value(const Standard_Integer Index) const {
IntPolyh_SectionLine *ptrstpoint = (IntPolyh_SectionLine *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd";}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_SectionLine& IntPolyh_ArrayOfSectionLines::ChangeValue(const Standard_Integer Index) {
IntPolyh_SectionLine *ptrstpoint = (IntPolyh_SectionLine *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd"; }
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfSectionLines::Destroy() {
if(n) {
if(ptr) {
IntPolyh_SectionLine *ptrsectionline = (IntPolyh_SectionLine *)ptr;
for(Standard_Integer i=0; i<n; i++)
ptrsectionline[i].Destroy();
delete [] ptrsectionline;
ptrsectionline=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfSectionLines & IntPolyh_ArrayOfSectionLines::Copy(const IntPolyh_ArrayOfSectionLines& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_SectionLine[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfSectionLines::Dump() const{
printf("\n ArrayOfSectionLines 0-> %d",nbsectionlines-1);
for(Standard_Integer i=0;i<nbsectionlines;i++) {
(*this)[i].Dump();
}
printf("\n");
}

View File

@@ -0,0 +1,59 @@
-- File: IntPolyh_ArrayOfStartPoints.cdl
-- Created: Tue Apr 6 11:05:48 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfStartPoints from IntPolyh
uses
StartPoint from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns StartPoint from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns StartPoint from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfStartPoints from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfStartPoints from IntPolyh
is static;
NbPoints(me)
returns Integer from Standard
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n : Integer from Standard;
ptr :Address from Standard;
end ArrayOfStartPoints from IntPolyh;

View File

@@ -0,0 +1,77 @@
// File: IntPolyh_ArrayOfStartPoints.cxx
// Created: Tue Apr 6 11:05:39 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfStartPoints.ixx>
#include <stdio.h>
IntPolyh_ArrayOfStartPoints::IntPolyh_ArrayOfStartPoints() : n(0),ptr(0) { }
IntPolyh_ArrayOfStartPoints::IntPolyh_ArrayOfStartPoints(const Standard_Integer N){
Init(N);
}
void IntPolyh_ArrayOfStartPoints::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_StartPoint [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfStartPoints::NbPoints() const {
return(n);
}
#define BORNES1
const IntPolyh_StartPoint& IntPolyh_ArrayOfStartPoints::Value(const Standard_Integer Index) const {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd";}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_StartPoint& IntPolyh_ArrayOfStartPoints::ChangeValue(const Standard_Integer Index) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd"; }
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfStartPoints::Destroy() {
if(n) {
if(ptr) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
delete [] ptrstpoint;
ptrstpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfStartPoints & IntPolyh_ArrayOfStartPoints::Copy(const IntPolyh_ArrayOfStartPoints& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.NbPoints();
ptr = (void *) (new IntPolyh_StartPoint[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfStartPoints::Dump() const{
printf("\n ArrayOfStartPoints 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,66 @@
-- File: IntPolyh_ArrayOfTangentZones.cdl
-- Created: Tue Apr 6 11:05:48 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfTangentZones from IntPolyh
uses
StartPoint from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns StartPoint from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns StartPoint from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfTangentZones from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfTangentZones from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbTangentZones(me)
returns Integer from Standard
is static;
IncrementNbTangentZones(me: in out)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,nbtangentzones : Integer from Standard;
ptr : Address from Standard;
end ArrayOfTangentZones from IntPolyh;

View File

@@ -0,0 +1,92 @@
// File: IntPolyh_ArrayOfTangentZones.cxx
// Created: Tue Apr 6 11:05:39 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfTangentZones.ixx>
#include <stdio.h>
IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones() : n(0),nbtangentzones(0),ptr(0) { }
IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones(const Standard_Integer N) : nbtangentzones(0){
Init(N);
}
void IntPolyh_ArrayOfTangentZones::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_StartPoint [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfTangentZones::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfTangentZones::NbTangentZones() const {
return(nbtangentzones);
}
void IntPolyh_ArrayOfTangentZones::IncrementNbTangentZones() {
nbtangentzones++;
}
# ifdef DEB
# define BORNES1
# endif
const IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::Value(const Standard_Integer Index) const {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::ChangeValue(const Standard_Integer Index) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
}
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfTangentZones::Destroy() {
if(n) {
if(ptr) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
delete [] ptrstpoint;
ptrstpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfTangentZones & IntPolyh_ArrayOfTangentZones::Copy(const IntPolyh_ArrayOfTangentZones& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_StartPoint[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfTangentZones::Dump() const{
printf("\n ArrayOfTangentZones 0-> %d",nbtangentzones-1);
for(Standard_Integer i=0;i<nbtangentzones;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,75 @@
-- File: IntPolyh_ArrayOfTriangles.cdl
-- Created: Mon Mar 8 08:12:34 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class ArrayOfTriangles from IntPolyh
uses
Triangle from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
GetN(me)
returns Integer from Standard
---C++: return const
is static;
NbTriangles(me)
returns Integer from Standard
---C++: return const
is static;
SetNbTriangles(me : in out; endaot: Integer from Standard)
is static;
IncNbTriangles(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Triangle from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Triangle from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfTriangles from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfTriangles from IntPolyh
is static;
Destroy(me:in out)
---C++: alias ~
is static;
Dump(me)
is static;
DumpFleches(me)
is static;
fields
n, fintt : Integer from Standard;
ptr : Address from Standard;
end ArrayOfTriangles from IntPolyh;

View File

@@ -0,0 +1,104 @@
// File: IntPolyh_ArrayOfTriangles.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_ArrayOfTriangles.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfTriangles::IntPolyh_ArrayOfTriangles() : n(0),fintt(0),ptr(0) { }
IntPolyh_ArrayOfTriangles::IntPolyh_ArrayOfTriangles(const Standard_Integer N): fintt(0) {
Init(N);
}
void IntPolyh_ArrayOfTriangles::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_Triangle [N]);
n=N;
}
const Standard_Integer IntPolyh_ArrayOfTriangles::GetN() const {
return(n);
}
const Standard_Integer IntPolyh_ArrayOfTriangles::NbTriangles() const {
return(fintt);
}
void IntPolyh_ArrayOfTriangles::SetNbTriangles(const Standard_Integer endaot) {
fintt=endaot;
}
void IntPolyh_ArrayOfTriangles::IncNbTriangles() {
fintt++;
}
# ifdef DEB
# define BORNES 1
# endif
const IntPolyh_Triangle& IntPolyh_ArrayOfTriangles::Value(const Standard_Integer Index) const {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur31 "<<endl;
printf("Value() from IntPolyh_ArrayOfTriangles.cxx : ERROR value out of array\n");
}
#endif
return(ptrtriangle[Index]);
}
IntPolyh_Triangle& IntPolyh_ArrayOfTriangles::ChangeValue(const Standard_Integer Index) {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur32 "<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfTriangles.cxx : ERROR value out of array\n");
}
#endif
return(ptrtriangle[Index]);
}
IntPolyh_ArrayOfTriangles & IntPolyh_ArrayOfTriangles::Copy(const IntPolyh_ArrayOfTriangles& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *)(new IntPolyh_Triangle[n]);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfTriangles::Destroy(){
if(n) {
if(ptr) {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
delete [] ptrtriangle;
ptrtriangle=0;
ptr=0;
n=0;
}
}
}
void IntPolyh_ArrayOfTriangles::Dump() const{
printf("\n ArrayOfTriangles 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
((*this)[i]).Dump(i);
}
printf("\n");
}
void IntPolyh_ArrayOfTriangles::DumpFleches() const{
printf("\n ArrayOfTriangles 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
((*this)[i]).DumpFleche(i);
}
printf("\n");
}

View File

@@ -0,0 +1,57 @@
-- File: IntPolyh_Couple.cdl
-- Created: Thu Apr 8 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class Couple from IntPolyh
uses
Pnt from gp
is
Create;
Create(i1,i2: Integer from Standard) ;
FirstValue(me)
returns Integer from Standard
is static;
SecondValue(me)
returns Integer from Standard
is static;
AnalyseFlagValue(me)
returns Integer from Standard
is static;
AngleValue(me)
returns Real from Standard
is static;
SetCoupleValue(me: in out; v,w: Integer from Standard)
is static;
SetAnalyseFlag(me: in out; v: Integer from Standard)
is static;
SetAngleValue(me: in out; ang: Real from Standard)
is static;
Dump(me; v: Integer from Standard)
is static;
fields
t1,t2,ia : Integer from Standard;
angle : Real from Standard;
end Couple from IntPolyh;

View File

@@ -0,0 +1,30 @@
// File: IntPolyh_Couple.cxx
// Created: Thu Apr 8 10:34:41 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_Couple.ixx>
#include <stdio.h>
IntPolyh_Couple::IntPolyh_Couple() : t1(-1),t2(-1),ia(0),angle(-2.0) { }
IntPolyh_Couple::IntPolyh_Couple(const Standard_Integer a,const Standard_Integer b) : t1(a),t2(b),ia(0),angle(-2.0) { }
Standard_Integer IntPolyh_Couple::FirstValue() const{ return(t1);}
Standard_Integer IntPolyh_Couple::SecondValue() const{ return(t2);}
Standard_Integer IntPolyh_Couple::AnalyseFlagValue() const{ return(ia);}
Standard_Real IntPolyh_Couple::AngleValue() const{ return(angle);}
void IntPolyh_Couple::SetCoupleValue(const Standard_Integer a,const Standard_Integer b)
{ t1=a; t2=b; }
void IntPolyh_Couple::SetAnalyseFlag(const Standard_Integer iiaa) { ia=iiaa; }
void IntPolyh_Couple::SetAngleValue(const Standard_Real ang) { angle=ang; }
void IntPolyh_Couple::Dump(const Standard_Integer i) const{
printf("\nCouple(%3d) : %5d %5d %3d %5f\n",i,t1,t2,ia,angle);
}

73
src/IntPolyh/IntPolyh_Edge.cdl Executable file
View File

@@ -0,0 +1,73 @@
-- File: IntPolyh_Edge.cdl
-- Created: Fri Mar 5 18:12:33 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
--Copyright: Matra Datavision 1999
class Edge from IntPolyh
uses
Pnt from gp
is
Create;
Create(i1,i2,i3,i4: Integer from Standard) ;
FirstPoint(me)
returns Integer from Standard
is static;
SecondPoint(me)
returns Integer from Standard
is static;
FirstTriangle(me)
returns Integer from Standard
is static;
SecondTriangle(me)
returns Integer from Standard
is static;
AnalysisFlag(me)
returns Integer from Standard
is static;
-- GetTriangles(me; T1,T2: Integer from Standard)
-- is static;
SetFirstPoint(me: in out; v: Integer from Standard)
is static;
SetSecondPoint(me: in out; v: Integer from Standard)
is static;
SetFirstTriangle(me: in out; v: Integer from Standard)
is static;
SetSecondTriangle(me: in out; v: Integer from Standard)
is static;
SetAnalysisFlag(me: in out; v: Integer from Standard)
is static;
-- SetTriangles(me: in out; T1,T2: in out Integer from Standard)
-- is static;
Dump(me; v: Integer from Standard)
is static;
fields
p1,p2 : Integer from Standard;
t1,t2 : Integer from Standard;
ia : Integer from Standard;
end Edge from IntPolyh;

33
src/IntPolyh/IntPolyh_Edge.cxx Executable file
View File

@@ -0,0 +1,33 @@
// File: IntPolyh_Edge.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_Edge.ixx>
#include <stdio.h>
IntPolyh_Edge::IntPolyh_Edge() : p1(-1),p2(-1),t1(-1),t2(-1),ia(-1) { }
IntPolyh_Edge::IntPolyh_Edge(const Standard_Integer a, const Standard_Integer b,
const Standard_Integer c, const Standard_Integer d) : p1(a),p2(b),t1(c),t2(d),ia(-1) {
}
Standard_Integer IntPolyh_Edge::FirstPoint() const{ return(p1);}
Standard_Integer IntPolyh_Edge::SecondPoint() const{ return(p2);}
Standard_Integer IntPolyh_Edge::FirstTriangle() const{ return(t1);}
Standard_Integer IntPolyh_Edge::SecondTriangle() const{ return(t2);}
Standard_Integer IntPolyh_Edge::AnalysisFlag() const{ return(ia);}
void IntPolyh_Edge::SetFirstPoint(const Standard_Integer a) { p1=a; }
void IntPolyh_Edge::SetSecondPoint(const Standard_Integer b) { p2=b; }
void IntPolyh_Edge::SetFirstTriangle(const Standard_Integer c) { t1=c; }
void IntPolyh_Edge::SetSecondTriangle(const Standard_Integer d) { t2=d; }
void IntPolyh_Edge::SetAnalysisFlag(const Standard_Integer e) { ia=e; }
void IntPolyh_Edge::Dump(const Standard_Integer i) const{
printf("\nEdge(%3d) : P1:%5d P2:%5d T1:%5d T2:%5d AnalysisFlag:%5d\n",i,p1,p2,t1,t2,ia);
}

View File

@@ -0,0 +1,216 @@
-- File: IntPolyh_Intersection.cdl
-- Created: Wed Mar 3 11:23:52 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
-- Modified by skv - Thu Sep 25 17:57:09 2003 OCC567
-- Add two private methods: PerformMaillage(..) and MergeCouples(..) and several
-- private fields. Removed field MaillageS.
-- The method MergeCouples(..) is used
-- to remove same couples of interferable triangles from different
-- MaillageAffinage's in order to avoid taking them into section lines several
-- times.
class Intersection from IntPolyh
uses
Pnt from gp,
HSurface from Adaptor3d,
Array1OfReal from TColStd,
Point from IntPolyh,
Edge from IntPolyh,
Triangle from IntPolyh,
ArrayOfPoints from IntPolyh,
ArrayOfEdges from IntPolyh,
ArrayOfTriangles from IntPolyh,
PMaillageAffinage from IntPolyh,
SectionLine from IntPolyh,
ArrayOfSectionLines from IntPolyh,
--TangentZones from IntPolyh, On utilise la classe StartPoint
ArrayOfTangentZones from IntPolyh,
ArrayOfCouples from IntPolyh
is
Create(S1,S2 : HSurface from Adaptor3d);
---Purpose: Constructor
--
--
Create(S1 : HSurface from Adaptor3d;
NbSU1,NbSV1 : Integer from Standard;
S2 : HSurface from Adaptor3d;
NbSU2,NbSV2 : Integer from Standard);
---Purpose: NbSU1 ... NbSV2 are used to compute the initial
-- samples of the iso parametric meshes on the
-- surfaces.
Create(S1 : HSurface from Adaptor3d;
anUpars1, aVpars1 : Array1OfReal from TColStd;
S2 : HSurface from Adaptor3d;
anUpars2, aVpars2 : Array1OfReal from TColStd);
---Purpose: D1, D2 are used to compute the initial
-- samples of the iso parametric meshes on the
-- surfaces.
Perform(me: in out)
---Purpose: Compute the intersection.
is static;
Perform(me: in out;
Upars1, Vpars1, Upars2, Vpars2 : Array1OfReal from TColStd)
---Purpose: Compute the intersection.
is static;
IsDone(me)
returns Boolean from Standard
is static;
---------------------------------------------------------------
NbSectionLines(me)
returns Integer from Standard
is static;
NbPointsInLine(me; IndexLine: Integer from Standard)
returns Integer from Standard
is static;
GetLinePoint(me; IndexLine,IndexPoint: Integer from Standard;
x,y,z,u1,v1,u2,v2,incidence : out Real from Standard)
is static;
---------------------------------------------------------------
NbTangentZones(me)
returns Integer from Standard
is static;
NbPointsInTangentZone(me; IndexLine: Integer from Standard)
returns Integer from Standard
is static;
GetTangentZonePoint(me; IndexLine,IndexPoint: Integer from Standard;
x,y,z,u1,v1,u2,v2 : out Real from Standard)
is static;
-- Modified by skv - Thu Sep 25 17:57:09 2003 OCC567 Begin
PerformMaillage(me: in out;
isFirstFwd : Boolean from Standard;
isSecondFwd : Boolean from Standard;
MaillageS : in out PMaillageAffinage from IntPolyh)
---Purpose: Computes MaillageAffinage
returns Boolean from Standard
is static private;
PerformMaillage(me: in out; MaillageS: in out PMaillageAffinage from IntPolyh)
---Purpose: The method PerformMaillage(..) is used to compute MaillageAffinage. It is
-- called four times (two times for each surface) for creation of inscribed
-- and circumscribed mesh for each surface.
returns Boolean from Standard
is static private;
-- Modified by skv - Thu Sep 25 17:57:09 2003 OCC567 Begin
PerformMaillage(me: in out;
isFirstFwd : Boolean from Standard;
isSecondFwd : Boolean from Standard;
Upars1, Vpars1, Upars2, Vpars2 : Array1OfReal from TColStd;
MaillageS : in out PMaillageAffinage from IntPolyh)
---Purpose: Computes MaillageAffinage
returns Boolean from Standard
is static private;
PerformMaillage(me: in out; Upars1, Vpars1, Upars2, Vpars2 : Array1OfReal from TColStd;
MaillageS: in out PMaillageAffinage from IntPolyh)
---Purpose: The method PerformMaillage(..) is used to compute MaillageAffinage. It is
-- called four times (two times for each surface) for creation of inscribed
-- and circumscribed mesh for each surface.
returns Boolean from Standard
is static private;
MergeCouples(me; anArrayFF: in out ArrayOfCouples from IntPolyh;
anArrayFR: in out ArrayOfCouples from IntPolyh;
anArrayRF: in out ArrayOfCouples from IntPolyh;
anArrayRR: in out ArrayOfCouples from IntPolyh)
---Purpose: This method analyzes arrays to find same couples. If some
-- are detected it leaves the couple in only one array
-- deleting from others.
is static private;
-- Modified by skv - Thu Sep 25 17:57:11 2003 OCC567 End
-- ofv from
PerformStd(me: in out;
MaillageS: in out PMaillageAffinage from IntPolyh;
NbCouples: in out Integer from Standard)
---Purpose: Process default interference
returns Boolean from Standard
is static private;
PerformAdv(me: in out;
MaillageFF: in out PMaillageAffinage from IntPolyh;
MaillageFR: in out PMaillageAffinage from IntPolyh;
MaillageRF: in out PMaillageAffinage from IntPolyh;
MaillageRR: in out PMaillageAffinage from IntPolyh;
NbCouples : in out Integer from Standard)
---Purpose: Process advanced interference
returns Boolean from Standard
is static private;
PerformStd(me: in out;
Upars1, Vpars1, Upars2, Vpars2 : Array1OfReal from TColStd;
MaillageS: in out PMaillageAffinage from IntPolyh;
NbCouples: in out Integer from Standard)
---Purpose: Process default interference
returns Boolean from Standard
is static private;
PerformAdv(me: in out;
Upars1, Vpars1, Upars2, Vpars2 : Array1OfReal from TColStd;
MaillageFF: in out PMaillageAffinage from IntPolyh;
MaillageFR: in out PMaillageAffinage from IntPolyh;
MaillageRF: in out PMaillageAffinage from IntPolyh;
MaillageRR: in out PMaillageAffinage from IntPolyh;
NbCouples : in out Integer from Standard)
---Purpose: Process advanced interference
returns Boolean from Standard
is static private;
-- ofv to
fields
done : Boolean from Standard;
nbsectionlines : Integer from Standard;
nbtangentzones : Integer from Standard;
TSectionLines : ArrayOfSectionLines from IntPolyh;
TTangentZones : ArrayOfTangentZones from IntPolyh;
-- Modified by skv - Thu Sep 25 17:38:57 2003 OCC567 Begin
-- MaillageS : MaillageAffinage from IntPolyh;
myNbSU1 : Integer from Standard;
myNbSV1 : Integer from Standard;
myNbSU2 : Integer from Standard;
myNbSV2 : Integer from Standard;
-- Modified by skv - Thu Sep 25 17:38:58 2003 OCC567 End
mySurf1 : HSurface from Adaptor3d;
mySurf2 : HSurface from Adaptor3d;
end Intersection from IntPolyh;

View File

@@ -0,0 +1,459 @@
// File: IntPolyh_Intersection.cxx
// Created: Wed Mar 3 11:33:51 1999
// Author: Fabrice SERVANT
// <fst>
// modified by Edward AGAPOV (eap) Tue Jan 22 12:29:55 2002 (occ53)
// Modified by skv - Thu Sep 25 18:24:29 2003 OCC567
#include <IntPolyh_Intersection.ixx>
#include <IntPolyh_SectionLine.hxx>
#include <IntPolyh_StartPoint.hxx>
#include <IntPolyh_MaillageAffinage.hxx>
#include <IntPolyh_Couple.hxx>
#ifdef DEB
# define MYDEBUG DEB
#else
# define MYDEBUG 0
#endif
Standard_Integer MYDISPLAY = 0;
Standard_Integer MYPRINT = 0;
# if MYDEBUG
// # include "visudebug.hxx"
# endif
IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2)
{
myNbSU1 = -1;
myNbSV1 = -1;
myNbSU2 = -1;
myNbSV2 = -1;
mySurf1 = S1;
mySurf2 = S2;
done = Standard_False;
TSectionLines.Init(1000);
TTangentZones.Init(10000);
Perform();
}
IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_HSurface)& S1,
const Standard_Integer NbSU1,
const Standard_Integer NbSV1,
const Handle(Adaptor3d_HSurface)& S2,
const Standard_Integer NbSU2,
const Standard_Integer NbSV2)
{
myNbSU1 = NbSU1;
myNbSV1 = NbSV1;
myNbSU2 = NbSU2;
myNbSV2 = NbSV2;
mySurf1 = S1;
mySurf2 = S2;
done = Standard_False;
TSectionLines.Init(1000);
TTangentZones.Init(10000);
Perform();
}
void IntPolyh_Intersection::Perform() {
done = Standard_True;
Standard_Boolean startFromAdvanced = Standard_False;
Standard_Boolean isStdDone = Standard_False;
Standard_Boolean isAdvDone = Standard_False;
Standard_Integer nbCouplesStd = 0;
Standard_Integer nbCouplesAdv = 0;
GeomAbs_SurfaceType ST1 = mySurf1->GetType();
GeomAbs_SurfaceType ST2 = mySurf2->GetType();
// if(ST1 == GeomAbs_Torus || ST2 == GeomAbs_Torus)
// startFromAdvanced = Standard_True;
IntPolyh_PMaillageAffinage aPMaillageStd = 0;
IntPolyh_PMaillageAffinage aPMaillageFF = 0;
IntPolyh_PMaillageAffinage aPMaillageFR = 0;
IntPolyh_PMaillageAffinage aPMaillageRF = 0;
IntPolyh_PMaillageAffinage aPMaillageRR = 0;
if(!startFromAdvanced) {
isStdDone = PerformStd(aPMaillageStd,nbCouplesStd);
// default interference done well, use it
if(isStdDone && nbCouplesStd > 10) {
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
// default interference done, but too few interferences foud;
// use advanced interference
else if(isStdDone && nbCouplesStd <= 10) {
isAdvDone = PerformAdv(aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// advanced interference found
if(isAdvDone && nbCouplesAdv > 10) {
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
}
else {
// use result of default
if(nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
}
// default interference faild, use advanced
else {
// isAdvDone = PerformAdv(aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// if(isAdvDone && nbCouplesAdv > 0) {cout << "4adv done, nbc: " << nbCouplesAdv << endl;
// aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
// }
}
}// start from default
else {
isAdvDone = PerformAdv(aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// advanced done, interference found; use it
if(isAdvDone) {
if(nbCouplesAdv > 0) {
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
}
else {
isStdDone = PerformStd(aPMaillageStd,nbCouplesStd);
if(isStdDone && nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
}
else {
isStdDone = PerformStd(aPMaillageStd,nbCouplesStd);
if(isStdDone && nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
} // start from advanced
// accept result
nbsectionlines = TSectionLines.NbSectionLines();
nbtangentzones = TTangentZones.NbTangentZones();
// clean up
if(aPMaillageStd) delete aPMaillageStd;
if(aPMaillageFF) delete aPMaillageFF;
if(aPMaillageFR) delete aPMaillageFR;
if(aPMaillageRF) delete aPMaillageRF;
if(aPMaillageRR) delete aPMaillageRR;
// verify
if(!isStdDone && !isAdvDone)
done = Standard_False;
}
Standard_Boolean IntPolyh_Intersection::IsDone() const {
return(done);
}
Standard_Integer IntPolyh_Intersection::NbSectionLines() const {
return(nbsectionlines);
}
Standard_Integer IntPolyh_Intersection::NbPointsInLine(const Standard_Integer IndexLine) const {
return(TSectionLines[IndexLine-1].NbStartPoints());
}
Standard_Integer IntPolyh_Intersection::NbPointsInTangentZone(const Standard_Integer IndexLine) const {
//-- IndexLine--; (pas implemente) Attention : Tableaux de 0 a n-1
// eap
// return(TTangentZones.NbTangentZones());
return 1;
}
Standard_Integer IntPolyh_Intersection::NbTangentZones() const {
return(nbtangentzones);
}
void IntPolyh_Intersection::GetLinePoint(const Standard_Integer Indexl,
const Standard_Integer Indexp,
Standard_Real &x,
Standard_Real &y,
Standard_Real &z,
Standard_Real &u1,
Standard_Real &v1,
Standard_Real &u2,
Standard_Real &v2,
Standard_Real &incidence) const {
const IntPolyh_SectionLine &msl=TSectionLines[Indexl-1];
const IntPolyh_StartPoint &sp=msl[Indexp-1];
x=sp.X();
y=sp.Y();
z=sp.Z();
u1=sp.U1();
v1=sp.V1();
u2=sp.U2();
v2=sp.V2();
incidence=sp.GetAngle();
}
void IntPolyh_Intersection::GetTangentZonePoint(const Standard_Integer Indexz,
const Standard_Integer Indexp,
Standard_Real &x,
Standard_Real &y,
Standard_Real &z,
Standard_Real &u1,
Standard_Real &v1,
Standard_Real &u2,
Standard_Real &v2) const {
//-- Indexz--; tableaux C
// eap
//const IntPolyh_StartPoint &sp=TTangentZones[Indexp-1];
const IntPolyh_StartPoint &sp=TTangentZones[Indexz-1];
x=sp.X();
y=sp.Y();
z=sp.Y();
u1=sp.U1();
v1=sp.V1();
u2=sp.U2();
v2=sp.V2();
}
// Modified by skv - Thu Sep 25 18:07:41 2003 OCC567 Begin
//=======================================================================
//function : PerformMaillage
//purpose : Computes MaillageAffinage
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformMaillage
(const Standard_Boolean isFirstFwd,
const Standard_Boolean isSecondFwd,
IntPolyh_PMaillageAffinage &theMaillageS)
{
if (myNbSU1 == -1)
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, mySurf2, MYPRINT);
else
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, myNbSU1, myNbSV1,
mySurf2, myNbSU2, myNbSV2,
MYPRINT);
theMaillageS->FillArrayOfPnt(1, isFirstFwd);
theMaillageS->FillArrayOfPnt(2, isSecondFwd);
Standard_Real xx0,yy0,zz0,xx1,yy1,zz1;
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
Standard_Integer FinTTC = theMaillageS->TriangleCompare();
// if too many intersections, consider surfaces parallel (eap)
if(FinTTC > 200 &&
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : PerformMaillage
//purpose : Computes MaillageAffinage
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformMaillage(IntPolyh_PMaillageAffinage &theMaillageS)
{
if (myNbSU1 == -1)
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, mySurf2, MYPRINT);
else
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, myNbSU1, myNbSV1,
mySurf2, myNbSU2, myNbSV2,
MYPRINT);
theMaillageS->FillArrayOfPnt(1);
theMaillageS->FillArrayOfPnt(2);
Standard_Real xx0,yy0,zz0,xx1,yy1,zz1;
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
Standard_Integer FinTTC = theMaillageS->TriangleCompare();
if( FinTTC == 0 ) {
Standard_Boolean myZone = Standard_True;
theMaillageS->SetEnlargeZone( myZone );
theMaillageS->FillArrayOfPnt(1);
theMaillageS->FillArrayOfPnt(2);
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
FinTTC = theMaillageS->TriangleCompare();
myZone = Standard_False;
theMaillageS->SetEnlargeZone( myZone );
}
// if too many intersections, consider surfaces parallel (eap)
if(FinTTC > 200 &&
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : MergeCouples
//purpose : This method analyzes arrays to find same couples. If some
// are detected it leaves the couple in only one array
// deleting from others.
//=======================================================================
void IntPolyh_Intersection::MergeCouples
(IntPolyh_ArrayOfCouples &anArrayFF,
IntPolyh_ArrayOfCouples &anArrayFR,
IntPolyh_ArrayOfCouples &anArrayRF,
IntPolyh_ArrayOfCouples &anArrayRR) const
{
// Step 1: Sorting arrays.
IntPolyh_ArrayOfCouples *anArrays[4];
Standard_Integer aNbCouples[4];
Standard_Integer i;
IntPolyh_ArrayOfCouples *aTmpPtr;
Standard_Integer aTmpNbr;
anArrays[0] = &anArrayFF;
anArrays[1] = &anArrayFR;
anArrays[2] = &anArrayRF;
anArrays[3] = &anArrayRR;
for (i = 0; i < 4; i++)
aNbCouples[i] = anArrays[i]->NbCouples();
Standard_Boolean isChanged = Standard_True;
while (isChanged) {
isChanged = Standard_False;
for (i = 0; i < 3; i++) {
if (aNbCouples[i] < aNbCouples[i + 1]) {
aTmpPtr = anArrays[i];
anArrays[i] = anArrays[i + 1];
anArrays[i + 1] = aTmpPtr;
aTmpNbr = aNbCouples[i];
aNbCouples[i] = aNbCouples[i + 1];
aNbCouples[i + 1] = aTmpNbr;
isChanged = Standard_True;
}
}
}
// Step 2: Searching for same couples.
Standard_Integer j;
Standard_Integer indC1;
Standard_Integer indC2;
for (i = 0; i < 3; i++) {
for (j = i + 1; j < 4; j++) {
for (indC1 = 1; indC1 <= aNbCouples[i]; indC1++) {
IntPolyh_Couple &aCouple1 = anArrays[i]->ChangeValue(indC1);
if (aCouple1.AnalyseFlagValue() == 1)
continue;
for (indC2 = 1; indC2 <= aNbCouples[j]; indC2++) {
IntPolyh_Couple &aCouple2 = anArrays[j]->ChangeValue(indC2);
if (aCouple2.AnalyseFlagValue() == 1)
continue;
if (aCouple1.FirstValue() == aCouple2.FirstValue() &&
aCouple1.SecondValue() == aCouple2.SecondValue()) {
aCouple2.SetAnalyseFlag(1);
}
}
}
}
}
}
// Modified by skv - Thu Sep 25 18:07:42 2003 OCC567 End
Standard_Boolean IntPolyh_Intersection::PerformStd(IntPolyh_PMaillageAffinage& MaillageS,
Standard_Integer& NbCouples)
{
Standard_Boolean isdone = PerformMaillage(MaillageS);
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbCouples()) : 0;
return isdone;
}
Standard_Boolean IntPolyh_Intersection::PerformAdv(IntPolyh_PMaillageAffinage& MaillageFF,
IntPolyh_PMaillageAffinage& MaillageFR,
IntPolyh_PMaillageAffinage& MaillageRF,
IntPolyh_PMaillageAffinage& MaillageRR,
Standard_Integer& NbCouples)
{
Standard_Boolean isdone = Standard_True;
NbCouples = 0;
if(!PerformMaillage(Standard_True,Standard_False,MaillageFR) ||
!PerformMaillage(Standard_False,Standard_True,MaillageRF) ||
!PerformMaillage(Standard_True,Standard_True,MaillageFF) ||
!PerformMaillage(Standard_False,Standard_False,MaillageRR) )
isdone = Standard_False;
if(isdone) {
NbCouples = MaillageFF->GetArrayOfCouples().NbCouples() +
MaillageFR->GetArrayOfCouples().NbCouples() +
MaillageRF->GetArrayOfCouples().NbCouples() +
MaillageRR->GetArrayOfCouples().NbCouples();
if(NbCouples > 0)
MergeCouples(MaillageFF->GetArrayOfCouples(),MaillageFR->GetArrayOfCouples(),
MaillageRF->GetArrayOfCouples(),MaillageRR->GetArrayOfCouples());
}
return isdone;
}

View File

@@ -0,0 +1,354 @@
// File: IntPolyh_Intersection_1.cxx
// Created: Mon Sep 26 15:40:16 2005
// Author: Igor FEOKTISTOV
// <ifv@ygrex.nnov.opencascade.com>
#include <IntPolyh_Intersection.ixx>
#include <IntPolyh_PMaillageAffinage.hxx>
#include <IntPolyh_MaillageAffinage.hxx>
#include <IntPolyh_ArrayOfCouples.hxx>
#include <IntPolyh_Couple.hxx>
Standard_Integer MYPRINT1 = 0;
//=======================================================================
//function : IntPolyh_Intersection
//purpose :
//=======================================================================
IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_HSurface)& S1,
const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const Handle(Adaptor3d_HSurface)& S2,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2)
{
myNbSU1 = Upars1.Length();
myNbSV1 = Vpars1.Length();
myNbSU2 = Upars2.Length();
myNbSV2 = Vpars2.Length();
mySurf1 = S1;
mySurf2 = S2;
done = Standard_False;
TSectionLines.Init(1000);
TTangentZones.Init(10000);
Perform(Upars1, Vpars1, Upars2, Vpars2);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void IntPolyh_Intersection::Perform(const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2) {
done = Standard_True;
Standard_Boolean startFromAdvanced = Standard_False;
Standard_Boolean isStdDone = Standard_False;
Standard_Boolean isAdvDone = Standard_False;
Standard_Integer nbCouplesStd = 0;
Standard_Integer nbCouplesAdv = 0;
IntPolyh_PMaillageAffinage aPMaillageStd = 0;
IntPolyh_PMaillageAffinage aPMaillageFF = 0;
IntPolyh_PMaillageAffinage aPMaillageFR = 0;
IntPolyh_PMaillageAffinage aPMaillageRF = 0;
IntPolyh_PMaillageAffinage aPMaillageRR = 0;
if(!startFromAdvanced) {
isStdDone = PerformStd(Upars1, Vpars1, Upars2, Vpars2,
aPMaillageStd,nbCouplesStd);
// default interference done well, use it
if(isStdDone && nbCouplesStd > 10) {
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
// default interference done, but too few interferences foud;
// use advanced interference
else if(isStdDone && nbCouplesStd <= 10) {
isAdvDone = PerformAdv(Upars1, Vpars1, Upars2, Vpars2,
aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// advanced interference found
if(isAdvDone && nbCouplesAdv > 10) {
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
}
else {
// use result of default
if(nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
}
// default interference faild, use advanced
else {
// isAdvDone = PerformAdv(aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// if(isAdvDone && nbCouplesAdv > 0) {cout << "4adv done, nbc: " << nbCouplesAdv << endl;
// aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
// aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
// }
}
}// start from default
else {
isAdvDone = PerformAdv(Upars1, Vpars1, Upars2, Vpars2,
aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
// advanced done, interference found; use it
if(isAdvDone) {
if(nbCouplesAdv > 0) {
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
aPMaillageRR->StartPointsChain(TSectionLines,TTangentZones);
}
else {
isStdDone = PerformStd(aPMaillageStd,nbCouplesStd);
if(isStdDone && nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
}
else {
isStdDone = PerformStd(Upars1, Vpars1, Upars2, Vpars2,
aPMaillageStd,nbCouplesStd);
if(isStdDone && nbCouplesStd > 0)
aPMaillageStd->StartPointsChain(TSectionLines, TTangentZones);
}
} // start from advanced
// accept result
nbsectionlines = TSectionLines.NbSectionLines();
nbtangentzones = TTangentZones.NbTangentZones();
// clean up
if(aPMaillageStd) delete aPMaillageStd;
if(aPMaillageFF) delete aPMaillageFF;
if(aPMaillageFR) delete aPMaillageFR;
if(aPMaillageRF) delete aPMaillageRF;
if(aPMaillageRR) delete aPMaillageRR;
// verify
if(!isStdDone && !isAdvDone)
done = Standard_False;
}
//=======================================================================
//function : PerformMaillage
//purpose : Computes MaillageAffinage
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformMaillage(const Standard_Boolean isFirstFwd,
const Standard_Boolean isSecondFwd,
const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2,
IntPolyh_PMaillageAffinage &theMaillageS)
{
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, Upars1.Length(), Vpars1.Length(),
mySurf2, Upars2.Length(), Vpars2.Length(),
MYPRINT1);
theMaillageS->FillArrayOfPnt(1, isFirstFwd, Upars1, Vpars1);
theMaillageS->FillArrayOfPnt(2, isSecondFwd, Upars2, Vpars2);
Standard_Real xx0,yy0,zz0,xx1,yy1,zz1;
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
Standard_Integer FinTTC = theMaillageS->TriangleCompare();
// if too many intersections, consider surfaces parallel (eap)
/*
if(FinTTC > 200 &&
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
return Standard_False;
}
*/
//IFV test for parallel surf
if(FinTTC > 200) {
const Standard_Real eps = .996; //~ cos of 5deg.
IntPolyh_ArrayOfCouples& Couples = theMaillageS->GetArrayOfCouples();
Standard_Integer i, npara = 0;
for(i = 0; i < FinTTC; ++i) {
Standard_Real cosa = Abs(Couples[i].AngleValue());
if(cosa > eps) ++npara;
}
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbTriangles() ) {
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : PerformMaillage
//purpose : Computes MaillageAffinage
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformMaillage(const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2,
IntPolyh_PMaillageAffinage &theMaillageS)
{
theMaillageS = new IntPolyh_MaillageAffinage(mySurf1, Upars1.Length(), Vpars1.Length(),
mySurf2, Upars2.Length(), Vpars2.Length(),
MYPRINT1);
theMaillageS->FillArrayOfPnt(1, Upars1, Vpars1);
theMaillageS->FillArrayOfPnt(2, Upars2, Vpars2);
Standard_Real xx0,yy0,zz0,xx1,yy1,zz1;
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
Standard_Integer FinTTC = theMaillageS->TriangleCompare();
if( FinTTC == 0 ) {
Standard_Boolean myZone = Standard_True;
theMaillageS->SetEnlargeZone( myZone );
theMaillageS->FillArrayOfPnt(1);
theMaillageS->FillArrayOfPnt(2);
theMaillageS->CommonBox(theMaillageS->GetBox(1), theMaillageS->GetBox(2),
xx0, yy0, zz0, xx1, yy1, zz1);
theMaillageS->FillArrayOfEdges(1);
theMaillageS->FillArrayOfEdges(2);
theMaillageS->FillArrayOfTriangles(1);
theMaillageS->FillArrayOfTriangles(2);
theMaillageS->LinkEdges2Triangles();
theMaillageS->TrianglesDeflectionsRefinementBSB();
FinTTC = theMaillageS->TriangleCompare();
myZone = Standard_False;
theMaillageS->SetEnlargeZone( myZone );
}
// if too many intersections, consider surfaces parallel (eap)
/*
if(FinTTC > 200 &&
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
return Standard_False;
}
*/
//IFV test for parallel surf
if(FinTTC > 200) {
const Standard_Real eps = .996; //~ cos of 5deg.
IntPolyh_ArrayOfCouples& Couples = theMaillageS->GetArrayOfCouples();
Standard_Integer i, npara = 0;
for(i = 0; i < FinTTC; ++i) {
Standard_Real cosa = Abs(Couples[i].AngleValue());
if(cosa > eps) ++npara;
}
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbTriangles() ) {
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : PerformAdv
//purpose :
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformAdv(const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2,
IntPolyh_PMaillageAffinage& MaillageFF,
IntPolyh_PMaillageAffinage& MaillageFR,
IntPolyh_PMaillageAffinage& MaillageRF,
IntPolyh_PMaillageAffinage& MaillageRR,
Standard_Integer& NbCouples)
{
Standard_Boolean isdone = Standard_True;
NbCouples = 0;
if(!PerformMaillage(Standard_True,Standard_False,
Upars1, Vpars1, Upars2, Vpars2,
MaillageFR) ||
!PerformMaillage(Standard_False,Standard_True,
Upars1, Vpars1, Upars2, Vpars2,
MaillageRF) ||
!PerformMaillage(Standard_True,Standard_True,
Upars1, Vpars1, Upars2, Vpars2,
MaillageFF) ||
!PerformMaillage(Standard_False,Standard_False,
Upars1, Vpars1, Upars2, Vpars2,
MaillageRR) )
isdone = Standard_False;
if(isdone) {
NbCouples = MaillageFF->GetArrayOfCouples().NbCouples() +
MaillageFR->GetArrayOfCouples().NbCouples() +
MaillageRF->GetArrayOfCouples().NbCouples() +
MaillageRR->GetArrayOfCouples().NbCouples();
if(NbCouples > 0)
MergeCouples(MaillageFF->GetArrayOfCouples(),MaillageFR->GetArrayOfCouples(),
MaillageRF->GetArrayOfCouples(),MaillageRR->GetArrayOfCouples());
}
return isdone;
}
//=======================================================================
//function : PerformStd
//purpose :
//=======================================================================
Standard_Boolean IntPolyh_Intersection::PerformStd(const TColStd_Array1OfReal& Upars1,
const TColStd_Array1OfReal& Vpars1,
const TColStd_Array1OfReal& Upars2,
const TColStd_Array1OfReal& Vpars2,
IntPolyh_PMaillageAffinage& MaillageS,
Standard_Integer& NbCouples)
{
Standard_Boolean isdone = PerformMaillage(Upars1, Vpars1, Upars2, Vpars2,
MaillageS);
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbCouples()) : 0;
return isdone;
}

View File

@@ -0,0 +1,295 @@
-- File: IntPolyh_MaillageAffinage.cdl
-- Created: Wed Mar 3 11:23:52 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
--Copyright: Matra Datavision 1999
-- Modified by skv - Thu Sep 25 16:51:09 2003 OCC567
-- The method GetArrayOfCouples() is added. The Boolean flag isShiftFwd is
-- added to the method FillArrayOfPnt(..).
-- The method GetArrayOfCouples() returns array of couples of contact triangles.
-- The flag isShiftFwd shows whether circumscribed (Standard_True) or inscribed
-- (Standard_False) mesh should be constructed.
-- modified by ofv Thu Apr 8 14:45:35 2004 fip
class MaillageAffinage from IntPolyh
uses
Box from Bnd,
Pnt from gp,
HSurface from Adaptor3d,
TopolTool from Adaptor3d,
Point from IntPolyh,
StartPoint from IntPolyh,
Edge from IntPolyh,
Triangle from IntPolyh,
ArrayOfCouples from IntPolyh,
ArrayOfPoints from IntPolyh,
ArrayOfStartPoints from IntPolyh,
ArrayOfEdges from IntPolyh,
ArrayOfTriangles from IntPolyh,
SectionLine from IntPolyh,
ArrayOfSectionLines from IntPolyh,
ArrayOfTangentZones from IntPolyh,
Array1OfReal from TColStd
is
Create(S1 : HSurface from Adaptor3d;
NbSU1,NbSV1 : Integer from Standard;
S2 : HSurface from Adaptor3d;
NbSU2,NbSV2 : Integer from Standard;
PRINT : Integer from Standard);
Create(S1,S2: HSurface from Adaptor3d;
PRINT : Integer from Standard);
FillArrayOfPnt(me: in out; SurfID: Integer from Standard)
is static;
---Purpose: Compute points on one surface and fill an array of points;
--- standard (default) method
FillArrayOfPnt(me: in out; SurfID : Integer from Standard;
isShiftFwd: Boolean from Standard)
---Purpose: isShiftFwd flag is added. The purpose is to define shift
-- of points along normal to the surface in this point. The
-- shift length represents maximal deflection of triangulation.
-- The direction (forward or reversed regarding to normal
-- direction) is defined by isShiftFwd flag.
is static;
---Purpose: Compute points on one surface and fill an array of points;
--- advanced method
-- IFV start
FillArrayOfPnt(me: in out; SurfID: Integer from Standard;
Upars, Vpars : Array1OfReal from TColStd)
is static;
---Purpose: Compute points on one surface and fill an array of points;
--- standard (default) method
FillArrayOfPnt(me: in out; SurfID : Integer from Standard;
isShiftFwd: Boolean from Standard;
Upars, Vpars : Array1OfReal from TColStd)
---Purpose: isShiftFwd flag is added. The purpose is to define shift
-- of points along normal to the surface in this point. The
-- shift length represents maximal deflection of triangulation.
-- The direction (forward or reversed regarding to normal
-- direction) is defined by isShiftFwd flag.
is static;
---Purpose: Compute points on one surface and fill an array of points;
--- advanced method
-- IFV end
CommonBox(me:in out; B1,B2: Box from Bnd; xMin,yMin,zMin,xMax,yMax,zMax: in out Real from Standard)
is static;
---Purpose: Compute the common box witch is the intersection
-- of the two bounding boxes, and mark the points of
-- the two surfaces that are inside.
FillArrayOfEdges(me: in out; SurfID: Integer from Standard)
is static;
---Purpose: Compute edges from the array of points
FillArrayOfTriangles(me: in out; SurfID: Integer from Standard)
is static;
---Purpose: Compute triangles from the array of points, and --
-- mark the triangles that use marked points by the
-- CommonBox function.
LinkEdges2Triangles(me:in out)
is static;
---Purpose: fill the edge fields in Triangle object for the
-- two array of triangles.
CommonPartRefinement(me: in out)
is static;
---Purpose: Refine systematicaly all marked triangles of both surfaces
LocalSurfaceRefinement(me: in out; SurfId: Integer from Standard)
is static;
---Purpose: Refine systematicaly all marked triangles of ONE surface
ComputeDeflections(me: in out; SurfID: Integer from Standard)
is static;
---Purpose: Compute deflection for all triangles of one
-- surface,and sort min and max of deflections
TrianglesDeflectionsRefinementBSB(me:in out)
is static;
---Purpose: Refine both surfaces using BoundSortBox as --
-- rejection. The criterions used to refine a --
-- triangle are: The deflection The size of the --
-- bounding boxes (one surface may be very small
-- compared to the other)
TriContact(me; P1,P2,P3,Q1,Q2,Q3: Point from IntPolyh;
Angle:in out Real from Standard)
returns Integer from Standard
is static;
---Purpose: This fonction Check if two triangles are in
-- contact or no, return 1 if yes, return 0
-- if no.
TriangleEdgeContact(me; TriSurfID, EdgeIndice: Integer from Standard;
P1,P2,P3,C1,C2,C3,Pe1,Pe2,E,N: Point from IntPolyh;
SP1,SP2: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
TriangleEdgeContact2(me; TriSurfID, EdgeIndice: Integer from Standard;
Tri1, Tri2: Triangle from IntPolyh;
P1,P2,P3,C1,C2,C3,Pe1,Pe2,E,N: Point from IntPolyh;
SP1,SP2: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
StartingPointsResearch(me; T1,T2: Integer from Standard;
SP1,SP2: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
StartingPointsResearch2(me; T1,T2: Integer from Standard;
SP1,SP2: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
---Purpose: From two triangles compute intersection points.
-- If I found more than two intersection points
-- that's mean that those triangle are coplanar
NextStartingPointsResearch(me; T1,T2: Integer from Standard;
SPInit: StartPoint from IntPolyh;
SPNext: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
NextStartingPointsResearch2(me; T1,T2: Integer from Standard;
SPInit: StartPoint from IntPolyh;
SPNext: in out StartPoint from IntPolyh)
returns Integer from Standard
is static;
---Purpose: from two triangles and an intersection point I
-- seach the other point (if it exist).
-- This function is used by StartPointChain
TriangleCompare(me :in out)
returns Integer from Standard
is static;
---Purpose: Analyse each couple of triangles from the two --
-- array of triangles, to see if they are in
-- contact, and compute the incidence. Then put
-- couples in contact in the array of couples
TriangleComparePSP(me :in out)
returns Integer from Standard
is static;
---Purpose: The same as TriangleCompare, plus compute the
-- StartPoints without chaining them.
StartPointsCalcul(me)
is static;
---Purpose: From the array of couples compute all the start
-- points and display them on the screen
StartPointsChain(me: in out;
TSectionLines: in out ArrayOfSectionLines from IntPolyh;
TTangentZones: in out ArrayOfTangentZones from IntPolyh)
returns Integer from Standard
is static;
---Purpose: Loop on the array of couples. Compute StartPoints.
-- Try to chain the StartPoints into SectionLines or
-- put the point in the ArrayOfTangentZones if
-- chaining it, is not possible.
GetNextChainStartPoint(me: in out;
SPInit: StartPoint from IntPolyh;
SPNext: in out StartPoint from IntPolyh;
MySectionLine: in out SectionLine from IntPolyh;
TTangentZones: in out ArrayOfTangentZones from IntPolyh;
Prepend : Boolean from Standard = Standard_False)
returns Integer from Standard
is static;
---Purpose: Mainly used by StartPointsChain(), this function
-- try to compute the next StartPoint.
GetArrayOfPoints(me; SurfID: Integer from Standard)
---C++: return const &
returns ArrayOfPoints from IntPolyh
is static;
GetArrayOfEdges(me; SurfID: Integer from Standard)
---C++: return const &
returns ArrayOfEdges from IntPolyh
is static;
GetArrayOfTriangles(me; SurfID: Integer from Standard)
---C++: return const &
returns ArrayOfTriangles from IntPolyh
is static;
GetFinTE(me; SurfID: Integer from Standard)
returns Integer from Standard
is static;
GetFinTT(me; SurfID: Integer from Standard)
returns Integer from Standard
is static;
GetBox(me; SurfID: Integer from Standard)
returns Box from Bnd
is static;
GetBoxDraw(me; SurfID: Integer from Standard)
is static;
GetArrayOfSP(me)
---C++: return const &
returns ArrayOfStartPoints from IntPolyh
is static;
GetArrayOfCouples(me: in out)
---Purpose: This method returns array of couples of contact triangles.
---C++: return &
returns ArrayOfCouples from IntPolyh
is static;
SetEnlargeZone(me: in out; EnlargeZone: in out Boolean from Standard);
GetEnlargeZone(me) returns Boolean from Standard;
fields
MaSurface1 : HSurface from Adaptor3d;
MaSurface2 : HSurface from Adaptor3d;
MyBox1 : Box from Bnd;
MyBox2 : Box from Bnd;
NbSamplesU1 : Integer from Standard;
NbSamplesU2 : Integer from Standard;
NbSamplesV1 : Integer from Standard;
NbSamplesV2 : Integer from Standard;
FlecheMax1 : Real from Standard;
FlecheMax2 : Real from Standard;
FlecheMin1 : Real from Standard;
FlecheMin2 : Real from Standard;
FlecheMoy1 : Real from Standard;
FlecheMoy2 : Real from Standard;
TPoints1 : ArrayOfPoints from IntPolyh;
TPoints2 : ArrayOfPoints from IntPolyh;
TEdges1 : ArrayOfEdges from IntPolyh;
TEdges2 : ArrayOfEdges from IntPolyh;
TTriangles1 : ArrayOfTriangles from IntPolyh;
TTriangles2 : ArrayOfTriangles from IntPolyh;
TTrianglesContacts : ArrayOfCouples from IntPolyh;
TStartPoints : ArrayOfStartPoints from IntPolyh;
myEnlargeZone : Boolean from Standard;
end Test from IntPolyh;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
// File: IntPolyh_MaillageAffinage.cxx
// Created: Fri Mar 5 01:52:52 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
// modified by Edward AGAPOV (eap) Tue Jan 22 2002 (bug occ53)
// - improve SectionLine table management (avoid memory reallocation)
// - some protection against arrays overflow
// modified by Edward AGAPOV (eap) Thu Feb 14 2002 (occ139)
// - make Section Line parts rightly connected (prepend 2nd part to the 1st)
// - TriangleShape() for debugging purpose
// Modified by skv - Thu Sep 25 17:42:42 2003 OCC567
// modified by ofv Thu Apr 8 14:58:13 2004 fip
//#ifndef _maillIso_HeaderFile
//#define _maillIso_HeaderFile
//#endif
#include <Standard_Stream.hxx>
#include <stdio.h>
#include <Precision.hxx>
#include <IntPolyh_MaillageAffinage.ixx>
#include <IntPolyh_Edge.hxx>
#include <IntPolyh_Couple.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <gp_Pnt.hxx>
#include <gp.hxx>
#include <IntCurveSurface_ThePolyhedronOfHInter.hxx>
#include <IntPolyh_ArrayOfCouples.hxx>
# ifdef DEB
#include <TopoDS_Shape.hxx>
#include <Poly_Triangulation.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <BRep_TFace.hxx>
#include <TopoDS_Face.hxx>
#ifdef DRAW
#include <DBRep.hxx>
#endif
# endif
# ifdef DEB
# define MYDEBUG DEB
Standard_Integer MYDRAW1 = 0;
# else
# define MYDEBUG 0
# endif
Standard_Integer MYPRINTma1 = 0;
#define MyTolerance 10.0e-7
#define MyConfusionPrecision 10.0e-12
#define SquareMyConfusionPrecision 10.0e-24
//=======================================================================
//function : FillArrayOfPnt
//purpose : Compute points on one surface and fill an array of points
//=======================================================================
void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID,
const TColStd_Array1OfReal& Upars,
const TColStd_Array1OfReal& Vpars)
{
Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2);
Standard_Integer CpteurTabPnt=0;
Standard_Real Tol;
//cout << "Nb : " << NbSamplesU << " " << NbSamplesV << endl;
Standard_Real u0 = Upars(1);
Standard_Real v0 = Vpars(1);
Standard_Real u1 = Upars(NbSamplesU);
Standard_Real v1 = Vpars(NbSamplesV);
IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, Upars, Vpars);
Tol=polyhedron.DeflectionOverEstimation();
for(Standard_Integer BoucleU=1; BoucleU<=NbSamplesU; BoucleU++){
Standard_Real U = Upars(BoucleU);
for(Standard_Integer BoucleV=1; BoucleV<=NbSamplesV; BoucleV++){
Standard_Real V = Vpars(BoucleV);
gp_Pnt PtXYZ = (MaSurface)->Value(U,V);
(TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V);
CpteurTabPnt++;
PtrBox->Add(PtXYZ);
}
}
TPoints.SetNbPoints(CpteurTabPnt);
Tol*=1.2;
Standard_Real a1,a2,a3,b1,b2,b3;
PtrBox->Get(a1,a2,a3,b1,b2,b3);
PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol);
PtrBox->Enlarge(MyTolerance);
//cout << "End Fill Array 1" << endl;
}
//=======================================================================
//function : FillArrayOfPnt
//purpose : Compute points on one surface and fill an array of points
// REMPLISSAGE DU TABLEAU DE POINTS
//=======================================================================
void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID,
const Standard_Boolean isShiftFwd,
const TColStd_Array1OfReal& Upars,
const TColStd_Array1OfReal& Vpars)
{
Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2);
Standard_Integer CpteurTabPnt=0;
Standard_Real Tol;
//cout << "FillArrayOfPnt 2" << endl;
//cout << "??????????????" << endl;
Standard_Real resol = gp::Resolution();
Standard_Real u0 = Upars(1);
Standard_Real v0 = Vpars(1);
Standard_Real u1 = Upars(NbSamplesU);
Standard_Real v1 = Vpars(NbSamplesV);
IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, Upars, Vpars);
Tol=polyhedron.DeflectionOverEstimation();
for(Standard_Integer BoucleU=1; BoucleU<=NbSamplesU; BoucleU++){
Standard_Real U = Upars(BoucleU);
for(Standard_Integer BoucleV=1; BoucleV<=NbSamplesV; BoucleV++){
Standard_Real V = Vpars(BoucleV);
gp_Pnt PtXYZ;
gp_Vec aDU;
gp_Vec aDV;
gp_Vec aNorm;
MaSurface->D1(U, V, PtXYZ, aDU, aDV);
aNorm = aDU.Crossed(aDV);
Standard_Real aMag = aNorm.Magnitude();
if (aMag > resol) {
aNorm /= aMag;
aNorm.Multiply(Tol*1.5);
if (isShiftFwd)
PtXYZ.Translate(aNorm);
else
PtXYZ.Translate(aNorm.Reversed());
}
(TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V);
CpteurTabPnt++;
PtrBox->Add(PtXYZ);
}
}
TPoints.SetNbPoints(CpteurTabPnt);
Tol*=1.2;
Standard_Real a1,a2,a3,b1,b2,b3;
PtrBox->Get(a1,a2,a3,b1,b2,b3);
PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol);
PtrBox->Enlarge(MyTolerance);
}//fin FillArrayOfPnt

124
src/IntPolyh/IntPolyh_Point.cdl Executable file
View File

@@ -0,0 +1,124 @@
-- File: IntPolyh_Point.cdl
-- Created: Fri Mar 5 18:12:33 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class Point from IntPolyh
uses
Pnt from gp,
HSurface from Adaptor3d
is
Create;
Create(xx,yy,zz,uu,vv : Real from Standard);
X(me)
returns Real from Standard
is static;
Y(me)
returns Real from Standard
is static;
Z(me)
returns Real from Standard
is static;
U(me)
returns Real from Standard
is static;
V(me)
returns Real from Standard
is static;
PartOfCommon(me)
returns Integer from Standard
is static;
Equal(me: in out; Pt: Point from IntPolyh)
---C++: alias operator =
is static;
Set(me: in out; v1,v2,v3,v4,v5: Real from Standard; II: Integer from Standard = 1)
is static;
SetX(me: in out; v: Real from Standard)
is static;
SetY(me: in out; v: Real from Standard)
is static;
SetZ(me: in out; v: Real from Standard)
is static;
SetU(me: in out; v: Real from Standard)
is static;
SetV(me: in out; v: Real from Standard)
is static;
SetPartOfCommon(me :in out; ii: Integer from Standard)
is static;
Middle(me: in out; MySurface: HSurface from Adaptor3d; P1,P2: Point from IntPolyh)
is static;
Add(me; P1: Point from IntPolyh)
---C++: alias operator +
returns Point from IntPolyh
is static;
Sub(me; P1: Point from IntPolyh)
---C++: alias operator -
returns Point from IntPolyh
is static;
Divide(me; rr: Real from Standard)
---C++: alias operator /
returns Point from IntPolyh
is static;
Multiplication(me; rr: Real from Standard)
---C++: alias operator *
returns Point from IntPolyh
is static;
SquareModulus(me)
returns Real from Standard
is static;
SquareDistance(me; P2: Point from IntPolyh)
returns Real from Standard
is static;
Dot(me; P2: Point from IntPolyh)
returns Real from Standard
is static;
Cross(me:in out; P1,P2: Point from IntPolyh)
is static;
Dump(me)
is static;
Dump(me; i: Integer from Standard)
is static;
fields
x,y,z,u,v : Real from Standard;
POC : Integer from Standard;
end Point from IntPolyh;

148
src/IntPolyh/IntPolyh_Point.cxx Executable file
View File

@@ -0,0 +1,148 @@
// File: IntPolyh_Point.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_Point.ixx>
#include <stdio.h>
IntPolyh_Point::IntPolyh_Point() : x(0),y(0),z(0),u(0),v(0),POC(1) {
}
IntPolyh_Point::IntPolyh_Point(const Standard_Real _x,
const Standard_Real _y,
const Standard_Real _z,
const Standard_Real _u,
const Standard_Real _v):POC(1) {
x=_x; y=_y; z=_z; u=_u; v=_v;
}
Standard_Real IntPolyh_Point::X() const { return(x); }
Standard_Real IntPolyh_Point::Y() const { return(y); }
Standard_Real IntPolyh_Point::Z() const { return(z); }
Standard_Real IntPolyh_Point::U() const { return(u); }
Standard_Real IntPolyh_Point::V() const { return(v); }
Standard_Integer IntPolyh_Point::PartOfCommon() const {return(POC);}
void IntPolyh_Point::Set(const Standard_Real _x,const Standard_Real _y, const Standard_Real _z,
const Standard_Real _u, const Standard_Real _v, const Standard_Integer II) {
x=_x; y=_y; z=_z; u=_u; v=_v; POC=II;}
void IntPolyh_Point::Equal(const IntPolyh_Point &Pt) {
x = Pt.x;
y = Pt.y;
z = Pt.z;
u = Pt.u;
v = Pt.v;
}
void IntPolyh_Point::SetX(const Standard_Real _x) { x=_x; }
void IntPolyh_Point::SetY(const Standard_Real _y) { y=_y; }
void IntPolyh_Point::SetZ(const Standard_Real _z) { z=_z; }
void IntPolyh_Point::SetU(const Standard_Real _u) { u=_u; }
void IntPolyh_Point::SetV(const Standard_Real _v) { v=_v; }
void IntPolyh_Point::SetPartOfCommon(const Standard_Integer ii) { POC=ii; }
void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface,
const IntPolyh_Point & Point1,
const IntPolyh_Point & Point2){
u = (Point1.U()+Point2.U())*0.5;
v = (Point1.V()+Point2.V())*0.5;
gp_Pnt PtXYZ = (MySurface)->Value(u, v);
x=PtXYZ.X();
y=PtXYZ.Y();
z=PtXYZ.Z();
}
IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const{
IntPolyh_Point res;
res.SetX(x+P1.X());
res.SetY(y+P1.Y());
res.SetZ(z+P1.Z());
res.SetU(u+P1.U());
res.SetV(v+P1.V());
return(res);
}
IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const{
IntPolyh_Point res;
res.SetX(x-P1.X());
res.SetY(y-P1.Y());
res.SetZ(z-P1.Z());
res.SetU(u-P1.U());
res.SetV(v-P1.V());
return(res);
}
IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const{
IntPolyh_Point res;
if (Abs(RR)>10.0e-20) {
res.SetX(x/RR);
res.SetY(y/RR);
res.SetZ(z/RR);
res.SetU(u/RR);
res.SetV(v/RR);
}
else {
printf("Division par zero RR=%f\n",RR);
//Dump();
}
return(res);
}
IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const{
IntPolyh_Point res;
res.SetX(x*RR);
res.SetY(y*RR);
res.SetZ(z*RR);
res.SetU(u*RR);
res.SetV(v*RR);
return(res);
}
Standard_Real IntPolyh_Point::SquareModulus()const{
Standard_Real res=x*x+y*y+z*z;
return(res);
}
Standard_Real IntPolyh_Point::SquareDistance(const IntPolyh_Point &P2)const{
Standard_Real res=(x-P2.x)*(x-P2.x)+(y-P2.y)*(y-P2.y)+(z-P2.z)*(z-P2.z);
return(res);
}
//inline
Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const{
Standard_Real t=x*b.x+y*b.y+z*b.z;
return(t);
}
//inline
void IntPolyh_Point::Cross(const IntPolyh_Point &a,const IntPolyh_Point &b){
x=a.y*b.z-a.z*b.y;
y=a.z*b.x-a.x*b.z;
z=a.x*b.y-a.y*b.x;
//u=?
//v=?
}
void IntPolyh_Point::Dump() const{
printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg\n",x,y,z,u,v);
}
void IntPolyh_Point::Dump(const Standard_Integer i) const{
printf("\nPoint(%3d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg poc=%3d\n",i,x,y,z,u,v,POC);
}

View File

@@ -0,0 +1,73 @@
-- File: IntPolyh_SectionLine.cdl
-- Created: Tue Apr 6 11:05:48 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
-- modified by Edward AGAPOV (eap) Thu Feb 14 2002 (occ139)
-- Add Prepend(), replace array with sequence
class SectionLine from IntPolyh
uses
SeqOfStartPoints from IntPolyh,
StartPoint from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns StartPoint from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns StartPoint from IntPolyh
is static;
Copy(me: in out; Other : SectionLine from IntPolyh)
---C++: alias operator =
---C++: return &
returns SectionLine from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbStartPoints(me)
returns Integer from Standard
is static;
IncrementNbStartPoints(me: in out)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
Prepend(me:in out; SP: StartPoint from IntPolyh)
is static;
fields
-- n,nbstartpoints : Integer from Standard;
-- ptr :Address from Standard;
mySeqOfSPoints : SeqOfStartPoints from IntPolyh;
end SectionLine from IntPolyh;

View File

@@ -0,0 +1,168 @@
// File: IntPolyh_SectionLine.cxx
// Created: Tue Apr 6 11:05:39 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
// modified by Edward AGAPOV (eap) Thu Feb 14 2002 (occ139)
// Add Prepend(), replace array with sequence
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_SectionLine.ixx>
#include <stdio.h>
//=======================================================================
//function : IntPolyh_SectionLine
//purpose :
//=======================================================================
IntPolyh_SectionLine::IntPolyh_SectionLine() /*: n(0),nbstartpoints(0),ptr(0)*/ { }
//=======================================================================
//function : IntPolyh_SectionLine
//purpose :
//=======================================================================
IntPolyh_SectionLine::IntPolyh_SectionLine(const Standard_Integer N)/* : nbstartpoints(0)*/{
Init(N);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void IntPolyh_SectionLine::Init(const Standard_Integer /*N*/) {
// ptr = (void*) (new IntPolyh_StartPoint [N]);
// n=N;
if (!mySeqOfSPoints.Length()) IncrementNbStartPoints();
}
//=======================================================================
//function : GetN
//purpose :
//=======================================================================
Standard_Integer IntPolyh_SectionLine::GetN() const {
//return(n);
return mySeqOfSPoints.Length();
}
//=======================================================================
//function : NbStartPoints
//purpose :
//=======================================================================
Standard_Integer IntPolyh_SectionLine::NbStartPoints() const {
// return(nbstartpoints);
return mySeqOfSPoints.Length() - 1;
}
//=======================================================================
//function : IncrementNbStartPoints
//purpose :
//=======================================================================
void IntPolyh_SectionLine::IncrementNbStartPoints() {
// nbstartpoints++;
IntPolyh_StartPoint aSP;
mySeqOfSPoints.Append(aSP);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
// # ifdef DEB
// #define BORNES1
// # endif
const IntPolyh_StartPoint& IntPolyh_SectionLine::Value(const Standard_Integer Index) const {
// IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
// #if BORNES
// if(Index<0 || Index>=n) {
// cerr<<" Erreur1 "<<endl;
// printf("Value() from IntPolyh_SectionLine.cxx : ERROR : value out of array\n");
// }
// #endif
// return(ptrstpoint[Index]);
return mySeqOfSPoints(Index+1);
}
//=======================================================================
//function : ChangeValue
//purpose :
//=======================================================================
IntPolyh_StartPoint& IntPolyh_SectionLine::ChangeValue(const Standard_Integer Index) {
// IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
// #if BORNES
// if(Index<0 || Index>=n) {
// cerr<<" Erreur1 "<<endl;
// printf("ChangeValue() from IntPolyh_SectionLine.cxx : ERROR : value out of array\n");
// }
// #endif
// return(ptrstpoint[Index]);
return mySeqOfSPoints(Index+1);
}
//=======================================================================
//function : Destroy
//purpose :
//=======================================================================
void IntPolyh_SectionLine::Destroy() {
// if(n) {
// if(ptr) {
// IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
// delete [] ptrstpoint;
// ptr=0;
// n=0;
// }
// }
}
//=======================================================================
//function : Copy
//purpose :
//=======================================================================
IntPolyh_SectionLine & IntPolyh_SectionLine::Copy(const IntPolyh_SectionLine& Other) {
// if(ptr==Other.ptr) return(*this);
// Destroy();
// n=Other.n;
// ptr = (void *) (new IntPolyh_StartPoint[n]);
// for(Standard_Integer i=0;i<=n;i++) {
// (*this)[i]=Other[i];
// }
mySeqOfSPoints = Other.mySeqOfSPoints;
return(*this);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void IntPolyh_SectionLine::Dump() const{
printf("\n SectionLine 0-> %d",/*nbstartpoints*/NbStartPoints()-1);
for(Standard_Integer i=0;i<NbStartPoints();i++) {
//(*this)[i].Dump(i);
Value(i).Dump(i);
// const IntPolyh_StartPoint& SP = Value(i);
// cout << "point P" << i << " " << SP.X() << " " << SP.Y() << " " << SP.Z() << endl;
}
printf("\n");
}
//=======================================================================
//function : Prepend
//purpose :
//=======================================================================
void IntPolyh_SectionLine::Prepend(const IntPolyh_StartPoint& SP)
{
mySeqOfSPoints.Prepend(SP);
}

View File

@@ -0,0 +1,143 @@
-- File: IntPolyh_StartPoint.cdl
-- Created: Tue Apr 6 10:15:11 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class StartPoint from IntPolyh
uses
Triangle from IntPolyh
is
Create;
Create(xx,yy,zz,uu1,vv1,uu2,vv2 : Real from Standard;
T1,E1: Integer from Standard;
LAM1 : Real from Standard;
T2,E2: Integer from Standard;
LAM2 : Real from Standard;
List : Integer from Standard);
X(me)
returns Real from Standard
is static;
Y(me)
returns Real from Standard
is static;
Z(me)
returns Real from Standard
is static;
U1(me)
returns Real from Standard
is static;
V1(me)
returns Real from Standard
is static;
U2(me)
returns Real from Standard
is static;
V2(me)
returns Real from Standard
is static;
T1(me)
returns Integer from Standard
is static;
E1(me)
returns Integer from Standard
is static;
Lambda1(me)
returns Real from Standard
is static;
T2(me)
returns Integer from Standard
is static;
E2(me)
returns Integer from Standard
is static;
Lambda2(me)
returns Real from Standard
is static;
GetAngle(me)
returns Real from Standard
is static;
ChainList(me)
returns Integer from Standard;
GetEdgePoints(me; Triangle: Triangle from IntPolyh;
FirstEdgePoint,SecondEdgePoint,LastPoint: in out Integer from Standard)
returns Integer from Standard
is static;
Equal(me: in out; StPt: StartPoint from IntPolyh)
---C++: alias operator =
is static;
SetXYZ(me: in out; XX,YY,ZZ: Real from Standard)
is static;
SetUV1(me: in out; UU1,VV1: Real from Standard)
is static;
SetUV2(me: in out; UU2,VV2: Real from Standard)
is static;
SetEdge1(me: in out; IE1: Integer from Standard)
is static;
SetLambda1(me: in out; LAM1: Real from Standard)
is static;
SetEdge2(me: in out; IE2: Integer from Standard)
is static;
SetLambda2(me: in out; LAM2: Real from Standard)
is static;
SetCoupleValue(me: in out; IT1,IT2: Integer from Standard)
is static;
SetAngle(me : in out; ang:Real from Standard)
is static;
SetChainList(me: in out; ChList: Integer from Standard)
is static;
CheckSameSP(me; SP: StartPoint from IntPolyh)
returns Integer from Standard
is static;
Dump(me)
is static;
Dump(me; i: Integer from Standard)
is static;
fields
x,y,z,u1,v1,u2,v2 : Real from Standard;
lambda1,lambda2,angle : Real from Standard;--angle: cos angle normales triangles
t1,e1,t2,e2,chainlist : Integer from Standard;
end StartPoint from IntPolyh;

View File

@@ -0,0 +1,189 @@
// File: IntPolyh_StartPoint.cxx
// Created: Tue Apr 6 10:27:56 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_StartPoint.ixx>
//#include <Precision.hxx>
#include <stdio.h>
#define MyConfusionPrecision 10.0e-12
IntPolyh_StartPoint::IntPolyh_StartPoint() : x(0),y(0),z(0),u1(0),v1(0),u2(0),v2(0),
lambda1(-1.0),lambda2(-1.0),angle(-2.0),t1(-1),e1(-2),t2(-1),e2(-2),
chainlist(-1) {
}
IntPolyh_StartPoint::IntPolyh_StartPoint(const Standard_Real _x,
const Standard_Real _y,
const Standard_Real _z,
const Standard_Real _u1,
const Standard_Real _v1,
const Standard_Real _u2,
const Standard_Real _v2,
const Standard_Integer _t1,
const Standard_Integer _e1,
const Standard_Real _lambda1,
const Standard_Integer _t2,
const Standard_Integer _e2,
const Standard_Real _lambda2,
const Standard_Integer _chainlist):angle(-2.0) {
x=_x; y=_y; z=_z;
u1=_u1; v1=_v1;
u2=_u2; v2=_v2;
t1=_t1; e1=_e1; lambda1=_lambda1;
t2=_t2; e2=_e2; lambda2=_lambda2;
chainlist=_chainlist;
}
Standard_Real IntPolyh_StartPoint::X() const { return(x); }
Standard_Real IntPolyh_StartPoint::Y() const { return(y); }
Standard_Real IntPolyh_StartPoint::Z() const { return(z); }
Standard_Real IntPolyh_StartPoint::U1() const { return(u1); }
Standard_Real IntPolyh_StartPoint::V1() const { return(v1); }
Standard_Real IntPolyh_StartPoint::U2() const { return(u2); }
Standard_Real IntPolyh_StartPoint::V2() const { return(v2); }
Standard_Integer IntPolyh_StartPoint::T1() const { return(t1); }
Standard_Integer IntPolyh_StartPoint::E1() const { return(e1); }
Standard_Real IntPolyh_StartPoint::Lambda1() const { return(lambda1); }
Standard_Integer IntPolyh_StartPoint::T2() const { return(t2); }
Standard_Integer IntPolyh_StartPoint::E2() const { return(e2); }
Standard_Real IntPolyh_StartPoint::Lambda2() const { return(lambda2); }
Standard_Integer IntPolyh_StartPoint::ChainList() const { return(chainlist); }
Standard_Real IntPolyh_StartPoint::GetAngle() const { return(angle); }
Standard_Integer IntPolyh_StartPoint::GetEdgePoints(const IntPolyh_Triangle &Triangle,
Standard_Integer &FirstEdgePoint,
Standard_Integer &SecondEdgePoint,
Standard_Integer &LastPoint) const {
Standard_Integer SurfID;
if(e1!=-1) {
if(e1==1) { FirstEdgePoint = Triangle.FirstPoint(); SecondEdgePoint = Triangle.SecondPoint();
LastPoint = Triangle.ThirdPoint(); }
else if(e1==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();
LastPoint = Triangle.FirstPoint(); }
else if(e1==3) { FirstEdgePoint = Triangle.ThirdPoint(); SecondEdgePoint = Triangle.FirstPoint();
LastPoint = Triangle.SecondPoint();}
SurfID=1;
}
else if(e2!=-1) {
if(e2==1) { FirstEdgePoint = Triangle.FirstPoint(); SecondEdgePoint = Triangle.SecondPoint();
LastPoint = Triangle.ThirdPoint();}
else if(e2==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();
LastPoint = Triangle.FirstPoint();}
else if(e2==3) { FirstEdgePoint = Triangle.ThirdPoint(); SecondEdgePoint = Triangle.FirstPoint();
LastPoint = Triangle.SecondPoint();}
SurfID=2;
}
else SurfID=0;
return(SurfID) ;
}
void IntPolyh_StartPoint::Equal(const IntPolyh_StartPoint &StPt) {
x = StPt.x;
y = StPt.y;
z = StPt.z;
u1 = StPt.u1;
v1 = StPt.v1;
u2 = StPt.u2;
v2 = StPt.v2;
t1 = StPt.t1;
e1 = StPt.e1;
lambda1 = StPt.lambda1;
t2 = StPt.t2;
e2 = StPt.e2;
lambda2 = StPt.lambda2;
angle = StPt.angle;
chainlist = StPt.chainlist;
}
void IntPolyh_StartPoint::SetXYZ(const Standard_Real XX,
const Standard_Real YY,
const Standard_Real ZZ) {
x=XX; y=YY; z=ZZ;
}
void IntPolyh_StartPoint::SetUV1(const Standard_Real UU1,
const Standard_Real VV1) {
u1=UU1; v1=VV1;
}
void IntPolyh_StartPoint::SetUV2(const Standard_Real UU2,
const Standard_Real VV2) {
u2=UU2; v2=VV2;
}
void IntPolyh_StartPoint::SetEdge1(const Standard_Integer IE1) {
e1=IE1;
}
void IntPolyh_StartPoint::SetLambda1(const Standard_Real LAM1) {
lambda1=LAM1;
}
void IntPolyh_StartPoint::SetEdge2(const Standard_Integer IE2) {
e2=IE2;
}
void IntPolyh_StartPoint::SetLambda2(const Standard_Real LAM2) {
lambda2=LAM2;
}
void IntPolyh_StartPoint::SetCoupleValue(const Standard_Integer IT1,
const Standard_Integer IT2) {
t1=IT1;
t2=IT2;
}
void IntPolyh_StartPoint::SetAngle(const Standard_Real Ang) {
angle=Ang;
}
void IntPolyh_StartPoint::SetChainList(const Standard_Integer ChList) {
chainlist=ChList;
}
Standard_Integer IntPolyh_StartPoint::CheckSameSP(const IntPolyh_StartPoint & SP) const {
///Renvoit 1 si monSP==SP
Standard_Integer Test=0;
if( ( (e1>=-1)&&(e1==SP.e1))||((e2>=-1)&&(e2==SP.e2)) ) {
///Les edges sont definis
if( ( (lambda1>-MyConfusionPrecision)&&(Abs(lambda1-SP.lambda1)<MyConfusionPrecision) ) //lambda1!=-1 && lambda1==SP.lambda2
||( (lambda2>-MyConfusionPrecision)&&(Abs(lambda2-SP.lambda2)<MyConfusionPrecision) ) )
Test=1;
//if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
//Test=1;
}
if( (Test==0) && ((e1==-1)||(e2==-1)) ) {
///monSP est un sommet
if( (Abs(SP.u1-u1)<MyConfusionPrecision)&&(Abs(SP.v1-v1)<MyConfusionPrecision) )
Test=1;
}
else if( (e1==-2)&&(e2==-2) ) {
Dump(00200);
SP.Dump(00201);
printf("e1==-2 & e2==-2 Can't Check\n");
}
/* if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
Test=1;*/
return(Test);
}
void IntPolyh_StartPoint::Dump() const{
printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u1=%+8.3eg v1=%+8.3eg u2=%+8.3eg v2=%+8.3eg\n",
x,y,z,u1,v1,u2,v2);
printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
printf("Angle: %f List Number: %d\n",angle,chainlist);
}
void IntPolyh_StartPoint::Dump(const Standard_Integer i) const{
printf("\nPoint(%d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u1=%+8.3eg v1=%+8.3eg u2=%+8.3eg v2=%+8.3eg\n",
i,x,y,z,u1,v1,u2,v2);
printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
printf("Angle: %f List Number: %d\n",angle,chainlist);
}

View File

@@ -0,0 +1,201 @@
-- File: IntPolyh_Triangle.cdl
-- Created: Fri Mar 5 18:12:33 1999
-- Author: Fabrice SERVANT
-- <fst@cleox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class Triangle from IntPolyh
uses
HSurface from Adaptor3d,
Point from IntPolyh,
ArrayOfPoints from IntPolyh,
StartPoint from IntPolyh,
ArrayOfEdges from IntPolyh,
ArrayOfCouples from IntPolyh,
ArrayOfTriangles from IntPolyh,
Box from Bnd
is
Create;
Create(i1,i2,i3: Integer from Standard);
FirstPoint(me)
returns Integer from Standard
is static;
SecondPoint(me)
returns Integer from Standard
is static;
ThirdPoint(me)
returns Integer from Standard
is static;
FirstEdge(me)
returns Integer from Standard
is static;
FirstEdgeOrientation(me)
returns Integer from Standard
is static;
SecondEdge(me)
returns Integer from Standard
is static;
SecondEdgeOrientation(me)
returns Integer from Standard
is static;
ThirdEdge(me)
returns Integer from Standard
is static;
ThirdEdgeOrientation(me)
returns Integer from Standard
is static;
GetFleche(me)
returns Real from Standard
is static;
IndiceIntersectionPossible(me)
returns Integer from Standard
is static;
IndiceIntersection(me)
returns Integer from Standard
is static;
SetFirstPoint(me: in out; v: Integer from Standard)
is static;
SetSecondPoint(me: in out; v: Integer from Standard)
is static;
SetThirdPoint(me: in out; v: Integer from Standard)
is static;
SetFirstEdge(me: in out; v,s: Integer from Standard)
is static;
SetSecondEdge(me: in out; v,s: Integer from Standard)
is static;
SetThirdEdge(me: in out; v,s: Integer from Standard)
is static;
SetFleche(me: in out; v: Real from Standard)
is static;
SetIndiceIntersectionPossible(me: in out; v: Integer from Standard)
is static;
SetIndiceIntersection(me: in out; v: Integer from Standard)
is static;
GetEdgeNumber(me;v: Integer from Standard )
returns Integer from Standard
is static;
SetEdge(me: in out; v,en: Integer from Standard )
is static;
GetEdgeOrientation(me;v: Integer from Standard )
returns Integer from Standard
is static;
SetEdgeOrientation(me: in out; v,oe: Integer from Standard )
is static;
TriangleDeflection(me : in out; MaSurface:HSurface from Adaptor3d;
TP : ArrayOfPoints from IntPolyh)
is static;
CheckCommonEdge(me; PE1,PE2,P3,Index: Integer from Standard;
TTriangles: ArrayOfTriangles from IntPolyh)
returns Integer from Standard
is static;
-- GetNextTriangle(me; NumTri,PE1,PE2,P3,FinTT,NbSamplesU,NbSamplesV: Integer from Standard;
-- TTriangles: ArrayOfTriangles from IntPolyh)
-- returns Integer from Standard
-- is static;
GetNextTriangle2(me; NumTri,NumEdge: Integer from Standard;
TEdges: ArrayOfEdges from IntPolyh)
returns Integer from Standard
is static;
MiddleRefinement(me: in out; TriangleNumber: Integer from Standard;
MySurface:HSurface from Adaptor3d;
TPoints: in out ArrayOfPoints from IntPolyh;
TTriangles: in out ArrayOfTriangles from IntPolyh;
TEdges: in out ArrayOfEdges from IntPolyh)
is static;
MultipleMiddleRefinement(me: in out;
NombreAffinages,TriangleNumber: Integer from Standard;
MySurface:HSurface from Adaptor3d;
TPoints: in out ArrayOfPoints from IntPolyh;
TTriangles: in out ArrayOfTriangles from IntPolyh;
TEdges: in out ArrayOfEdges from IntPolyh)
is static;
CompareBoxTriangle(me; b: Box from Bnd;
TPoints: ArrayOfPoints from IntPolyh)
returns Integer from Standard
is static;
MultipleMiddleRefinement2(me: in out;
RefineCriterion: Real from Standard;
thebox: Box from Bnd;
TriangleNumber: Integer from Standard;
MySurface:HSurface from Adaptor3d;
TPoints: in out ArrayOfPoints from IntPolyh;
TTriangles: in out ArrayOfTriangles from IntPolyh;
TEdges: in out ArrayOfEdges from IntPolyh)
is static;
GetNextChainTriangle(me; SPIni: StartPoint from IntPolyh; LastTTC: Integer from Standard;
TriContactsArray: in out ArrayOfCouples from IntPolyh;
TTriangles1, TTriangles2: ArrayOfTriangles from IntPolyh;
NumContact,NextTriangle: in out Integer from Standard)
returns Integer from Standard
is static;
LinkEdges2Triangle(me: in out; TEdges: ArrayOfEdges from IntPolyh;
ed1,ed2,ed3: Integer from Standard)
is static;
SetEdgeandOrientation(me: in out; Edge: Integer from Standard;
TEdges: ArrayOfEdges from IntPolyh)
is static;
Dump(me; v: Integer from Standard)
is static;
DumpFleche(me; v: Integer from Standard)
is static;
fields
p1,p2,p3,e1,oe1,e2,oe2,e3,oe3,II,IP : Integer from Standard;
Fleche : Real from Standard;
end Triangle from IntPolyh;
-- The code is inside, but as it is not used for my algorythms I leave
-- it as a comment.
--
-- RefinementG(me: in out; SurfID: Integer from Standard; T: in out
-- Triangle from IntPolyh) is static;

View File

@@ -0,0 +1,902 @@
// File: IntPolyh_Triangle.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_Triangle.ixx>
#include <IntPolyh_Point.ixx>
#include <IntPolyh_Edge.ixx>
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_Couple.ixx>
#include <stdio.h>
#define MyTolerance 10.0e-7
#define MyConfusionPrecision 10.0e-12
#define SquareMyConfusionPrecision 10.0e-24
//# ifdef DEB
//#define MYDEBUG DEB
//# else
//#define MYDEBUG 0
//# endif
IntPolyh_Triangle::IntPolyh_Triangle() : p1(-1),p2(-1),p3(-1),
e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0),
II(0),IP(1),Fleche(0.0) { }
IntPolyh_Triangle::IntPolyh_Triangle(const Standard_Integer a,const Standard_Integer b,
const Standard_Integer c) : p1(a),p2(b),p3(c),
e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0),II(0),IP(1),Fleche(0.0) { }
Standard_Integer IntPolyh_Triangle::FirstPoint() const { return(p1); }
Standard_Integer IntPolyh_Triangle::SecondPoint() const { return(p2); }
Standard_Integer IntPolyh_Triangle::ThirdPoint() const { return(p3); }
Standard_Integer IntPolyh_Triangle::FirstEdge() const { return(e1); }
Standard_Integer IntPolyh_Triangle::FirstEdgeOrientation() const { return(oe1); }
Standard_Integer IntPolyh_Triangle::SecondEdge() const { return(e2); }
Standard_Integer IntPolyh_Triangle::SecondEdgeOrientation() const { return(oe2); }
Standard_Integer IntPolyh_Triangle::ThirdEdge() const { return(e3); }
Standard_Integer IntPolyh_Triangle::ThirdEdgeOrientation() const { return(oe3); }
Standard_Real IntPolyh_Triangle::GetFleche() const { return(Fleche); }
Standard_Integer IntPolyh_Triangle::IndiceIntersectionPossible() const { return(IP); }
Standard_Integer IntPolyh_Triangle::IndiceIntersection() const { return(II); }
void IntPolyh_Triangle::SetFirstPoint(const Standard_Integer a) { p1=a; }
void IntPolyh_Triangle::SetSecondPoint(const Standard_Integer b) { p2=b; }
void IntPolyh_Triangle::SetThirdPoint(const Standard_Integer c) { p3=c; }
void IntPolyh_Triangle::SetFirstEdge(const Standard_Integer e, const Standard_Integer oe) { e1=e; oe1=oe;}
void IntPolyh_Triangle::SetSecondEdge(const Standard_Integer f, const Standard_Integer of) { e2=f; oe2=of; }
void IntPolyh_Triangle::SetThirdEdge(const Standard_Integer g, const Standard_Integer og) { e3=g; oe3=og; }
void IntPolyh_Triangle::SetFleche(const Standard_Real A) { Fleche=A;}
void IntPolyh_Triangle::SetIndiceIntersectionPossible(const Standard_Integer I) { IP=I; }
void IntPolyh_Triangle::SetIndiceIntersection(const Standard_Integer I) { II=I; }
Standard_Integer IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeIndex) const {
if(EdgeIndex==1)
return(e1);
if(EdgeIndex==2)
return(e2);
if(EdgeIndex==3)
return(e3);
return 0;
}
void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex,
const Standard_Integer EdgeNumber) {
if(EdgeIndex==1)
e1=EdgeNumber;
if(EdgeIndex==2)
e2=EdgeNumber;
if(EdgeIndex==3)
e3=EdgeNumber;
}
Standard_Integer IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer EdgeIndex) const {
if(EdgeIndex==1)
return(oe1);
if(EdgeIndex==2)
return(oe2);
if(EdgeIndex==3)
return(oe3);
return 0;
}
void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex,
const Standard_Integer OrEd) {
if(EdgeIndex==1)
oe1=OrEd;
if(EdgeIndex==2)
oe2=OrEd;
if(EdgeIndex==3)
oe3=OrEd;
}
/*Calcul de la fleche pour un triangle**************
Distance entre le plan forme par le triangle et
le barycentre situe sur la surface calcule avec les coordonnees Gu,Gv
(coordonnees du barycentre du triangle dans l'espace UV)*/
void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MySurface,
const IntPolyh_ArrayOfPoints& TPoints){
const IntPolyh_Point & P1 = TPoints[p1];
const IntPolyh_Point & P2 = TPoints[p2];
const IntPolyh_Point & P3 = TPoints[p3];
Standard_Real Gu=(P1.U()+P2.U()+P3.U())/3.0;
Standard_Real Gv=(P1.V()+P2.V()+P3.V())/3.0;
gp_Pnt PtXYZ = (MySurface)->Value( Gu, Gv);
IntPolyh_Point BarycentreReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), Gu, Gv);
IntPolyh_Point NormaleTri;
NormaleTri.Cross(P2-P1,P3-P1);
Standard_Real SqNorme=NormaleTri.SquareModulus();
if (SqNorme > SquareMyConfusionPrecision) {
NormaleTri=NormaleTri/sqrt(SqNorme);
Fleche=Abs(NormaleTri.Dot( BarycentreReel-P1));
}
else {
// On calcule la fleche sur le plus grand des edges
// calcul des longueurs des cotes au carre
Standard_Real L12 = P1.SquareDistance(P2);
Standard_Real L23 = P2.SquareDistance(P3);
Standard_Real L31 = P3.SquareDistance(P1);
if (L12<SquareMyConfusionPrecision) {
# if MYDEBUG
printf("\nTriangleDeflection() from IntPolyh_Triangle : L12=0\n");
P1.Dump();
P2.Dump();
# endif
}
if (L23<SquareMyConfusionPrecision) {
# if MYDEBUG
printf("\nTriangleDeflection() from IntPolyh_Triangle : L23=0\n");
P2.Dump();
P3.Dump();
# endif
}
if (L31<SquareMyConfusionPrecision) {
# if MYDEBUG
printf("\nTriangleDeflection() from IntPolyh_Triangle : L31=0\n");
P3.Dump();
P1.Dump();
# endif
}
IntPolyh_Point Milieu; // milieu du plus grand des edges
if ((L12>L23) && (L12>L31))
Milieu.Middle( MySurface,P1, P2);
else if ((L23>L31) && (L23>L12))
Milieu.Middle( MySurface,P2, P3);
else if ((L31>L12) && (L31>L23))
Milieu.Middle( MySurface,P3, P1);
gp_Pnt PtXYZ = (MySurface)->Value( Milieu.U(), Milieu.V());
IntPolyh_Point MilieuReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), Milieu.U(), Milieu.V());
Fleche = sqrt(Milieu.SquareDistance(MilieuReel));
}
}
Standard_Integer IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1,
const Standard_Integer PT2,
const Standard_Integer PT3,
const Standard_Integer Index,
const IntPolyh_ArrayOfTriangles &TTriangles) const {
Standard_Integer P1,P2,P3,res=-1;
P1=TTriangles[Index].FirstPoint();
P2=TTriangles[Index].SecondPoint();
P3=TTriangles[Index].ThirdPoint();
if ( (P1==PT1)||(P1==PT2) ) {
if ( ( (P2==PT1)||(P2==PT2) )&&(P3!=PT3) ) res = Index; //edge commun P1P2
else if ( ( (P3==PT1)||(P3==PT2) )&&(P2!=PT3) ) res = Index;//edge commun P1P3
}
else if ( (P2==PT1)||(P2==PT2) ) {
if ( ( (P3==PT1)||(P3==PT2) )&&(P1!=PT3) ) res = Index; //edge commun P2P3
}
else res=-1;
return(res);
}
Standard_Integer IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumTri,
const Standard_Integer NumEdge,
const IntPolyh_ArrayOfEdges &TEdges) const {
Standard_Integer NumNextTri=-1;
if (NumEdge==1) {
const IntPolyh_Edge & Edge1=TEdges[e1];
if(Edge1.FirstTriangle()==NumTri)
NumNextTri=Edge1.SecondTriangle();
else
NumNextTri=Edge1.FirstTriangle();
}
else if (NumEdge==2) {
const IntPolyh_Edge & Edge2=TEdges[e2];
if(Edge2.FirstTriangle()==NumTri)
NumNextTri=Edge2.SecondTriangle();
else
NumNextTri=Edge2.FirstTriangle();
}
else if (NumEdge==3) {
const IntPolyh_Edge & Edge3=TEdges[e3];
if(Edge3.FirstTriangle()==NumTri)
NumNextTri=Edge3.SecondTriangle();
else
NumNextTri=Edge3.FirstTriangle();
}
else {
# if MYDEBUG
printf("\nTriangleDeflection() from IntPolyh_Triangle :\n");
printf("Edge index != {1,2,3}, Edge Number=%d\n",NumEdge);
# endif
}
return (NumNextTri);
}
void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges,
const Standard_Integer edge1,
const Standard_Integer edge2,
const Standard_Integer edge3) {
if( (edge1<0)||(edge2<0)||(edge3<0) ) {
# if MYDEBUG
printf("LinkEdges2Triangle() from IntPolyh_Triangle.cxx :/n");
printf("Some edges are unknown LinkEdges2Triangle impossible\n");
printf("edge1=%d edge2=%d edge3=%d\n",edge1,edge2,edge3);
# endif
}
else {
e1=edge1;
e2=edge2;
e3=edge3;
if(TEdges[e1].FirstPoint()==p1) oe1=1;
else oe1=-1;
if(TEdges[e2].FirstPoint()==p2) oe2=1;
else oe2=-1;
if(TEdges[e3].FirstPoint()==p3) oe3=1;
else oe3=-1;
}
}
void GetInfoTA(const Standard_Integer numP1,
const Standard_Integer numP2,
const Standard_Integer numTA,
const IntPolyh_ArrayOfTriangles & TTriangles,
Standard_Integer & numP3b,
Standard_Integer & P3bIndex,
Standard_Integer & Edge2b,
Standard_Integer & Edge3b) {
/// On veut savoir quel est le troisieme point du triangle
/// adjacent (TriAdj) et quel sont les edges partant de ce point
const IntPolyh_Triangle & TriAdj=TTriangles[numTA];
Standard_Integer P1b=TriAdj.FirstPoint();
Standard_Integer P2b=TriAdj.SecondPoint();
Standard_Integer P3b=TriAdj.ThirdPoint();
if ( (P1b!=numP1)&&(P1b!=numP2) ) {
numP3b=P1b;
P3bIndex=1;
if (P2b==numP1) {
///P1bP2b==numP3bnumP1:Edge3b donc dans ce cas
Edge3b=TriAdj.FirstEdge();
/// Donc P1bP3b==numP3bnumP2:Edge2b
Edge2b=TriAdj.ThirdEdge();
}
else {
Edge2b=TriAdj.FirstEdge();
Edge3b=TriAdj.ThirdEdge();
}
}
else if( (P2b!=numP1)&&(P2b!=numP2) ) {
numP3b=P2b;
P3bIndex=2;
if (P1b==numP1) {
///P2bP1b==numP3bnumP1:Edge3b donc dans ce cas
Edge3b=TriAdj.FirstEdge();
/// Donc P2bP3b==numP3bnumP2:Edge2b
Edge2b=TriAdj.SecondEdge();
}
else {
Edge2b=TriAdj.FirstEdge();
Edge3b=TriAdj.SecondEdge();
}
}
else if( (P3b!=numP1)&&(P3b!=numP2) ) {
numP3b=P3b;
P3bIndex=3;
if (P2b==numP1) {
///P3bP2b==numP3bnumP1:Edge3b donc dans ce cas
Edge3b=TriAdj.SecondEdge();
/// Donc P3bP1b==numP3bnumP2:Edge2b
Edge2b=TriAdj.ThirdEdge();
}
else {
Edge2b=TriAdj.SecondEdge();
Edge3b=TriAdj.ThirdEdge();
}
}
if(numP3b<0) {
# if MYDEBUG
printf("ERROR1 refinement with null Point\n");
# endif
}
}
void NewTriangle(const Standard_Integer P1,
const Standard_Integer P2,
const Standard_Integer P3,
IntPolyh_ArrayOfTriangles &TTriangles,
const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints) {
const Standard_Integer FinTT = TTriangles.NbTriangles();
TTriangles[FinTT].SetFirstPoint(P1);
TTriangles[FinTT].SetSecondPoint(P2);
TTriangles[FinTT].SetThirdPoint(P3);
TTriangles[FinTT].TriangleDeflection(MySurface, TPoints);
TTriangles.IncNbTriangles();
}
void NewEdge(const Standard_Integer P1,
const Standard_Integer P2,
const Standard_Integer T1,
const Standard_Integer T2,
IntPolyh_ArrayOfEdges & TEdges) {
//#ifndef DEB
const Standard_Integer FinTE = TEdges.NbEdges();
//#else
// const FinTE = TEdges.NbEdges();
//#endif
TEdges[FinTE].SetFirstPoint(P1);
TEdges[FinTE].SetSecondPoint(P2);
TEdges[FinTE].SetFirstTriangle(T1);
TEdges[FinTE].SetSecondTriangle(T2);
TEdges.IncNbEdges();
}
void OldEdge(const Standard_Integer EdgeN,
const Standard_Integer NumTri,
const Standard_Integer NewTriNum,
IntPolyh_ArrayOfEdges & TEdges) {
if(TEdges[EdgeN].FirstTriangle()==NumTri) TEdges[EdgeN].SetFirstTriangle(NewTriNum);
else TEdges[EdgeN].SetSecondTriangle(NewTriNum);
}
void TestOldEdgeB(const Standard_Integer NumTA,
const Standard_Integer numPtT1,
const Standard_Integer numPtT2,
const Standard_Integer T1,
const Standard_Integer T2,
const IntPolyh_ArrayOfTriangles & TTriangles,
const Standard_Integer Edge1,
const Standard_Integer Edge3,
IntPolyh_ArrayOfEdges & TEdges ) {
if( (TEdges[Edge1].FirstPoint() == numPtT1)
||(TEdges[Edge1].SecondPoint()== numPtT1) ) {
/// L'edge1 est commun aux triangles NumTA et T1
if(TEdges[Edge1].FirstTriangle()==NumTA)
TEdges[Edge1].SetFirstTriangle(T1);
else TEdges[Edge1].SetSecondTriangle(T1);
if(TEdges[Edge3].FirstTriangle()==NumTA)
TEdges[Edge3].SetFirstTriangle(T2);
else TEdges[Edge3].SetSecondTriangle(T2);
}
else {
/// L'edge3 est commun aux triangles NumTA et T1
if(TEdges[Edge3].FirstTriangle()==NumTA)
TEdges[Edge3].SetFirstTriangle(T1);
else TEdges[Edge3].SetSecondTriangle(T1);
if(TEdges[Edge1].FirstTriangle()==NumTA)
TEdges[Edge1].SetFirstTriangle(T2);
else TEdges[Edge1].SetSecondTriangle(T2);
}
}
void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints,
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
Standard_Integer FinTE = TEdges.NbEdges();
Standard_Integer FinTT = TTriangles.NbTriangles();
///Raffinage de la maille et de ses voisines par le milieu du plus grand des cotes
Standard_Integer numP1 = FirstPoint();
Standard_Integer numP2 = SecondPoint();
Standard_Integer numP3 = ThirdPoint();
IntPolyh_Point P1 = TPoints[numP1];
IntPolyh_Point P2 = TPoints[numP2];
IntPolyh_Point P3 = TPoints[numP3];
///calcul des longueurs des cotes au carre
Standard_Real L12 = P1.SquareDistance(P2);
Standard_Real L23 = P2.SquareDistance(P3);
Standard_Real L31 = P3.SquareDistance(P1);
if ((L12>L23) && (L12>L31)) {
const Standard_Integer FinTP = TPoints.NbPoints();
(TPoints[FinTP]).Middle( MySurface,P1, P2);
///les nouveaux triangles
Standard_Integer T1,T2,T3,T4;
T1=FinTT;
NewTriangle(numP2,numP3,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T2=FinTT;;
NewTriangle(numP3,numP1,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
///***AFFINAGE DU TRIANGLE ADJACENT***
Standard_Integer numTA = GetNextTriangle2(NumTri,1,TEdges);
if (numTA>=0) {
Standard_Integer numP3b = -1;
Standard_Integer P3bIndex = -1;
Standard_Integer Edge2b = -1;
Standard_Integer Edge3b = -1;
GetInfoTA(numP1,numP2,numTA,TTriangles,numP3b,P3bIndex,Edge2b,Edge3b);
T3=FinTT;
NewTriangle(numP2,numP3b,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T4=FinTT;
NewTriangle(numP3b,numP1,FinTP,TTriangles,MySurface,TPoints);
///On cree les nouveaux edges
Standard_Integer E1,E2,E3,E4;
E1=FinTE;
NewEdge(numP1,FinTP,T2,T4,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP2,T1,T3,TEdges);
FinTE++;
E3=FinTE;
NewEdge(FinTP,numP3,T1,T2,TEdges);
FinTE++;
E4=FinTE;
NewEdge(FinTP,numP3b,T3,T4,TEdges);
///On met a jour les anciens edges
OldEdge(e2,NumTri,T1,TEdges);
OldEdge(e3,NumTri,T2,TEdges);
OldEdge(Edge2b,numTA,T3,TEdges);
OldEdge(Edge3b,numTA,T4,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e2,E3,E2);
TTriangles[T2].LinkEdges2Triangle(TEdges,e3,E1,E3);
TTriangles[T3].LinkEdges2Triangle(TEdges,Edge2b,E4,E2);
TTriangles[T4].LinkEdges2Triangle(TEdges,Edge3b,E1,E4);
///On tue le triangle adjacent
TTriangles[numTA].Fleche=-1.0;
TTriangles[numTA].IP=0;
}
else { ///seulement deux nouveaux triangles
//on cree les nouveaux edges avec T1 et T2
Standard_Integer E1,E2,E3;
E1=FinTE;
NewEdge(numP1,FinTP,T2,-1,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP2,T1,-1,TEdges);
FinTE++;
E3=FinTE;
NewEdge(FinTP,numP3,T1,T2,TEdges);
///On met a jour les anciens edges
OldEdge(e2,NumTri,T1,TEdges);
OldEdge(e3,NumTri,T2,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e2,E3,E2);
TTriangles[T2].LinkEdges2Triangle(TEdges,e3,E1,E3);
}
}
else if ((L23>L31) && (L23>L12)){
const Standard_Integer FinTP = TPoints.NbPoints();
(TPoints[FinTP]).Middle(MySurface, P2,P3);
///les nouveaux triangles
Standard_Integer T1,T2,T3,T4;
T1=FinTT;
NewTriangle(numP1,numP2,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T2=FinTT;
NewTriangle(numP3,numP1,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
///*RAFFINAGE DU TRIANGLE ADJACENT***
Standard_Integer numTA = GetNextTriangle2(NumTri,2,TEdges);
if (numTA>=0) {
Standard_Integer numP1b=-1;
Standard_Integer P1bIndex = -1;
Standard_Integer Edge1b = -1;
Standard_Integer Edge3b = -1;
GetInfoTA(numP2,numP3,numTA,TTriangles,numP1b,P1bIndex,Edge3b,Edge1b);
T3=FinTT;
NewTriangle(numP2,numP1b,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T4=FinTT;
NewTriangle(numP1b,numP3,FinTP,TTriangles,MySurface,TPoints);
///Nouveaux Edges
Standard_Integer E1,E2,E3,E4;
E1=FinTE;
NewEdge(numP2,FinTP,T1,T3,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP3,T2,T4,TEdges);
FinTE++;
E3=FinTE;
NewEdge(FinTP,numP1,T1,T2,TEdges);
FinTE++;
E4=FinTE;
NewEdge(FinTP,numP1b,T3,T4,TEdges);
///On met a jour les anciens edges
OldEdge(e1,NumTri,T1,TEdges);
OldEdge(e3,NumTri,T2,TEdges);
OldEdge(Edge1b,numTA,T3,TEdges);
OldEdge(Edge3b,numTA,T4,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e1,E1,E3);
TTriangles[T2].LinkEdges2Triangle(TEdges,e3,E3,E2);
TTriangles[T3].LinkEdges2Triangle(TEdges,Edge1b,E4,E1);
TTriangles[T4].LinkEdges2Triangle(TEdges,Edge3b,E2,E4);
///On tue le triangle adjacent
TTriangles[numTA].Fleche=-1.0;
TTriangles[numTA].IP=0;
}
else { ///seulement deux nouveaux triangles
///Nouveaux Edges
Standard_Integer E1,E2,E3;
E1=FinTE;
NewEdge(numP2,FinTP,T1,-1,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP3,T2,-1,TEdges);
FinTE++;
E3=FinTE;
NewEdge(FinTP,numP1,T1,T2,TEdges);
///On met a jour les anciens edges
OldEdge(e1,NumTri,T1,TEdges);
OldEdge(e3,NumTri,T2,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e1,E1,E3);
TTriangles[T2].LinkEdges2Triangle(TEdges,e3,E3,E2);
}
}
else {
const Standard_Integer FinTP = TPoints.NbPoints();
(TPoints[FinTP]).Middle(MySurface, P3,P1);
Standard_Integer T1,T2,T3,T4;
T1=FinTT;
NewTriangle(numP1,numP2,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T2=FinTT;
NewTriangle(numP2,numP3,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
///*RAFFINAGE DU TRIANGLE ADJACENT***
Standard_Integer numTA = GetNextTriangle2(NumTri,3,TEdges);
if (numTA>=0) {
Standard_Integer numP2b = -1;
Standard_Integer P2bIndex = -1;
Standard_Integer Edge1b = -1;
Standard_Integer Edge2b = -1;
GetInfoTA(numP3,numP1,numTA,TTriangles,numP2b,P2bIndex,Edge1b,Edge2b);
T3=FinTT;
NewTriangle(numP1,numP2b,FinTP,TTriangles,MySurface,TPoints);
FinTT++;
T4=FinTT;
NewTriangle(numP2b,numP3,FinTP,TTriangles,MySurface,TPoints);
///Nouveaux Edges
Standard_Integer E1,E2,E3,E4;
E1=FinTE;
NewEdge(numP2,FinTP,T1,T2,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP3,T2,T4,TEdges);
FinTE++;
E3=FinTE;
NewEdge(FinTP,numP2b,T4,T3,TEdges);
FinTE++;
E4=FinTE;
NewEdge(FinTP,numP1,T1,T3,TEdges);
///On met a jour les anciens edges
OldEdge(e1,NumTri,T1,TEdges);
OldEdge(e2,NumTri,T2,TEdges);
OldEdge(Edge1b,numTA,T3,TEdges);
OldEdge(Edge2b,numTA,T4,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e1,E1,E4);
TTriangles[T2].LinkEdges2Triangle(TEdges,e2,E2,E1);
TTriangles[T3].LinkEdges2Triangle(TEdges,Edge1b,E3,E4);
TTriangles[T4].LinkEdges2Triangle(TEdges,Edge2b,E2,E3);
///On tue le triangle adjacent
TTriangles[numTA].Fleche=-1.0;
TTriangles[numTA].IP=0;
}
else { ///seulement deux nouveaux triangles
///Nouveaux Edges
Standard_Integer E1,E2,E4;
E1=FinTE;
NewEdge(numP2,FinTP,T1,T2,TEdges);
FinTE++;
E2=FinTE;
NewEdge(FinTP,numP3,T2,-1,TEdges);
FinTE++;
E4=FinTE;
NewEdge(FinTP,numP1,T1,-1,TEdges);
///On met a jour les anciens edges
OldEdge(e1,NumTri,T1,TEdges);
OldEdge(e2,NumTri,T2,TEdges);
/// On remplit les nouveaux triangles avec les edges
TTriangles[T1].LinkEdges2Triangle(TEdges,e1,E1,E4);
TTriangles[T2].LinkEdges2Triangle(TEdges,e2,E2,E1);
}
}
/// Le triangle traite est maintenant obsolete
///***On tue le triangle***
Fleche=-1.0;
IP=0;
TPoints.IncNbPoints();
}
void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffinages,
const Standard_Integer NumTri,
const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints,
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
const Standard_Integer FinTTInit = TTriangles.NbTriangles();
//On sait qu'il faut affiner au moins une fois
TTriangles[NumTri].MiddleRefinement(NumTri,MySurface,TPoints,
TTriangles,TEdges);
if (NbAffinages>1) {
Standard_Integer MyNbAffinages=0;
if (NbAffinages > 5)
MyNbAffinages = 4;//5 est le maximum et on a deja affine une fois
//On a decide d'arreter a 5 car avec un triangle on peut en obtenir 1024
else MyNbAffinages = NbAffinages-1;//dans tous les cas MyNbAffinages>0
//Un affinage peut donner deux ou quatre nouveaux triangles
// ils seront ajoute a la fin du tableau de triangles, et auront comme indice
// FinTTInit, FinTTInit+1,...
Standard_Integer NombreReelsAffinages = 4;
for(Standard_Integer iii=1; iii<MyNbAffinages; iii++)
NombreReelsAffinages*=4;
//Avec ce calcul on fait l'hypothese que chaque triangle affine donne quatre nouveaux triangles
//ce qui peut etre faux si on n'affine pas le triangle adjacent
//dans quel cas on n'obtient que deux nouveaux triangles
Standard_Integer FinTTAffinage = FinTTInit + NombreReelsAffinages;
for(Standard_Integer NumTriangle=FinTTInit; NumTriangle < FinTTAffinage; NumTriangle++)
TTriangles[NumTriangle].MiddleRefinement(NumTriangle,MySurface,TPoints,
TTriangles,TEdges);
}
}
Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b,
const IntPolyh_ArrayOfPoints &TPoints) const{
Standard_Integer Test=0;
Bnd_Box maboite;
const IntPolyh_Point& PA=TPoints[p1];
const IntPolyh_Point& PB=TPoints[p2];
const IntPolyh_Point& PC=TPoints[p3];
gp_Pnt pntA(PA.X(),PA.Y(),PA.Z());
gp_Pnt pntB(PB.X(),PB.Y(),PB.Z());
gp_Pnt pntC(PC.X(),PC.Y(),PC.Z());
maboite.Add(pntA);
maboite.Add(pntB);
maboite.Add(pntC);
maboite.Enlarge(Fleche+MyTolerance);
if (maboite.IsOut(b))
Test=0;
else
Test=1;
return(Test);
//Pour gagner du temps on pourrait envisager de garder la boite englobante dans la structure du triangle
}
void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAffinage,
const Bnd_Box &b,//boite englobante de l'autre surface
const Standard_Integer NumTri,
const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints,
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
const Standard_Integer FinTTInit = TTriangles.NbTriangles();
Standard_Integer CritereArret=FinTTInit+250;
//On sait qu'il faut affiner une fois au moins
MiddleRefinement(NumTri,MySurface,TPoints,
TTriangles,TEdges);
Standard_Integer FinTT = TTriangles.NbTriangles();// FinTT n'est pas une constante, elle augmente avec l'affinage
for(Standard_Integer iii=FinTTInit; iii<(FinTT=TTriangles.NbTriangles()); iii++) {
IntPolyh_Triangle& TriangleCourant = TTriangles[iii];
if(TriangleCourant.CompareBoxTriangle(b,TPoints)==0)
//On n'affine pas le triangle
TriangleCourant.IP=0;
else if (TriangleCourant.Fleche > CritereAffinage)
TriangleCourant.MiddleRefinement(iii,MySurface,TPoints,
TTriangles,TEdges);
if ( FinTT > CritereArret )//critere d'arret 250 nouveaux triangles
iii = FinTT;
}
}
void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
const IntPolyh_ArrayOfEdges &TEdges) {
const Standard_Integer FinTE = TEdges.NbEdges();
#ifndef DEB
Standard_Integer PE1 =0,PE2 =0;
#else
Standard_Integer PE1,PE2;
#endif
Standard_Integer Test=1;
if (EdgeIndex==1) { PE1=p1; PE2=p2; }
else if (EdgeIndex==2) { PE1=p2; PE2=p3; }
else if (EdgeIndex==3) { PE1=p3; PE2=p1; }
else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : No edge, No Edge\n");
# endif
Test=0;
}
if (Test!=0) {
for(Standard_Integer iioo=0; iioo<FinTE; iioo++) {
Standard_Integer EFP=TEdges[iioo].FirstPoint();
if (EFP==PE1) {
Standard_Integer ESP=TEdges[iioo].SecondPoint();
if (ESP!=EFP) {
if (ESP==PE2) {
SetEdgeOrientation(EdgeIndex,1);
SetEdge(EdgeIndex,iioo);
iioo=FinTE;
}
}
else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n");
# endif
Test=0;
}
}
else if (EFP==PE2) {
Standard_Integer ESP=TEdges[iioo].SecondPoint();
if (ESP!=EFP) {
if (ESP==PE1) {
SetEdgeOrientation(EdgeIndex,-1);
SetEdge(EdgeIndex,iioo);
iioo=FinTE;
}
}
else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n");
# endif
}
}
}
}
}
void IntPolyh_Triangle::Dump (const Standard_Integer i) const {
printf("\nTriangle(%3d) : Points %5d %5d %5d Edges %5d %5d %5d fleche: %8f intersection possible %8d intersection: %5d\n"
,i,p1,p2,p3,e1,e2,e3,Fleche,IP,II);
}
void IntPolyh_Triangle::DumpFleche (const Standard_Integer i) const {
printf("\nTriangle(%3d) fleche: %5f\n",i,Fleche);
}
/* Affinage par le barycentre
calcul du barycentre
remaillage
void IntPolyh_MaillageAffinage::RefinementG(const Standard_Integer SurfID,
IntPolyh_Triangle& MonTriangle){
Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
IntPolyh_ArrayOfTriangles &TTriangles=(SurfID==1)? TTriangles1:TTriangles2;
Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
Standard_Integer FinTP = TPoints.NbPoints();
Standard_Integer FinTT = TTriangles.NbTriangles();
Standard_Integer P1 = MonTriangle.FirstPoint();
Standard_Integer P2 = MonTriangle.SecondPoint();
Standard_Integer P3 = MonTriangle.ThirdPoint();
Standard_Real U,V,x,y,z;
U = (TPoints[P1].U()+TPoints[P2].U()+TPoints[P3].U())/3.0;
V = (TPoints[P1].V()+TPoints[P2].V()+TPoints[P3].V())/3.0;
gp_Pnt PtXYZ = (MaSurface)->Value(U, V);
IntPolyh_Point BarycentreTriangleReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V);
TPoints[FinTP]=BarycentreTriangleReel;
TTriangles[FinTT].SetFirstPoint(P1);
TTriangles[FinTT].SetSecondPoint(P2);
TTriangles[FinTT].SetThirdPoint(FinTP);
(TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints);
FinTT++;
TTriangles[FinTT].SetFirstPoint(P2);
TTriangles[FinTT].SetSecondPoint(P3);
TTriangles[FinTT].SetThirdPoint(FinTP);
(TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints);
FinTT++;
TTriangles[FinTT].SetFirstPoint(P3);
TTriangles[FinTT].SetSecondPoint(P1);
TTriangles[FinTT].SetThirdPoint(FinTP);
(TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints);
FinTT++;
// FinTP++;
TPoints.IncNbPoints();
TTriangles.SetNbTriangles(FinTT);
// Le triangle traite est maintenant obsolete
MonTriangle.SetFleche(-1.0);
}*/