1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0022923: The command 'intersect' throws an exception.

This commit is contained in:
PKV 2012-01-27 14:53:47 +00:00 committed by bugmaster
parent 572db63c30
commit 55ab6ed611
6 changed files with 1517 additions and 1306 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +0,0 @@
// 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

View File

@ -113,10 +113,20 @@ is
Dump(me; i: Integer from Standard) Dump(me; i: Integer from Standard)
is static; is static;
fields --modified by NIZNHY-PKV Fri Jan 20 12:11:36 2012 f
SetDegenerated(me:out;
theFlag:Boolean from Standard);
Degenerated(me)
returns Boolean from Standard;
--modified by NIZNHY-PKV Fri Jan 20 12:12:07 2012t
fields
x,y,z,u,v : Real from Standard; x,y,z,u,v : Real from Standard;
POC : Integer from Standard; POC : Integer from Standard;
--modified by NIZNHY-PKV Fri Jan 20 12:17:39 2012f
myDegenerated : Boolean from Standard;
--modified by NIZNHY-PKV Fri Jan 20 12:17:41 2012t
end Point from IntPolyh; end Point from IntPolyh;

View File

@ -9,44 +9,164 @@
#include <stdio.h> #include <stdio.h>
IntPolyh_Point::IntPolyh_Point() : x(0),y(0),z(0),u(0),v(0),POC(1) { //=======================================================================
//function : IntPolyh_Point
//purpose :
//=======================================================================
IntPolyh_Point::IntPolyh_Point()
:
x(0),y(0),z(0),u(0),v(0),POC(1),
myDegenerated(Standard_False)
{
} }
//=======================================================================
//function : IntPolyh_Point
//purpose :
//=======================================================================
IntPolyh_Point::IntPolyh_Point(const Standard_Real _x, IntPolyh_Point::IntPolyh_Point(const Standard_Real _x,
const Standard_Real _y, const Standard_Real _y,
const Standard_Real _z, const Standard_Real _z,
const Standard_Real _u, const Standard_Real _u,
const Standard_Real _v):POC(1) { const Standard_Real _v)
:
POC(1),
myDegenerated(Standard_False)
{
x=_x; y=_y; z=_z; u=_u; v=_v; x=_x; y=_y; z=_z; u=_u; v=_v;
} }
//=======================================================================
Standard_Real IntPolyh_Point::X() const { return(x); } //function : X
Standard_Real IntPolyh_Point::Y() const { return(y); } //purpose :
Standard_Real IntPolyh_Point::Z() const { return(z); } //=======================================================================
Standard_Real IntPolyh_Point::U() const { return(u); } Standard_Real IntPolyh_Point::X() const
Standard_Real IntPolyh_Point::V() const { return(v); } {
Standard_Integer IntPolyh_Point::PartOfCommon() const {return(POC);} return x;
}
//=======================================================================
void IntPolyh_Point::Set(const Standard_Real _x,const Standard_Real _y, const Standard_Real _z, //function : Y
const Standard_Real _u, const Standard_Real _v, const Standard_Integer II) { //purpose :
x=_x; y=_y; z=_z; u=_u; v=_v; POC=II;} //=======================================================================
Standard_Real IntPolyh_Point::Y() const
void IntPolyh_Point::Equal(const IntPolyh_Point &Pt) { {
return y;
}
//=======================================================================
//function : Z
//purpose :
//=======================================================================
Standard_Real IntPolyh_Point::Z() const
{
return z;
}
//=======================================================================
//function : U
//purpose :
//=======================================================================
Standard_Real IntPolyh_Point::U() const
{
return u;
}
//=======================================================================
//function : V
//purpose :
//=======================================================================
Standard_Real IntPolyh_Point::V() const
{
return v;
}
//=======================================================================
//function : PartOfCommon
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Point::PartOfCommon() const
{
return POC;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
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;
}
//=======================================================================
//function : Equal
//purpose :
//=======================================================================
void IntPolyh_Point::Equal(const IntPolyh_Point &Pt)
{
x = Pt.x; x = Pt.x;
y = Pt.y; y = Pt.y;
z = Pt.z; z = Pt.z;
u = Pt.u; u = Pt.u;
v = Pt.v; v = Pt.v;
} }
//=======================================================================
//function : SetX
//purpose :
//=======================================================================
void IntPolyh_Point::SetX(const Standard_Real _x)
{
x=_x;
}
//=======================================================================
//function : SetY
//purpose :
//=======================================================================
void IntPolyh_Point::SetY(const Standard_Real _y)
{
y=_y;
}
//=======================================================================
//function : SetZ
//purpose :
//=======================================================================
void IntPolyh_Point::SetZ(const Standard_Real _z)
{
z=_z;
}
//=======================================================================
//function : SetU
//purpose :
//=======================================================================
void IntPolyh_Point::SetU(const Standard_Real _u)
{
u=_u;
}
//=======================================================================
//function : SetV
//purpose :
//=======================================================================
void IntPolyh_Point::SetV(const Standard_Real _v)
{
v=_v;
}
//=======================================================================
//function : SetPartOfCommon
//purpose :
//=======================================================================
void IntPolyh_Point::SetPartOfCommon(const Standard_Integer ii)
{
POC=ii;
}
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; }
//=======================================================================
//function : Middle
//purpose :
//=======================================================================
void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface, void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface,
const IntPolyh_Point & Point1, const IntPolyh_Point & Point1,
const IntPolyh_Point & Point2){ const IntPolyh_Point & Point2){
@ -59,30 +179,45 @@ void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface,
y=PtXYZ.Y(); y=PtXYZ.Y();
z=PtXYZ.Z(); z=PtXYZ.Z();
} }
//=======================================================================
//function : Add
IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const{ //purpose :
//=======================================================================
IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const
{
IntPolyh_Point res; IntPolyh_Point res;
//
res.SetX(x+P1.X()); res.SetX(x+P1.X());
res.SetY(y+P1.Y()); res.SetY(y+P1.Y());
res.SetZ(z+P1.Z()); res.SetZ(z+P1.Z());
res.SetU(u+P1.U()); res.SetU(u+P1.U());
res.SetV(v+P1.V()); res.SetV(v+P1.V());
return(res); return res;
} }
IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const{ //=======================================================================
//function : Sub
//purpose :
//=======================================================================
IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const
{
IntPolyh_Point res; IntPolyh_Point res;
//
res.SetX(x-P1.X()); res.SetX(x-P1.X());
res.SetY(y-P1.Y()); res.SetY(y-P1.Y());
res.SetZ(z-P1.Z()); res.SetZ(z-P1.Z());
res.SetU(u-P1.U()); res.SetU(u-P1.U());
res.SetV(v-P1.V()); res.SetV(v-P1.V());
return(res); return res;
} }
//=======================================================================
IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const{ //function : Divide
//purpose :
//=======================================================================
IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const
{
IntPolyh_Point res; IntPolyh_Point res;
//
if (Abs(RR)>10.0e-20) { if (Abs(RR)>10.0e-20) {
res.SetX(x/RR); res.SetX(x/RR);
res.SetY(y/RR); res.SetY(y/RR);
@ -92,52 +227,94 @@ IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const{
} }
else { else {
printf("Division par zero RR=%f\n",RR); printf("Division par zero RR=%f\n",RR);
//Dump();
} }
return(res); return res;
} }
//=======================================================================
IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const{ //function : Multiplication
//purpose :
//=======================================================================
IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const
{
IntPolyh_Point res; IntPolyh_Point res;
//
res.SetX(x*RR); res.SetX(x*RR);
res.SetY(y*RR); res.SetY(y*RR);
res.SetZ(z*RR); res.SetZ(z*RR);
res.SetU(u*RR); res.SetU(u*RR);
res.SetV(v*RR); res.SetV(v*RR);
return(res); return res;
} }
//=======================================================================
Standard_Real IntPolyh_Point::SquareModulus()const{ //function : SquareModulus
//purpose :
//=======================================================================
Standard_Real IntPolyh_Point::SquareModulus()const
{
Standard_Real res=x*x+y*y+z*z; Standard_Real res=x*x+y*y+z*z;
return(res); return res;
} }
Standard_Real IntPolyh_Point::SquareDistance(const IntPolyh_Point &P2)const{ //=======================================================================
//function : SquareDistance
//purpose :
//=======================================================================
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); Standard_Real res=(x-P2.x)*(x-P2.x)+(y-P2.y)*(y-P2.y)+(z-P2.z)*(z-P2.z);
return(res); return res;
} }
//=======================================================================
//inline //function : Dot
Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const{ //purpose :
//=======================================================================
Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const
{
Standard_Real t=x*b.x+y*b.y+z*b.z; Standard_Real t=x*b.x+y*b.y+z*b.z;
return(t); return t;
} }
//=======================================================================
//inline //function : Cross
//purpose :
//=======================================================================
void IntPolyh_Point::Cross(const IntPolyh_Point &a,const IntPolyh_Point &b){ void IntPolyh_Point::Cross(const IntPolyh_Point &a,const IntPolyh_Point &b){
x=a.y*b.z-a.z*b.y; x=a.y*b.z-a.z*b.y;
y=a.z*b.x-a.x*b.z; y=a.z*b.x-a.x*b.z;
z=a.x*b.y-a.y*b.x; z=a.x*b.y-a.y*b.x;
//u=?
//v=?
} }
//=======================================================================
void IntPolyh_Point::Dump() const{ //function : Dump
//purpose :
//=======================================================================
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); 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{ //function : Dump
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); //purpose :
//=======================================================================
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);
}
//modified by NIZNHY-PKV Fri Jan 20 12:13:03 2012f
//=======================================================================
//function : SetDegenerated
//purpose :
//=======================================================================
void IntPolyh_Point::SetDegenerated(const Standard_Boolean theFlag)
{
myDegenerated=theFlag;
}
//=======================================================================
//function : Degenerated
//purpose :
//=======================================================================
Standard_Boolean IntPolyh_Point::Degenerated()const
{
return myDegenerated;
} }

View File

@ -15,45 +15,249 @@
#define MyConfusionPrecision 10.0e-12 #define MyConfusionPrecision 10.0e-12
#define SquareMyConfusionPrecision 10.0e-24 #define SquareMyConfusionPrecision 10.0e-24
//# ifdef DEB static
//#define MYDEBUG DEB void GetInfoTA(const Standard_Integer numP1,
//# else const Standard_Integer numP2,
//#define MYDEBUG 0 const Standard_Integer numTA,
//# endif const IntPolyh_ArrayOfTriangles & TTriangles,
Standard_Integer & numP3b,
Standard_Integer & P3bIndex,
Standard_Integer & Edge2b,
Standard_Integer & Edge3b);
static
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);
static
void NewEdge(const Standard_Integer P1,
const Standard_Integer P2,
const Standard_Integer T1,
const Standard_Integer T2,
IntPolyh_ArrayOfEdges & TEdges);
static
void OldEdge(const Standard_Integer EdgeN,
const Standard_Integer NumTri,
const Standard_Integer NewTriNum,
IntPolyh_ArrayOfEdges & TEdges) ;
static
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 );
IntPolyh_Triangle::IntPolyh_Triangle() : p1(-1),p2(-1),p3(-1), //=======================================================================
//function : IntPolyh_Triangle
//purpose :
//=======================================================================
IntPolyh_Triangle::IntPolyh_Triangle()
:
p1(-1),p2(-1),p3(-1),
e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0), e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0),
II(0),IP(1),Fleche(0.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) { } //function : IntPolyh_Triangle
//purpose :
Standard_Integer IntPolyh_Triangle::FirstPoint() const { return(p1); } //=======================================================================
Standard_Integer IntPolyh_Triangle::SecondPoint() const { return(p2); } IntPolyh_Triangle::IntPolyh_Triangle(const Standard_Integer a,
Standard_Integer IntPolyh_Triangle::ThirdPoint() const { return(p3); } const Standard_Integer b,
Standard_Integer IntPolyh_Triangle::FirstEdge() const { return(e1); } const Standard_Integer c)
Standard_Integer IntPolyh_Triangle::FirstEdgeOrientation() const { return(oe1); } :
Standard_Integer IntPolyh_Triangle::SecondEdge() const { return(e2); } p1(a),p2(b),p3(c),
Standard_Integer IntPolyh_Triangle::SecondEdgeOrientation() const { return(oe2); } e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0),
Standard_Integer IntPolyh_Triangle::ThirdEdge() const { return(e3); } II(0),IP(1),Fleche(0.0)
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); } //function : FirstPoint
//purpose :
void IntPolyh_Triangle::SetFirstPoint(const Standard_Integer a) { p1=a; } //=======================================================================
void IntPolyh_Triangle::SetSecondPoint(const Standard_Integer b) { p2=b; } Standard_Integer IntPolyh_Triangle::FirstPoint() const
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;} return(p1);
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;} //function : SecondPoint
void IntPolyh_Triangle::SetIndiceIntersectionPossible(const Standard_Integer I) { IP=I; } //purpose :
void IntPolyh_Triangle::SetIndiceIntersection(const Standard_Integer I) { II=I; } //=======================================================================
Standard_Integer IntPolyh_Triangle::SecondPoint() const
{
Standard_Integer IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeIndex) const { return(p2);
}
//=======================================================================
//function : ThirdPoint
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::ThirdPoint() const
{
return(p3);
}
//=======================================================================
//function : FirstEdge
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::FirstEdge() const
{
return(e1);
}
//=======================================================================
//function : FirstEdgeOrientation
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::FirstEdgeOrientation() const
{
return(oe1);
}
//=======================================================================
//function : SecondEdge
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::SecondEdge() const
{
return(e2);
}
//=======================================================================
//function : SecondEdgeOrientation
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::SecondEdgeOrientation() const
{
return(oe2);
}
//=======================================================================
//function : ThirdEdge
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::ThirdEdge() const
{
return(e3);
}
//=======================================================================
//function : ThirdEdgeOrientation
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::ThirdEdgeOrientation() const
{
return(oe3);
}
//=======================================================================
//function : GetFleche
//purpose :
//=======================================================================
Standard_Real IntPolyh_Triangle::GetFleche() const
{
return(Fleche);
}
//=======================================================================
//function : IndiceIntersectionPossible
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::IndiceIntersectionPossible() const
{
return(IP);
}
//=======================================================================
//function : IndiceIntersection
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::IndiceIntersection() const
{
return(II);
}
//=======================================================================
//function : SetFirstPoint
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetFirstPoint(const Standard_Integer a)
{
p1=a;
}
//=======================================================================
//function : SetSecondPoint
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetSecondPoint(const Standard_Integer b)
{
p2=b;
}
//=======================================================================
//function : SetThirdPoint
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetThirdPoint(const Standard_Integer c)
{
p3=c;
}
//=======================================================================
//function : SetFirstEdge
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetFirstEdge(const Standard_Integer e,
const Standard_Integer oe)
{
e1=e;
oe1=oe;
}
//=======================================================================
//function : SetSecondEdge
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetSecondEdge(const Standard_Integer f,
const Standard_Integer of)
{
e2=f;
oe2=of;
}
//=======================================================================
//function : SetThirdEdge
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetThirdEdge(const Standard_Integer g,
const Standard_Integer og)
{
e3=g;
oe3=og;
}
//=======================================================================
//function : SetFleche
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetFleche(const Standard_Real A)
{
Fleche=A;
}
//=======================================================================
//function : SetIndiceIntersectionPossible
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetIndiceIntersectionPossible(const Standard_Integer I)
{
IP=I;
}
//=======================================================================
//function : SetIndiceIntersection
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetIndiceIntersection(const Standard_Integer I)
{
II=I;
}
//=======================================================================
//function : GetEdgeNumber
//purpose :
//=======================================================================
Standard_Integer
IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeIndex) const
{
if(EdgeIndex==1) if(EdgeIndex==1)
return(e1); return(e1);
if(EdgeIndex==2) if(EdgeIndex==2)
@ -62,11 +266,14 @@ Standard_Integer IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeInd
return(e3); return(e3);
return 0; return 0;
} }
//=======================================================================
//function : SetEdge
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex, void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex,
const Standard_Integer EdgeNumber) { const Standard_Integer EdgeNumber)
{
if(EdgeIndex==1) if(EdgeIndex==1)
e1=EdgeNumber; e1=EdgeNumber;
if(EdgeIndex==2) if(EdgeIndex==2)
@ -74,8 +281,13 @@ void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex,
if(EdgeIndex==3) if(EdgeIndex==3)
e3=EdgeNumber; e3=EdgeNumber;
} }
//=======================================================================
Standard_Integer IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer EdgeIndex) const { //function : GetEdgeOrientation
//purpose :
//=======================================================================
Standard_Integer
IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer EdgeIndex) const
{
if(EdgeIndex==1) if(EdgeIndex==1)
return(oe1); return(oe1);
if(EdgeIndex==2) if(EdgeIndex==2)
@ -86,9 +298,13 @@ Standard_Integer IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer Ed
return 0; return 0;
} }
//=======================================================================
//function : SetEdgeOrientation
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex, void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex,
const Standard_Integer OrEd) { const Standard_Integer OrEd)
{
if(EdgeIndex==1) if(EdgeIndex==1)
oe1=OrEd; oe1=OrEd;
if(EdgeIndex==2) if(EdgeIndex==2)
@ -97,26 +313,47 @@ void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex,
oe3=OrEd; oe3=OrEd;
} }
/*Calcul de la fleche pour un triangle**************
//=======================================================================
//function : TriangleDeflection
//purpose :
/*Calcul de la fleche pour un triangle**************
Distance entre le plan forme par le triangle et Distance entre le plan forme par le triangle et
le barycentre situe sur la surface calcule avec les coordonnees Gu,Gv le barycentre situe sur la surface calcule avec les coordonnees Gu,Gv
(coordonnees du barycentre du triangle dans l'espace UV)*/ (coordonnees du barycentre du triangle dans l'espace UV)*/
//=======================================================================
void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MySurface, void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MySurface,
const IntPolyh_ArrayOfPoints& TPoints){ const IntPolyh_ArrayOfPoints& TPoints)
{
const IntPolyh_Point & P1 = TPoints[p1]; const IntPolyh_Point & P1 = TPoints[p1];
const IntPolyh_Point & P2 = TPoints[p2]; const IntPolyh_Point & P2 = TPoints[p2];
const IntPolyh_Point & P3 = TPoints[p3]; const IntPolyh_Point & P3 = TPoints[p3];
//
//modified by NIZNHY-PKV Fri Jan 20 14:25:11 2012f
{
Standard_Integer iDeg1, iDeg2, iDeg3, iDeg;
//
iDeg1=(P1.Degenerated()) ? 1 : 0;
iDeg2=(P2.Degenerated()) ? 1 : 0;
iDeg3=(P3.Degenerated()) ? 1 : 0;
iDeg=iDeg1+iDeg2+iDeg3;
if (iDeg>1) {
Fleche=0.;
return;
}
}
//modified by NIZNHY-PKV Fri Jan 20 14:25:13 2012t
Standard_Real Gu, Gv, SqNorme;
gp_Pnt PtXYZ;
//
Gu=(P1.U()+P2.U()+P3.U())/3.0;
Gv=(P1.V()+P2.V()+P3.V())/3.0;
Standard_Real Gu=(P1.U()+P2.U()+P3.U())/3.0; PtXYZ = (MySurface)->Value( Gu, Gv);
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 BarycentreReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), Gu, Gv);
IntPolyh_Point NormaleTri; IntPolyh_Point NormaleTri;
NormaleTri.Cross(P2-P1,P3-P1); NormaleTri.Cross(P2-P1,P3-P1);
Standard_Real SqNorme=NormaleTri.SquareModulus(); SqNorme=NormaleTri.SquareModulus();
if (SqNorme > SquareMyConfusionPrecision) { if (SqNorme > SquareMyConfusionPrecision) {
NormaleTri=NormaleTri/sqrt(SqNorme); NormaleTri=NormaleTri/sqrt(SqNorme);
@ -125,33 +362,10 @@ void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MyS
else { else {
// On calcule la fleche sur le plus grand des edges // On calcule la fleche sur le plus grand des edges
// calcul des longueurs des cotes au carre // calcul des longueurs des cotes au carre
Standard_Real L12 = P1.SquareDistance(P2); Standard_Real L12 = P1.SquareDistance(P2);
Standard_Real L23 = P2.SquareDistance(P3); Standard_Real L23 = P2.SquareDistance(P3);
Standard_Real L31 = P3.SquareDistance(P1); 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 IntPolyh_Point Milieu; // milieu du plus grand des edges
if ((L12>L23) && (L12>L31)) if ((L12>L23) && (L12>L31))
@ -168,11 +382,17 @@ void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MyS
} }
} }
Standard_Integer IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1, //=======================================================================
//function : CheckCommonEdge
//purpose :
//=======================================================================
Standard_Integer
IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1,
const Standard_Integer PT2, const Standard_Integer PT2,
const Standard_Integer PT3, const Standard_Integer PT3,
const Standard_Integer Index, const Standard_Integer Index,
const IntPolyh_ArrayOfTriangles &TTriangles) const { const IntPolyh_ArrayOfTriangles &TTriangles) const
{
Standard_Integer P1,P2,P3,res=-1; Standard_Integer P1,P2,P3,res=-1;
P1=TTriangles[Index].FirstPoint(); P1=TTriangles[Index].FirstPoint();
P2=TTriangles[Index].SecondPoint(); P2=TTriangles[Index].SecondPoint();
@ -188,10 +408,15 @@ Standard_Integer IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1,
else res=-1; else res=-1;
return(res); return(res);
} }
//=======================================================================
Standard_Integer IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumTri, //function : GetNextTriangle2
//purpose :
//=======================================================================
Standard_Integer
IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumTri,
const Standard_Integer NumEdge, const Standard_Integer NumEdge,
const IntPolyh_ArrayOfEdges &TEdges) const { const IntPolyh_ArrayOfEdges &TEdges) const
{
Standard_Integer NumNextTri=-1; Standard_Integer NumNextTri=-1;
if (NumEdge==1) { if (NumEdge==1) {
const IntPolyh_Edge & Edge1=TEdges[e1]; const IntPolyh_Edge & Edge1=TEdges[e1];
@ -214,26 +439,20 @@ Standard_Integer IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumT
else else
NumNextTri=Edge3.FirstTriangle(); 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); return (NumNextTri);
} }
//=======================================================================
//function : LinkEdges2Triangle
//purpose :
//=======================================================================
void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges, void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges,
const Standard_Integer edge1, const Standard_Integer edge1,
const Standard_Integer edge2, const Standard_Integer edge2,
const Standard_Integer edge3) { const Standard_Integer edge3) {
if( (edge1<0)||(edge2<0)||(edge3<0) ) { 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 { else {
e1=edge1; e1=edge1;
@ -249,6 +468,10 @@ void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges,
} }
} }
//=======================================================================
//function : GetInfoTA
//purpose :
//=======================================================================
void GetInfoTA(const Standard_Integer numP1, void GetInfoTA(const Standard_Integer numP1,
const Standard_Integer numP2, const Standard_Integer numP2,
const Standard_Integer numTA, const Standard_Integer numTA,
@ -256,7 +479,8 @@ void GetInfoTA(const Standard_Integer numP1,
Standard_Integer & numP3b, Standard_Integer & numP3b,
Standard_Integer & P3bIndex, Standard_Integer & P3bIndex,
Standard_Integer & Edge2b, Standard_Integer & Edge2b,
Standard_Integer & Edge3b) { Standard_Integer & Edge3b)
{
/// On veut savoir quel est le troisieme point du triangle /// On veut savoir quel est le troisieme point du triangle
/// adjacent (TriAdj) et quel sont les edges partant de ce point /// adjacent (TriAdj) et quel sont les edges partant de ce point
const IntPolyh_Triangle & TriAdj=TTriangles[numTA]; const IntPolyh_Triangle & TriAdj=TTriangles[numTA];
@ -306,13 +530,12 @@ void GetInfoTA(const Standard_Integer numP1,
Edge3b=TriAdj.ThirdEdge(); Edge3b=TriAdj.ThirdEdge();
} }
} }
if(numP3b<0) {
# if MYDEBUG
printf("ERROR1 refinement with null Point\n");
# endif
}
} }
//=======================================================================
//function : NewTriangle
//purpose :
//=======================================================================
void NewTriangle(const Standard_Integer P1, void NewTriangle(const Standard_Integer P1,
const Standard_Integer P2, const Standard_Integer P2,
const Standard_Integer P3, const Standard_Integer P3,
@ -327,16 +550,19 @@ void NewTriangle(const Standard_Integer P1,
TTriangles.IncNbTriangles(); TTriangles.IncNbTriangles();
} }
//=======================================================================
//function : NewEdge
//purpose :
//=======================================================================
void NewEdge(const Standard_Integer P1, void NewEdge(const Standard_Integer P1,
const Standard_Integer P2, const Standard_Integer P2,
const Standard_Integer T1, const Standard_Integer T1,
const Standard_Integer T2, const Standard_Integer T2,
IntPolyh_ArrayOfEdges & TEdges) { IntPolyh_ArrayOfEdges & TEdges)
//#ifndef DEB {
const Standard_Integer FinTE = TEdges.NbEdges(); const Standard_Integer FinTE = TEdges.NbEdges();
//#else
// const FinTE = TEdges.NbEdges();
//#endif
TEdges[FinTE].SetFirstPoint(P1); TEdges[FinTE].SetFirstPoint(P1);
TEdges[FinTE].SetSecondPoint(P2); TEdges[FinTE].SetSecondPoint(P2);
TEdges[FinTE].SetFirstTriangle(T1); TEdges[FinTE].SetFirstTriangle(T1);
@ -344,14 +570,27 @@ void NewEdge(const Standard_Integer P1,
TEdges.IncNbEdges(); TEdges.IncNbEdges();
} }
//=======================================================================
//function : OldEdge
//purpose :
//=======================================================================
void OldEdge(const Standard_Integer EdgeN, void OldEdge(const Standard_Integer EdgeN,
const Standard_Integer NumTri, const Standard_Integer NumTri,
const Standard_Integer NewTriNum, const Standard_Integer NewTriNum,
IntPolyh_ArrayOfEdges & TEdges) { IntPolyh_ArrayOfEdges & TEdges)
if(TEdges[EdgeN].FirstTriangle()==NumTri) TEdges[EdgeN].SetFirstTriangle(NewTriNum); {
else TEdges[EdgeN].SetSecondTriangle(NewTriNum); if(TEdges[EdgeN].FirstTriangle()==NumTri){
TEdges[EdgeN].SetFirstTriangle(NewTriNum);
}
else{
TEdges[EdgeN].SetSecondTriangle(NewTriNum);
}
} }
//=======================================================================
//function : TestOldEdgeB
//purpose :
//=======================================================================
void TestOldEdgeB(const Standard_Integer NumTA, void TestOldEdgeB(const Standard_Integer NumTA,
const Standard_Integer numPtT1, const Standard_Integer numPtT1,
const Standard_Integer numPtT2, const Standard_Integer numPtT2,
@ -360,7 +599,8 @@ void TestOldEdgeB(const Standard_Integer NumTA,
const IntPolyh_ArrayOfTriangles & TTriangles, const IntPolyh_ArrayOfTriangles & TTriangles,
const Standard_Integer Edge1, const Standard_Integer Edge1,
const Standard_Integer Edge3, const Standard_Integer Edge3,
IntPolyh_ArrayOfEdges & TEdges ) { IntPolyh_ArrayOfEdges & TEdges )
{
if( (TEdges[Edge1].FirstPoint() == numPtT1) if( (TEdges[Edge1].FirstPoint() == numPtT1)
||(TEdges[Edge1].SecondPoint()== numPtT1) ) { ||(TEdges[Edge1].SecondPoint()== numPtT1) ) {
@ -383,8 +623,10 @@ void TestOldEdgeB(const Standard_Integer NumTA,
else TEdges[Edge1].SetSecondTriangle(T2); else TEdges[Edge1].SetSecondTriangle(T2);
} }
} }
//=======================================================================
//function : MiddleRefinement
//purpose :
//=======================================================================
void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri, void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
const Handle(Adaptor3d_HSurface)& MySurface, const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints, IntPolyh_ArrayOfPoints &TPoints,
@ -679,6 +921,10 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
TPoints.IncNbPoints(); TPoints.IncNbPoints();
} }
//=======================================================================
//function : MultipleMiddleRefinement
//purpose :
//=======================================================================
void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffinages, void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffinages,
const Standard_Integer NumTri, const Standard_Integer NumTri,
const Handle(Adaptor3d_HSurface)& MySurface, const Handle(Adaptor3d_HSurface)& MySurface,
@ -720,6 +966,10 @@ void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffina
} }
} }
//=======================================================================
//function : CompareBoxTriangle
//purpose :
//=======================================================================
Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b, Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b,
const IntPolyh_ArrayOfPoints &TPoints) const{ const IntPolyh_ArrayOfPoints &TPoints) const{
Standard_Integer Test=0; Standard_Integer Test=0;
@ -742,6 +992,10 @@ Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b,
//Pour gagner du temps on pourrait envisager de garder la boite englobante dans la structure du triangle //Pour gagner du temps on pourrait envisager de garder la boite englobante dans la structure du triangle
} }
//=======================================================================
//function : MultipleMiddleRefinement2
//purpose :
//=======================================================================
void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAffinage, void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAffinage,
const Bnd_Box &b,//boite englobante de l'autre surface const Bnd_Box &b,//boite englobante de l'autre surface
const Standard_Integer NumTri, const Standard_Integer NumTri,
@ -773,23 +1027,22 @@ void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAff
} }
} }
//=======================================================================
//function : SetEdgeandOrientation
//purpose :
//=======================================================================
void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex, void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
const IntPolyh_ArrayOfEdges &TEdges) { const IntPolyh_ArrayOfEdges &TEdges) {
const Standard_Integer FinTE = TEdges.NbEdges(); const Standard_Integer FinTE = TEdges.NbEdges();
#ifndef DEB
Standard_Integer PE1 =0,PE2 =0; Standard_Integer PE1 =0,PE2 =0;
#else
Standard_Integer PE1,PE2;
#endif
Standard_Integer Test=1; Standard_Integer Test=1;
if (EdgeIndex==1) { PE1=p1; PE2=p2; } if (EdgeIndex==1) { PE1=p1; PE2=p2; }
else if (EdgeIndex==2) { PE1=p2; PE2=p3; } else if (EdgeIndex==2) { PE1=p2; PE2=p3; }
else if (EdgeIndex==3) { PE1=p3; PE2=p1; } else if (EdgeIndex==3) { PE1=p3; PE2=p1; }
else { else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : No edge, No Edge\n");
# endif
Test=0; Test=0;
} }
if (Test!=0) { if (Test!=0) {
@ -805,9 +1058,7 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
} }
} }
else { else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n");
# endif
Test=0; Test=0;
} }
} }
@ -821,9 +1072,7 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
} }
} }
else { else {
# if MYDEBUG
printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n");
# endif
} }
} }
} }
@ -831,72 +1080,22 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
} }
void IntPolyh_Triangle::Dump (const Standard_Integer i) const { //=======================================================================
//function : Dump
//purpose :
//=======================================================================
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" 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); ,i,p1,p2,p3,e1,e2,e3,Fleche,IP,II);
} }
//=======================================================================
//function : DumpFleche
//purpose :
//=======================================================================
void IntPolyh_Triangle::DumpFleche (const Standard_Integer i) const { void IntPolyh_Triangle::DumpFleche (const Standard_Integer i) const {
printf("\nTriangle(%3d) fleche: %5f\n",i,Fleche); 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);
}*/