1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0027870: Modeling - refactoring of HLR algorithms

Toolkit 'TKHLR' was fully refactored for 'Standard_Address' and macros except about half of package 'HLRBREP' there 'Standard_Address' is used through the 'generic' mechanism.
This commit is contained in:
abk
2016-10-05 13:49:44 +03:00
committed by apn
parent 4a6d278356
commit 681f3919f0
69 changed files with 2533 additions and 3949 deletions

View File

@@ -6,9 +6,7 @@ HLRAlgo_Array1OfPISeg.hxx
HLRAlgo_Array1OfTData.hxx
HLRAlgo_BiPoint.cxx
HLRAlgo_BiPoint.hxx
HLRAlgo_Coincidence.cxx
HLRAlgo_Coincidence.hxx
HLRAlgo_Coincidence.lxx
HLRAlgo_EdgeIterator.cxx
HLRAlgo_EdgeIterator.hxx
HLRAlgo_EdgeIterator.lxx
@@ -36,15 +34,13 @@ HLRAlgo_PolyData.cxx
HLRAlgo_PolyData.hxx
HLRAlgo_PolyData.lxx
HLRAlgo_PolyHidingData.hxx
HLRAlgo_PolyHidingData.lxx
HLRAlgo_PolyInternalData.cxx
HLRAlgo_PolyInternalData.hxx
HLRAlgo_PolyInternalData.lxx
HLRAlgo_PolyInternalNode.cxx
HLRAlgo_PolyInternalNode.hxx
HLRAlgo_PolyInternalNode.lxx
HLRAlgo_PolyInternalSegment.hxx
HLRAlgo_PolyInternalSegment.lxx
HLRAlgo_PolyMask.hxx
HLRAlgo_PolyShellData.cxx
HLRAlgo_PolyShellData.hxx
HLRAlgo_PolyShellData.lxx
@@ -52,7 +48,5 @@ HLRAlgo_Projector.cxx
HLRAlgo_Projector.hxx
HLRAlgo_Projector.lxx
HLRAlgo_TriangleData.hxx
HLRAlgo_TriangleData.lxx
HLRAlgo_WiresBlock.cxx
HLRAlgo_WiresBlock.hxx
HLRAlgo_WiresBlock.lxx

View File

@@ -40,8 +40,8 @@ static const Standard_Real sinu6 = sin(6.*M_PI/14.);
void HLRAlgo::UpdateMinMax (const Standard_Real x,
const Standard_Real y,
const Standard_Real z,
const Standard_Address Min,
const Standard_Address Max)
Standard_Real Min[16],
Standard_Real Max[16])
{
Standard_Real d[16];
d[ 0] = cosu0 * x + sinu0 * y;
@@ -61,12 +61,16 @@ void HLRAlgo::UpdateMinMax (const Standard_Real x,
d[14] = z;
d[15] = z;
Standard_Integer i = 0;
while (i < 16)
for (Standard_Integer i = 0; i < 16; ++i)
{
if (((Standard_Real*)Min)[i] > d[i]) ((Standard_Real*)Min)[i] = d[i];
if (((Standard_Real*)Max)[i] < d[i]) ((Standard_Real*)Max)[i] = d[i];
i++;
if (Min[i] > d[i])
{
Min[i] = d[i];
}
if (Max[i] < d[i])
{
Max[i] = d[i];
}
}
}
@@ -76,14 +80,14 @@ void HLRAlgo::UpdateMinMax (const Standard_Real x,
//=======================================================================
void HLRAlgo::EnlargeMinMax (const Standard_Real tol,
const Standard_Address Min,
const Standard_Address Max)
Standard_Real Min[16],
Standard_Real Max[16])
{
Standard_Integer i = 0;
while (i < 16)
{
((Standard_Real*)Min)[i] -= tol;
((Standard_Real*)Max)[i] += tol;
Min[i] -= tol;
Max[i] += tol;
i++;
}
}
@@ -94,14 +98,14 @@ void HLRAlgo::EnlargeMinMax (const Standard_Real tol,
//=======================================================================
void HLRAlgo::InitMinMax (const Standard_Real Big,
const Standard_Address Min,
const Standard_Address Max)
Standard_Real Min[16],
Standard_Real Max[16])
{
Standard_Integer i = 0;
while (i < 16)
{
((Standard_Real*)Min)[i] = Big;
((Standard_Real*)Max)[i] = -Big;
Min[i] = Big;
Max[i] = -Big;
i++;
}
}
@@ -111,42 +115,42 @@ void HLRAlgo::InitMinMax (const Standard_Real Big,
//purpose :
//=======================================================================
void HLRAlgo::EncodeMinMax (const Standard_Address Min,
const Standard_Address Max,
const Standard_Address MM)
void HLRAlgo::EncodeMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& Min,
HLRAlgo_EdgesBlock::MinMaxIndices& Max,
HLRAlgo_EdgesBlock::MinMaxIndices& MM)
{
((Standard_Integer*)MM)[ 0] = ((Standard_Integer*)Min)[ 1]&0x00007fff;
((Standard_Integer*)MM)[ 8] = ((Standard_Integer*)Max)[ 1]&0x00007fff;
((Standard_Integer*)MM)[ 0]+=(((Standard_Integer*)Min)[ 0]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 8]+=(((Standard_Integer*)Max)[ 0]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 1] = ((Standard_Integer*)Min)[ 3]&0x00007fff;
((Standard_Integer*)MM)[ 9] = ((Standard_Integer*)Max)[ 3]&0x00007fff;
((Standard_Integer*)MM)[ 1]+=(((Standard_Integer*)Min)[ 2]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 9]+=(((Standard_Integer*)Max)[ 2]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 2] = ((Standard_Integer*)Min)[ 5]&0x00007fff;
((Standard_Integer*)MM)[10] = ((Standard_Integer*)Max)[ 5]&0x00007fff;
((Standard_Integer*)MM)[ 2]+=(((Standard_Integer*)Min)[ 4]&0x00007fff)<<16;
((Standard_Integer*)MM)[10]+=(((Standard_Integer*)Max)[ 4]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 3] = ((Standard_Integer*)Min)[ 7]&0x00007fff;
((Standard_Integer*)MM)[11] = ((Standard_Integer*)Max)[ 7]&0x00007fff;
((Standard_Integer*)MM)[ 3]+=(((Standard_Integer*)Min)[ 6]&0x00007fff)<<16;
((Standard_Integer*)MM)[11]+=(((Standard_Integer*)Max)[ 6]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 4] = ((Standard_Integer*)Min)[ 9]&0x00007fff;
((Standard_Integer*)MM)[12] = ((Standard_Integer*)Max)[ 9]&0x00007fff;
((Standard_Integer*)MM)[ 4]+=(((Standard_Integer*)Min)[ 8]&0x00007fff)<<16;
((Standard_Integer*)MM)[12]+=(((Standard_Integer*)Max)[ 8]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 5] = ((Standard_Integer*)Min)[11]&0x00007fff;
((Standard_Integer*)MM)[13] = ((Standard_Integer*)Max)[11]&0x00007fff;
((Standard_Integer*)MM)[ 5]+=(((Standard_Integer*)Min)[10]&0x00007fff)<<16;
((Standard_Integer*)MM)[13]+=(((Standard_Integer*)Max)[10]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 6] = ((Standard_Integer*)Min)[13]&0x00007fff;
((Standard_Integer*)MM)[14] = ((Standard_Integer*)Max)[13]&0x00007fff;
((Standard_Integer*)MM)[ 6]+=(((Standard_Integer*)Min)[12]&0x00007fff)<<16;
((Standard_Integer*)MM)[14]+=(((Standard_Integer*)Max)[12]&0x00007fff)<<16;
((Standard_Integer*)MM)[ 7] = ((Standard_Integer*)Min)[15]&0x00007fff;
((Standard_Integer*)MM)[15] = ((Standard_Integer*)Max)[15]&0x00007fff;
((Standard_Integer*)MM)[ 7]+=(((Standard_Integer*)Min)[14]&0x00007fff)<<16;
((Standard_Integer*)MM)[15]+=(((Standard_Integer*)Max)[14]&0x00007fff)<<16;
MM.Min[0] = Min.Min[1] & 0x00007fff;
MM.Max[0] = Max.Min[1] & 0x00007fff;
MM.Min[0] += (Min.Min[0] & 0x00007fff) << 16;
MM.Max[0] += (Max.Min[0] & 0x00007fff) <<16;
MM.Min[1] = Min.Min[3] & 0x00007fff;
MM.Max[1] = Max.Min[3] & 0x00007fff;
MM.Min[1] += (Min.Min[2] & 0x00007fff) << 16;
MM.Max[1] += (Max.Min[2] & 0x00007fff) << 16;
MM.Min[2] = Min.Min[5] & 0x00007fff;
MM.Max[2] = Max.Min[5] & 0x00007fff;
MM.Min[2] += (Min.Min[4] & 0x00007fff) << 16;
MM.Max[2] += (Max.Min[4] & 0x00007fff) << 16;
MM.Min[3] = Min.Min[7] & 0x00007fff;
MM.Max[3] = Max.Min[7] & 0x00007fff;
MM.Min[3] += (Min.Min[6] & 0x00007fff) << 16;
MM.Max[3] += (Max.Min[6] & 0x00007fff) << 16;
MM.Min[4] = Min.Max[1] & 0x00007fff;
MM.Max[4] = Max.Max[1] & 0x00007fff;
MM.Min[4] += (Min.Max[0] & 0x00007fff) << 16;
MM.Max[4] += (Max.Max[0] & 0x00007fff) << 16;
MM.Min[5] = Min.Max[3] & 0x00007fff;
MM.Max[5] = Max.Max[3] & 0x00007fff;
MM.Min[5] += (Min.Max[2] & 0x00007fff) << 16;
MM.Max[5] += (Max.Max[2] & 0x00007fff) << 16;
MM.Min[6] = Min.Max[5] & 0x00007fff;
MM.Max[6] = Max.Max[5] & 0x00007fff;
MM.Min[6] += (Min.Max[4] & 0x00007fff) << 16;
MM.Max[6] += (Max.Max[4] & 0x00007fff) << 16;
MM.Min[7] = Min.Max[7] & 0x00007fff;
MM.Max[7] = Max.Max[7] & 0x00007fff;
MM.Min[7] += (Min.Max[6] & 0x00007fff) << 16;
MM.Max[7] += (Max.Max[6] & 0x00007fff) << 16;
}
//=======================================================================
@@ -154,15 +158,17 @@ void HLRAlgo::EncodeMinMax (const Standard_Address Min,
//purpose :
//=======================================================================
Standard_Real HLRAlgo::SizeBox(const Standard_Address Min,
const Standard_Address Max)
Standard_Real HLRAlgo::SizeBox(HLRAlgo_EdgesBlock::MinMaxIndices& Min,
HLRAlgo_EdgesBlock::MinMaxIndices& Max)
{
Standard_Real s = ((Standard_Integer *)Max)[0] - ((Standard_Integer *)Min)[0];
Standard_Integer i = 1;
while (i < 14)
Standard_Real s = Max.Min[0] - Min.Min[0];
for (Standard_Integer aI = 1; aI < 8; ++aI)
{
s *= ((Standard_Integer *)Max)[i] - ((Standard_Integer *)Min)[i];
i++;
s *= Max.Min[aI] - Min.Min[aI];
}
for (Standard_Integer aI = 0; aI < 6; ++aI)
{
s *= Max.Max[aI] - Min.Max[aI];
}
return s;
}
@@ -172,61 +178,42 @@ Standard_Real HLRAlgo::SizeBox(const Standard_Address Min,
//purpose :
//=======================================================================
void HLRAlgo::DecodeMinMax (const Standard_Address MM,
const Standard_Address Min,
const Standard_Address Max)
void HLRAlgo::DecodeMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& MM,
HLRAlgo_EdgesBlock::MinMaxIndices& Min,
HLRAlgo_EdgesBlock::MinMaxIndices& Max)
{
((Standard_Integer*)Min)[ 0]=(((Standard_Integer*)MM)[ 0]&0x7fff0000)>>16;
((Standard_Integer*)Max)[ 0]=(((Standard_Integer*)MM)[ 8]&0x7fff0000)>>16;
((Standard_Integer*)Min)[ 1]= ((Standard_Integer*)MM)[ 0]&0x00007fff;
((Standard_Integer*)Max)[ 1]= ((Standard_Integer*)MM)[ 8]&0x00007fff;
((Standard_Integer*)Min)[ 2]=(((Standard_Integer*)MM)[ 1]&0x7fff0000)>>16;
((Standard_Integer*)Max)[ 2]=(((Standard_Integer*)MM)[ 9]&0x7fff0000)>>16;
((Standard_Integer*)Min)[ 3]= ((Standard_Integer*)MM)[ 1]&0x00007fff;
((Standard_Integer*)Max)[ 3]= ((Standard_Integer*)MM)[ 9]&0x00007fff;
((Standard_Integer*)Min)[ 4]=(((Standard_Integer*)MM)[ 2]&0x7fff0000)>>16;
((Standard_Integer*)Max)[ 4]=(((Standard_Integer*)MM)[10]&0x7fff0000)>>16;
((Standard_Integer*)Min)[ 5]= ((Standard_Integer*)MM)[ 2]&0x00007fff;
((Standard_Integer*)Max)[ 5]= ((Standard_Integer*)MM)[10]&0x00007fff;
((Standard_Integer*)Min)[ 6]=(((Standard_Integer*)MM)[ 3]&0x7fff0000)>>16;
((Standard_Integer*)Max)[ 6]=(((Standard_Integer*)MM)[11]&0x7fff0000)>>16;
((Standard_Integer*)Min)[ 7]= ((Standard_Integer*)MM)[ 3]&0x00007fff;
((Standard_Integer*)Max)[ 7]= ((Standard_Integer*)MM)[11]&0x00007fff;
((Standard_Integer*)Min)[ 8]=(((Standard_Integer*)MM)[ 4]&0x7fff0000)>>16;
((Standard_Integer*)Max)[ 8]=(((Standard_Integer*)MM)[12]&0x7fff0000)>>16;
((Standard_Integer*)Min)[ 9]= ((Standard_Integer*)MM)[ 4]&0x00007fff;
((Standard_Integer*)Max)[ 9]= ((Standard_Integer*)MM)[12]&0x00007fff;
((Standard_Integer*)Min)[10]=(((Standard_Integer*)MM)[ 5]&0x7fff0000)>>16;
((Standard_Integer*)Max)[10]=(((Standard_Integer*)MM)[13]&0x7fff0000)>>16;
((Standard_Integer*)Min)[11]= ((Standard_Integer*)MM)[ 5]&0x00007fff;
((Standard_Integer*)Max)[11]= ((Standard_Integer*)MM)[13]&0x00007fff;
((Standard_Integer*)Min)[12]=(((Standard_Integer*)MM)[ 6]&0x7fff0000)>>16;
((Standard_Integer*)Max)[12]=(((Standard_Integer*)MM)[14]&0x7fff0000)>>16;
((Standard_Integer*)Min)[13]= ((Standard_Integer*)MM)[ 6]&0x00007fff;
((Standard_Integer*)Max)[13]= ((Standard_Integer*)MM)[14]&0x00007fff;
((Standard_Integer*)Min)[14]=(((Standard_Integer*)MM)[ 7]&0x7fff0000)>>16;
((Standard_Integer*)Max)[14]=(((Standard_Integer*)MM)[15]&0x7fff0000)>>16;
((Standard_Integer*)Min)[15]= ((Standard_Integer*)MM)[ 7]&0x00007fff;
((Standard_Integer*)Max)[15]= ((Standard_Integer*)MM)[15]&0x00007fff;
}
//=======================================================================
//function :CopyMinMax
//purpose :
//=======================================================================
void HLRAlgo::CopyMinMax (const Standard_Address IMin,
const Standard_Address IMax,
const Standard_Address OMin,
const Standard_Address OMax)
{
Standard_Integer i = 0;
while (i < 16)
{
((Standard_Integer*)OMin)[i]=((Standard_Integer*)IMin)[i];
((Standard_Integer*)OMax)[i]=((Standard_Integer*)IMax)[i];
i++;
}
Min.Min[0] =(MM.Min[0] & 0x7fff0000)>>16;
Max.Min[0] =(MM.Max[0] & 0x7fff0000)>>16;
Min.Min[1] = MM.Min[0] & 0x00007fff;
Max.Min[1] = MM.Max[0] & 0x00007fff;
Min.Min[2] =(MM.Min[1] & 0x7fff0000)>>16;
Max.Min[2] =(MM.Max[1] & 0x7fff0000)>>16;
Min.Min[3] = MM.Min[1] & 0x00007fff;
Max.Min[3] = MM.Max[1] & 0x00007fff;
Min.Min[4] =(MM.Min[2] & 0x7fff0000)>>16;
Max.Min[4] =(MM.Max[2] & 0x7fff0000)>>16;
Min.Min[5] = MM.Min[2] & 0x00007fff;
Max.Min[5] = MM.Max[2] & 0x00007fff;
Min.Min[6] =(MM.Min[3] & 0x7fff0000)>>16;
Max.Min[6] =(MM.Max[3] & 0x7fff0000)>>16;
Min.Min[7] = MM.Min[3] & 0x00007fff;
Max.Min[7] = MM.Max[3] & 0x00007fff;
Min.Max[0] =(MM.Min[4] & 0x7fff0000)>>16;
Max.Max[0] =(MM.Max[4] & 0x7fff0000)>>16;
Min.Max[1] = MM.Min[4] & 0x00007fff;
Max.Max[1] = MM.Max[4] & 0x00007fff;
Min.Max[2] =(MM.Min[5] & 0x7fff0000)>>16;
Max.Max[2] =(MM.Max[5] & 0x7fff0000)>>16;
Min.Max[3] = MM.Min[5] & 0x00007fff;
Max.Max[3] = MM.Max[5] & 0x00007fff;
Min.Max[4] =(MM.Min[6] & 0x7fff0000)>>16;
Max.Max[4] =(MM.Max[6] & 0x7fff0000)>>16;
Min.Max[5] = MM.Min[6] & 0x00007fff;
Max.Max[5] = MM.Max[6] & 0x00007fff;
Min.Max[6] =(MM.Min[7] & 0x7fff0000)>>16;
Max.Max[6] =(MM.Max[7] & 0x7fff0000)>>16;
Min.Max[7] = MM.Min[7] & 0x00007fff;
Max.Max[7] = MM.Max[7] & 0x00007fff;
}
//=======================================================================
@@ -234,18 +221,11 @@ void HLRAlgo::CopyMinMax (const Standard_Address IMin,
//purpose :
//=======================================================================
void HLRAlgo::AddMinMax (const Standard_Address IMin,
const Standard_Address IMax,
const Standard_Address OMin,
const Standard_Address OMax)
void HLRAlgo::AddMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin,
HLRAlgo_EdgesBlock::MinMaxIndices& IMax,
HLRAlgo_EdgesBlock::MinMaxIndices& OMin,
HLRAlgo_EdgesBlock::MinMaxIndices& OMax)
{
Standard_Integer i = 0;
while (i < 16)
{
if (((Standard_Integer*)OMin)[i] > ((Standard_Integer*)IMin)[i])
((Standard_Integer*)OMin)[i]=((Standard_Integer*)IMin)[i];
if (((Standard_Integer*)OMax)[i] < ((Standard_Integer*)IMax)[i])
((Standard_Integer*)OMax)[i]=((Standard_Integer*)IMax)[i];
i++;
}
OMin.Minimize(IMin);
OMax.Maximize(IMax);
}

View File

@@ -17,12 +17,14 @@
#ifndef _HLRAlgo_HeaderFile
#define _HLRAlgo_HeaderFile
#include <HLRAlgo_WiresBlock.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Address.hxx>
class HLRAlgo_BiPoint;
class HLRAlgo_PolyShellData;
class HLRAlgo_PolyInternalData;
@@ -73,21 +75,25 @@ public:
//! Iterator on the visible or hidden parts of an
//! EdgeStatus.
Standard_EXPORT static void UpdateMinMax (const Standard_Real x, const Standard_Real y, const Standard_Real z, const Standard_Address Min, const Standard_Address Max);
Standard_EXPORT static void UpdateMinMax (const Standard_Real x, const Standard_Real y, const Standard_Real z, Standard_Real Min[16], Standard_Real Max[16]);
Standard_EXPORT static void EnlargeMinMax (const Standard_Real tol, const Standard_Address Min, const Standard_Address Max);
Standard_EXPORT static void EnlargeMinMax (const Standard_Real tol, Standard_Real Min[16], Standard_Real Max[16]);
Standard_EXPORT static void InitMinMax (const Standard_Real Big, const Standard_Address Min, const Standard_Address Max);
Standard_EXPORT static void InitMinMax (const Standard_Real Big, Standard_Real Min[16], Standard_Real Max[16]);
Standard_EXPORT static void EncodeMinMax (const Standard_Address Min, const Standard_Address Max, const Standard_Address MinMax);
Standard_EXPORT static void EncodeMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max, HLRAlgo_EdgesBlock::MinMaxIndices& MinMax);
Standard_EXPORT static Standard_Real SizeBox (const Standard_Address Min, const Standard_Address Max);
Standard_EXPORT static Standard_Real SizeBox (HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max);
Standard_EXPORT static void DecodeMinMax (const Standard_Address MinMax, const Standard_Address Min, const Standard_Address Max);
Standard_EXPORT static void DecodeMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& MinMax, HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max);
Standard_EXPORT static void CopyMinMax (const Standard_Address IMin, const Standard_Address IMax, const Standard_Address OMin, const Standard_Address OMax);
static void CopyMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin, HLRAlgo_EdgesBlock::MinMaxIndices& IMax, HLRAlgo_EdgesBlock::MinMaxIndices& OMin, HLRAlgo_EdgesBlock::MinMaxIndices& OMax)
{
OMin = IMin;
OMax = IMax;
}
Standard_EXPORT static void AddMinMax (const Standard_Address IMin, const Standard_Address IMax, const Standard_Address OMin, const Standard_Address OMax);
Standard_EXPORT static void AddMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin, HLRAlgo_EdgesBlock::MinMaxIndices& IMax, HLRAlgo_EdgesBlock::MinMaxIndices& OMin, HLRAlgo_EdgesBlock::MinMaxIndices& OMax);

View File

@@ -21,30 +21,6 @@
#include <HLRAlgo_BiPoint.hxx>
#define PntX1 myCoordinates[ 0]
#define PntY1 myCoordinates[ 1]
#define PntZ1 myCoordinates[ 2]
#define PntX2 myCoordinates[ 3]
#define PntY2 myCoordinates[ 4]
#define PntZ2 myCoordinates[ 5]
#define PntXP1 myCoordinates[ 6]
#define PntYP1 myCoordinates[ 7]
#define PntZP1 myCoordinates[ 8]
#define PntXP2 myCoordinates[ 9]
#define PntYP2 myCoordinates[10]
#define PntZP2 myCoordinates[11]
#define ShapeIndex myIndices[0]
#define FaceConex1 myIndices[1]
#define Face1Pt1 myIndices[2]
#define Face1Pt2 myIndices[3]
#define FaceConex2 myIndices[4]
#define Face2Pt1 myIndices[5]
#define Face2Pt2 myIndices[6]
#define MinSeg myIndices[7]
#define MaxSeg myIndices[8]
#define SegFlags myIndices[9]
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
@@ -68,22 +44,14 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Boolean outl,
const Standard_Boolean intl)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = Face1Pt1 = Face1Pt2 =
FaceConex2 = Face2Pt1 = Face2Pt2 = 0;
SegFlags = 0;
myPoints.Pnt1.SetCoord(X1, Y1, Z1);
myPoints.Pnt2.SetCoord(X2, Y2, Z2);
myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = myIndices.Face1Pt1 = myIndices.Face1Pt2 =
myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
myIndices.SegFlags = 0;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
@@ -111,22 +79,14 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Integer Index,
const Standard_Integer flag)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = Face1Pt1 = Face1Pt2 =
FaceConex2 = Face2Pt1 = Face2Pt2 = 0;
SegFlags = flag;
myPoints.Pnt1 = gp_XYZ(X1, Y1, Z1);
myPoints.Pnt2 = gp_XYZ(X2, Y2, Z2);
myPoints.PntP1 = gp_XYZ(XT1, YT1, ZT1);
myPoints.PntP2 = gp_XYZ(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = myIndices.Face1Pt1 = myIndices.Face1Pt2 =
myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
myIndices.SegFlags = flag;
Hidden(Standard_False);
}
@@ -156,24 +116,16 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Boolean outl,
const Standard_Boolean intl)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = i1;
Face1Pt1 = i1p1;
Face1Pt2 = i1p2;
FaceConex2 = Face2Pt1 = Face2Pt2 = 0;
SegFlags = 0;
myPoints.Pnt1.SetCoord(X1, Y1, Z1);
myPoints.Pnt2.SetCoord(X2, Y2, Z2);
myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = i1;
myIndices.Face1Pt1 = i1p1;
myIndices.Face1Pt2 = i1p2;
myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
myIndices.SegFlags = 0;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
@@ -204,24 +156,16 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Integer i1p2,
const Standard_Integer flag)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = i1;
Face1Pt1 = i1p1;
Face1Pt2 = i1p2;
FaceConex2 = Face2Pt1 = Face2Pt2 = 0;
SegFlags = flag;
myPoints.Pnt1.SetCoord(X1, Y1, Z1);
myPoints.Pnt2.SetCoord(X2, Y2, Z2);
myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = i1;
myIndices.Face1Pt1 = i1p1;
myIndices.Face1Pt2 = i1p2;
myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
myIndices.SegFlags = flag;
Hidden(Standard_False);
}
@@ -254,26 +198,18 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Boolean outl,
const Standard_Boolean intl)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = i1;
Face1Pt1 = i1p1;
Face1Pt2 = i1p2;
FaceConex2 = i2;
Face2Pt1 = i2p1;
Face2Pt2 = i2p2;
SegFlags = 0;
myPoints.Pnt1.SetCoord(X1, Y1, Z1);
myPoints.Pnt2.SetCoord(X2, Y2, Z2);
myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = i1;
myIndices.Face1Pt1 = i1p1;
myIndices.Face1Pt2 = i1p2;
myIndices.FaceConex2 = i2;
myIndices.Face2Pt1 = i2p1;
myIndices.Face2Pt2 = i2p2;
myIndices.SegFlags = 0;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
@@ -307,25 +243,17 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
const Standard_Integer i2p2,
const Standard_Integer flag)
{
PntX1 = X1;
PntY1 = Y1;
PntZ1 = Z1;
PntX2 = X2;
PntY2 = Y2;
PntZ2 = Z2;
PntXP1 = XT1;
PntYP1 = YT1;
PntZP1 = ZT1;
PntXP2 = XT2;
PntYP2 = YT2;
PntZP2 = ZT2;
ShapeIndex = Index;
FaceConex1 = i1;
Face1Pt1 = i1p1;
Face1Pt2 = i1p2;
FaceConex2 = i2;
Face2Pt1 = i2p1;
Face2Pt2 = i2p2;
SegFlags = flag;
myPoints.Pnt1.SetCoord(X1, Y1, Z1);
myPoints.Pnt2.SetCoord(X2, Y2, Z2);
myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
myIndices.ShapeIndex = Index;
myIndices.FaceConex1 = i1;
myIndices.Face1Pt1 = i1p1;
myIndices.Face1Pt2 = i1p2;
myIndices.FaceConex2 = i2;
myIndices.Face2Pt1 = i2p1;
myIndices.Face2Pt2 = i2p2;
myIndices.SegFlags = flag;
Hidden(Standard_False);
}

View File

@@ -24,13 +24,45 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Address.hxx>
#include <gp_XYZ.hxx>
#include <gp_XY.hxx>
class HLRAlgo_BiPoint
class HLRAlgo_BiPoint
{
public:
struct IndicesT
{
Standard_Integer ShapeIndex;
Standard_Integer FaceConex1;
Standard_Integer Face1Pt1;
Standard_Integer Face1Pt2;
Standard_Integer FaceConex2;
Standard_Integer Face2Pt1;
Standard_Integer Face2Pt2;
Standard_Integer MinSeg;
Standard_Integer MaxSeg;
Standard_Integer SegFlags;
};
struct PointsT
{
gp_XYZ Pnt1;
gp_XYZ Pnt2;
gp_XYZ PntP1;
gp_XYZ PntP2;
gp_XY PntP12D() const
{
return gp_XY(PntP1.X(), PntP1.Y());
}
gp_XY PntP22D() const
{
return gp_XY(PntP2.X(), PntP2.Y());
}
};
DEFINE_STANDARD_ALLOC
@@ -48,49 +80,70 @@ public:
Standard_EXPORT HLRAlgo_BiPoint(const Standard_Real X1, const Standard_Real Y1, const Standard_Real Z1, const Standard_Real X2, const Standard_Real Y2, const Standard_Real Z2, const Standard_Real XT1, const Standard_Real YT1, const Standard_Real ZT1, const Standard_Real XT2, const Standard_Real YT2, const Standard_Real ZT2, const Standard_Integer Index, const Standard_Integer i1, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i2, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer flag);
Standard_Boolean Rg1Line() const { return (myIndices[9] & EMskRg1Line) != 0; }
Standard_Boolean Rg1Line() const
{
return (myIndices.SegFlags & EMskRg1Line) != 0;
}
void Rg1Line (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskRg1Line;
else myIndices[9] &= ~EMskRg1Line;
if (B) myIndices.SegFlags |= EMskRg1Line;
else myIndices.SegFlags &= ~EMskRg1Line;
}
Standard_Boolean RgNLine() const { return (myIndices[9] & EMskRgNLine) != 0; }
Standard_Boolean RgNLine() const
{
return (myIndices.SegFlags & EMskRgNLine) != 0;
}
void RgNLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskRgNLine;
else myIndices[9] &= ~EMskRgNLine;
if (B) myIndices.SegFlags |= EMskRgNLine;
else myIndices.SegFlags &= ~EMskRgNLine;
}
Standard_Boolean OutLine() const { return (myIndices[9] & EMskOutLine) != 0; }
Standard_Boolean OutLine() const
{
return (myIndices.SegFlags & EMskOutLine) != 0;
}
void OutLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskOutLine;
else myIndices[9] &= ~EMskOutLine;
if (B) myIndices.SegFlags |= EMskOutLine;
else myIndices.SegFlags &= ~EMskOutLine;
}
Standard_Boolean IntLine() const { return (myIndices[9] & EMskIntLine) != 0; }
Standard_Boolean IntLine() const
{
return (myIndices.SegFlags & EMskIntLine) != 0;
}
void IntLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskIntLine;
else myIndices[9] &= ~EMskIntLine;
if (B) myIndices.SegFlags |= EMskIntLine;
else myIndices.SegFlags &= ~EMskIntLine;
}
Standard_Boolean Hidden() const { return (myIndices[9] & EMskHidden) != 0; }
Standard_Boolean Hidden() const
{
return (myIndices.SegFlags & EMskHidden) != 0;
}
void Hidden (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskHidden;
else myIndices[9] &= ~EMskHidden;
if (B) myIndices.SegFlags |= EMskHidden;
else myIndices.SegFlags &= ~EMskHidden;
}
Standard_Address Indices() const { return const_cast<Standard_Integer* >(myIndices); }
IndicesT& Indices()
{
return myIndices;
}
Standard_Address Coordinates() const { return const_cast<Standard_Real* >(myCoordinates); }
PointsT& Points()
{
return myPoints;
}
protected:
@@ -104,9 +157,8 @@ protected:
};
private:
Standard_Integer myIndices[10];
Standard_Real myCoordinates[12];
IndicesT myIndices;
PointsT myPoints;
};

View File

@@ -1,30 +0,0 @@
// Created on: 1992-02-19
// Created by: Christophe MARION
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <HLRAlgo_Coincidence.hxx>
//=======================================================================
//function : HLRAlgo_Coincidence
//purpose :
//=======================================================================
HLRAlgo_Coincidence::HLRAlgo_Coincidence()
: myFE(0),
myParam(0.),
myStBef(TopAbs_IN),
myStAft(TopAbs_IN)
{
}

View File

@@ -25,7 +25,6 @@
#include <Standard_Real.hxx>
#include <TopAbs_State.hxx>
//! The Coincidence class is used in an Inteference to
//! store informations on the "hiding" edge.
//!
@@ -38,49 +37,48 @@
//! intersection with the face (before and after).
//! This is necessary when the intersection is "ON"
//! the face.
class HLRAlgo_Coincidence
class HLRAlgo_Coincidence
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT HLRAlgo_Coincidence();
void Set2D (const Standard_Integer FE, const Standard_Real Param);
void SetState3D (const TopAbs_State stbef, const TopAbs_State staft);
void Value2D (Standard_Integer& FE, Standard_Real& Param) const;
void State3D (TopAbs_State& stbef, TopAbs_State& staft) const;
protected:
Standard_EXPORT HLRAlgo_Coincidence() :
myFE(0),
myParam(0.),
myStBef(TopAbs_IN),
myStAft(TopAbs_IN)
{
}
void Set2D (const Standard_Integer FE, const Standard_Real Param)
{
myFE = FE;
myParam = Param;
}
void SetState3D (const TopAbs_State stbef, const TopAbs_State staft)
{
myStBef = stbef;
myStAft = staft;
}
void Value2D (Standard_Integer& FE, Standard_Real& Param) const
{
FE = myFE;
Param = myParam;
}
void State3D (TopAbs_State& stbef, TopAbs_State& staft) const
{
stbef = myStBef;
staft = myStAft;
}
private:
Standard_Integer myFE;
Standard_Real myParam;
TopAbs_State myStBef;
TopAbs_State myStAft;
};
#include <HLRAlgo_Coincidence.lxx>
#endif // _HLRAlgo_Coincidence_HeaderFile

View File

@@ -1,65 +0,0 @@
// Created on: 1992-02-19
// Created by: Christophe MARION
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : Set2D
//purpose :
//=======================================================================
inline void HLRAlgo_Coincidence::Set2D
(const Standard_Integer FE,
const Standard_Real Param)
{
myFE = FE;
myParam = Param;
}
//=======================================================================
//function : SetState3D
//purpose :
//=======================================================================
inline void HLRAlgo_Coincidence::SetState3D
(const TopAbs_State stbef,const TopAbs_State staft)
{
myStBef = stbef;
myStAft = staft;
}
//=======================================================================
//function : Value2D
//purpose :
//=======================================================================
inline void HLRAlgo_Coincidence::Value2D
(Standard_Integer& FE,
Standard_Real& Param) const
{
FE = myFE;
Param = myParam;
}
//=======================================================================
//function : State3D
//purpose :
//=======================================================================
inline void HLRAlgo_Coincidence::State3D
(TopAbs_State& stbef,TopAbs_State& staft) const
{
stbef = myStBef;
staft = myStAft;
}

View File

@@ -34,9 +34,9 @@ HLRAlgo_EdgeIterator::HLRAlgo_EdgeIterator ()
//purpose :
//=======================================================================
void HLRAlgo_EdgeIterator::InitHidden (const HLRAlgo_EdgeStatus& status)
void HLRAlgo_EdgeIterator::InitHidden (HLRAlgo_EdgeStatus& status)
{
EHid = (Standard_Address)&status;
EHid = &status;
iHid = 1;
if (((HLRAlgo_EdgeStatus*)EHid)->AllHidden()) {
((HLRAlgo_EdgeStatus*)EHid)->Bounds

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Address.hxx>
#include <Standard_Real.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_Boolean.hxx>
@@ -41,7 +40,7 @@ public:
//! edge.
Standard_EXPORT HLRAlgo_EdgeIterator();
Standard_EXPORT void InitHidden (const HLRAlgo_EdgeStatus& status);
Standard_EXPORT void InitHidden (HLRAlgo_EdgeStatus& status);
Standard_Boolean MoreHidden() const;
@@ -51,7 +50,7 @@ public:
//! of the current Hidden Interval
void Hidden (Standard_Real& Start, Standard_ShortReal& TolStart, Standard_Real& End, Standard_ShortReal& TolEnd) const;
void InitVisible (const HLRAlgo_EdgeStatus& status);
void InitVisible (HLRAlgo_EdgeStatus& status);
Standard_Boolean MoreVisible() const;
@@ -76,8 +75,8 @@ private:
Standard_Integer myNbVis;
Standard_Integer myNbHid;
Standard_Address EVis;
Standard_Address EHid;
HLRAlgo_EdgeStatus* EVis;
HLRAlgo_EdgeStatus* EHid;
Standard_Integer iVis;
Standard_Integer iHid;
Standard_Real myHidStart;

View File

@@ -47,9 +47,9 @@ HLRAlgo_EdgeIterator::Hidden (Standard_Real& Start,
//=======================================================================
inline void
HLRAlgo_EdgeIterator::InitVisible (const HLRAlgo_EdgeStatus& status)
HLRAlgo_EdgeIterator::InitVisible(HLRAlgo_EdgeStatus& status)
{
EVis = (Standard_Address)&status;
EVis = &status;
iVis = 1;
myNbVis = ((HLRAlgo_EdgeStatus*)EVis)->NbVisiblePart();
}

View File

@@ -31,14 +31,3 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock,MMgt_TShared)
HLRAlgo_EdgesBlock::HLRAlgo_EdgesBlock (const Standard_Integer NbEdges) :
myEdges(1,NbEdges), myFlags(1,NbEdges)
{}
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
void HLRAlgo_EdgesBlock::UpdateMinMax (const Standard_Address TotMinMax)
{
for (Standard_Integer i = 0; i <= 15; i++)
myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
}

View File

@@ -26,7 +26,6 @@
#include <MMgt_TShared.hxx>
#include <TopAbs_Orientation.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Address.hxx>
class HLRAlgo_EdgesBlock;
@@ -48,6 +47,42 @@ class HLRAlgo_EdgesBlock : public MMgt_TShared
{
public:
struct MinMaxIndices
{
Standard_Integer Min[8], Max[8];
MinMaxIndices& Minimize(const MinMaxIndices& theMinMaxIndices)
{
for (Standard_Integer aI = 0; aI < 8; ++aI)
{
if (Min[aI] > theMinMaxIndices.Min[aI])
{
Min[aI] = theMinMaxIndices.Min[aI];
}
if (Max[aI] > theMinMaxIndices.Max[aI])
{
Max[aI] = theMinMaxIndices.Max[aI];
}
}
return *this;
}
MinMaxIndices& Maximize(const MinMaxIndices& theMinMaxIndices)
{
for (Standard_Integer aI = 0; aI < 8; ++aI)
{
if (Min[aI] < theMinMaxIndices.Min[aI])
{
Min[aI] = theMinMaxIndices.Min[aI];
}
if (Max[aI] < theMinMaxIndices.Max[aI])
{
Max[aI] = theMinMaxIndices.Max[aI];
}
}
return *this;
}
};
//! Create a Block of Edges for a wire.
Standard_EXPORT HLRAlgo_EdgesBlock(const Standard_Integer NbEdges);
@@ -101,9 +136,15 @@ public:
else myFlags(I) &= ~EMaskIsoLine;
}
Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
void UpdateMinMax(const MinMaxIndices& TotMinMax)
{
myMinMax = TotMinMax;
}
Standard_Address MinMax() const { return (Standard_Address )&myMinMax; }
MinMaxIndices& MinMax()
{
return myMinMax;
}
DEFINE_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock,MMgt_TShared)
@@ -122,8 +163,7 @@ private:
TColStd_Array1OfInteger myEdges;
TColStd_Array1OfInteger myFlags;
Standard_Integer myMinMax[16];
MinMaxIndices myMinMax;
};
#endif // _HLRAlgo_EdgesBlock_HeaderFile

View File

@@ -23,72 +23,14 @@
#include <HLRAlgo_EdgeStatus.hxx>
#include <HLRAlgo_ListOfBPoint.hxx>
#include <HLRAlgo_PolyAlgo.hxx>
#include <HLRAlgo_PolyData.hxx>
#include <HLRAlgo_PolyShellData.hxx>
#include <HLRAlgo_PolyMask.hxx>
#include <Precision.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyAlgo,MMgt_TShared)
#define EMskGrALin1 ((Standard_Integer) 8)
#define EMskGrALin2 ((Standard_Integer) 16)
#define EMskGrALin3 ((Standard_Integer) 32)
#define FMskHiding ((Standard_Integer) 256)
#define TriNode1 ((Standard_Integer*)TriIndices)[0]
#define TriNode2 ((Standard_Integer*)TriIndices)[1]
#define TriNode3 ((Standard_Integer*)TriIndices)[2]
#define TriFlags ((Standard_Integer*)TriIndices)[3]
#define XV1 myRealPtr[0]
#define XV2 myRealPtr[1]
#define XV3 myRealPtr[2]
#define YV1 myRealPtr[3]
#define YV2 myRealPtr[4]
#define YV3 myRealPtr[5]
#define Param myRealPtr[6]
#define myTolParam myRealPtr[7]
#define myTolAngular myRealPtr[8]
#define myTolerance myRealPtr[9]
#define PntX1 ((Standard_Real*)Coordinates)[ 0]
#define PntY1 ((Standard_Real*)Coordinates)[ 1]
#define PntZ1 ((Standard_Real*)Coordinates)[ 2]
#define PntX2 ((Standard_Real*)Coordinates)[ 3]
#define PntY2 ((Standard_Real*)Coordinates)[ 4]
#define PntZ2 ((Standard_Real*)Coordinates)[ 5]
#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
#define PntYP2 ((Standard_Real*)Coordinates)[10]
#define PntZP2 ((Standard_Real*)Coordinates)[11]
#define TotXMin ((Standard_Real*)TotMinMax)[0]
#define TotYMin ((Standard_Real*)TotMinMax)[1]
#define TotZMin ((Standard_Real*)TotMinMax)[2]
#define TotXMax ((Standard_Real*)TotMinMax)[3]
#define TotYMax ((Standard_Real*)TotMinMax)[4]
#define TotZMax ((Standard_Real*)TotMinMax)[5]
#define ShapeIndex ((Standard_Integer*)IndexPtr)[0]
#define FaceConex1 ((Standard_Integer*)IndexPtr)[1]
#define Face1Pt1 ((Standard_Integer*)IndexPtr)[2]
#define Face1Pt2 ((Standard_Integer*)IndexPtr)[3]
#define FaceConex2 ((Standard_Integer*)IndexPtr)[4]
#define Face2Pt1 ((Standard_Integer*)IndexPtr)[5]
#define Face2Pt2 ((Standard_Integer*)IndexPtr)[6]
#define MinSeg ((Standard_Integer*)IndexPtr)[7]
#define MaxSeg ((Standard_Integer*)IndexPtr)[8]
#define SegFlags ((Standard_Integer*)IndexPtr)[9]
#define MinShell ((Standard_Integer*)ShellIndices)[0]
#define MaxShell ((Standard_Integer*)ShellIndices)[1]
#define FIndex ((Standard_Integer*)PolyTIndices)[0]
#define MinPolyT ((Standard_Integer*)PolyTIndices)[1]
#define MaxPolyT ((Standard_Integer*)PolyTIndices)[2]
//static Standard_Integer ERROR = Standard_False;
//=======================================================================
@@ -98,8 +40,8 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyAlgo,MMgt_TShared)
HLRAlgo_PolyAlgo::HLRAlgo_PolyAlgo ()
{
myTolParam = 0.00000001;
myTolAngular = 0.0001;
myTriangle.TolParam = 0.00000001;
myTriangle.TolAng = 0.0001;
}
//=======================================================================
@@ -141,45 +83,39 @@ void HLRAlgo_PolyAlgo::Update ()
Standard_Real xTrianMax,yTrianMax,zTrianMax;
Standard_Real xSegmnMin,ySegmnMin,zSegmnMin;
Standard_Real xSegmnMax,ySegmnMax,zSegmnMax;
Standard_Real TotMinMax[6];
Standard_Real Big = Precision::Infinite();
TotMinMax[0] = Big;
TotMinMax[1] = Big;
TotMinMax[2] = Big;
TotMinMax[3] = -Big;
TotMinMax[4] = -Big;
TotMinMax[5] = -Big;
HLRAlgo_PolyData::Box aBox(Big, Big, Big, -Big, -Big, -Big);
TColStd_Array1OfTransient& Shell = myHShell->ChangeArray1();
myNbrShell = Shell.Upper();
Handle(HLRAlgo_PolyShellData)* psd1 =
(Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
for (i = 1; i <= myNbrShell; i++) {
(*psd1)->UpdateGlobalMinMax(&TotMinMax);
(*psd1)->UpdateGlobalMinMax(aBox);
psd1++;
}
Standard_Real dx = TotMinMax[3] - TotMinMax[0];
Standard_Real dy = TotMinMax[4] - TotMinMax[1];
Standard_Real dz = TotMinMax[5] - TotMinMax[2];
Standard_Real dx = aBox.XMax - aBox.XMin;
Standard_Real dy = aBox.YMax - aBox.YMin;
Standard_Real dz = aBox.ZMax - aBox.ZMin;
Standard_Real precad = dx;
if (precad < dy) precad = dy;
if (precad < dz) precad = dz;
myTolerance = precad * myTolParam;
myTriangle.Tolerance = precad * myTriangle.TolParam;
precad = precad * 0.01;
Standard_Real SurDX = 1020 / (dx + precad);
Standard_Real SurDY = 1020 / (dy + precad);
Standard_Real SurDZ = 508 / (dz + precad);
precad = precad * 0.5;
Standard_Real DecaX = - TotMinMax[0] + precad;
Standard_Real DecaY = - TotMinMax[1] + precad;
Standard_Real DecaZ = - TotMinMax[2] + precad;
Standard_Real DecaX = - aBox.XMin + precad;
Standard_Real DecaY = - aBox.YMin + precad;
Standard_Real DecaZ = - aBox.ZMin + precad;
Handle(HLRAlgo_PolyShellData)* psd2 =
(Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
for (i = 1; i <= myNbrShell; i++) {
const Standard_Address ShellIndices = (*psd2)->Indices();
HLRAlgo_PolyShellData::ShellIndices& aShellIndices = (*psd2)->Indices();
xShellMin = Big;
yShellMin = Big;
zShellMin = Big;
@@ -191,26 +127,26 @@ void HLRAlgo_PolyAlgo::Update ()
mySegListIt.More();
mySegListIt.Next()) {
HLRAlgo_BiPoint& BP = mySegListIt.Value();
const Standard_Address Coordinates = BP.Coordinates();
const Standard_Address IndexPtr = BP.Indices();
if (PntXP1 < PntXP2) { xSegmnMin = PntXP1; xSegmnMax = PntXP2; }
else { xSegmnMin = PntXP2; xSegmnMax = PntXP1; }
if (PntYP1 < PntYP2) { ySegmnMin = PntYP1; ySegmnMax = PntYP2; }
else { ySegmnMin = PntYP2; ySegmnMax = PntYP1; }
if (PntZP1 < PntZP2) { zSegmnMin = PntZP1; zSegmnMax = PntZP2; }
else { zSegmnMin = PntZP2; zSegmnMax = PntZP1; }
HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
if (aPoints.PntP1.X() < aPoints.PntP2.X()) { xSegmnMin = aPoints.PntP1.X(); xSegmnMax = aPoints.PntP2.X(); }
else { xSegmnMin = aPoints.PntP2.X(); xSegmnMax = aPoints.PntP1.X(); }
if (aPoints.PntP1.Y() < aPoints.PntP2.Y()) { ySegmnMin = aPoints.PntP1.Y(); ySegmnMax = aPoints.PntP2.Y(); }
else { ySegmnMin = aPoints.PntP2.Y(); ySegmnMax = aPoints.PntP1.Y(); }
if (aPoints.PntP1.Z() < aPoints.PntP2.Z()) { zSegmnMin = aPoints.PntP1.Z(); zSegmnMax = aPoints.PntP2.Z(); }
else { zSegmnMin = aPoints.PntP2.Z(); zSegmnMax = aPoints.PntP1.Z(); }
nxMin = (Standard_Integer)((DecaX + xSegmnMin) * SurDX);
nyMin = (Standard_Integer)((DecaY + ySegmnMin) * SurDY);
nzMin = (Standard_Integer)((DecaZ + zSegmnMin) * SurDZ);
nxMax = (Standard_Integer)((DecaX + xSegmnMax) * SurDX);
nyMax = (Standard_Integer)((DecaY + ySegmnMax) * SurDY);
nzMax = (Standard_Integer)((DecaZ + zSegmnMax) * SurDZ);
MinSeg = nyMin + (nxMin << 11);
MinSeg <<= 10;
MinSeg += nzMin;
MaxSeg = nyMax + (nxMax << 11);
MaxSeg <<= 10;
MaxSeg += nzMax + 0x00000200;
theIndices.MinSeg = nyMin + (nxMin << 11);
theIndices.MinSeg <<= 10;
theIndices.MinSeg += nzMin;
theIndices.MaxSeg = nyMax + (nxMax << 11);
theIndices.MaxSeg <<= 10;
theIndices.MaxSeg += nzMax + 0x00000200;
if (xShellMin > xSegmnMin) xShellMin = xSegmnMin;
if (xShellMax < xSegmnMax) xShellMax = xSegmnMax;
if (yShellMin > ySegmnMin) yShellMin = ySegmnMin;
@@ -238,7 +174,7 @@ void HLRAlgo_PolyAlgo::Update ()
Standard_Real dn,dnx,dny,dnz,dx1,dy1,dz1,dx2,dy2,dz2,dx3,dy3;
Standard_Real adx1,ady1,adx2,ady2,adx3,ady3;
Standard_Real a =0.,b =0.,c =0.,d =0.;
const Standard_Address PolyTIndices = (*pd)->Indices();
HLRAlgo_PolyData::FaceIndices& PolyTIndices = (*pd)->Indices();
TColgp_Array1OfXYZ & Nodes = (*pd)->Nodes();
HLRAlgo_Array1OfTData& TData = (*pd)->TData();
HLRAlgo_Array1OfPHDat& PHDat = (*pd)->PHDat();
@@ -246,11 +182,10 @@ void HLRAlgo_PolyAlgo::Update ()
HLRAlgo_TriangleData* TD = &(TData.ChangeValue(1));
for (otheri = 1; otheri <= nbT; otheri++) {
const Standard_Address TriIndices = TD->Indices();
if (TriFlags & FMskHiding) {
const gp_XYZ& P1 = Nodes(TriNode1);
const gp_XYZ& P2 = Nodes(TriNode2);
const gp_XYZ& P3 = Nodes(TriNode3);
if (TD->Flags & HLRAlgo_PolyMask_FMskHiding) {
const gp_XYZ& P1 = Nodes(TD->Node1);
const gp_XYZ& P2 = Nodes(TD->Node2);
const gp_XYZ& P3 = Nodes(TD->Node3);
X1 = P1.X();
Y1 = P1.Y();
Z1 = P1.Z();
@@ -320,12 +255,12 @@ void HLRAlgo_PolyAlgo::Update ()
ady3 = dy3;
if (dx3 < 0) adx3 = -dx3;
if (dy3 < 0) ady3 = -dy3;
if (adx1 > ady1) TriFlags |= EMskGrALin1;
else TriFlags &= ~EMskGrALin1;
if (adx2 > ady2) TriFlags |= EMskGrALin2;
else TriFlags &= ~EMskGrALin2;
if (adx3 > ady3) TriFlags |= EMskGrALin3;
else TriFlags &= ~EMskGrALin3;
if (adx1 > ady1) TD->Flags |= HLRAlgo_PolyMask_EMskGrALin1;
else TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin1;
if (adx2 > ady2) TD->Flags |= HLRAlgo_PolyMask_EMskGrALin2;
else TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin2;
if (adx3 > ady3) TD->Flags |= HLRAlgo_PolyMask_EMskGrALin3;
else TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin3;
if (xPolyTMin > xTrianMin) xPolyTMin = xTrianMin;
if (xPolyTMax < xTrianMax) xPolyTMax = xTrianMax;
if (yPolyTMin > yTrianMin) yPolyTMin = yTrianMin;
@@ -341,12 +276,12 @@ void HLRAlgo_PolyAlgo::Update ()
nxMax = (Standard_Integer)((DecaX + xPolyTMax) * SurDX);
nyMax = (Standard_Integer)((DecaY + yPolyTMax) * SurDY);
nzMax = (Standard_Integer)((DecaZ + zPolyTMax) * SurDZ);
MinPolyT = nyMin + (nxMin << 11);
MinPolyT <<= 10;
MinPolyT += nzMin - 0x00000200;
MaxPolyT = nyMax + (nxMax << 11);
MaxPolyT <<= 10;
MaxPolyT += nzMax;
PolyTIndices.Min = nyMin + (nxMin << 11);
PolyTIndices.Min <<= 10;
PolyTIndices.Min += nzMin - 0x00000200;
PolyTIndices.Max = nyMax + (nxMax << 11);
PolyTIndices.Max <<= 10;
PolyTIndices.Max += nzMax;
if (xShellMin > xPolyTMin) xShellMin = xPolyTMin;
if (xShellMax < xPolyTMax) xShellMax = xPolyTMax;
if (yShellMin > yPolyTMin) yShellMin = yPolyTMin;
@@ -363,12 +298,12 @@ void HLRAlgo_PolyAlgo::Update ()
nxMax = (Standard_Integer)((DecaX + xShellMax) * SurDX);
nyMax = (Standard_Integer)((DecaY + yShellMax) * SurDY);
nzMax = (Standard_Integer)((DecaZ + zShellMax) * SurDZ);
MinShell = nyMin + (nxMin << 11);
MinShell <<= 10;
MinShell += nzMin - 0x00000200;
MaxShell = nyMax + (nxMax << 11);
MaxShell <<= 10;
MaxShell += nzMax;
aShellIndices.Min = nyMin + (nxMin << 11);
aShellIndices.Min <<= 10;
aShellIndices.Min += nzMin - 0x00000200;
aShellIndices.Max = nyMax + (nxMax << 11);
aShellIndices.Max <<= 10;
aShellIndices.Max += nzMax;
(*psd2)->UpdateHiding(nbFaHi);
TColStd_Array1OfTransient& PolHi = (*psd2)->HidingPolyData();
pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1));
@@ -385,8 +320,8 @@ void HLRAlgo_PolyAlgo::Update ()
}
else {
(*psd2)->UpdateHiding(0);
MinShell = 0;
MaxShell = 0;
aShellIndices.Min = 0;
aShellIndices.Max = 0;
}
psd2++;
}
@@ -427,7 +362,7 @@ void HLRAlgo_PolyAlgo::NextHide ()
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
HLRAlgo_BiPoint::PointsT& HLRAlgo_PolyAlgo::Hide (
HLRAlgo_EdgeStatus& status,
Standard_Integer& Index,
Standard_Boolean& reg1,
@@ -436,10 +371,10 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
Standard_Boolean& intl)
{
HLRAlgo_BiPoint& BP = mySegListIt.Value();
Coordinates = BP.Coordinates();
const Standard_Address IndexPtr = BP.Indices();
status = HLRAlgo_EdgeStatus(0.,(Standard_ShortReal)myTolParam,1.,(Standard_ShortReal)myTolParam);
Index = ShapeIndex;
HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
status = HLRAlgo_EdgeStatus(0.,(Standard_ShortReal)myTriangle.TolParam,1.,(Standard_ShortReal)myTriangle.TolParam);
Index = theIndices.ShapeIndex;
reg1 = BP.Rg1Line();
regn = BP.RgNLine();
outl = BP.OutLine();
@@ -454,9 +389,9 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
for (Standard_Integer s = 1; s <= myNbrShell; s++) {
if ((*psd)->Hiding()) {
const Standard_Address ShellIndices = (*psd)->Indices();
if (((MaxShell - MinSeg) & 0x80100200) == 0 &&
((MaxSeg - MinShell) & 0x80100000) == 0) {
HLRAlgo_PolyShellData::ShellIndices& aShellIndices = (*psd)->Indices();
if (((aShellIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
((theIndices.MaxSeg - aShellIndices.Min) & 0x80100000) == 0) {
HidingShell = (s == myCurShell);
TColStd_Array1OfTransient& Face = (*psd)->HidingPolyData();
Standard_Integer nbFace = Face.Upper();
@@ -464,9 +399,9 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
(Handle(HLRAlgo_PolyData)*)&(Face.ChangeValue(1));
for (Standard_Integer f = 1; f <= nbFace; f++) {
(*pd)->HideByPolyData(Coordinates,
(Standard_Address)myRealPtr,
IndexPtr,
(*pd)->HideByPolyData(aPoints,
myTriangle,
theIndices,
HidingShell,
status);
pd++;
@@ -476,6 +411,7 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
psd++;
}
}
return aPoints;
}
//=======================================================================
@@ -508,7 +444,7 @@ void HLRAlgo_PolyAlgo::NextShow ()
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates,
HLRAlgo_BiPoint::PointsT& HLRAlgo_PolyAlgo::Show (
Standard_Integer& Index,
Standard_Boolean& reg1,
Standard_Boolean& regn,
@@ -516,12 +452,13 @@ void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates,
Standard_Boolean& intl)
{
HLRAlgo_BiPoint& BP = mySegListIt.Value();
Standard_Address IndexPtr = BP.Indices();
Coordinates = BP.Coordinates();
Index = ShapeIndex;
HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
Index = theIndices.ShapeIndex;
reg1 = BP.Rg1Line();
regn = BP.RgNLine();
outl = BP.OutLine();
intl = BP.IntLine();
return aPoints;
}

View File

@@ -17,6 +17,8 @@
#ifndef _HLRAlgo_PolyAlgo_HeaderFile
#define _HLRAlgo_PolyAlgo_HeaderFile
#include <HLRAlgo_PolyData.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -27,7 +29,7 @@
#include <Standard_Boolean.hxx>
#include <MMgt_TShared.hxx>
#include <TColStd_Array1OfTransient.hxx>
#include <Standard_Address.hxx>
class HLRAlgo_EdgeStatus;
@@ -59,7 +61,7 @@ public:
Standard_EXPORT void NextHide();
//! process hiding between <Pt1> and <Pt2>.
Standard_EXPORT void Hide (Standard_Address& Coordinates, HLRAlgo_EdgeStatus& status, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
Standard_EXPORT HLRAlgo_BiPoint::PointsT& Hide (HLRAlgo_EdgeStatus& status, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
void InitShow();
@@ -68,7 +70,7 @@ public:
Standard_EXPORT void NextShow();
//! process hiding between <Pt1> and <Pt2>.
Standard_EXPORT void Show (Standard_Address& Coordinates, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
Standard_EXPORT HLRAlgo_BiPoint::PointsT& Show (Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
@@ -84,7 +86,7 @@ private:
Handle(TColStd_HArray1OfTransient) myHShell;
Standard_Real myRealPtr[10];
HLRAlgo_PolyData::Triangle myTriangle;
HLRAlgo_ListIteratorOfListOfBPoint mySegListIt;
Standard_Integer myNbrShell;
Standard_Integer myCurShell;

View File

@@ -17,75 +17,12 @@
#include <HLRAlgo_PolyData.hxx>
#include <HLRAlgo_EdgeStatus.hxx>
#include <HLRAlgo_PolyMask.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyData,MMgt_TShared)
#define EMskGrALin1 ((Standard_Integer) 8)
#define EMskGrALin2 ((Standard_Integer) 16)
#define EMskGrALin3 ((Standard_Integer) 32)
#define FMskHiding ((Standard_Integer) 256)
#define FIndex myIndices[0]
#define MinFac myIndices[1]
#define MaxFac myIndices[2]
#define TriNode1 ((Standard_Integer*)TriIndices)[0]
#define TriNode2 ((Standard_Integer*)TriIndices)[1]
#define TriNode3 ((Standard_Integer*)TriIndices)[2]
#define TriFlags ((Standard_Integer*)TriIndices)[3]
#define PntX1 ((Standard_Real*)Coordinates)[ 0]
#define PntY1 ((Standard_Real*)Coordinates)[ 1]
#define PntZ1 ((Standard_Real*)Coordinates)[ 2]
#define PntX2 ((Standard_Real*)Coordinates)[ 3]
#define PntY2 ((Standard_Real*)Coordinates)[ 4]
#define PntZ2 ((Standard_Real*)Coordinates)[ 5]
#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
#define PntYP2 ((Standard_Real*)Coordinates)[10]
#define PntZP2 ((Standard_Real*)Coordinates)[11]
#define XV1 ((Standard_Real*)RealPtr)[0]
#define XV2 ((Standard_Real*)RealPtr)[1]
#define XV3 ((Standard_Real*)RealPtr)[2]
#define YV1 ((Standard_Real*)RealPtr)[3]
#define YV2 ((Standard_Real*)RealPtr)[4]
#define YV3 ((Standard_Real*)RealPtr)[5]
#define Param ((Standard_Real*)RealPtr)[6]
#define TolParam ((Standard_Real*)RealPtr)[7]
#define TolAng ((Standard_Real*)RealPtr)[8]
#define Tolerance ((Standard_Real*)RealPtr)[9]
#define TotXMin ((Standard_Real*)TotMinMax)[0]
#define TotYMin ((Standard_Real*)TotMinMax)[1]
#define TotZMin ((Standard_Real*)TotMinMax)[2]
#define TotXMax ((Standard_Real*)TotMinMax)[3]
#define TotYMax ((Standard_Real*)TotMinMax)[4]
#define TotZMax ((Standard_Real*)TotMinMax)[5]
#define IndexTri ((Standard_Integer*)MinMaxPtr)[0]
#define MinTri ((Standard_Integer*)MinMaxPtr)[1]
#define MaxTri ((Standard_Integer*)MinMaxPtr)[2]
#define APlan ((Standard_Real*)PlanPtr)[0]
#define BPlan ((Standard_Real*)PlanPtr)[1]
#define CPlan ((Standard_Real*)PlanPtr)[2]
#define DPlan ((Standard_Real*)PlanPtr)[3]
#define ShapeIndex ((Standard_Integer*)Indices)[0]
#define FaceConex1 ((Standard_Integer*)Indices)[1]
#define Face1Pt1 ((Standard_Integer*)Indices)[2]
#define Face1Pt2 ((Standard_Integer*)Indices)[3]
#define FaceConex2 ((Standard_Integer*)Indices)[4]
#define Face2Pt1 ((Standard_Integer*)Indices)[5]
#define Face2Pt2 ((Standard_Integer*)Indices)[6]
#define MinSeg ((Standard_Integer*)Indices)[7]
#define MaxSeg ((Standard_Integer*)Indices)[8]
#define SegFlags ((Standard_Integer*)Indices)[9]
#ifdef OCCT_DEBUG
static Standard_Integer ERROR = Standard_False;
#endif
@@ -127,7 +64,7 @@ void HLRAlgo_PolyData::HPHDat(const Handle(HLRAlgo_HArray1OfPHDat)& HPHDat)
//=======================================================================
void
HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
HLRAlgo_PolyData::UpdateGlobalMinMax (Box& theBox)
{
Standard_Integer i;
Standard_Real X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3;
@@ -137,11 +74,10 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
HLRAlgo_TriangleData* TD = &(TData.ChangeValue(1));
for (i = 1; i <= nbT; i++) {
const Standard_Address TriIndices = TD->Indices();
if (TriFlags & FMskHiding) {
const gp_XYZ& P1 = Nodes(TriNode1);
const gp_XYZ& P2 = Nodes(TriNode2);
const gp_XYZ& P3 = Nodes(TriNode3);
if (TD->Flags & HLRAlgo_PolyMask_FMskHiding) {
const gp_XYZ& P1 = Nodes(TD->Node1);
const gp_XYZ& P2 = Nodes(TD->Node2);
const gp_XYZ& P3 = Nodes(TD->Node3);
X1 = P1.X();
Y1 = P1.Y();
Z1 = P1.Z();
@@ -151,24 +87,24 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
X3 = P3.X();
Y3 = P3.Y();
Z3 = P3.Z();
if (TotXMin > X1) TotXMin = X1;
else if (TotXMax < X1) TotXMax = X1;
if (TotYMin > Y1) TotYMin = Y1;
else if (TotYMax < Y1) TotYMax = Y1;
if (TotZMin > Z1) TotZMin = Z1;
else if (TotZMax < Z1) TotZMax = Z1;
if (TotXMin > X2) TotXMin = X2;
else if (TotXMax < X2) TotXMax = X2;
if (TotYMin > Y2) TotYMin = Y2;
else if (TotYMax < Y2) TotYMax = Y2;
if (TotZMin > Z2) TotZMin = Z2;
else if (TotZMax < Z2) TotZMax = Z2;
if (TotXMin > X3) TotXMin = X3;
else if (TotXMax < X3) TotXMax = X3;
if (TotYMin > Y3) TotYMin = Y3;
else if (TotYMax < Y3) TotYMax = Y3;
if (TotZMin > Z3) TotZMin = Z3;
else if (TotZMax < Z3) TotZMax = Z3;
if (theBox.XMin > X1) theBox.XMin = X1;
else if (theBox.XMax < X1) theBox.XMax = X1;
if (theBox.YMin > Y1) theBox.YMin = Y1;
else if (theBox.YMax < Y1) theBox.YMax = Y1;
if (theBox.ZMin > Z1) theBox.ZMin = Z1;
else if (theBox.ZMax < Z1) theBox.ZMax = Z1;
if (theBox.XMin > X2) theBox.XMin = X2;
else if (theBox.XMax < X2) theBox.XMax = X2;
if (theBox.YMin > Y2) theBox.YMin = Y2;
else if (theBox.YMax < Y2) theBox.YMax = Y2;
if (theBox.ZMin > Z2) theBox.ZMin = Z2;
else if (theBox.ZMax < Z2) theBox.ZMax = Z2;
if (theBox.XMin > X3) theBox.XMin = X3;
else if (theBox.XMax < X3) theBox.XMax = X3;
if (theBox.YMin > Y3) theBox.YMin = Y3;
else if (theBox.YMax < Y3) theBox.YMax = Y3;
if (theBox.ZMin > Z3) theBox.ZMin = Z3;
else if (theBox.ZMax < Z3) theBox.ZMax = Z3;
}
TD++;
}
@@ -179,14 +115,14 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
//purpose :
//=======================================================================
void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
const Standard_Address RealPtr,
const Standard_Address Indices,
void HLRAlgo_PolyData::HideByPolyData (const HLRAlgo_BiPoint::PointsT& thePoints,
Triangle& theTriangle,
HLRAlgo_BiPoint::IndicesT& theIndices,
const Standard_Boolean HidingShell,
HLRAlgo_EdgeStatus& status)
{
if (((MaxFac - MinSeg) & 0x80100200) == 0 &&
((MaxSeg - MinFac) & 0x80100000) == 0) {
if (((myFaceIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
((theIndices.MaxSeg - myFaceIndices.Min) & 0x80100000) == 0) {
HLRAlgo_Array1OfPHDat& PHDat = myHPHDat->ChangeArray1();
const HLRAlgo_Array1OfTData& TData = myHTData->Array1();
Standard_Real d1,d2;
@@ -194,105 +130,92 @@ void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
Standard_Boolean isCrossing = Standard_False;
Standard_Boolean toHideBefore = Standard_False;
Standard_Integer TFlag = 0;
Standard_Address PlanPtr,MinMaxPtr,TriIndices;
Standard_Integer h,h2 = PHDat.Upper();
HLRAlgo_PolyHidingData* PH = &(PHDat(1));
for (h = 1; h <= h2; h++) {
MinMaxPtr = PH->IndexAndMinMax();
if (((MaxTri - MinSeg) & 0x80100200) == 0 &&
((MaxSeg - MinTri) & 0x80100000) == 0) {
TriIndices = TData(IndexTri).Indices();
HLRAlgo_PolyHidingData::TriangleIndices& aTriangleIndices = PH->Indices();
if (((aTriangleIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
((theIndices.MaxSeg - aTriangleIndices.Min) & 0x80100000) == 0) {
const HLRAlgo_TriangleData& aTriangle = TData(aTriangleIndices.Index);
NotConnex = Standard_True;
if (HidingShell) {
if (FIndex == FaceConex1) {
if (Face1Pt1 == TriNode1)
NotConnex = Face1Pt2 != TriNode2 && Face1Pt2 != TriNode3;
else if (Face1Pt1 == TriNode2)
NotConnex = Face1Pt2 != TriNode3 && Face1Pt2 != TriNode1;
else if (Face1Pt1 == TriNode3)
NotConnex = Face1Pt2 != TriNode1 && Face1Pt2 != TriNode2;
if (myFaceIndices.Index == theIndices.FaceConex1) {
if (theIndices.Face1Pt1 == aTriangle.Node1)
NotConnex = theIndices.Face1Pt2 != aTriangle.Node2 && theIndices.Face1Pt2 != aTriangle.Node3;
else if (theIndices.Face1Pt1 == aTriangle.Node2)
NotConnex = theIndices.Face1Pt2 != aTriangle.Node3 && theIndices.Face1Pt2 != aTriangle.Node1;
else if (theIndices.Face1Pt1 == aTriangle.Node3)
NotConnex = theIndices.Face1Pt2 != aTriangle.Node1 && theIndices.Face1Pt2 != aTriangle.Node2;
}
else if (FIndex == FaceConex2) {
if (Face2Pt1 == TriNode1)
NotConnex = Face2Pt2 != TriNode2 && Face2Pt2 != TriNode3;
else if (Face2Pt1 == TriNode2)
NotConnex = Face2Pt2 != TriNode3 && Face2Pt2 != TriNode1;
else if (Face2Pt1 == TriNode3)
NotConnex = Face2Pt2 != TriNode1 && Face2Pt2 != TriNode2;
else if (myFaceIndices.Index == theIndices.FaceConex2) {
if (theIndices.Face2Pt1 == aTriangle.Node1)
NotConnex = theIndices.Face2Pt2 != aTriangle.Node2 && theIndices.Face2Pt2 != aTriangle.Node3;
else if (theIndices.Face2Pt1 == aTriangle.Node2)
NotConnex = theIndices.Face2Pt2 != aTriangle.Node3 && theIndices.Face2Pt2 != aTriangle.Node1;
else if (theIndices.Face2Pt1 == aTriangle.Node3)
NotConnex = theIndices.Face2Pt2 != aTriangle.Node1 && theIndices.Face2Pt2 != aTriangle.Node2;
}
}
if (NotConnex) {
PlanPtr = PH->Plan();
d1 = APlan * PntXP1 + BPlan * PntYP1 + CPlan * PntZP1 - DPlan;
d2 = APlan * PntXP2 + BPlan * PntYP2 + CPlan * PntZP2 - DPlan;
if (d1 > Tolerance) {
if (d2 < -Tolerance) {
Param = d1 / ( d1 - d2 );
HLRAlgo_PolyHidingData::PlaneT& aPlane = PH->Plane();
d1 = aPlane.Normal * thePoints.PntP1 - aPlane.D;
d2 = aPlane.Normal * thePoints.PntP2 - aPlane.D;
if (d1 > theTriangle.Tolerance) {
if (d2 < -theTriangle.Tolerance) {
theTriangle.Param = d1 / ( d1 - d2 );
toHideBefore = Standard_False;
isCrossing = Standard_True;
TFlag = TriFlags;
TFlag = aTriangle.Flags;
const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
const gp_XYZ & P1 = Nodes(TriNode1);
const gp_XYZ & P2 = Nodes(TriNode2);
const gp_XYZ & P3 = Nodes(TriNode3);
XV1 = P1.X();
YV1 = P1.Y();
XV2 = P2.X();
YV2 = P2.Y();
XV3 = P3.X();
YV3 = P3.Y();
hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
const gp_XYZ & P1 = Nodes(aTriangle.Node1);
const gp_XYZ & P2 = Nodes(aTriangle.Node2);
const gp_XYZ & P3 = Nodes(aTriangle.Node3);
theTriangle.V1 = gp_XY(P1.X(), P1.Y());
theTriangle.V2 = gp_XY(P2.X(), P2.Y());
theTriangle.V3 = gp_XY(P3.X(), P3.Y());
hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
}
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
Param = d1 / ( d1 - d2 );
else if (d1 < -theTriangle.Tolerance) {
if (d2 > theTriangle.Tolerance) {
theTriangle.Param = d1 / ( d1 - d2 );
toHideBefore = Standard_True;
isCrossing = Standard_True;
TFlag = TriFlags;
TFlag = aTriangle.Flags;
const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
const gp_XYZ & P1 = Nodes(TriNode1);
const gp_XYZ & P2 = Nodes(TriNode2);
const gp_XYZ & P3 = Nodes(TriNode3);
XV1 = P1.X();
YV1 = P1.Y();
XV2 = P2.X();
YV2 = P2.Y();
XV3 = P3.X();
YV3 = P3.Y();
hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
const gp_XYZ & P1 = Nodes(aTriangle.Node1);
const gp_XYZ & P2 = Nodes(aTriangle.Node2);
const gp_XYZ & P3 = Nodes(aTriangle.Node3);
theTriangle.V1 = gp_XY(P1.X(), P1.Y());
theTriangle.V2 = gp_XY(P2.X(), P2.Y());
theTriangle.V3 = gp_XY(P3.X(), P3.Y());
hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
}
else {
isCrossing = Standard_False;
TFlag = TriFlags;
TFlag = aTriangle.Flags;
const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
const gp_XYZ & P1 = Nodes(TriNode1);
const gp_XYZ & P2 = Nodes(TriNode2);
const gp_XYZ & P3 = Nodes(TriNode3);
XV1 = P1.X();
YV1 = P1.Y();
XV2 = P2.X();
YV2 = P2.Y();
XV3 = P3.X();
YV3 = P3.Y();
hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
const gp_XYZ & P1 = Nodes(aTriangle.Node1);
const gp_XYZ & P2 = Nodes(aTriangle.Node2);
const gp_XYZ & P3 = Nodes(aTriangle.Node3);
theTriangle.V1 = gp_XY(P1.X(), P1.Y());
theTriangle.V2 = gp_XY(P2.X(), P2.Y());
theTriangle.V3 = gp_XY(P3.X(), P3.Y());
hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
}
}
else if (d2 < -Tolerance) {
else if (d2 < -theTriangle.Tolerance) {
isCrossing = Standard_False;
TFlag = TriFlags;
TFlag = aTriangle.Flags;
const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
const gp_XYZ & P1 = Nodes(TriNode1);
const gp_XYZ & P2 = Nodes(TriNode2);
const gp_XYZ & P3 = Nodes(TriNode3);
XV1 = P1.X();
YV1 = P1.Y();
XV2 = P2.X();
YV2 = P2.Y();
XV3 = P3.X();
YV3 = P3.Y();
hideByOneTriangle(Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
const gp_XYZ & P1 = Nodes(aTriangle.Node1);
const gp_XYZ & P2 = Nodes(aTriangle.Node2);
const gp_XYZ & P3 = Nodes(aTriangle.Node3);
theTriangle.V1 = gp_XY(P1.X(), P1.Y());
theTriangle.V2 = gp_XY(P2.X(), P2.Y());
theTriangle.V3 = gp_XY(P3.X(), P3.Y());
hideByOneTriangle(thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
}
}
}
@@ -306,66 +229,68 @@ void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
//purpose :
//=======================================================================
void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
const Standard_Address RealPtr,
void HLRAlgo_PolyData::hideByOneTriangle (const HLRAlgo_BiPoint::PointsT& thePoints,
Triangle& theTriangle,
const Standard_Boolean Crossing,
const Standard_Boolean HideBefore,
const Standard_Integer TrFlags,
HLRAlgo_EdgeStatus& status)
{
Standard_Boolean o[2],m[2];
Standard_Integer l,n1=0,nn1,nn2,npi=-1,npiRej=0;
Standard_Real a,b,c,da,db,d1,d2,p[2]={0.,0.},pd1,pd2,pdp,pp,psta=0.,pend=1.;
Standard_Boolean CrosSeg;
Standard_Boolean CrosSeg = Standard_False;
Standard_Integer n1 = 0;
Standard_Real pd1 = 0., pd2 = 0.;
Standard_Integer nn1 = 0, nn2 = 0;
Standard_Real pend = 1., psta = 0., pp = 0., pdp = 0.;
Standard_Integer npi = -1;
Standard_Boolean o[] = {Standard_False, Standard_False};
Standard_Boolean m[] = {Standard_False, Standard_False};
Standard_Real p[] = {0., 0.};
Standard_Integer npiRej = 0;
da = XV2 - XV1;
db = YV2 - YV1;
a = -db;
b = da;
c = sqrt( a * a + b * b);
a /= c;
b /= c;
c = a * XV1 + b * YV1;
d1 = a * PntXP1 + b * PntYP1 - c;
d2 = a * PntXP2 + b * PntYP2 - c;
if (d1 > Tolerance) {
if (d2 < -Tolerance) {
{
const gp_XY aD = theTriangle.V2 - theTriangle.V1;
const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
const Standard_Real aDot = aA * theTriangle.V1;
const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
if (d1 > theTriangle.Tolerance) {
if (d2 < -theTriangle.Tolerance) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
else if (d1 < -theTriangle.Tolerance) {
if (d2 > theTriangle.Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
if (d2 > theTriangle.Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else if (d2 < -theTriangle.Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin1) {
pd1 = (PntXP1 - XV1) / da;
pd2 = (PntXP2 - XV1) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin1) {
pd1 = (thePoints.PntP1.X() - theTriangle.V1.X()) / aD.X();
pd2 = (thePoints.PntP2.X() - theTriangle.V1.X()) / aD.X();
}
else {
pd1 = (PntYP1 - YV1) / db;
pd2 = (PntYP2 - YV1) / db;
pd1 = (thePoints.PntP1.Y() - theTriangle.V1.Y()) / aD.Y();
pd2 = (thePoints.PntP2.Y() - theTriangle.V1.Y()) / aD.Y();
}
if (pd1 < -TolParam) nn1 = 1;
else if (pd1 < TolParam) nn1 = 2;
else if (pd1 - 1. < -TolParam) nn1 = 3;
else if (pd1 - 1. < TolParam) nn1 = 4;
if (pd1 < -theTriangle.TolParam) nn1 = 1;
else if (pd1 < theTriangle.TolParam) nn1 = 2;
else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
else nn1 = 5;
if (pd2 < -TolParam) nn2 = 1;
else if (pd2 < TolParam) nn2 = 2;
else if (pd2 - 1. < -TolParam) nn2 = 3;
else if (pd2 - 1. < TolParam) nn2 = 4;
if (pd2 < -theTriangle.TolParam) nn2 = 1;
else if (pd2 < theTriangle.TolParam) nn2 = 2;
else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -401,17 +326,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin1)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV1) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin1)
pdp = (thePoints.PntP1.X() + (thePoints.PntP2.X() - thePoints.PntP1.X()) * pp - theTriangle.V1.X()) / aD.X();
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV1) / db;
pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V1.Y()) / aD.Y();
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
if (pdp < -theTriangle.TolParam) OutSideP = Standard_True;
else if (pdp < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
@@ -427,11 +352,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
else if (pdp - 1. < -theTriangle.TolParam) {}
else if (pdp - 1. < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (n1 == -1)) {
@@ -463,55 +388,52 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
#endif
}
}
}
da = XV3 - XV2;
db = YV3 - YV2;
a = -db;
b = da;
c = sqrt(a * a + b * b);
a /= c;
b /= c;
c = a * XV2 + b * YV2;
d1 = a * PntXP1 + b * PntYP1 - c;
d2 = a * PntXP2 + b * PntYP2 - c;
if (d1 > Tolerance) {
if (d2 < -Tolerance) {
{
const gp_XY aD = theTriangle.V3 - theTriangle.V2;
const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
const Standard_Real aDot = aA * theTriangle.V2;
const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
if (d1 > theTriangle.Tolerance) {
if (d2 < -theTriangle.Tolerance) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
else if (d1 < -theTriangle.Tolerance) {
if (d2 > theTriangle.Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
if (d2 > theTriangle.Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else if (d2 < -theTriangle.Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin2) {
pd1 = (PntXP1 - XV2) / da;
pd2 = (PntXP2 - XV2) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin2) {
pd1 = (thePoints.PntP1.X() - theTriangle.V2.X()) / aD.X();
pd2 = (thePoints.PntP2.X() - theTriangle.V2.X()) / aD.X();
}
else {
pd1 = (PntYP1 - YV2) / db;
pd2 = (PntYP2 - YV2) / db;
pd1 = (thePoints.PntP1.Y() - theTriangle.V2.Y()) / aD.Y();
pd2 = (thePoints.PntP2.Y() - theTriangle.V2.Y()) / aD.Y();
}
if (pd1 < -TolParam) nn1 = 1;
else if (pd1 < TolParam) nn1 = 2;
else if (pd1 - 1. < -TolParam) nn1 = 3;
else if (pd1 - 1. < TolParam) nn1 = 4;
if (pd1 < -theTriangle.TolParam) nn1 = 1;
else if (pd1 < theTriangle.TolParam) nn1 = 2;
else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
else nn1 = 5;
if (pd2 < -TolParam) nn2 = 1;
else if (pd2 < TolParam) nn2 = 2;
else if (pd2 - 1. < -TolParam) nn2 = 3;
else if (pd2 - 1. < TolParam) nn2 = 4;
if (pd2 < -theTriangle.TolParam) nn2 = 1;
else if (pd2 < theTriangle.TolParam) nn2 = 2;
else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -547,17 +469,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin2)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV2) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin2)
pdp = (thePoints.PntP1.X() + (thePoints.Pnt2.X() - thePoints.PntP1.X()) * pp - theTriangle.V2.X()) / aD.X();
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV2) / db;
pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V2.Y()) / aD.Y();
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
if (pdp < -theTriangle.TolParam) OutSideP = Standard_True;
else if (pdp < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (n1 == -1)) {
@@ -572,11 +494,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
else if (pdp - 1. < -theTriangle.TolParam) {}
else if (pdp - 1. < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (n1 == -1)) {
@@ -608,55 +530,52 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
#endif
}
}
}
da = XV1 - XV3;
db = YV1 - YV3;
a = -db;
b = da;
c = sqrt(a * a + b * b);
a /= c;
b /= c;
c = a * XV3 + b * YV3;
d1 = a * PntXP1 + b * PntYP1 - c;
d2 = a * PntXP2 + b * PntYP2 - c;
if (d1 > Tolerance) {
if (d2 < -Tolerance) {
{
const gp_XY aD = theTriangle.V1 - theTriangle.V3;
const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
const Standard_Real aDot = aA * theTriangle.V3;
const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
if (d1 > theTriangle.Tolerance) {
if (d2 < -theTriangle.Tolerance) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
else if (d1 < -theTriangle.Tolerance) {
if (d2 > theTriangle.Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
if (d2 > theTriangle.Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else if (d2 < -theTriangle.Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin3) {
pd1 = (PntXP1 - XV3) / da;
pd2 = (PntXP2 - XV3) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin3) {
pd1 = (thePoints.PntP1.X() - theTriangle.V3.X()) / aD.X();
pd2 = (thePoints.PntP2.X() - theTriangle.V3.X()) / aD.X();
}
else {
pd1 = (PntYP1 - YV3) / db;
pd2 = (PntYP2 - YV3) / db;
pd1 = (thePoints.PntP1.Y() - theTriangle.V3.Y()) / aD.Y();
pd2 = (thePoints.PntP2.Y() - theTriangle.V3.Y()) / aD.Y();
}
if (pd1 < -TolParam) nn1 = 1;
else if (pd1 < TolParam) nn1 = 2;
else if (pd1 - 1. < -TolParam) nn1 = 3;
else if (pd1 - 1. < TolParam) nn1 = 4;
if (pd1 < -theTriangle.TolParam) nn1 = 1;
else if (pd1 < theTriangle.TolParam) nn1 = 2;
else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
else nn1 = 5;
if (pd2 < -TolParam) nn2 = 1;
else if (pd2 < TolParam) nn2 = 2;
else if (pd2 - 1. < -TolParam) nn2 = 3;
else if (pd2 - 1. < TolParam) nn2 = 4;
if (pd2 < -theTriangle.TolParam) nn2 = 1;
else if (pd2 < theTriangle.TolParam) nn2 = 2;
else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -692,17 +611,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin3)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV3) / da;
if (TrFlags & HLRAlgo_PolyMask_EMskGrALin3)
pdp = (thePoints.PntP1.X() + (thePoints.PntP2.X() - thePoints.PntP1.X()) * pp - theTriangle.V3.X()) / aD.X();
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV3) / db;
pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V3.Y()) / aD.Y();
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
if (pdp < -theTriangle.TolParam) OutSideP = Standard_True;
else if (pdp < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (n1 == -1)) {
@@ -717,11 +636,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
else if (pdp - 1. < -theTriangle.TolParam) {}
else if (pdp - 1. < theTriangle.TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
for (Standard_Integer l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (n1 == -1)) {
@@ -753,7 +672,8 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
#endif
}
}
}
if (npi == -1) {
if (npiRej >= 2) return;
}
@@ -780,24 +700,24 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
if (Crossing) {
if (HideBefore) {
if (Param-psta < TolParam) return;
else if (Param < pend) pend = Param;
if (theTriangle.Param - psta < theTriangle.TolParam) return;
else if (theTriangle.Param < pend) pend = theTriangle.Param;
}
else {
if (pend-Param < TolParam) return;
else if (psta < Param) psta = Param;
if (pend - theTriangle.Param < theTriangle.TolParam) return;
else if (psta < theTriangle.Param) psta = theTriangle.Param;
}
}
Standard_Boolean total;
if (psta > 0) total = psta < TolParam;
else total = psta > -TolParam;
if (psta > 0) total = psta < theTriangle.TolParam;
else total = psta > -theTriangle.TolParam;
if (total) {
Standard_Real pfin = pend - 1.;
if (pfin > 0) total = pfin < TolParam;
else total = pfin > -TolParam;
if (pfin > 0) total = pfin < theTriangle.TolParam;
else total = pfin > -theTriangle.TolParam;
}
if (total) status.HideAll();
else status.Hide(psta,(Standard_ShortReal)TolParam,pend,(Standard_ShortReal)TolParam,
else status.Hide(psta,(Standard_ShortReal)theTriangle.TolParam,pend,(Standard_ShortReal)theTriangle.TolParam,
Standard_False,Standard_False);
}

View File

@@ -17,6 +17,7 @@
#ifndef _HLRAlgo_PolyData_HeaderFile
#define _HLRAlgo_PolyData_HeaderFile
#include <HLRAlgo_BiPoint.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -28,10 +29,9 @@
#include <TColgp_Array1OfXYZ.hxx>
#include <HLRAlgo_Array1OfTData.hxx>
#include <HLRAlgo_Array1OfPHDat.hxx>
#include <Standard_Address.hxx>
#include <Standard_Boolean.hxx>
class HLRAlgo_EdgeStatus;
class HLRAlgo_EdgeStatus;
class HLRAlgo_PolyData;
DEFINE_STANDARD_HANDLE(HLRAlgo_PolyData, MMgt_TShared)
@@ -41,8 +41,44 @@ class HLRAlgo_PolyData : public MMgt_TShared
{
public:
struct FaceIndices
{
Standard_Integer Index, Min, Max;
};
struct Triangle
{
gp_XY V1, V2, V3;
Standard_Real Param, TolParam, TolAng, Tolerance;
};
struct Box
{
Standard_Real XMin, YMin, ZMin, XMax, YMax, ZMax;
//! The default constructor.
Box()
{
}
//! The initializing constructor.
Box(
const Standard_Real& theXMin,
const Standard_Real& theYMin,
const Standard_Real& theZMin,
const Standard_Real& theXMax,
const Standard_Real& theYMax,
const Standard_Real& theZMax) :
XMin(theXMin),
YMin(theYMin),
ZMin(theZMin),
XMax(theXMax),
YMax(theYMax),
ZMax(theZMax)
{
}
};
Standard_EXPORT HLRAlgo_PolyData();
Standard_EXPORT void HNodes (const Handle(TColgp_HArray1OfXYZ)& HNodes);
@@ -61,28 +97,31 @@ public:
HLRAlgo_Array1OfPHDat& PHDat() const;
Standard_EXPORT void UpdateGlobalMinMax (const Standard_Address ToTMinMax);
Standard_EXPORT void UpdateGlobalMinMax (Box& theBox);
Standard_Boolean Hiding() const;
//! process hiding between <Pt1> and <Pt2>.
Standard_EXPORT void HideByPolyData (const Standard_Address Coordinates, const Standard_Address RealPtr, const Standard_Address Indices, const Standard_Boolean HidingShell, HLRAlgo_EdgeStatus& status);
Standard_EXPORT void HideByPolyData (const HLRAlgo_BiPoint::PointsT& thePoints, Triangle& theTriangle, HLRAlgo_BiPoint::IndicesT& theIndices, const Standard_Boolean HidingShell, HLRAlgo_EdgeStatus& status);
Standard_Address Indices();
FaceIndices& Indices()
{
return myFaceIndices;
}
DEFINE_STANDARD_RTTIEXT(HLRAlgo_PolyData,MMgt_TShared)
private:
//! evident.
void hideByOneTriangle (const Standard_Address Coordinates,
const Standard_Address RealPtr,
void hideByOneTriangle (const HLRAlgo_BiPoint::PointsT& thePoints,
Triangle& theTriangle,
const Standard_Boolean Crossing,
const Standard_Boolean HideBefore,
const Standard_Integer TrFlags,
HLRAlgo_EdgeStatus& status);
Standard_Integer myIndices[3];
FaceIndices myFaceIndices;
Handle(TColgp_HArray1OfXYZ) myHNodes;
Handle(HLRAlgo_HArray1OfTData) myHTData;
Handle(HLRAlgo_HArray1OfPHDat) myHPHDat;

View File

@@ -25,7 +25,9 @@
inline void
HLRAlgo_PolyData::FaceIndex (const Standard_Integer I)
{ myIndices[0] = I; }
{
myFaceIndices.Index = I;
}
//=======================================================================
//function : FaceIndex
@@ -34,7 +36,9 @@ HLRAlgo_PolyData::FaceIndex (const Standard_Integer I)
inline Standard_Integer
HLRAlgo_PolyData::FaceIndex () const
{ return myIndices[0]; }
{
return myFaceIndices.Index;
}
//=======================================================================
//function : Nodes
@@ -70,11 +74,3 @@ HLRAlgo_PolyData::PHDat () const
inline Standard_Boolean HLRAlgo_PolyData::Hiding () const
{ return !myHPHDat.IsNull(); }
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyData::Indices ()
{ return (Standard_Address)myIndices; }

View File

@@ -23,49 +23,58 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Address.hxx>
//! Data structure of a set of Hiding Triangles.
class HLRAlgo_PolyHidingData
class HLRAlgo_PolyHidingData
{
public:
DEFINE_STANDARD_ALLOC
HLRAlgo_PolyHidingData();
void Set (const Standard_Integer Index, const Standard_Integer Minim, const Standard_Integer Maxim, const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D);
Standard_Address IndexAndMinMax() const;
Standard_Address Plan() const;
struct TriangleIndices
{
Standard_Integer Index, Min, Max;
};
struct PlaneT
{
gp_XYZ Normal;
Standard_Real D;
};
HLRAlgo_PolyHidingData()
{
}
void Set (
const Standard_Integer Index,
const Standard_Integer Minim,
const Standard_Integer Maxim,
const Standard_Real A,
const Standard_Real B,
const Standard_Real C,
const Standard_Real D)
{
myIndices.Index = Index;
myIndices.Min = Minim;
myIndices.Max = Maxim;
myPlane.Normal = gp_XYZ(A, B, C);
myPlane.D = D;
}
protected:
TriangleIndices& Indices()
{
return myIndices;
}
PlaneT& Plane()
{
return myPlane;
}
private:
Standard_Integer myMinMax[3];
Standard_Real myPlan[4];
TriangleIndices myIndices;
PlaneT myPlane;
};
#include <HLRAlgo_PolyHidingData.lxx>
#endif // _HLRAlgo_PolyHidingData_HeaderFile

View File

@@ -1,64 +0,0 @@
// Created on: 1995-06-21
// Created by: Christophe MARION
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : PolyHidingData
//purpose :
//=======================================================================
inline HLRAlgo_PolyHidingData::HLRAlgo_PolyHidingData ()
{}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
inline void
HLRAlgo_PolyHidingData::Set (const Standard_Integer Index,
const Standard_Integer Minim,
const Standard_Integer Maxim,
const Standard_Real A,
const Standard_Real B,
const Standard_Real C,
const Standard_Real D)
{
myMinMax[0] = Index;
myMinMax[1] = Minim;
myMinMax[2] = Maxim;
myPlan[0] = A;
myPlan[1] = B;
myPlan[2] = C;
myPlan[3] = D;
}
//=======================================================================
//function : IndexAndMinMax
//purpose :
//=======================================================================
inline Standard_Address
HLRAlgo_PolyHidingData::IndexAndMinMax() const
{ return (Standard_Address)myMinMax; }
//=======================================================================
//function : Plan
//purpose :
//=======================================================================
inline Standard_Address
HLRAlgo_PolyHidingData::Plan() const
{ return (Standard_Address)myPlan; }

View File

@@ -22,97 +22,6 @@
IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Tri1Node1 ((Standard_Integer*)Tri1Indices)[0]
#define Tri1Node2 ((Standard_Integer*)Tri1Indices)[1]
#define Tri1Node3 ((Standard_Integer*)Tri1Indices)[2]
#define Tri1Flags ((Standard_Integer*)Tri1Indices)[3]
#define Tri2Node1 ((Standard_Integer*)Tri2Indices)[0]
#define Tri2Node2 ((Standard_Integer*)Tri2Indices)[1]
#define Tri2Node3 ((Standard_Integer*)Tri2Indices)[2]
#define Tri2Flags ((Standard_Integer*)Tri2Indices)[3]
#define Seg1LstSg1 ((Standard_Integer*)Seg1Indices)[0]
#define Seg1LstSg2 ((Standard_Integer*)Seg1Indices)[1]
#define Seg1NxtSg1 ((Standard_Integer*)Seg1Indices)[2]
#define Seg1NxtSg2 ((Standard_Integer*)Seg1Indices)[3]
#define Seg1Conex1 ((Standard_Integer*)Seg1Indices)[4]
#define Seg1Conex2 ((Standard_Integer*)Seg1Indices)[5]
#define Seg2LstSg1 ((Standard_Integer*)Seg2Indices)[0]
#define Seg2LstSg2 ((Standard_Integer*)Seg2Indices)[1]
#define Seg2NxtSg1 ((Standard_Integer*)Seg2Indices)[2]
#define Seg2NxtSg2 ((Standard_Integer*)Seg2Indices)[3]
#define Seg2Conex1 ((Standard_Integer*)Seg2Indices)[4]
#define Seg2Conex2 ((Standard_Integer*)Seg2Indices)[5]
#define Nod1NdSg ((Standard_Integer*)Nod1Indices)[0]
#define Nod1Flag ((Standard_Integer*)Nod1Indices)[1]
#define Nod1Edg1 ((Standard_Integer*)Nod1Indices)[2]
#define Nod1Edg2 ((Standard_Integer*)Nod1Indices)[3]
#define Nod1PntX ((Standard_Real*)Nod1RValues)[ 0]
#define Nod1PntY ((Standard_Real*)Nod1RValues)[ 1]
#define Nod1PntZ ((Standard_Real*)Nod1RValues)[ 2]
#define Nod1PntU ((Standard_Real*)Nod1RValues)[ 3]
#define Nod1PntV ((Standard_Real*)Nod1RValues)[ 4]
#define Nod1NrmX ((Standard_Real*)Nod1RValues)[ 5]
#define Nod1NrmY ((Standard_Real*)Nod1RValues)[ 6]
#define Nod1NrmZ ((Standard_Real*)Nod1RValues)[ 7]
#define Nod1PCu1 ((Standard_Real*)Nod1RValues)[ 8]
#define Nod1PCu2 ((Standard_Real*)Nod1RValues)[ 9]
#define Nod1Scal ((Standard_Real*)Nod1RValues)[10]
#define Nod2NdSg ((Standard_Integer*)Nod2Indices)[0]
#define Nod2Flag ((Standard_Integer*)Nod2Indices)[1]
#define Nod2Edg1 ((Standard_Integer*)Nod2Indices)[2]
#define Nod2Edg2 ((Standard_Integer*)Nod2Indices)[3]
#define Nod2PntX ((Standard_Real*)Nod2RValues)[ 0]
#define Nod2PntY ((Standard_Real*)Nod2RValues)[ 1]
#define Nod2PntZ ((Standard_Real*)Nod2RValues)[ 2]
#define Nod2PntU ((Standard_Real*)Nod2RValues)[ 3]
#define Nod2PntV ((Standard_Real*)Nod2RValues)[ 4]
#define Nod2NrmX ((Standard_Real*)Nod2RValues)[ 5]
#define Nod2NrmY ((Standard_Real*)Nod2RValues)[ 6]
#define Nod2NrmZ ((Standard_Real*)Nod2RValues)[ 7]
#define Nod2PCu1 ((Standard_Real*)Nod2RValues)[ 8]
#define Nod2PCu2 ((Standard_Real*)Nod2RValues)[ 9]
#define Nod2Scal ((Standard_Real*)Nod2RValues)[10]
#define Nod3NdSg ((Standard_Integer*)Nod3Indices)[0]
#define Nod3Flag ((Standard_Integer*)Nod3Indices)[1]
#define Nod3Edg1 ((Standard_Integer*)Nod3Indices)[2]
#define Nod3Edg2 ((Standard_Integer*)Nod3Indices)[3]
#define Nod3PntX ((Standard_Real*)Nod3RValues)[ 0]
#define Nod3PntY ((Standard_Real*)Nod3RValues)[ 1]
#define Nod3PntZ ((Standard_Real*)Nod3RValues)[ 2]
#define Nod3PntU ((Standard_Real*)Nod3RValues)[ 3]
#define Nod3PntV ((Standard_Real*)Nod3RValues)[ 4]
#define Nod3NrmX ((Standard_Real*)Nod3RValues)[ 5]
#define Nod3NrmY ((Standard_Real*)Nod3RValues)[ 6]
#define Nod3NrmZ ((Standard_Real*)Nod3RValues)[ 7]
#define Nod3PCu1 ((Standard_Real*)Nod3RValues)[ 8]
#define Nod3PCu2 ((Standard_Real*)Nod3RValues)[ 9]
#define Nod3Scal ((Standard_Real*)Nod3RValues)[10]
#define Nod4NdSg ((Standard_Integer*)Nod4Indices)[0]
#define Nod4Flag ((Standard_Integer*)Nod4Indices)[1]
#define Nod4Edg1 ((Standard_Integer*)Nod4Indices)[2]
#define Nod4Edg2 ((Standard_Integer*)Nod4Indices)[3]
#define Nod4PntX ((Standard_Real*)Nod4RValues)[ 0]
#define Nod4PntY ((Standard_Real*)Nod4RValues)[ 1]
#define Nod4PntZ ((Standard_Real*)Nod4RValues)[ 2]
#define Nod4PntU ((Standard_Real*)Nod4RValues)[ 3]
#define Nod4PntV ((Standard_Real*)Nod4RValues)[ 4]
#define Nod4NrmX ((Standard_Real*)Nod4RValues)[ 5]
#define Nod4NrmY ((Standard_Real*)Nod4RValues)[ 6]
#define Nod4NrmZ ((Standard_Real*)Nod4RValues)[ 7]
#define Nod4PCu1 ((Standard_Real*)Nod4RValues)[ 8]
#define Nod4PCu2 ((Standard_Real*)Nod4RValues)[ 9]
#define Nod4Scal ((Standard_Real*)Nod4RValues)[10]
#ifdef OCCT_DEBUG
static Standard_Integer TRACE = Standard_False;
static Standard_Integer ERROR = Standard_False;
@@ -141,8 +50,7 @@ HLRAlgo_PolyInternalData::HLRAlgo_PolyInternalData
HLRAlgo_Array1OfPINod& PINod = myPINod->ChangeArray1();
Handle(HLRAlgo_PolyInternalNode)* NN = &(PINod.ChangeValue(1));
// Standard_Address Nod1Indices;
for (i = 1; i <= myMxPINod; i++) {
*NN = new HLRAlgo_PolyInternalNode();
NN++;
@@ -155,230 +63,225 @@ HLRAlgo_PolyInternalData::HLRAlgo_PolyInternalData
//=======================================================================
void HLRAlgo_PolyInternalData::UpdateLinks
(Standard_Address& TData,
Standard_Address& PISeg,
Standard_Address& PINod)
(HLRAlgo_Array1OfTData*& TData,
HLRAlgo_Array1OfPISeg*& PISeg,
HLRAlgo_Array1OfPINod*& PINod)
{
Standard_Integer i,n1,n2;
Standard_Integer find,iiii,icsv = 0;
Standard_Address A1,A2,A3,Nod1Indices,Nod2Indices,Seg2Indices = NULL,Tri2Indices;
HLRAlgo_PolyInternalSegment* aSegIndices = NULL;
Standard_Boolean newSeg = Standard_False;
HLRAlgo_TriangleData* TD =
&(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
for (i = 1; i <= myNbTData; i++) {
Tri2Indices = TD->Indices();
A1 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node1)->Indices();
A2 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node2)->Indices();
A3 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node3)->Indices();
n1 = Tri2Node1;
n2 = Tri2Node2;
Nod1Indices = A1;
Nod2Indices = A2;
HLRAlgo_PolyInternalNode::NodeIndices& A1 =
PINod->ChangeValue(TD->Node1)->Indices();
HLRAlgo_PolyInternalNode::NodeIndices& A2 =
PINod->ChangeValue(TD->Node2)->Indices();
HLRAlgo_PolyInternalNode::NodeIndices& A3 =
PINod->ChangeValue(TD->Node3)->Indices();
{
n1 = TD->Node1;
n2 = TD->Node2;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
if (A1.NdSg == 0 && A2.NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
A1.NdSg = myNbPISeg;
A2.NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
iiii = A1.NdSg;
if (iiii != 0) {
find = 0;
while (iiii != 0 && find == 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n1) {
if (Seg2LstSg2 == n2) find = iiii;
else iiii = Seg2NxtSg1;
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n1) {
if (aSegIndices->LstSg2 == n2) find = iiii;
else iiii = aSegIndices->NxtSg1;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
if (aSegIndices->LstSg1 == n2) find = iiii;
else iiii = aSegIndices->NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
else aSegIndices->Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
A1.NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
iiii = A2.NdSg;
if (iiii != 0) {
while (iiii != 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
else { icsv = 2; iiii = Seg2NxtSg2; }
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
else { icsv = 2; iiii = aSegIndices->NxtSg2; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
else A2.NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
aSegIndices = &PISeg->ChangeValue(myNbPISeg);
aSegIndices->LstSg1 = n1;
aSegIndices->LstSg2 = n2;
aSegIndices->Conex1 = i;
aSegIndices->Conex2 = 0;
aSegIndices->NxtSg1 = 0;
aSegIndices->NxtSg2 = 0;
}
n1 = Tri2Node2;
n2 = Tri2Node3;
Nod1Indices = A2;
Nod2Indices = A3;
}
{
n1 = TD->Node2;
n2 = TD->Node3;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
if (A2.NdSg == 0 && A3.NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
A2.NdSg = myNbPISeg;
A3.NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
iiii = A2.NdSg;
if (iiii != 0) {
find = 0;
while (iiii != 0 && find == 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n1) {
if (Seg2LstSg2 == n2) find = iiii;
else iiii = Seg2NxtSg1;
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n1) {
if (aSegIndices->LstSg2 == n2) find = iiii;
else iiii = aSegIndices->NxtSg1;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
if (aSegIndices->LstSg1 == n2) find = iiii;
else iiii = aSegIndices->NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
else aSegIndices->Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
A2.NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
iiii = A3.NdSg;
if (iiii != 0) {
while (iiii != 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
else { icsv = 2; iiii = Seg2NxtSg2; }
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
else { icsv = 2; iiii = aSegIndices->NxtSg2; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
else A3.NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
aSegIndices = &PISeg->ChangeValue(myNbPISeg);
aSegIndices->LstSg1 = n1;
aSegIndices->LstSg2 = n2;
aSegIndices->Conex1 = i;
aSegIndices->Conex2 = 0;
aSegIndices->NxtSg1 = 0;
aSegIndices->NxtSg2 = 0;
}
n1 = Tri2Node3;
n2 = Tri2Node1;
Nod1Indices = A3;
Nod2Indices = A1;
}
{
n1 = TD->Node3;
n2 = TD->Node1;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
if (A3.NdSg == 0 && A1.NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
A3.NdSg = myNbPISeg;
A1.NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
iiii = A3.NdSg;
if (iiii != 0) {
find = 0;
while (iiii != 0 && find == 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n1) {
if (Seg2LstSg2 == n2) find = iiii;
else iiii = Seg2NxtSg1;
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n1) {
if (aSegIndices->LstSg2 == n2) find = iiii;
else iiii = aSegIndices->NxtSg1;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
if (aSegIndices->LstSg1 == n2) find = iiii;
else iiii = aSegIndices->NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
else aSegIndices->Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
A3.NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
iiii = A1.NdSg;
if (iiii != 0) {
while (iiii != 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
else { icsv = 2; iiii = Seg2NxtSg2; }
aSegIndices = &PISeg->ChangeValue(iiii);
if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
else { icsv = 2; iiii = aSegIndices->NxtSg2; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
else A1.NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
aSegIndices = &PISeg->ChangeValue(myNbPISeg);
aSegIndices->LstSg1 = n1;
aSegIndices->LstSg2 = n2;
aSegIndices->Conex1 = i;
aSegIndices->Conex2 = 0;
aSegIndices->NxtSg1 = 0;
aSegIndices->NxtSg2 = 0;
}
}
TD++;
}
@@ -390,14 +293,15 @@ void HLRAlgo_PolyInternalData::UpdateLinks
//=======================================================================
Standard_Integer
HLRAlgo_PolyInternalData::AddNode (const Standard_Address Nod1RValues,
const Standard_Address Nod2RValues,
Standard_Address& PINod1,
Standard_Address& PINod2,
const Standard_Real coef1,
const Standard_Real X3,
const Standard_Real Y3,
const Standard_Real Z3)
HLRAlgo_PolyInternalData::AddNode (
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
HLRAlgo_Array1OfPINod*& PINod1,
HLRAlgo_Array1OfPINod*& PINod2,
const Standard_Real coef1,
const Standard_Real X3,
const Standard_Real Y3,
const Standard_Real Z3)
{
Standard_Real coef2 = 1 - coef1;
IncPINod(PINod1,PINod2);
@@ -405,30 +309,21 @@ HLRAlgo_PolyInternalData::AddNode (const Standard_Address Nod1RValues,
Handle(HLRAlgo_PolyInternalNode)* pip3 =
&(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip3));
*pip3 = new HLRAlgo_PolyInternalNode();
const Standard_Address Nod3RValues = (*pip3)->RValues();
const Standard_Address Nod3Indices = (*pip3)->Indices();
Nod3NdSg = 0;
Nod3Flag = 0;
Nod3PntX = X3;
Nod3PntY = Y3;
Nod3PntZ = Z3;
Nod3PntU = Nod1PntU * coef2 + Nod2PntU * coef1;
Nod3PntV = Nod1PntV * coef2 + Nod2PntV * coef1;
Nod3Scal = Nod1Scal * coef2 + Nod2Scal * coef1;
Standard_Real x = Nod1NrmX * coef2 + Nod2NrmX * coef1;
Standard_Real y = Nod1NrmY * coef2 + Nod2NrmY * coef1;
Standard_Real z = Nod1NrmZ * coef2 + Nod2NrmZ * coef1;
Standard_Real d = sqrt(x * x + y * y + z * z);
HLRAlgo_PolyInternalNode::NodeData& Nod3RValues = (*pip3)->Data();
HLRAlgo_PolyInternalNode::NodeIndices& aNodeIndices = (*pip3)->Indices();
aNodeIndices.NdSg = 0;
aNodeIndices.Flag = 0;
Nod3RValues.Point = gp_XYZ(X3, Y3, Z3);
Nod3RValues.UV = coef2 * Nod1RValues.UV + coef1 * Nod2RValues.UV;
Nod3RValues.Scal = Nod1RValues.Scal * coef2 + Nod2RValues.Scal * coef1;
const gp_XYZ aXYZ = coef2 * Nod1RValues.Normal + coef1 * Nod2RValues.Normal;
const Standard_Real aNorm = aXYZ.Modulus();
if (d > 0) {
Nod3NrmX = x / d;
Nod3NrmY = y / d;
Nod3NrmZ = z / d;
if (aNorm > 0) {
Nod3RValues.Normal = (1 / aNorm) * aXYZ;
}
else {
Nod3NrmX = 1;
Nod3NrmY = 0;
Nod3NrmZ = 0;
Nod3RValues.Normal = gp_XYZ(1., 0., 0.);
#ifdef OCCT_DEBUG
if (ERROR)
cout << "HLRAlgo_PolyInternalData::AddNode" << endl;
@@ -446,16 +341,16 @@ void
HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
const Standard_Integer ip2,
const Standard_Integer ip3,
Standard_Address& TData1,
Standard_Address& TData2,
Standard_Address& PISeg1,
Standard_Address& PISeg2,
Standard_Address& PINod1,
Standard_Address& )
HLRAlgo_Array1OfTData*& TData1,
HLRAlgo_Array1OfTData*& TData2,
HLRAlgo_Array1OfPISeg*& PISeg1,
HLRAlgo_Array1OfPISeg*& PISeg2,
HLRAlgo_Array1OfPINod*& PINod1,
HLRAlgo_Array1OfPINod*& )
{
Standard_Integer find,iiii,iisv,icsv,iip2 =0,cnx1 =0,cnx2 =0;
Standard_Address Seg1Indices,Seg2Indices = NULL;
Seg1Indices = 0;
HLRAlgo_PolyInternalSegment* aSegIndices = NULL;
HLRAlgo_PolyInternalSegment* aSegIndices2 = NULL;
find = 0;
iisv = 0;
icsv = 0;
@@ -468,54 +363,53 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
IncTData(TData1,TData2);
myNbTData--;
myNbTData--;
Standard_Address Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip1)->Indices();
Standard_Address Nod2Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip2)->Indices();
Standard_Address Nod3Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip3)->Indices();
iiii = Nod2NdSg;
HLRAlgo_PolyInternalNode::NodeIndices* aNodIndices1 =
&PINod1->ChangeValue(ip1)->Indices();
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices2 =
PINod1->ChangeValue(ip2)->Indices();
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices3 =
PINod1->ChangeValue(ip3)->Indices();
iiii = aNodIndices2.NdSg;
while (iiii != 0 && find == 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == ip2) {
if (Seg2LstSg2 == ip1) {
aSegIndices2 = &PISeg1->ChangeValue(iiii);
if (aSegIndices2->LstSg1 == ip2) {
if (aSegIndices2->LstSg2 == ip1) {
find = iiii;
cnx1 = Seg2Conex1;
cnx2 = Seg2Conex2;
Seg2LstSg1 = ip3;
iip2 = Seg2NxtSg1;
Seg2NxtSg1 = myNbPISeg;
if (iisv == 0) Nod2NdSg = myNbPISeg;
else if (icsv == 1) Seg1NxtSg1 = myNbPISeg;
else Seg1NxtSg2 = myNbPISeg;
cnx1 = aSegIndices2->Conex1;
cnx2 = aSegIndices2->Conex2;
aSegIndices2->LstSg1 = ip3;
iip2 = aSegIndices2->NxtSg1;
aSegIndices2->NxtSg1 = myNbPISeg;
if (iisv == 0) aNodIndices2.NdSg = myNbPISeg;
else if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else {
iisv = iiii;
icsv = 1;
}
iiii = Seg2NxtSg1;
iiii = aSegIndices2->NxtSg1;
}
else {
if (Seg2LstSg1 == ip1) {
if (aSegIndices2->LstSg1 == ip1) {
find = iiii;
cnx1 = Seg2Conex1;
cnx2 = Seg2Conex2;
Seg2LstSg2 = ip3;
iip2 = Seg2NxtSg2;
Seg2NxtSg2 = myNbPISeg;
if (iisv == 0) Nod2NdSg = myNbPISeg;
else if (icsv == 1) Seg1NxtSg1 = myNbPISeg;
else Seg1NxtSg2 = myNbPISeg;
cnx1 = aSegIndices2->Conex1;
cnx2 = aSegIndices2->Conex2;
aSegIndices2->LstSg2 = ip3;
iip2 = aSegIndices2->NxtSg2;
aSegIndices2->NxtSg2 = myNbPISeg;
if (iisv == 0) aNodIndices2.NdSg = myNbPISeg;
else if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
else aSegIndices->NxtSg2 = myNbPISeg;
}
else {
iisv = iiii;
icsv = 2;
}
iiii = Seg2NxtSg2;
iiii = aSegIndices2->NxtSg2;
}
Seg1Indices = Seg2Indices;
aSegIndices = aSegIndices2;
}
if (find == 0) {
myNbPISeg--;
@@ -527,15 +421,14 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
#endif
}
else {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
Seg2NxtSg1 = 0;
Seg2NxtSg2 = iip2;
Seg2LstSg1 = ip3;
Seg2LstSg2 = ip2;
Seg2Conex1 = cnx1;
Seg2Conex2 = cnx2;
Nod3NdSg = find;
aSegIndices2 = &PISeg1->ChangeValue(myNbPISeg);
aSegIndices2->NxtSg1 = 0;
aSegIndices2->NxtSg2 = iip2;
aSegIndices2->LstSg1 = ip3;
aSegIndices2->LstSg2 = ip2;
aSegIndices2->Conex1 = cnx1;
aSegIndices2->Conex2 = cnx2;
aNodIndices3.NdSg = find;
Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
@@ -554,13 +447,11 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
iOld = New[skip];
iNew = New[skip + 2];
if (iOld != 0) {
Standard_Address Tri1Indices =
((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iOld).Indices();
Standard_Address Tri2Indices =
((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iNew).Indices();
n1 = Tri1Node1;
n2 = Tri1Node2;
n3 = Tri1Node3;
HLRAlgo_TriangleData& aTriangle = TData1->ChangeValue(iOld);
HLRAlgo_TriangleData& aTriangle2 = TData1->ChangeValue(iNew);
n1 = aTriangle.Node1;
n2 = aTriangle.Node2;
n3 = aTriangle.Node3;
nOld[0] = n1;
nOld[1] = n2;
nOld[2] = n3;
@@ -607,26 +498,25 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
if (found) {
myNbTData++;
ip4 = itpk[skip];
Standard_Address Nod4Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip4)->Indices();
Tri1Node1 = nOld[0];
Tri1Node2 = nOld[1];
Tri1Node3 = nOld[2];
Tri2Node1 = nNew[0];
Tri2Node2 = nNew[1];
Tri2Node3 = nNew[2];
Tri2Flags = Tri1Flags;
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices4 =
PINod1->ChangeValue(ip4)->Indices();
aTriangle.Node1 = nOld[0];
aTriangle.Node2 = nOld[1];
aTriangle.Node3 = nOld[2];
aTriangle2.Node1 = nNew[0];
aTriangle2.Node2 = nNew[1];
aTriangle2.Node3 = nNew[2];
aTriangle2.Flags = aTriangle.Flags;
myNbPISeg++;
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = ip3;
Seg2LstSg2 = ip4;
Seg2NxtSg1 = Nod3NdSg;
Seg2NxtSg2 = Nod4NdSg;
Seg2Conex1 = iOld;
Seg2Conex2 = iNew;
Nod3NdSg = myNbPISeg;
Nod4NdSg = myNbPISeg;
aSegIndices2 = &PISeg1->ChangeValue(myNbPISeg);
aSegIndices2->LstSg1 = ip3;
aSegIndices2->LstSg2 = ip4;
aSegIndices2->NxtSg1 = aNodIndices3.NdSg;
aSegIndices2->NxtSg2 = aNodIndices4.NdSg;
aSegIndices2->Conex1 = iOld;
aSegIndices2->Conex2 = iNew;
aNodIndices3.NdSg = myNbPISeg;
aNodIndices4.NdSg = myNbPISeg;
}
#ifdef OCCT_DEBUG
else if (ERROR) {
@@ -644,37 +534,34 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
iOld = New [skip];
ip4 = itpk[skip];
if (iNew != 0) {
Standard_Address Tri2Indices =
((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iNew).Indices();
n1 = Tri2Node1;
n2 = Tri2Node2;
n3 = Tri2Node3;
HLRAlgo_TriangleData& aTriangle2 = TData1->ChangeValue(iNew);
n1 = aTriangle2.Node1;
n2 = aTriangle2.Node2;
n3 = aTriangle2.Node3;
if (!((n1 == ip3 && n2 == ip4) ||
(n2 == ip3 && n1 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n1)->Indices();
iiii = Nod1NdSg;
aNodIndices1 = &PINod1->ChangeValue(n1)->Indices();
iiii = aNodIndices1->NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n1) {
if (Seg2LstSg2 == n2) {
aSegIndices2 = &PISeg1->ChangeValue(iiii);
if (aSegIndices2->LstSg1 == n1) {
if (aSegIndices2->LstSg2 == n2) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
else iiii = aSegIndices2->NxtSg1;
}
else {
if (Seg2LstSg1 == n2) {
if (aSegIndices2->LstSg1 == n2) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
else iiii = aSegIndices2->NxtSg2;
}
}
}
@@ -682,28 +569,26 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
if (!((n2 == ip3 && n3 == ip4) ||
(n3 == ip3 && n2 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n2)->Indices();
iiii = Nod1NdSg;
aNodIndices1 = &PINod1->ChangeValue(n2)->Indices();
iiii = aNodIndices1->NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n2) {
if (Seg2LstSg2 == n3) {
aSegIndices2 = &PISeg1->ChangeValue(iiii);
if (aSegIndices2->LstSg1 == n2) {
if (aSegIndices2->LstSg2 == n3) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
else iiii = aSegIndices2->NxtSg1;
}
else {
if (Seg2LstSg1 == n3) {
if (aSegIndices2->LstSg1 == n3) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
else iiii = aSegIndices2->NxtSg2;
}
}
}
@@ -711,28 +596,26 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
if (!((n3 == ip3 && n1 == ip4) ||
(n1 == ip3 && n3 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n3)->Indices();
iiii = Nod1NdSg;
aNodIndices1 = &PINod1->ChangeValue(n3)->Indices();
iiii = aNodIndices1->NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n3) {
if (Seg2LstSg2 == n1) {
aSegIndices2 = &PISeg1->ChangeValue(iiii);
if (aSegIndices2->LstSg1 == n3) {
if (aSegIndices2->LstSg2 == n1) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
else iiii = aSegIndices2->NxtSg1;
}
else {
if (Seg2LstSg1 == n1) {
if (aSegIndices2->LstSg1 == n1) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
if (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
else iiii = aSegIndices2->NxtSg2;
}
}
}
@@ -749,44 +632,40 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
void HLRAlgo_PolyInternalData::Dump () const
{
Standard_Integer i;//,i1,i2,i3;
Standard_Address Seg2Indices;
Standard_Address TData = &myTData->ChangeArray1();
Standard_Address PISeg = &myPISeg->ChangeArray1();
Standard_Address PINod = &myPINod->ChangeArray1();
HLRAlgo_Array1OfTData* TData = &myTData->ChangeArray1();
HLRAlgo_Array1OfPISeg* PISeg = &myPISeg->ChangeArray1();
HLRAlgo_Array1OfPINod* PINod = &myPINod->ChangeArray1();
for (i = 1; i <= myNbPINod; i++) {
const Handle(HLRAlgo_PolyInternalNode)* pi =
&(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(i));
Standard_Address Nod1Indices = (*pi)->Indices();
Standard_Address Nod1RValues = (*pi)->RValues();
const Handle(HLRAlgo_PolyInternalNode)* pi = &PINod->ChangeValue(i);
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices1 = (*pi)->Indices();
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*pi)->Data();
cout << "Node " << setw(6) << i << " : ";
cout << setw(6) << Nod1NdSg;
cout << setw(20)<< Nod1PntX;
cout << setw(20)<< Nod1PntY;
cout << setw(20)<< Nod1PntZ;
cout << setw(6) << aNodIndices1.NdSg;
cout << setw(20)<< Nod1RValues.Point.X();
cout << setw(20)<< Nod1RValues.Point.Y();
cout << setw(20)<< Nod1RValues.Point.Z();
cout << endl;
}
for (i = 1; i <= myNbPISeg; i++) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(i).Indices();
HLRAlgo_PolyInternalSegment* aSegIndices = &PISeg->ChangeValue(i);
cout << "Segment " << setw(6) << i << " : ";
cout << setw(6) << Seg2LstSg1;
cout << setw(6) << Seg2LstSg2;
cout << setw(6) << Seg2NxtSg1;
cout << setw(6) << Seg2NxtSg2;
cout << setw(6) << Seg2Conex1;
cout << setw(6) << Seg2Conex2;
cout << setw(6) << aSegIndices->LstSg1;
cout << setw(6) << aSegIndices->LstSg2;
cout << setw(6) << aSegIndices->NxtSg1;
cout << setw(6) << aSegIndices->NxtSg2;
cout << setw(6) << aSegIndices->Conex1;
cout << setw(6) << aSegIndices->Conex2;
cout << endl;
}
for (i = 1; i <= myNbTData; i++) {
Standard_Address Tri2Indices =
((HLRAlgo_Array1OfTData*)TData)->ChangeValue(i).Indices();
HLRAlgo_TriangleData& aTriangle = TData->ChangeValue(i);
cout << "Triangle " << setw(6) << i << " : ";
cout << setw(6) << Tri2Node1;
cout << setw(6) << Tri2Node2;
cout << setw(6) << Tri2Node3;
cout << setw(6) << aTriangle.Node1;
cout << setw(6) << aTriangle.Node2;
cout << setw(6) << aTriangle.Node3;
cout << endl;
}
}
@@ -796,9 +675,8 @@ void HLRAlgo_PolyInternalData::Dump () const
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncTData (Standard_Address& TData1,
Standard_Address& TData2)
void HLRAlgo_PolyInternalData::IncTData(
HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2)
{
if (myNbTData >= myMxTData) {
#ifdef OCCT_DEBUG
@@ -813,19 +691,10 @@ IncTData (Standard_Address& TData1,
new HLRAlgo_HArray1OfTData(0,k);
HLRAlgo_Array1OfTData& oTData = myTData->ChangeArray1();
HLRAlgo_Array1OfTData& nTData = NwTData->ChangeArray1();
HLRAlgo_TriangleData* OT = &(oTData.ChangeValue(1));
HLRAlgo_TriangleData* NT = &(nTData.ChangeValue(1));
Standard_Address Tri1Indices,Tri2Indices;
for (i = 1; i <= j; i++) {
Tri1Indices = OT->Indices();
Tri2Indices = NT->Indices();
Tri2Node1 = Tri1Node1;
Tri2Node2 = Tri1Node2;
Tri2Node3 = Tri1Node3;
Tri2Flags = Tri1Flags;
OT++;
NT++;
for (i = 1; i <= j; i++)
{
nTData.ChangeValue(i) = oTData.Value(i);
}
myMxTData = k;
myTData = NwTData;
@@ -845,9 +714,8 @@ IncTData (Standard_Address& TData1,
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncPISeg (Standard_Address& PISeg1,
Standard_Address& PISeg2)
void HLRAlgo_PolyInternalData::IncPISeg(
HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2)
{
if (myNbPISeg >= myMxPISeg) {
#ifdef OCCT_DEBUG
@@ -861,21 +729,10 @@ IncPISeg (Standard_Address& PISeg1,
new HLRAlgo_HArray1OfPISeg(0,k);
HLRAlgo_Array1OfPISeg& oPISeg = myPISeg->ChangeArray1();
HLRAlgo_Array1OfPISeg& nPISeg = NwPISeg->ChangeArray1();
HLRAlgo_PolyInternalSegment* OS = &(oPISeg.ChangeValue(1));
HLRAlgo_PolyInternalSegment* NS = &(nPISeg.ChangeValue(1));
Standard_Address Seg1Indices,Seg2Indices;
for (i = 1; i <= j; i++) {
Seg1Indices = OS->Indices();
Seg2Indices = NS->Indices();
Seg2LstSg1 = Seg1LstSg1;
Seg2LstSg2 = Seg1LstSg2;
Seg2NxtSg1 = Seg1NxtSg1;
Seg2NxtSg2 = Seg1NxtSg2;
Seg2Conex1 = Seg1Conex1;
Seg2Conex2 = Seg1Conex2;
OS++;
NS++;
for (i = 1; i <= j; i++)
{
nPISeg.ChangeValue(i) = oPISeg.Value(i);
}
myMxPISeg = k;
myPISeg = NwPISeg;
@@ -895,9 +752,8 @@ IncPISeg (Standard_Address& PISeg1,
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncPINod (Standard_Address& PINod1,
Standard_Address& PINod2)
void HLRAlgo_PolyInternalData::IncPINod(
HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2)
{
if (myNbPINod >= myMxPINod) {
#ifdef OCCT_DEBUG
@@ -905,7 +761,6 @@ IncPINod (Standard_Address& PINod1,
cout << "HLRAlgo_PolyInternalData::IncPINod : " << myMxPINod << endl;
#endif
Standard_Integer i,j,k;
// Standard_Address Nod1Indices;
j = myMxPINod;
k = 2 * j;
Handle(HLRAlgo_HArray1OfPINod) NwPINod =

View File

@@ -26,7 +26,6 @@
#include <HLRAlgo_HArray1OfPISeg.hxx>
#include <HLRAlgo_HArray1OfPINod.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Address.hxx>
#include <Standard_Real.hxx>
#include <HLRAlgo_Array1OfTData.hxx>
#include <HLRAlgo_Array1OfPISeg.hxx>
@@ -45,19 +44,19 @@ public:
Standard_EXPORT HLRAlgo_PolyInternalData(const Standard_Integer nbNod, const Standard_Integer nbTri);
Standard_EXPORT void UpdateLinks (Standard_Address& TData, Standard_Address& PISeg, Standard_Address& PINod);
Standard_EXPORT void UpdateLinks (HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod);
Standard_EXPORT Standard_Integer AddNode (const Standard_Address Nod1RValues, const Standard_Address Nod2RValues, Standard_Address& PINod1, Standard_Address& PINod2, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3);
Standard_EXPORT Standard_Integer AddNode (HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3);
Standard_EXPORT void UpdateLinks (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Integer ip3, Standard_Address& TData1, Standard_Address& TData2, Standard_Address& PISeg1, Standard_Address& PISeg2, Standard_Address& PINod1, Standard_Address& PINod2);
Standard_EXPORT void UpdateLinks (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Integer ip3, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2);
Standard_EXPORT void Dump() const;
Standard_EXPORT void IncTData (Standard_Address& TData1, Standard_Address& TData2);
Standard_EXPORT void IncTData (HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2);
Standard_EXPORT void IncPISeg (Standard_Address& PISeg1, Standard_Address& PISeg2);
Standard_EXPORT void IncPISeg (HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2);
Standard_EXPORT void IncPINod (Standard_Address& PINod1, Standard_Address& PINod2);
Standard_EXPORT void IncPINod (HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2);
void DecTData();

View File

@@ -23,7 +23,8 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Address.hxx>
#include <gp_XYZ.hxx>
#include <gp_XY.hxx>
class HLRAlgo_PolyInternalNode;
@@ -32,40 +33,42 @@ DEFINE_STANDARD_HANDLE(HLRAlgo_PolyInternalNode, MMgt_TShared)
//! to Update OutLines.
class HLRAlgo_PolyInternalNode : public MMgt_TShared
{
public:
struct NodeIndices
{
Standard_Integer NdSg, Flag, Edg1, Edg2;
};
HLRAlgo_PolyInternalNode();
Standard_Address Indices() const;
Standard_Address RValues() const;
struct NodeData
{
gp_XYZ Point, Normal;
gp_XY UV;
Standard_Real PCu1, PCu2, Scal;
};
HLRAlgo_PolyInternalNode()
{
myIndices.NdSg = 0;
myIndices.Flag = 0;
myIndices.Edg1 = 0;
myIndices.Edg2 = 0;
}
NodeIndices& Indices()
{
return myIndices;
}
NodeData& Data()
{
return myData;
}
DEFINE_STANDARD_RTTIEXT(HLRAlgo_PolyInternalNode,MMgt_TShared)
protected:
private:
Standard_Integer myIndices[4];
Standard_Real myRValues[11];
NodeIndices myIndices;
NodeData myData;
};
#include <HLRAlgo_PolyInternalNode.lxx>
#endif // _HLRAlgo_PolyInternalNode_HeaderFile

View File

@@ -1,44 +0,0 @@
// Created on: 1997-01-10
// Created by: Christophe MARION
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : HLRAlgo_PolyInternalNode
//purpose :
//=======================================================================
inline HLRAlgo_PolyInternalNode::HLRAlgo_PolyInternalNode ()
{
myIndices[0] = 0;
myIndices[1] = 0;
myIndices[2] = 0;
myIndices[3] = 0;
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyInternalNode::Indices () const
{ return (Standard_Address)myIndices; }
//=======================================================================
//function : RValues
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyInternalNode::RValues () const
{ return (Standard_Address)myRValues; }

View File

@@ -22,44 +22,13 @@
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Address.hxx>
//! to Update OutLines.
class HLRAlgo_PolyInternalSegment
struct HLRAlgo_PolyInternalSegment
{
public:
DEFINE_STANDARD_ALLOC
HLRAlgo_PolyInternalSegment();
Standard_Address Indices() const;
protected:
private:
Standard_Integer myIndices[6];
Standard_Integer LstSg1, LstSg2, NxtSg1, NxtSg2, Conex1, Conex2;
};
#include <HLRAlgo_PolyInternalSegment.lxx>
#endif // _HLRAlgo_PolyInternalSegment_HeaderFile

View File

@@ -1,31 +0,0 @@
// Created on: 1996-12-03
// Created by: Christophe MARION
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : HLRAlgo_PolyInternalSegment
//purpose :
//=======================================================================
inline HLRAlgo_PolyInternalSegment::HLRAlgo_PolyInternalSegment ()
{}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyInternalSegment::Indices () const
{ return (Standard_Address)myIndices; }

View File

@@ -0,0 +1,37 @@
// Created on: 2016-10-14
// Created by: Aleksandr Bobkov
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _HLRAlgo_PolyMask_HeaderFile
#define _HLRAlgo_PolyMask_HeaderFile
enum HLRAlgo_PolyMask
{
HLRAlgo_PolyMask_EMskOutLin1 = 1,
HLRAlgo_PolyMask_EMskOutLin2 = 2,
HLRAlgo_PolyMask_EMskOutLin3 = 4,
HLRAlgo_PolyMask_EMskGrALin1 = 8,
HLRAlgo_PolyMask_EMskGrALin2 = 16,
HLRAlgo_PolyMask_EMskGrALin3 = 32,
HLRAlgo_PolyMask_FMskBack = 64,
HLRAlgo_PolyMask_FMskSide = 128,
HLRAlgo_PolyMask_FMskHiding = 256,
HLRAlgo_PolyMask_FMskFlat = 512,
HLRAlgo_PolyMask_FMskOnOutL = 1024,
HLRAlgo_PolyMask_FMskOrBack = 2048,
HLRAlgo_PolyMask_FMskFrBack = 4096
};
#endif // _HLRAlgo_PolyData_HeaderFile

View File

@@ -27,26 +27,6 @@
IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,MMgt_TShared)
#define PntX1 ((Standard_Real*)Coordinates)[ 0]
#define PntY1 ((Standard_Real*)Coordinates)[ 1]
#define PntZ1 ((Standard_Real*)Coordinates)[ 2]
#define PntX2 ((Standard_Real*)Coordinates)[ 3]
#define PntY2 ((Standard_Real*)Coordinates)[ 4]
#define PntZ2 ((Standard_Real*)Coordinates)[ 5]
#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
#define PntYP2 ((Standard_Real*)Coordinates)[10]
#define PntZP2 ((Standard_Real*)Coordinates)[11]
#define TotXMin ((Standard_Real*)TotMinMax)[0]
#define TotYMin ((Standard_Real*)TotMinMax)[1]
#define TotZMin ((Standard_Real*)TotMinMax)[2]
#define TotXMax ((Standard_Real*)TotMinMax)[3]
#define TotYMax ((Standard_Real*)TotMinMax)[4]
#define TotZMax ((Standard_Real*)TotMinMax)[5]
//=======================================================================
//function : HLRAlgo_PolyShellData
//purpose :
@@ -63,37 +43,36 @@ HLRAlgo_PolyShellData (const Standard_Integer nbFace)
//=======================================================================
void
HLRAlgo_PolyShellData::
UpdateGlobalMinMax(const Standard_Address TotMinMax)
HLRAlgo_PolyShellData::UpdateGlobalMinMax(HLRAlgo_PolyData::Box& theBox)
{
HLRAlgo_ListIteratorOfListOfBPoint it;
for (it.Initialize(mySegList); it.More(); it.Next()) {
HLRAlgo_BiPoint& BP = it.Value();
const Standard_Address Coordinates = BP.Coordinates();
if (PntXP1 < PntXP2) {
if (TotXMin > PntXP1) TotXMin = PntXP1;
else if (TotXMax < PntXP2) TotXMax = PntXP2;
HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
if (aPoints.PntP1.X() < aPoints.PntP2.X()) {
if (theBox.XMin > aPoints.PntP1.X()) theBox.XMin = aPoints.PntP1.X();
else if (theBox.XMax < aPoints.PntP2.X()) theBox.XMax = aPoints.PntP2.X();
}
else {
if (TotXMin > PntXP2) TotXMin = PntXP2;
else if (TotXMax < PntXP1) TotXMax = PntXP1;
if (theBox.XMin > aPoints.PntP2.X()) theBox.XMin = aPoints.PntP2.X();
else if (theBox.XMax < aPoints.PntP1.X()) theBox.XMax = aPoints.PntP1.X();
}
if (PntYP1 < PntYP2) {
if (TotYMin > PntYP1) TotYMin = PntYP1;
else if (TotYMax < PntYP2) TotYMax = PntYP2;
if (aPoints.PntP1.Y() < aPoints.PntP2.Y()) {
if (theBox.YMin > aPoints.PntP1.Y()) theBox.YMin = aPoints.PntP1.Y();
else if (theBox.YMax < aPoints.PntP2.Y()) theBox.YMax = aPoints.PntP2.Y();
}
else {
if (TotYMin > PntYP2) TotYMin = PntYP2;
else if (TotYMax < PntYP1) TotYMax = PntYP1;
if (theBox.YMin > aPoints.PntP2.Y()) theBox.YMin = aPoints.PntP2.Y();
else if (theBox.YMax < aPoints.PntP1.Y()) theBox.YMax = aPoints.PntP1.Y();
}
if (PntZP1 < PntZP2) {
if (TotZMin > PntZP1) TotZMin = PntZP1;
else if (TotZMax < PntZP2) TotZMax = PntZP2;
if (aPoints.PntP1.Z() < aPoints.PntP2.Z()) {
if (theBox.ZMin > aPoints.PntP1.Z()) theBox.ZMin = aPoints.PntP1.Z();
else if (theBox.ZMax < aPoints.PntP2.Z()) theBox.ZMax = aPoints.PntP2.Z();
}
else {
if (TotZMin > PntZP2) TotZMin = PntZP2;
else if (TotZMax < PntZP1) TotZMax = PntZP1;
if (theBox.ZMin > aPoints.PntP2.Z()) theBox.ZMin = aPoints.PntP2.Z();
else if (theBox.ZMax < aPoints.PntP1.Z()) theBox.ZMax = aPoints.PntP1.Z();
}
}
Standard_Integer nbFace = myPolyg.Upper();
@@ -101,7 +80,7 @@ UpdateGlobalMinMax(const Standard_Address TotMinMax)
if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1));
for (Standard_Integer i = 1; i <= nbFace; i++) {
(*pd)->UpdateGlobalMinMax(TotMinMax);
(*pd)->UpdateGlobalMinMax(theBox);
pd++;
}
}

View File

@@ -25,7 +25,6 @@
#include <TColStd_HArray1OfTransient.hxx>
#include <HLRAlgo_ListOfBPoint.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Address.hxx>
#include <Standard_Boolean.hxx>
@@ -37,11 +36,15 @@ class HLRAlgo_PolyShellData : public MMgt_TShared
{
public:
struct ShellIndices
{
Standard_Integer Min, Max;
};
Standard_EXPORT HLRAlgo_PolyShellData(const Standard_Integer nbFace);
Standard_EXPORT void UpdateGlobalMinMax (const Standard_Address TotMinMax);
Standard_EXPORT void UpdateGlobalMinMax (HLRAlgo_PolyData::Box& theBox);
Standard_EXPORT void UpdateHiding (const Standard_Integer nbHiding);
@@ -53,7 +56,10 @@ public:
HLRAlgo_ListOfBPoint& Edges();
Standard_Address Indices();
ShellIndices& Indices()
{
return myIndices;
}
@@ -68,7 +74,7 @@ protected:
private:
Standard_Integer myMinMax[2];
ShellIndices myIndices;
TColStd_Array1OfTransient myPolyg;
Handle(TColStd_HArray1OfTransient) myHPolHi;
HLRAlgo_ListOfBPoint mySegList;

View File

@@ -51,11 +51,3 @@ HLRAlgo_PolyShellData::HidingPolyData ()
inline HLRAlgo_ListOfBPoint &
HLRAlgo_PolyShellData::Edges ()
{ return mySegList; }
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyShellData::Indices ()
{ return (Standard_Address)myMinMax; }

View File

@@ -22,44 +22,13 @@
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Address.hxx>
//! Data structure of a triangle.
class HLRAlgo_TriangleData
struct HLRAlgo_TriangleData
{
public:
DEFINE_STANDARD_ALLOC
HLRAlgo_TriangleData();
Standard_Address Indices() const;
protected:
private:
Standard_Integer myIndices[4];
Standard_Integer Node1, Node2, Node3, Flags;
};
#include <HLRAlgo_TriangleData.lxx>
#endif // _HLRAlgo_TriangleData_HeaderFile

View File

@@ -1,31 +0,0 @@
// Created on: 1993-01-11
// Created by: Christophe MARION
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : TriangleData
//purpose :
//=======================================================================
inline HLRAlgo_TriangleData::HLRAlgo_TriangleData ()
{}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_TriangleData::Indices () const
{ return (Standard_Address)myIndices; }

View File

@@ -18,54 +18,7 @@
#define No_Exception
#endif
#include <HLRAlgo_EdgesBlock.hxx>
#include <HLRAlgo_WiresBlock.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_WiresBlock,MMgt_TShared)
//=======================================================================
//function : HLRAlgo_WiresBlock
//purpose :
//=======================================================================
HLRAlgo_WiresBlock::HLRAlgo_WiresBlock (const Standard_Integer NbWires) :
myWires(1,NbWires)
{}
//=======================================================================
//function : NbWires
//purpose :
//=======================================================================
Standard_Integer HLRAlgo_WiresBlock::NbWires () const
{ return myWires.Upper(); }
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRAlgo_WiresBlock::Set (const Standard_Integer I,
const Handle(HLRAlgo_EdgesBlock)& W)
{ myWires (I) = W; }
//=======================================================================
//function : Wire
//purpose :
//=======================================================================
Handle(HLRAlgo_EdgesBlock) &
HLRAlgo_WiresBlock::Wire (const Standard_Integer I)
{ return *((Handle(HLRAlgo_EdgesBlock)*) &myWires(I)); }
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
void HLRAlgo_WiresBlock::UpdateMinMax (const Standard_Address TotMinMax)
{
for (Standard_Integer i = 0; i <= 15; i++)
myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
}

View File

@@ -17,14 +17,14 @@
#ifndef _HLRAlgo_WiresBlock_HeaderFile
#define _HLRAlgo_WiresBlock_HeaderFile
#include <HLRAlgo_EdgesBlock.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array1OfTransient.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Address.hxx>
class HLRAlgo_EdgesBlock;
class HLRAlgo_WiresBlock;
@@ -38,47 +38,41 @@ DEFINE_STANDARD_HANDLE(HLRAlgo_WiresBlock, MMgt_TShared)
//! * An Array of Blocks.
class HLRAlgo_WiresBlock : public MMgt_TShared
{
public:
//! Create a Block of Blocks.
Standard_EXPORT HLRAlgo_WiresBlock(const Standard_Integer NbWires);
HLRAlgo_WiresBlock(const Standard_Integer NbWires) :
myWires(1,NbWires)
{
}
Standard_EXPORT Standard_Integer NbWires() const;
Standard_Integer NbWires() const
{
return myWires.Upper();
}
Standard_EXPORT void Set (const Standard_Integer I, const Handle(HLRAlgo_EdgesBlock)& W);
void Set (const Standard_Integer I, const Handle(HLRAlgo_EdgesBlock)& W)
{
myWires (I) = W;
}
Standard_EXPORT Handle(HLRAlgo_EdgesBlock)& Wire (const Standard_Integer I);
Handle(HLRAlgo_EdgesBlock)& Wire (const Standard_Integer I)
{
return *((Handle(HLRAlgo_EdgesBlock)*) &myWires(I));
}
Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
Standard_Address MinMax() const;
void UpdateMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& theMinMaxes)
{myMinMax = theMinMaxes;}
HLRAlgo_EdgesBlock::MinMaxIndices& MinMax()
{
return myMinMax;
}
DEFINE_STANDARD_RTTIEXT(HLRAlgo_WiresBlock,MMgt_TShared)
protected:
private:
TColStd_Array1OfTransient myWires;
Standard_Integer myMinMax[16];
HLRAlgo_EdgesBlock::MinMaxIndices myMinMax;
};
#include <HLRAlgo_WiresBlock.lxx>
#endif // _HLRAlgo_WiresBlock_HeaderFile

View File

@@ -1,23 +0,0 @@
// Created on: 1995-09-05
// Created by: Christophe MARION
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : MinMax
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_WiresBlock::MinMax () const
{ return (Standard_Address)&myMinMax; }