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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

170
src/HLRAlgo/HLRAlgo.cdl Executable file
View File

@@ -0,0 +1,170 @@
-- File: HLRAlgo.cdl
-- Created: Tue Feb 18 17:18:30 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
package HLRAlgo
--- Purpose: In order to have the precision required in
-- industrial design, drawings need to offer the
-- possibility of removing lines, which are hidden
-- in a given projection. To do this, the Hidden
-- Line Removal component provides two
-- algorithms: HLRBRep_Algo and HLRBRep_PolyAlgo.
-- These algorithms remove or indicate lines
-- hidden by surfaces. For a given projection, they
-- calculate a set of lines characteristic of the
-- object being represented. They are also used
-- in conjunction with extraction utilities, which
-- reconstruct a new, simplified shape from a
-- selection of calculation results. This new shape
-- is made up of edges, which represent the lines
-- of the visualized shape in a plane. This plane is the projection plane.
-- HLRBRep_Algo takes into account the shape
-- itself. HLRBRep_PolyAlgo works with a
-- polyhedral simplification of the shape. When
-- you use HLRBRep_Algo, you obtain an exact
-- result, whereas, when you use
-- HLRBRep_PolyAlgo, you reduce computation
-- time but obtain polygonal segments.
uses
Standard,
StdFail,
MMgt,
TCollection,
TColStd,
TColgp,
Intrv,
gp,
GeomAbs,
TopAbs,
TopBas,
TopCnx,
TopLoc,
IntRes2d,
IntCurveSurface
is
class BiPoint;
class ListOfBPoint instantiates List from TCollection
(BiPoint from HLRAlgo);
class PolyShellData;
---Purpose: All the PolyData of a Shell
class PolyInternalData;
---Purpose: to Update OutLines.
class PolyInternalSegment;
---Purpose: to Update OutLines.
class PolyInternalNode;
---Purpose: to Update OutLines.
class PolyData;
---Purpose: Data structure of a set of Triangles.
class PolyHidingData;
---Purpose: Data structure of a set of Hiding Triangles.
class TriangleData;
---Purpose: Data structure of a triangle.
class Array1OfPHDat instantiates Array1 from TCollection
(PolyHidingData from HLRAlgo);
class HArray1OfPHDat instantiates HArray1 from TCollection
(PolyHidingData from HLRAlgo,
Array1OfPHDat from HLRAlgo);
class Array1OfPISeg instantiates Array1 from TCollection
(PolyInternalSegment from HLRAlgo);
class HArray1OfPISeg instantiates HArray1 from TCollection
(PolyInternalSegment from HLRAlgo,
Array1OfPISeg from HLRAlgo);
class Array1OfPINod instantiates Array1 from TCollection
(PolyInternalNode from HLRAlgo);
class HArray1OfPINod instantiates HArray1 from TCollection
(PolyInternalNode from HLRAlgo,
Array1OfPINod from HLRAlgo);
class Array1OfTData instantiates Array1 from TCollection
(TriangleData from HLRAlgo);
class HArray1OfTData instantiates HArray1 from TCollection
(TriangleData from HLRAlgo,
Array1OfTData from HLRAlgo);
class PolyAlgo;
---Purpose: to remove Hidden lines on Triangulations.
class EdgeStatus;
---Purpose: This class describes the visible-hidden Status of
-- an Edge and its parametric bounds.
class Projector;
---Purpose: To transform and project Points and Planes.
class Intersection;
---Purpose: Parameter and State (above, on or under the face).
class Coincidence;
---Purpose: A coincidence describes the geometry of the edge
-- of the hiding face around the intersection.
class Interference instantiates Interference from TopBas
(Intersection from HLRAlgo,
Coincidence from HLRAlgo);
class InterferenceList instantiates List from TCollection
(Interference from HLRAlgo);
class EdgesBlock;
---Purpose: A set of oriented Edges. (A wire).
class WiresBlock;
---Purpose: A set of Wires. (A face).
class EdgeIterator;
---Purpose: Iterator on the visible or hidden parts of an
-- EdgeStatus.
UpdateMinMax (x,y,z : Real from Standard;
Min : Address from Standard;
Max : Address from Standard);
EnlargeMinMax (tol : Real from Standard;
Min : Address from Standard;
Max : Address from Standard);
InitMinMax (Big : Real from Standard;
Min : Address from Standard;
Max : Address from Standard);
EncodeMinMax (Min : Address from Standard;
Max : Address from Standard;
MinMax : Address from Standard);
SizeBox (Min : Address from Standard;
Max : Address from Standard)
returns Real from Standard;
DecodeMinMax (MinMax : Address from Standard;
Min : Address from Standard;
Max : Address from Standard);
CopyMinMax (IMin : Address from Standard;
IMax : Address from Standard;
OMin : Address from Standard;
OMax : Address from Standard);
AddMinMax (IMin : Address from Standard;
IMax : Address from Standard;
OMin : Address from Standard;
OMax : Address from Standard);
end HLRAlgo;

404
src/HLRAlgo/HLRAlgo.cxx Executable file
View File

@@ -0,0 +1,404 @@
// File: HLRAlgo.cxx
// Created: Tue Sep 12 17:05:53 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <HLRAlgo.ixx>
static Standard_Real cosu0 = cos(0*PI/14);
static Standard_Real sinu0 = sin(0*PI/14);
static Standard_Real cosu1 = cos(1*PI/14);
static Standard_Real sinu1 = sin(1*PI/14);
static Standard_Real cosu2 = cos(2*PI/14);
static Standard_Real sinu2 = sin(2*PI/14);
static Standard_Real cosu3 = cos(3*PI/14);
static Standard_Real sinu3 = sin(3*PI/14);
static Standard_Real cosu4 = cos(4*PI/14);
static Standard_Real sinu4 = sin(4*PI/14);
static Standard_Real cosu5 = cos(5*PI/14);
static Standard_Real sinu5 = sin(5*PI/14);
static Standard_Real cosu6 = cos(6*PI/14);
static Standard_Real sinu6 = sin(6*PI/14);
//=======================================================================
//function : UpdateMinMax
//purpose :
//=======================================================================
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 d00,d01,d02,d03,d04,d05,d06,d07;
Standard_Real d08,d09,d10,d11,d12,d13,d14,d15;
d00 = cosu0 * x + sinu0 * y;
d01 = sinu0 * x - cosu0 * y;
d02 = cosu1 * x + sinu1 * y;
d03 = sinu1 * x - cosu1 * y;
d04 = cosu2 * x + sinu2 * y;
d05 = sinu2 * x - cosu2 * y;
d06 = cosu3 * x + sinu3 * y;
d07 = sinu3 * x - cosu3 * y;
d08 = cosu4 * x + sinu4 * y;
d09 = sinu4 * x - cosu4 * y;
d10 = cosu5 * x + sinu5 * y;
d11 = sinu5 * x - cosu5 * y;
d12 = cosu6 * x + sinu6 * y;
d13 = sinu6 * x - cosu6 * y;
d14 = z;
d15 = z;
if (((Standard_Real*)Min)[ 0] > d00) ((Standard_Real*)Min) [ 0] = d00;
if (((Standard_Real*)Max)[ 0] < d00) ((Standard_Real*)Max) [ 0] = d00;
if (((Standard_Real*)Min)[ 1] > d01) ((Standard_Real*)Min) [ 1] = d01;
if (((Standard_Real*)Max)[ 1] < d01) ((Standard_Real*)Max) [ 1] = d01;
if (((Standard_Real*)Min)[ 2] > d02) ((Standard_Real*)Min) [ 2] = d02;
if (((Standard_Real*)Max)[ 2] < d02) ((Standard_Real*)Max) [ 2] = d02;
if (((Standard_Real*)Min)[ 3] > d03) ((Standard_Real*)Min) [ 3] = d03;
if (((Standard_Real*)Max)[ 3] < d03) ((Standard_Real*)Max) [ 3] = d03;
if (((Standard_Real*)Min)[ 4] > d04) ((Standard_Real*)Min) [ 4] = d04;
if (((Standard_Real*)Max)[ 4] < d04) ((Standard_Real*)Max) [ 4] = d04;
if (((Standard_Real*)Min)[ 5] > d05) ((Standard_Real*)Min) [ 5] = d05;
if (((Standard_Real*)Max)[ 5] < d05) ((Standard_Real*)Max) [ 5] = d05;
if (((Standard_Real*)Min)[ 6] > d06) ((Standard_Real*)Min) [ 6] = d06;
if (((Standard_Real*)Max)[ 6] < d06) ((Standard_Real*)Max) [ 6] = d06;
if (((Standard_Real*)Min)[ 7] > d07) ((Standard_Real*)Min) [ 7] = d07;
if (((Standard_Real*)Max)[ 7] < d07) ((Standard_Real*)Max) [ 7] = d07;
if (((Standard_Real*)Min)[ 8] > d08) ((Standard_Real*)Min) [ 8] = d08;
if (((Standard_Real*)Max)[ 8] < d08) ((Standard_Real*)Max) [ 8] = d08;
if (((Standard_Real*)Min)[ 9] > d09) ((Standard_Real*)Min) [ 9] = d09;
if (((Standard_Real*)Max)[ 9] < d09) ((Standard_Real*)Max) [ 9] = d09;
if (((Standard_Real*)Min)[10] > d10) ((Standard_Real*)Min) [10] = d10;
if (((Standard_Real*)Max)[10] < d10) ((Standard_Real*)Max) [10] = d10;
if (((Standard_Real*)Min)[11] > d11) ((Standard_Real*)Min) [11] = d11;
if (((Standard_Real*)Max)[11] < d11) ((Standard_Real*)Max) [11] = d11;
if (((Standard_Real*)Min)[12] > d12) ((Standard_Real*)Min) [12] = d12;
if (((Standard_Real*)Max)[12] < d12) ((Standard_Real*)Max) [12] = d12;
if (((Standard_Real*)Min)[13] > d13) ((Standard_Real*)Min) [13] = d13;
if (((Standard_Real*)Max)[13] < d13) ((Standard_Real*)Max) [13] = d13;
if (((Standard_Real*)Min)[14] > d14) ((Standard_Real*)Min) [14] = d14;
if (((Standard_Real*)Max)[14] < d14) ((Standard_Real*)Max) [14] = d14;
if (((Standard_Real*)Min)[15] > d15) ((Standard_Real*)Min) [15] = d15;
if (((Standard_Real*)Max)[15] < d15) ((Standard_Real*)Max) [15] = d15;
}
//=======================================================================
//function : EnlargeMinMax
//purpose :
//=======================================================================
void HLRAlgo::EnlargeMinMax (const Standard_Real tol,
const Standard_Address Min,
const Standard_Address Max)
{
((Standard_Real*)Min)[ 0] -= tol;
((Standard_Real*)Max)[ 0] += tol;
((Standard_Real*)Min)[ 1] -= tol;
((Standard_Real*)Max)[ 1] += tol;
((Standard_Real*)Min)[ 2] -= tol;
((Standard_Real*)Max)[ 2] += tol;
((Standard_Real*)Min)[ 3] -= tol;
((Standard_Real*)Max)[ 3] += tol;
((Standard_Real*)Min)[ 4] -= tol;
((Standard_Real*)Max)[ 4] += tol;
((Standard_Real*)Min)[ 5] -= tol;
((Standard_Real*)Max)[ 5] += tol;
((Standard_Real*)Min)[ 6] -= tol;
((Standard_Real*)Max)[ 6] += tol;
((Standard_Real*)Min)[ 7] -= tol;
((Standard_Real*)Max)[ 7] += tol;
((Standard_Real*)Min)[ 8] -= tol;
((Standard_Real*)Max)[ 8] += tol;
((Standard_Real*)Min)[ 9] -= tol;
((Standard_Real*)Max)[ 9] += tol;
((Standard_Real*)Min)[10] -= tol;
((Standard_Real*)Max)[10] += tol;
((Standard_Real*)Min)[11] -= tol;
((Standard_Real*)Max)[11] += tol;
((Standard_Real*)Min)[12] -= tol;
((Standard_Real*)Max)[12] += tol;
((Standard_Real*)Min)[13] -= tol;
((Standard_Real*)Max)[13] += tol;
((Standard_Real*)Min)[14] -= tol;
((Standard_Real*)Max)[14] += tol;
((Standard_Real*)Min)[15] -= tol;
((Standard_Real*)Max)[15] += tol;
}
//=======================================================================
//function :InitMinMax
//purpose :
//=======================================================================
void HLRAlgo::InitMinMax (const Standard_Real Big,
const Standard_Address Min,
const Standard_Address Max)
{
((Standard_Real*)Min)[ 0] =
((Standard_Real*)Min)[ 1] =
((Standard_Real*)Min)[ 2] =
((Standard_Real*)Min)[ 3] =
((Standard_Real*)Min)[ 4] =
((Standard_Real*)Min)[ 5] =
((Standard_Real*)Min)[ 6] =
((Standard_Real*)Min)[ 7] =
((Standard_Real*)Min)[ 8] =
((Standard_Real*)Min)[ 9] =
((Standard_Real*)Min)[10] =
((Standard_Real*)Min)[11] =
((Standard_Real*)Min)[12] =
((Standard_Real*)Min)[13] =
((Standard_Real*)Min)[14] =
((Standard_Real*)Min)[15] = Big;
((Standard_Real*)Max)[ 0] =
((Standard_Real*)Max)[ 1] =
((Standard_Real*)Max)[ 2] =
((Standard_Real*)Max)[ 3] =
((Standard_Real*)Max)[ 4] =
((Standard_Real*)Max)[ 5] =
((Standard_Real*)Max)[ 6] =
((Standard_Real*)Max)[ 7] =
((Standard_Real*)Max)[ 8] =
((Standard_Real*)Max)[ 9] =
((Standard_Real*)Max)[10] =
((Standard_Real*)Max)[11] =
((Standard_Real*)Max)[12] =
((Standard_Real*)Max)[13] =
((Standard_Real*)Max)[14] =
((Standard_Real*)Max)[15] = -Big;
}
//=======================================================================
//function : EncodeMinMax
//purpose :
//=======================================================================
void HLRAlgo::EncodeMinMax (const Standard_Address Min,
const Standard_Address Max,
const Standard_Address 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;
}
//=======================================================================
//function : SizeBox
//purpose :
//=======================================================================
Standard_Real HLRAlgo::SizeBox(const Standard_Address Min,
const Standard_Address Max)
{
Standard_Real s;
s = ((Standard_Integer *)Max)[ 0] - ((Standard_Integer *)Min)[ 0];
s *= ((Standard_Integer *)Max)[ 1] - ((Standard_Integer *)Min)[ 1];
s *= ((Standard_Integer *)Max)[ 2] - ((Standard_Integer *)Min)[ 2];
s *= ((Standard_Integer *)Max)[ 3] - ((Standard_Integer *)Min)[ 3];
s *= ((Standard_Integer *)Max)[ 4] - ((Standard_Integer *)Min)[ 4];
s *= ((Standard_Integer *)Max)[ 5] - ((Standard_Integer *)Min)[ 5];
s *= ((Standard_Integer *)Max)[ 6] - ((Standard_Integer *)Min)[ 6];
s *= ((Standard_Integer *)Max)[ 7] - ((Standard_Integer *)Min)[ 7];
s *= ((Standard_Integer *)Max)[ 8] - ((Standard_Integer *)Min)[ 8];
s *= ((Standard_Integer *)Max)[ 9] - ((Standard_Integer *)Min)[ 9];
s *= ((Standard_Integer *)Max)[10] - ((Standard_Integer *)Min)[10];
s *= ((Standard_Integer *)Max)[11] - ((Standard_Integer *)Min)[11];
s *= ((Standard_Integer *)Max)[12] - ((Standard_Integer *)Min)[12];
s *= ((Standard_Integer *)Max)[13] - ((Standard_Integer *)Min)[13];
return s;
}
//=======================================================================
//function : DecodeMinMax
//purpose :
//=======================================================================
void HLRAlgo::DecodeMinMax (const Standard_Address MM,
const Standard_Address Min,
const Standard_Address 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*)OMin)[ 0]=((Standard_Integer*)IMin)[ 0];
((Standard_Integer*)OMax)[ 0]=((Standard_Integer*)IMax)[ 0];
((Standard_Integer*)OMin)[ 1]=((Standard_Integer*)IMin)[ 1];
((Standard_Integer*)OMax)[ 1]=((Standard_Integer*)IMax)[ 1];
((Standard_Integer*)OMin)[ 2]=((Standard_Integer*)IMin)[ 2];
((Standard_Integer*)OMax)[ 2]=((Standard_Integer*)IMax)[ 2];
((Standard_Integer*)OMin)[ 3]=((Standard_Integer*)IMin)[ 3];
((Standard_Integer*)OMax)[ 3]=((Standard_Integer*)IMax)[ 3];
((Standard_Integer*)OMin)[ 4]=((Standard_Integer*)IMin)[ 4];
((Standard_Integer*)OMax)[ 4]=((Standard_Integer*)IMax)[ 4];
((Standard_Integer*)OMin)[ 5]=((Standard_Integer*)IMin)[ 5];
((Standard_Integer*)OMax)[ 5]=((Standard_Integer*)IMax)[ 5];
((Standard_Integer*)OMin)[ 6]=((Standard_Integer*)IMin)[ 6];
((Standard_Integer*)OMax)[ 6]=((Standard_Integer*)IMax)[ 6];
((Standard_Integer*)OMin)[ 7]=((Standard_Integer*)IMin)[ 7];
((Standard_Integer*)OMax)[ 7]=((Standard_Integer*)IMax)[ 7];
((Standard_Integer*)OMin)[ 8]=((Standard_Integer*)IMin)[ 8];
((Standard_Integer*)OMax)[ 8]=((Standard_Integer*)IMax)[ 8];
((Standard_Integer*)OMin)[ 9]=((Standard_Integer*)IMin)[ 9];
((Standard_Integer*)OMax)[ 9]=((Standard_Integer*)IMax)[ 9];
((Standard_Integer*)OMin)[10]=((Standard_Integer*)IMin)[10];
((Standard_Integer*)OMax)[10]=((Standard_Integer*)IMax)[10];
((Standard_Integer*)OMin)[11]=((Standard_Integer*)IMin)[11];
((Standard_Integer*)OMax)[11]=((Standard_Integer*)IMax)[11];
((Standard_Integer*)OMin)[12]=((Standard_Integer*)IMin)[12];
((Standard_Integer*)OMax)[12]=((Standard_Integer*)IMax)[12];
((Standard_Integer*)OMin)[13]=((Standard_Integer*)IMin)[13];
((Standard_Integer*)OMax)[13]=((Standard_Integer*)IMax)[13];
((Standard_Integer*)OMin)[14]=((Standard_Integer*)IMin)[14];
((Standard_Integer*)OMax)[14]=((Standard_Integer*)IMax)[14];
((Standard_Integer*)OMin)[15]=((Standard_Integer*)IMin)[15];
((Standard_Integer*)OMax)[15]=((Standard_Integer*)IMax)[15];
}
//=======================================================================
//function :AddMinMax
//purpose :
//=======================================================================
void HLRAlgo::AddMinMax (const Standard_Address IMin,
const Standard_Address IMax,
const Standard_Address OMin,
const Standard_Address OMax)
{
if (((Standard_Integer*)OMin)[ 0] > ((Standard_Integer*)IMin)[ 0])
((Standard_Integer*)OMin)[ 0]=((Standard_Integer*)IMin)[ 0];
if (((Standard_Integer*)OMax)[ 0] < ((Standard_Integer*)IMax)[ 0])
((Standard_Integer*)OMax)[ 0]=((Standard_Integer*)IMax)[ 0];
if (((Standard_Integer*)OMin)[ 1] > ((Standard_Integer*)IMin)[ 1])
((Standard_Integer*)OMin)[ 1]=((Standard_Integer*)IMin)[ 1];
if (((Standard_Integer*)OMax)[ 1] < ((Standard_Integer*)IMax)[ 1])
((Standard_Integer*)OMax)[ 1]=((Standard_Integer*)IMax)[ 1];
if (((Standard_Integer*)OMin)[ 2] > ((Standard_Integer*)IMin)[ 2])
((Standard_Integer*)OMin)[ 2]=((Standard_Integer*)IMin)[ 2];
if (((Standard_Integer*)OMax)[ 2] < ((Standard_Integer*)IMax)[ 2])
((Standard_Integer*)OMax)[ 2]=((Standard_Integer*)IMax)[ 2];
if (((Standard_Integer*)OMin)[ 3] > ((Standard_Integer*)IMin)[ 3])
((Standard_Integer*)OMin)[ 3]=((Standard_Integer*)IMin)[ 3];
if (((Standard_Integer*)OMax)[ 3] < ((Standard_Integer*)IMax)[ 3])
((Standard_Integer*)OMax)[ 3]=((Standard_Integer*)IMax)[ 3];
if (((Standard_Integer*)OMin)[ 4] > ((Standard_Integer*)IMin)[ 4])
((Standard_Integer*)OMin)[ 4]=((Standard_Integer*)IMin)[ 4];
if (((Standard_Integer*)OMax)[ 4] < ((Standard_Integer*)IMax)[ 4])
((Standard_Integer*)OMax)[ 4]=((Standard_Integer*)IMax)[ 4];
if (((Standard_Integer*)OMin)[ 5] > ((Standard_Integer*)IMin)[ 5])
((Standard_Integer*)OMin)[ 5]=((Standard_Integer*)IMin)[ 5];
if (((Standard_Integer*)OMax)[ 5] < ((Standard_Integer*)IMax)[ 5])
((Standard_Integer*)OMax)[ 5]=((Standard_Integer*)IMax)[ 5];
if (((Standard_Integer*)OMin)[ 6] > ((Standard_Integer*)IMin)[ 6])
((Standard_Integer*)OMin)[ 6]=((Standard_Integer*)IMin)[ 6];
if (((Standard_Integer*)OMax)[ 6] < ((Standard_Integer*)IMax)[ 6])
((Standard_Integer*)OMax)[ 6]=((Standard_Integer*)IMax)[ 6];
if (((Standard_Integer*)OMin)[ 7] > ((Standard_Integer*)IMin)[ 7])
((Standard_Integer*)OMin)[ 7]=((Standard_Integer*)IMin)[ 7];
if (((Standard_Integer*)OMax)[ 7] < ((Standard_Integer*)IMax)[ 7])
((Standard_Integer*)OMax)[ 7]=((Standard_Integer*)IMax)[ 7];
if (((Standard_Integer*)OMin)[ 8] > ((Standard_Integer*)IMin)[ 8])
((Standard_Integer*)OMin)[ 8]=((Standard_Integer*)IMin)[ 8];
if (((Standard_Integer*)OMax)[ 8] < ((Standard_Integer*)IMax)[ 8])
((Standard_Integer*)OMax)[ 8]=((Standard_Integer*)IMax)[ 8];
if (((Standard_Integer*)OMin)[ 9] > ((Standard_Integer*)IMin)[ 9])
((Standard_Integer*)OMin)[ 9]=((Standard_Integer*)IMin)[ 9];
if (((Standard_Integer*)OMax)[ 9] < ((Standard_Integer*)IMax)[ 9])
((Standard_Integer*)OMax)[ 9]=((Standard_Integer*)IMax)[ 9];
if (((Standard_Integer*)OMin)[10] > ((Standard_Integer*)IMin)[10])
((Standard_Integer*)OMin)[10]=((Standard_Integer*)IMin)[10];
if (((Standard_Integer*)OMax)[10] < ((Standard_Integer*)IMax)[10])
((Standard_Integer*)OMax)[10]=((Standard_Integer*)IMax)[10];
if (((Standard_Integer*)OMin)[11] > ((Standard_Integer*)IMin)[11])
((Standard_Integer*)OMin)[11]=((Standard_Integer*)IMin)[11];
if (((Standard_Integer*)OMax)[11] < ((Standard_Integer*)IMax)[11])
((Standard_Integer*)OMax)[11]=((Standard_Integer*)IMax)[11];
if (((Standard_Integer*)OMin)[12] > ((Standard_Integer*)IMin)[12])
((Standard_Integer*)OMin)[12]=((Standard_Integer*)IMin)[12];
if (((Standard_Integer*)OMax)[12] < ((Standard_Integer*)IMax)[12])
((Standard_Integer*)OMax)[12]=((Standard_Integer*)IMax)[12];
if (((Standard_Integer*)OMin)[13] > ((Standard_Integer*)IMin)[13])
((Standard_Integer*)OMin)[13]=((Standard_Integer*)IMin)[13];
if (((Standard_Integer*)OMax)[13] < ((Standard_Integer*)IMax)[13])
((Standard_Integer*)OMax)[13]=((Standard_Integer*)IMax)[13];
if (((Standard_Integer*)OMin)[14] > ((Standard_Integer*)IMin)[14])
((Standard_Integer*)OMin)[14]=((Standard_Integer*)IMin)[14];
if (((Standard_Integer*)OMax)[14] < ((Standard_Integer*)IMax)[14])
((Standard_Integer*)OMax)[14]=((Standard_Integer*)IMax)[14];
if (((Standard_Integer*)OMin)[15] > ((Standard_Integer*)IMin)[15])
((Standard_Integer*)OMin)[15]=((Standard_Integer*)IMin)[15];
if (((Standard_Integer*)OMax)[15] < ((Standard_Integer*)IMax)[15])
((Standard_Integer*)OMax)[15]=((Standard_Integer*)IMax)[15];
}

107
src/HLRAlgo/HLRAlgo_BiPoint.cdl Executable file
View File

@@ -0,0 +1,107 @@
-- File: HLRAlgo_BiPoint.cdl
-- Created: Thu Jun 22 12:28:58 1995
-- Author: Christophe MARION
-- <cma@ecolox>
---Copyright: Matra Datavision 1995
class BiPoint from HLRAlgo
uses
Address from Standard,
Boolean from Standard,
Integer from Standard
is
Create
returns BiPoint from HLRAlgo;
---C++: inline
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index : Integer from Standard;
reg1,regn,outl,intl : Boolean from Standard)
returns BiPoint from HLRAlgo;
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index : Integer from Standard;
flag : Boolean from Standard)
returns BiPoint from HLRAlgo;
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index,i1,i1p1,i1p2 : Integer from Standard;
reg1,regn,outl,intl : Boolean from Standard)
returns BiPoint from HLRAlgo;
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index,i1,i1p1,i1p2 : Integer from Standard;
flag : Boolean from Standard)
returns BiPoint from HLRAlgo;
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index,i1,i1p1,i1p2,i2,i2p1,i2p2 : Integer from Standard;
reg1,regn,outl,intl : Boolean from Standard)
returns BiPoint from HLRAlgo;
Create(X1,Y1,Z1,X2,Y2,Z2 : Real from Standard;
XT1,YT1,ZT1,XT2,YT2,ZT2 : Real from Standard;
Index,i1,i1p1,i1p2,i2,i2p1,i2p2 : Integer from Standard;
flag : Boolean from Standard)
returns BiPoint from HLRAlgo;
Rg1Line(me) returns Boolean from Standard
---C++: inline
is static;
Rg1Line(me : in out; B : Boolean from Standard)
---C++: inline
is static;
RgNLine(me) returns Boolean from Standard
---C++: inline
is static;
RgNLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
OutLine(me) returns Boolean from Standard
---C++: inline
is static;
OutLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
IntLine(me) returns Boolean from Standard
---C++: inline
is static;
IntLine(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Hidden(me) returns Boolean from Standard
---C++: inline
is static;
Hidden(me : in out; B : Boolean from Standard)
---C++: inline
is static;
Indices(me) returns Address from Standard
---C++: inline
is static;
Coordinates(me) returns Address from Standard
---C++: inline
is static;
fields
myIndices : Integer from Standard[10];
myCoordinates : Real from Standard[12];
end BiPoint;

318
src/HLRAlgo/HLRAlgo_BiPoint.cxx Executable file
View File

@@ -0,0 +1,318 @@
// File: HLRAlgo_BiPoint.cxx
// Created: Thu Jun 22 12:31:58 1995
// Author: Christophe MARION
// <cma@ecolox>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_BiPoint.ixx>
#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 :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean reg1,
const Standard_Boolean regn,
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;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
IntLine(intl);
Hidden(Standard_False);
}
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean 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;
Hidden(Standard_False);
}
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean reg1,
const Standard_Boolean regn,
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;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
IntLine(intl);
Hidden(Standard_False);
}
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean 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;
Hidden(Standard_False);
}
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean reg1,
const Standard_Boolean regn,
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;
Rg1Line(reg1);
RgNLine(regn);
OutLine(outl);
IntLine(intl);
Hidden(Standard_False);
}
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
HLRAlgo_BiPoint::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_Boolean 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;
Hidden(Standard_False);
}

131
src/HLRAlgo/HLRAlgo_BiPoint.lxx Executable file
View File

@@ -0,0 +1,131 @@
// File: HLRAlgo_BiPoint.lxx
// Created: Thu Jun 22 12:35:03 1995
// Author: Christophe MARION
// <cma@ecolox>
#define EMskRg1Line ((Standard_Boolean)1)
#define EMskRgNLine ((Standard_Boolean)2)
#define EMskOutLine ((Standard_Boolean)4)
#define EMskIntLine ((Standard_Boolean)8)
#define EMskHidden ((Standard_Boolean)16)
//=======================================================================
//function : HLRAlgo_BiPoint
//purpose :
//=======================================================================
inline HLRAlgo_BiPoint::HLRAlgo_BiPoint ()
{
}
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_BiPoint::Rg1Line () const
{ return (myIndices[9] & EMskRg1Line) != 0; }
//=======================================================================
//function : Rg1Line
//purpose :
//=======================================================================
inline void HLRAlgo_BiPoint::Rg1Line (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskRg1Line;
else myIndices[9] &= ~EMskRg1Line;
}
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_BiPoint::RgNLine () const
{ return (myIndices[9] & EMskRgNLine) != 0; }
//=======================================================================
//function : RgNLine
//purpose :
//=======================================================================
inline void HLRAlgo_BiPoint::RgNLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskRgNLine;
else myIndices[9] &= ~EMskRgNLine;
}
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_BiPoint::OutLine () const
{ return (myIndices[9] & EMskOutLine) != 0; }
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline void HLRAlgo_BiPoint::OutLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskOutLine;
else myIndices[9] &= ~EMskOutLine;
}
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_BiPoint::IntLine () const
{ return (myIndices[9] & EMskIntLine) != 0; }
//=======================================================================
//function : IntLine
//purpose :
//=======================================================================
inline void HLRAlgo_BiPoint::IntLine (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskIntLine;
else myIndices[9] &= ~EMskIntLine;
}
//=======================================================================
//function : Hidden
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_BiPoint::Hidden () const
{ return (myIndices[9] & EMskHidden) != 0; }
//=======================================================================
//function : Hidden
//purpose :
//=======================================================================
inline void HLRAlgo_BiPoint::Hidden (const Standard_Boolean B)
{
if (B) myIndices[9] |= EMskHidden;
else myIndices[9] &= ~EMskHidden;
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_BiPoint::Indices () const
{ return (Standard_Address)myIndices; }
//=======================================================================
//function : Coordinates
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_BiPoint::Coordinates () const
{ return (Standard_Address)myCoordinates; }

View File

@@ -0,0 +1,54 @@
-- File: Coincidence.cdl
-- Created: Thu Aug 20 18:06:13 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class Coincidence from HLRAlgo
---Purpose: The Coincidence class is used in an Inteference to
-- store informations on the "hiding" edge.
--
-- 2D Data : The tangent and the curvature of the
-- projection of the edge at the intersection point.
-- This is necesserary when the intersection is at
-- the extremity of the edge.
--
-- 3D Data : The state of the edge near the
-- intersection with the face (before and after).
-- This is necessary when the intersection is "ON"
-- the face.
uses
Integer from Standard,
Real from Standard,
State from TopAbs
is
Create returns Coincidence from HLRAlgo;
Set2D(me : in out; FE : Integer from Standard;
Param : Real from Standard)
---C++: inline
is static;
SetState3D(me : in out; stbef,staft : State from TopAbs)
---C++: inline
is static;
Value2D(me; FE : out Integer from Standard;
Param : out Real from Standard)
---C++: inline
is static;
State3D(me; stbef,staft : out State from TopAbs)
---C++: inline
is static;
fields
myFE : Integer from Standard;
myParam : Real from Standard;
myStBef : State from TopAbs;
myStAft : State from TopAbs;
end Coincidence;

View File

@@ -0,0 +1,16 @@
// File: HLRAlgo_Coincidence.cxx
// Created: Wed Feb 19 14:31:45 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRAlgo_Coincidence.ixx>
//=======================================================================
//function : HLRAlgo_Coincidence
//purpose :
//=======================================================================
HLRAlgo_Coincidence::HLRAlgo_Coincidence()
{
}

View File

@@ -0,0 +1,55 @@
// File: HLRAlgo_Coincidence.lxx
// Created: Wed Feb 19 14:31:45 1992
// Author: Christophe MARION
// <cma@sdsun2>
//=======================================================================
//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

@@ -0,0 +1,75 @@
-- File: HLRAlgo_EdgeIterator.cdl
-- Created: Mon Jan 11 13:58:26 1993
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1993
class EdgeIterator from HLRAlgo
uses
EdgeStatus from HLRAlgo,
Address from Standard,
Integer from Standard,
Boolean from Standard,
ShortReal from Standard,
Real from Standard
is
Create returns EdgeIterator from HLRAlgo;
---Purpose: Iterator on the visible or hidden parts of an
-- edge.
InitHidden(me : in out; status : EdgeStatus from HLRAlgo)
is static;
MoreHidden(me) returns Boolean from Standard
---C++: inline
is static;
NextHidden(me : in out)
is static;
Hidden(me; Start : out Real from Standard;
TolStart : out ShortReal from Standard;
End : out Real from Standard;
TolEnd : out ShortReal from Standard)
---C++: inline
---Purpose: Returns the bounds and the tolerances
-- of the current Hidden Interval
is static;
InitVisible(me : in out; status : EdgeStatus from HLRAlgo)
---C++: inline
is static;
MoreVisible(me) returns Boolean from Standard
---C++: inline
is static;
NextVisible(me : in out)
---C++: inline
is static;
Visible(me : in out;
Start : out Real from Standard;
TolStart : out ShortReal from Standard;
End : out Real from Standard;
TolEnd : out ShortReal from Standard)
---C++: inline
---Purpose: Returns the bounds and the tolerances
-- of the current Visible Interval
is static;
fields
myNbVis : Integer from Standard;
myNbHid : Integer from Standard;
EVis : Address from Standard;
EHid : Address from Standard;
iVis : Integer from Standard;
iHid : Integer from Standard;
myHidStart : Real from Standard;
myHidEnd : Real from Standard;
myHidTolStart : ShortReal from Standard;
myHidTolEnd : ShortReal from Standard;
end EdgeIterator;

View File

@@ -0,0 +1,69 @@
// File: HLRAlgo_EdgeIterator.cxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_EdgeIterator.ixx>
//=======================================================================
//function : EdgeIterator
//purpose :
//=======================================================================
HLRAlgo_EdgeIterator::HLRAlgo_EdgeIterator ()
{}
//=======================================================================
//function : InitHidden
//purpose :
//=======================================================================
void HLRAlgo_EdgeIterator::InitHidden (const HLRAlgo_EdgeStatus& status)
{
EHid = (Standard_Address)&status;
iHid = 1;
if (((HLRAlgo_EdgeStatus*)EHid)->AllHidden()) {
((HLRAlgo_EdgeStatus*)EHid)->Bounds
(myHidStart,myHidTolStart,myHidEnd,myHidTolEnd);
myNbHid = 0;
}
else {
myNbHid = ((HLRAlgo_EdgeStatus*)EHid)->NbVisiblePart();
Standard_Real B1;
Standard_ShortReal B2;
((HLRAlgo_EdgeStatus*)EHid)->Bounds
(myHidStart,myHidTolStart,B1,B2);
((HLRAlgo_EdgeStatus*)EHid)->VisiblePart
(iHid,myHidEnd,myHidTolEnd,B1,B2);
}
if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd &&
myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart )
NextHidden();
}
//=======================================================================
//function : NextHidden
//purpose :
//=======================================================================
void HLRAlgo_EdgeIterator::NextHidden ()
{
if (iHid >= myNbHid + 1) iHid++;
else {
Standard_Real B1;
Standard_ShortReal B2;
((HLRAlgo_EdgeStatus*)EHid)->VisiblePart
(iHid,B1,B2,myHidStart,myHidTolStart);
iHid++;
if (iHid == myNbHid + 1) {
((HLRAlgo_EdgeStatus*)EHid)->Bounds(B1,B2,myHidEnd,myHidTolEnd);
if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd &&
myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart ) iHid++;
}
else ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart
(iHid,myHidEnd,myHidTolEnd,B1,B2);
}
}

View File

@@ -0,0 +1,76 @@
// File: HLRAlgo_EdgeIterator.lxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#include <HLRAlgo_EdgeStatus.hxx>
//=======================================================================
//function : MoreHidden
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_EdgeIterator::MoreHidden () const
{ return iHid <= myNbHid + 1; }
//=======================================================================
//function : Hidden
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgeIterator::Hidden (Standard_Real& Start,
Standard_ShortReal& TolStart,
Standard_Real& End ,
Standard_ShortReal& TolEnd) const
{
Start = myHidStart;
TolStart = myHidTolStart;
End = myHidEnd;
TolEnd = myHidTolEnd;
}
//=======================================================================
//function : InitVisible
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgeIterator::InitVisible (const HLRAlgo_EdgeStatus& status)
{
EVis = (Standard_Address)&status;
iVis = 1;
myNbVis = ((HLRAlgo_EdgeStatus*)EVis)->NbVisiblePart();
}
//=======================================================================
//function : MoreVisible
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_EdgeIterator::MoreVisible () const
{ return iVis <= myNbVis; }
//=======================================================================
//function : NextVisible
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeIterator::NextVisible ()
{ iVis++; }
//=======================================================================
//function : Visible
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgeIterator::Visible (Standard_Real& Start,
Standard_ShortReal& TolStart,
Standard_Real& End ,
Standard_ShortReal& TolEnd)
{
((HLRAlgo_EdgeStatus*)EVis)->VisiblePart
(iVis,Start,TolStart,End,TolEnd);
}

View File

@@ -0,0 +1,117 @@
-- File: EdgeStatus.cdl
-- Created: Tue Feb 18 10:36:07 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class EdgeStatus from HLRAlgo
---Purpose: This class describes the Hidden Line status of an
-- Edge. It contains :
--
-- The Bounds of the Edge and their tolerances
--
-- Two flags indicating if the edge is full visible
-- or full hidden.
--
-- The Sequence of visible Intervals on the Edge.
uses
Integer from Standard,
ShortReal from Standard,
Real from Standard,
Boolean from Standard,
Intervals from Intrv
raises
OutOfRange
is
Create returns EdgeStatus from HLRAlgo;
Create(Start : Real from Standard;
TolStart : ShortReal from Standard;
End : Real from Standard;
TolEnd : ShortReal from Standard)
returns EdgeStatus from HLRAlgo;
---Purpose: Creates a new EdgeStatus. Default visible. The
-- Edge is bounded by the interval <Start>, <End>
-- with the tolerances <TolStart>, <TolEnd>.
Initialize(me : in out;
Start : Real from Standard;
TolStart : ShortReal from Standard;
End : Real from Standard;
TolEnd : ShortReal from Standard)
---Purpose: Initialize an EdgeStatus. Default visible. The
-- Edge is bounded by the interval <Start>, <End>
-- with the tolerances <TolStart>, <TolEnd>.
is static;
Bounds (me;Start : out Real from Standard;
TolStart : out ShortReal from Standard;
End : out Real from Standard;
TolEnd : out ShortReal from Standard)
---C++: inline
is static;
NbVisiblePart(me) returns Integer from Standard
is static;
VisiblePart(me; Index : Integer from Standard;
Start : out Real from Standard;
TolStart : out ShortReal from Standard;
End : out Real from Standard;
TolEnd : out ShortReal from Standard)
is static;
Hide(me : in out; Start : Real from Standard;
TolStart : ShortReal from Standard;
End : Real from Standard;
TolEnd : ShortReal from Standard;
OnFace : Boolean from Standard;
OnBoundary : Boolean from Standard)
---Purpose: Hides the interval <Start>, <End> with the
-- tolerances <TolStart>, <TolEnd>. This interval is
-- subtracted from the visible parts. If the hidden
-- part is on ( or under ) the face the flag <OnFace>
-- is True ( or False ). If the hidden part is on (
-- or inside ) the boundary of the face the flag
-- <OnBoundary> is True ( or False ).
is static;
HideAll(me : in out)
---C++: inline
---Purpose: Hide the whole Edge.
is static;
ShowAll(me : in out)
---C++: inline
---Purpose: Show the whole Edge.
is static;
AllHidden(me) returns Boolean from Standard
---C++: inline
is static;
AllHidden(me : in out; B : Boolean from Standard)
---C++: inline
is static;
AllVisible(me) returns Boolean from Standard
---C++: inline
is static;
AllVisible(me : in out; B : Boolean from Standard)
---C++: inline
is static;
fields
myStart : Real from Standard;
myEnd : Real from Standard;
myTolStart : ShortReal from Standard;
myTolEnd : ShortReal from Standard;
myFlags : Boolean from Standard;
myVisibles : Intervals from Intrv;
end EdgeStatus;

View File

@@ -0,0 +1,103 @@
// File: HLRAlgo_EdgeStatus.cxx
// Created: Tue Feb 18 11:30:23 1992
// Author: Christophe MARION
// <cma@sdsun1>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_EdgeStatus.ixx>
//=======================================================================
//function : HLRAlgo_EdgeStatus
//purpose :
//=======================================================================
HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus ()
{
}
//=======================================================================
//function : HLRAlgo_EdgeStatus
//purpose :
//=======================================================================
HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus (const Standard_Real Start,
const Standard_ShortReal TolStart,
const Standard_Real End ,
const Standard_ShortReal TolEnd) :
myStart (Start),
myEnd (End),
myTolStart (TolStart),
myTolEnd (TolEnd),
myFlags (0)
{
ShowAll();
}
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void HLRAlgo_EdgeStatus::Initialize (const Standard_Real Start,
const Standard_ShortReal TolStart,
const Standard_Real End ,
const Standard_ShortReal TolEnd)
{
myStart = Start;
myTolStart = TolStart;
myEnd = End;
myTolEnd = TolEnd;
ShowAll();
}
//=======================================================================
//function : NbVisiblePart
//purpose :
//=======================================================================
Standard_Integer HLRAlgo_EdgeStatus::NbVisiblePart () const
{
if (AllHidden ()) return 0;
else if (AllVisible()) return 1;
else return myVisibles.NbIntervals();
}
//=======================================================================
//function : VisiblePart
//purpose :
//=======================================================================
void HLRAlgo_EdgeStatus::VisiblePart (const Standard_Integer Index,
Standard_Real& Start,
Standard_ShortReal& TolStart,
Standard_Real& End ,
Standard_ShortReal& TolEnd ) const
{
if (AllVisible()) Bounds(Start,TolStart,End,TolEnd);
else myVisibles.Value(Index).Bounds(Start,TolStart,End,TolEnd);
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRAlgo_EdgeStatus::Hide (const Standard_Real Start ,
const Standard_ShortReal TolStart,
const Standard_Real End ,
const Standard_ShortReal TolEnd ,
const Standard_Boolean OnFace ,
const Standard_Boolean)
{
if (!OnFace) {
if (AllVisible()) {
myVisibles = Intrv_Intervals
(Intrv_Interval(myStart,myTolStart,myEnd,myTolEnd));
AllVisible(Standard_False);
}
myVisibles.Subtract(Intrv_Interval(Start,TolStart,End,TolEnd));
if (!AllHidden()) AllHidden(myVisibles.NbIntervals() == 0);
}
}

View File

@@ -0,0 +1,83 @@
// File: HLRAlgo_EdgeStatus.lxx
// Created: Tue Feb 18 11:30:12 1992
// Author: Christophe MARION
// <cma@sdsun1>
#define EMaskAllHidden ((Standard_Boolean)1)
#define EMaskAllVisible ((Standard_Boolean)2)
//=======================================================================
//function : Bounds
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeStatus::Bounds
( Standard_Real& Start, Standard_ShortReal& TolStart,
Standard_Real& End , Standard_ShortReal& TolEnd ) const
{
Start = myStart;
TolStart = myTolStart;
End = myEnd;
TolEnd = myTolEnd;
}
//=======================================================================
//function : HideAll
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeStatus::HideAll()
{
AllVisible(Standard_False);
AllHidden (Standard_True);
}
//=======================================================================
//function : ShowAll
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeStatus::ShowAll()
{
AllVisible(Standard_True);
AllHidden (Standard_False);
}
//=======================================================================
//function : AllHidden
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_EdgeStatus::AllHidden () const
{ return (myFlags & EMaskAllHidden) != 0; }
//=======================================================================
//function : AllHidden
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeStatus::AllHidden (const Standard_Boolean B)
{
if (B) myFlags |= EMaskAllHidden;
else myFlags &= ~EMaskAllHidden;
}
//=======================================================================
//function : AllVisible
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_EdgeStatus::AllVisible () const
{ return (myFlags & EMaskAllVisible) != 0; }
//=======================================================================
//function : AllVisible
//purpose :
//=======================================================================
inline void HLRAlgo_EdgeStatus::AllVisible (const Standard_Boolean B)
{
if (B) myFlags |= EMaskAllVisible;
else myFlags &= ~EMaskAllVisible;
}

View File

@@ -0,0 +1,111 @@
-- File: HLRAlgo_EdgesBlock.cdl
-- Created: Mon Apr 6 17:57:45 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class EdgesBlock from HLRAlgo inherits TShared from MMgt
---Purpose: An EdgesBlock is a set of Edges. It is used by the
-- DataStructure to structure the Edges.
--
-- An EdgesBlock contains :
--
-- * An Array of index of Edges.
--
-- * An Array of flagsf ( Orientation
-- OutLine
-- Internal
-- Double
-- IsoLine)
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
Orientation from TopAbs,
Array1OfInteger from TColStd,
Array1OfBoolean from TColStd
is
Create(NbEdges : Integer)
---Purpose: Create a Block of Edges for a wire.
returns mutable EdgesBlock from HLRAlgo;
NbEdges(me) returns Integer from Standard
---C++: inline
is static;
Edge(me : mutable; I : Integer from Standard;
EI : Integer from Standard)
---C++: inline
is static;
Edge(me; I : Integer from Standard)
returns Integer from Standard
---C++: inline
is static;
Orientation(me : mutable; I : Integer from Standard;
Or : Orientation from TopAbs)
---C++: inline
is static;
Orientation(me; I : Integer from Standard)
returns Orientation from TopAbs
---C++: inline
is static;
OutLine(me; I : Integer from Standard)
returns Boolean from Standard
---C++: inline
is static;
OutLine(me : mutable; I : Integer from Standard;
B : Boolean from Standard)
---C++: inline
is static;
Internal(me; I : Integer from Standard)
returns Boolean from Standard
---C++: inline
is static;
Internal(me : mutable; I : Integer from Standard;
B : Boolean from Standard)
---C++: inline
is static;
Double(me; I : Integer from Standard)
returns Boolean from Standard
---C++: inline
is static;
Double(me : mutable; I : Integer from Standard;
B : Boolean from Standard)
---C++: inline
is static;
IsoLine(me; I : Integer from Standard)
returns Boolean from Standard
---C++: inline
is static;
IsoLine(me : mutable; I : Integer from Standard;
B : Boolean from Standard)
---C++: inline
is static;
UpdateMinMax(me : mutable; TotMinMax : Address from Standard)
is static;
MinMax(me) returns Address from Standard
---C++: inline
is static;
fields
myEdges : Array1OfInteger from TColStd;
myFlags : Array1OfBoolean from TColStd;
myMinMax : Integer from Standard[16];
end EdgesBlock;

View File

@@ -0,0 +1,29 @@
// File: HLRAlgo_EdgesBlock.cxx
// Created: Fri Mar 27 17:08:48 1992
// Author: Christophe MARION
// <cma@sdsun2>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_EdgesBlock.ixx>
//=======================================================================
//function : HLRAlgo_EdgesBlock
//purpose :
//=======================================================================
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

@@ -0,0 +1,169 @@
// File: HLRAlgo_EdgesBlock.lxx
// Created: Thu Apr 20 11:31:26 1995
// Author: Christophe MARION
// <cma@ecolox>
#define EMaskOrient ((Standard_Boolean)15)
#define EMaskOutLine ((Standard_Boolean)16)
#define EMaskInternal ((Standard_Boolean)32)
#define EMaskDouble ((Standard_Boolean)64)
#define EMaskIsoLine ((Standard_Boolean)128)
//=======================================================================
//function : NbEdges
//purpose :
//=======================================================================
inline Standard_Integer HLRAlgo_EdgesBlock::NbEdges() const
{
return myEdges.Upper();
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
inline void HLRAlgo_EdgesBlock::Edge (const Standard_Integer I,
const Standard_Integer EI)
{
myEdges(I) = EI;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
inline Standard_Integer
HLRAlgo_EdgesBlock::Edge (const Standard_Integer I) const
{
return myEdges(I);
}
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline TopAbs_Orientation
HLRAlgo_EdgesBlock::Orientation (const Standard_Integer I) const
{
return ((TopAbs_Orientation)(myFlags(I) & EMaskOrient));
}
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgesBlock::Orientation (const Standard_Integer I,
const TopAbs_Orientation Or)
{
myFlags(I) &= ~EMaskOrient;
myFlags(I) |= (((Standard_Boolean)Or) & EMaskOrient);
}
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_EdgesBlock::OutLine (const Standard_Integer I) const
{
return (myFlags(I) & EMaskOutLine) != 0;
}
//=======================================================================
//function : OutLine
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgesBlock::OutLine (const Standard_Integer I,
const Standard_Boolean B)
{
if (B) myFlags(I) |= EMaskOutLine;
else myFlags(I) &= ~EMaskOutLine;
}
//=======================================================================
//function : Internal
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_EdgesBlock::Internal (const Standard_Integer I) const
{
return (myFlags(I) & EMaskInternal) != 0;
}
//=======================================================================
//function : Internal
//purpose :
//=======================================================================
inline void
HLRAlgo_EdgesBlock::Internal (const Standard_Integer I,
const Standard_Boolean B)
{
if (B) myFlags(I) |= EMaskInternal;
else myFlags(I) &= ~EMaskInternal;
}
//=======================================================================
//function : Double
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_EdgesBlock::Double (const Standard_Integer I) const
{
return (myFlags(I) & EMaskDouble) != 0;
}
//=======================================================================
//function : Double
//purpose :
//=======================================================================
inline void HLRAlgo_EdgesBlock::Double (const Standard_Integer I,
const Standard_Boolean B)
{
if (B) myFlags(I) |= EMaskDouble;
else myFlags(I) &= ~EMaskDouble;
}
//=======================================================================
//function : IsoLine
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_EdgesBlock::IsoLine (const Standard_Integer I) const
{
return (myFlags(I) & EMaskIsoLine) != 0;
}
//=======================================================================
//function : IsoLine
//purpose :
//=======================================================================
inline void HLRAlgo_EdgesBlock::IsoLine (const Standard_Integer I,
const Standard_Boolean B)
{
if (B) myFlags(I) |= EMaskIsoLine;
else myFlags(I) &= ~EMaskIsoLine;
}
//=======================================================================
//function : MinMax
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_EdgesBlock::MinMax () const
{ return (Standard_Address)&myMinMax; }

View File

@@ -0,0 +1,97 @@
-- File: Intersection.cdl
-- Created: Fri Aug 21 10:41:54 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class Intersection from HLRAlgo
---Purpose: Describes an intersection on an edge to hide.
-- Contains a parameter and a state (ON = on the
-- face, OUT = above the face, IN = under the Face)
uses
Integer from Standard,
Real from Standard,
ShortReal from Standard,
Orientation from TopAbs,
State from TopAbs
is
Create returns Intersection from HLRAlgo;
Create(Ori : Orientation from TopAbs;
Lev : Integer from Standard;
SegInd : Integer from Standard;
Ind : Integer from Standard;
P : Real from Standard;
Tol : ShortReal from Standard;
S : State from TopAbs)
returns Intersection from HLRAlgo;
Orientation(me : in out; Ori : Orientation from TopAbs)
---C++: inline
is static;
Orientation(me) returns Orientation from TopAbs
---C++: inline
is static;
Level(me : in out; Lev : Integer from Standard)
---C++: inline
is static;
Level(me) returns Integer from Standard
---C++: inline
is static;
SegIndex(me : in out; SegInd : Integer from Standard)
---C++: inline
is static;
SegIndex(me) returns Integer from Standard
---C++: inline
is static;
Index(me : in out; Ind : Integer from Standard)
---C++: inline
is static;
Index(me) returns Integer from Standard
---C++: inline
is static;
Parameter(me : in out; P : Real from Standard)
---C++: inline
is static;
Parameter(me) returns Real from Standard
---C++: inline
is static;
Tolerance(me : in out; T : ShortReal from Standard)
---C++: inline
is static;
Tolerance(me) returns ShortReal from Standard
---C++: inline
is static;
State(me : in out; S : State from TopAbs)
---C++: inline
is static;
State(me) returns State from TopAbs
---C++: inline
is static;
fields
myOrien : Orientation from TopAbs;
mySegIndex : Integer from Standard;
myIndex : Integer from Standard;
myLevel : Integer from Standard;
myParam : Real from Standard;
myToler : ShortReal from Standard;
myState : State from TopAbs;
end Intersection;

View File

@@ -0,0 +1,37 @@
// File: HLRAlgo_Intersection.cxx
// Created: Wed Feb 19 14:22:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRAlgo_Intersection.ixx>
//=======================================================================
//function : HLRAlgo_Intersection
//purpose :
//=======================================================================
HLRAlgo_Intersection::HLRAlgo_Intersection()
{}
//=======================================================================
//function : HLRAlgo_Intersection
//purpose :
//=======================================================================
HLRAlgo_Intersection::HLRAlgo_Intersection
(const TopAbs_Orientation Ori,
const Standard_Integer Lev,
const Standard_Integer SegInd,
const Standard_Integer Ind,
const Standard_Real P,
const Standard_ShortReal Tol,
const TopAbs_State S) :
myOrien(Ori),
mySegIndex(SegInd),
myIndex(Ind),
myLevel(Lev),
myParam(P),
myToler(Tol),
myState(S)
{}

View File

@@ -0,0 +1,117 @@
// File: HLRAlgo_Intersection.lxx
// Created: Wed Feb 19 14:21:57 1992
// Author: Christophe MARION
// <cma@sdsun2>
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::Orientation (const TopAbs_Orientation Ori)
{ myOrien = Ori; }
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
inline TopAbs_Orientation HLRAlgo_Intersection::Orientation() const
{ return myOrien; }
//=======================================================================
//function : Level
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::Level (const Standard_Integer Lev)
{ myLevel = Lev; }
//=======================================================================
//function : Level
//purpose :
//=======================================================================
inline Standard_Integer HLRAlgo_Intersection::Level () const
{ return myLevel; }
//=======================================================================
//function : SegIndex
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::SegIndex (const Standard_Integer SegInd)
{ mySegIndex = SegInd; }
//=======================================================================
//function : SegIndex
//purpose :
//=======================================================================
inline Standard_Integer HLRAlgo_Intersection::SegIndex () const
{ return mySegIndex; }
//=======================================================================
//function : Index
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::Index (const Standard_Integer Ind)
{ myIndex = Ind; }
//=======================================================================
//function : Index
//purpose :
//=======================================================================
inline Standard_Integer HLRAlgo_Intersection::Index () const
{ return myIndex; }
//=======================================================================
//function : Parameter
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::Parameter (const Standard_Real P)
{ myParam = P; }
//=======================================================================
//function : Parameter
//purpose :
//=======================================================================
inline Standard_Real HLRAlgo_Intersection::Parameter () const
{ return myParam; }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::Tolerance (const Standard_ShortReal T)
{ myToler = T; }
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_ShortReal HLRAlgo_Intersection::Tolerance () const
{ return myToler; }
//=======================================================================
//function : State
//purpose :
//=======================================================================
inline void HLRAlgo_Intersection::State (const TopAbs_State St)
{ myState = St; }
//=======================================================================
//function : State
//purpose :
//=======================================================================
inline TopAbs_State HLRAlgo_Intersection::State() const
{ return myState; }

View File

@@ -0,0 +1,85 @@
-- File: HLRAlgo_PolyAlgo.cdl
-- Created: Tue Feb 18 10:36:07 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class PolyAlgo from HLRAlgo inherits TShared from MMgt
---Purpose: to remove Hidden lines on Triangulations.
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
Real from Standard,
HArray1OfTransient from TColStd,
Array1OfTransient from TColStd,
ListIteratorOfListOfBPoint from HLRAlgo,
EdgeStatus from HLRAlgo
is
Create
returns mutable PolyAlgo from HLRAlgo;
Init(me : mutable; HShell : HArray1OfTransient from TColStd)
is static;
PolyShell(me) returns Array1OfTransient from TColStd
---C++: return &
---C++: inline
is static;
Clear(me : mutable)
is static;
Update(me : mutable)
---Purpose: Prepare all the data to process the algo.
is static;
InitHide(me : mutable)
---C++: inline
is static;
MoreHide(me) returns Boolean from Standard
---C++: inline
is static;
NextHide(me : mutable)
is static;
Hide(me : mutable; Coordinates : out Address from Standard;
status : out EdgeStatus from HLRAlgo;
Index : out Integer from Standard;
reg1,regn : out Boolean from Standard;
outl,intl : out Boolean from Standard)
---Purpose: process hiding between <Pt1> and <Pt2>.
is static;
InitShow(me : mutable)
---C++: inline
is static;
MoreShow(me) returns Boolean from Standard
---C++: inline
is static;
NextShow(me : mutable)
is static;
Show(me : mutable; Coordinates : out Address from Standard;
Index : out Integer from Standard;
reg1,regn : out Boolean from Standard;
outl,intl : out Boolean from Standard)
---Purpose: process hiding between <Pt1> and <Pt2>.
is static;
fields
myHShell : HArray1OfTransient from TColStd;
myRealPtr : Real from Standard[10];
mySegListIt : ListIteratorOfListOfBPoint from HLRAlgo;
myNbrShell : Integer from Standard;
myCurShell : Integer from Standard;
myFound : Boolean from Standard;
end PolyAlgo;

513
src/HLRAlgo/HLRAlgo_PolyAlgo.cxx Executable file
View File

@@ -0,0 +1,513 @@
// File: HLRAlgo_PolyAlgo.cxx
// Created: Fri May 5 15:58:19 1995
// Author: Christophe MARION
// <cma@ecolox>
#ifndef No_Exception
//#define No_Exception
#endif
#include <HLRAlgo_PolyAlgo.ixx>
#include <HLRAlgo_PolyShellData.hxx>
#include <HLRAlgo_PolyData.hxx>
#include <HLRAlgo_ListOfBPoint.hxx>
#include <HLRAlgo_BiPoint.hxx>
#include <Precision.hxx>
#define EMskGrALin1 ((Standard_Boolean) 8)
#define EMskGrALin2 ((Standard_Boolean) 16)
#define EMskGrALin3 ((Standard_Boolean) 32)
#define FMskHiding ((Standard_Boolean) 256)
#define TriNode1 ((Standard_Integer*)TriIndices)[0]
#define TriNode2 ((Standard_Integer*)TriIndices)[1]
#define TriNode3 ((Standard_Integer*)TriIndices)[2]
#define TriFlags ((Standard_Boolean*)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;
//=======================================================================
//function : HLRAlgo_PolyAlgo
//purpose :
//=======================================================================
HLRAlgo_PolyAlgo::HLRAlgo_PolyAlgo ()
{
myTolParam = 0.00000001;
myTolAngular = 0.0001;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void
HLRAlgo_PolyAlgo::Init (const Handle(TColStd_HArray1OfTransient)& HShell)
{ myHShell = HShell; }
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Clear ()
{
if (!myHShell.IsNull()) {
myHShell.Nullify();
}
myNbrShell = 0;
}
//=======================================================================
//function : Update
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Update ()
{
Standard_Integer i,j;
Standard_Integer nxMin,nyMin,nzMin,nxMax,nyMax,nzMax;
Standard_Real xShellMin,yShellMin,zShellMin;
Standard_Real xShellMax,yShellMax,zShellMax;
Standard_Real xPolyTMin,yPolyTMin,zPolyTMin;
Standard_Real xPolyTMax,yPolyTMax,zPolyTMax;
Standard_Real xTrianMin,yTrianMin,zTrianMin;
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;
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++;
}
Standard_Real dx = TotMinMax[3] - TotMinMax[0];
Standard_Real dy = TotMinMax[4] - TotMinMax[1];
Standard_Real dz = TotMinMax[5] - TotMinMax[2];
Standard_Real precad = dx;
if (precad < dy) precad = dy;
if (precad < dz) precad = dz;
myTolerance = precad * myTolParam;
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;
Handle(HLRAlgo_PolyShellData)* psd2 =
(Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
for (i = 1; i <= myNbrShell; i++) {
const Standard_Address ShellIndices = (*psd2)->Indices();
xShellMin = Big;
yShellMin = Big;
zShellMin = Big;
xShellMax = -Big;
yShellMax = -Big;
zShellMax = -Big;
for (mySegListIt.Initialize((*psd2)->Edges());
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; }
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;
if (xShellMin > xSegmnMin) xShellMin = xSegmnMin;
if (xShellMax < xSegmnMax) xShellMax = xSegmnMax;
if (yShellMin > ySegmnMin) yShellMin = ySegmnMin;
if (yShellMax < ySegmnMax) yShellMax = ySegmnMax;
if (zShellMin > zSegmnMin) zShellMin = zSegmnMin;
if (zShellMax < zSegmnMax) zShellMax = zSegmnMax;
}
TColStd_Array1OfTransient& Polyg = (*psd2)->PolyData();
Standard_Integer nbFace = Polyg.Upper();
Standard_Integer nbFaHi = 0;
Handle(HLRAlgo_PolyData)* pd;
if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1));
for (j = 1; j <= nbFace; j++) {
if ((*pd)->Hiding()) {
nbFaHi++;
xPolyTMin = Big;
yPolyTMin = Big;
zPolyTMin = Big;
xPolyTMax = -Big;
yPolyTMax = -Big;
zPolyTMax = -Big;
Standard_Integer otheri,nbHide = 0;//min,max;
Standard_Real X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3;
Standard_Real dn,dnx,dny,dnz,dx1,dy1,dz1,dx2,dy2,dz2,dx3,dy3;
Standard_Real adx1,ady1,adx2,ady2,adx3,ady3;
#ifndef DEB
Standard_Real a =0.,b =0.,c =0.,d =0.;
#else
Standard_Real a,b,c,d;
#endif
const Standard_Address PolyTIndices = (*pd)->Indices();
TColgp_Array1OfXYZ & Nodes = (*pd)->Nodes();
HLRAlgo_Array1OfTData& TData = (*pd)->TData();
HLRAlgo_Array1OfPHDat& PHDat = (*pd)->PHDat();
Standard_Integer nbT = TData.Upper();
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);
X1 = P1.X();
Y1 = P1.Y();
Z1 = P1.Z();
X2 = P2.X();
Y2 = P2.Y();
Z2 = P2.Z();
X3 = P3.X();
Y3 = P3.Y();
Z3 = P3.Z();
xTrianMax = xTrianMin = X1;
yTrianMax = yTrianMin = Y1;
zTrianMax = zTrianMin = Z1;
if (xTrianMin > X2) xTrianMin = X2;
else if (xTrianMax < X2) xTrianMax = X2;
if (yTrianMin > Y2) yTrianMin = Y2;
else if (yTrianMax < Y2) yTrianMax = Y2;
if (zTrianMin > Z2) zTrianMin = Z2;
else if (zTrianMax < Z2) zTrianMax = Z2;
if (xTrianMin > X3) xTrianMin = X3;
else if (xTrianMax < X3) xTrianMax = X3;
if (yTrianMin > Y3) yTrianMin = Y3;
else if (yTrianMax < Y3) yTrianMax = Y3;
if (zTrianMin > Z3) zTrianMin = Z3;
else if (zTrianMax < Z3) zTrianMax = Z3;
nxMin = (Standard_Integer)((DecaX + xTrianMin) * SurDX);
nyMin = (Standard_Integer)((DecaY + yTrianMin) * SurDY);
nzMin = (Standard_Integer)((DecaZ + zTrianMin) * SurDZ);
nxMax = (Standard_Integer)((DecaX + xTrianMax) * SurDX);
nyMax = (Standard_Integer)((DecaY + yTrianMax) * SurDY);
nzMax = (Standard_Integer)((DecaZ + zTrianMax) * SurDZ);
Standard_Integer MinTrian,MaxTrian;
MinTrian = nyMin + (nxMin << 11);
MinTrian <<= 10;
MinTrian += nzMin - 0x00000200;
MaxTrian = nyMax + (nxMax << 11);
MaxTrian <<= 10;
MaxTrian += nzMax;
dx1 = X2 - X1;
dy1 = Y2 - Y1;
dz1 = Z2 - Z1;
dx2 = X3 - X2;
dy2 = Y3 - Y2;
dz2 = Z3 - Z2;
dx3 = X1 - X3;
dy3 = Y1 - Y3;
dnx = dy1 * dz2 - dy2 * dz1;
dny = dz1 * dx2 - dz2 * dx1;
dnz = dx1 * dy2 - dx2 * dy1;
dn = sqrt(dnx * dnx + dny * dny + dnz * dnz);
if (dn > 0) {
a = dnx / dn;
b = dny / dn;
c = dnz / dn;
}
d = a * X1 + b * Y1 + c * Z1;
nbHide++;
PHDat(nbHide).Set(otheri,MinTrian,MaxTrian,a,b,c,d);
adx1 = dx1;
ady1 = dy1;
if (dx1 < 0) adx1 = -dx1;
if (dy1 < 0) ady1 = -dy1;
adx2 = dx2;
ady2 = dy2;
if (dx2 < 0) adx2 = -dx2;
if (dy2 < 0) ady2 = -dy2;
adx3 = dx3;
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 (xPolyTMin > xTrianMin) xPolyTMin = xTrianMin;
if (xPolyTMax < xTrianMax) xPolyTMax = xTrianMax;
if (yPolyTMin > yTrianMin) yPolyTMin = yTrianMin;
if (yPolyTMax < yTrianMax) yPolyTMax = yTrianMax;
if (zPolyTMin > zTrianMin) zPolyTMin = zTrianMin;
if (zPolyTMax < zTrianMax) zPolyTMax = zTrianMax;
}
TD++;
}
nxMin = (Standard_Integer)((DecaX + xPolyTMin) * SurDX);
nyMin = (Standard_Integer)((DecaY + yPolyTMin) * SurDY);
nzMin = (Standard_Integer)((DecaZ + zPolyTMin) * SurDZ);
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;
if (xShellMin > xPolyTMin) xShellMin = xPolyTMin;
if (xShellMax < xPolyTMax) xShellMax = xPolyTMax;
if (yShellMin > yPolyTMin) yShellMin = yPolyTMin;
if (yShellMax < yPolyTMax) yShellMax = yPolyTMax;
if (zShellMin > zPolyTMin) zShellMin = zPolyTMin;
if (zShellMax < zPolyTMax) zShellMax = zPolyTMax;
}
pd++;
}
if (nbFaHi > 0) {
nxMin = (Standard_Integer)((DecaX + xShellMin) * SurDX);
nyMin = (Standard_Integer)((DecaY + yShellMin) * SurDY);
nzMin = (Standard_Integer)((DecaZ + zShellMin) * SurDZ);
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;
(*psd2)->UpdateHiding(nbFaHi);
TColStd_Array1OfTransient& PolHi = (*psd2)->HidingPolyData();
pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1));
Handle(HLRAlgo_PolyData)* phd =
(Handle(HLRAlgo_PolyData)*)&(PolHi.ChangeValue(1));
for (j = 1; j <= nbFace; j++) {
if ((*pd)->Hiding()) {
*phd = *pd;
phd++;
}
pd++;
}
}
else {
(*psd2)->UpdateHiding(0);
MinShell = 0;
MaxShell = 0;
}
psd2++;
}
}
//=======================================================================
//function : NextHide
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::NextHide ()
{
myFound = Standard_False;
if (myCurShell != 0) {
mySegListIt.Next();
if (mySegListIt.More()) myFound = Standard_True;
}
if (!myFound) {
myCurShell++;
//POP ADN pour que cela marche sur WNT
// while (myCurShell <= myNbrShell && !myFound) {
// mySegListIt.Initialize((*(Handle(HLRAlgo_PolyShellData)*)&
// (myHShell->ChangeValue(myCurShell)))
// ->Edges());
while (myCurShell <= myNbrShell && !myFound) {
Handle(HLRAlgo_PolyShellData) data =
Handle(HLRAlgo_PolyShellData)::DownCast(myHShell->Value(myCurShell));
mySegListIt.Initialize(data->Edges());
if (mySegListIt.More()) myFound = Standard_True;
else myCurShell++;
}
}
}
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
HLRAlgo_EdgeStatus& status,
Standard_Integer& Index,
Standard_Boolean& reg1,
Standard_Boolean& regn,
Standard_Boolean& outl,
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;
reg1 = BP.Rg1Line();
regn = BP.RgNLine();
outl = BP.OutLine();
intl = BP.IntLine();
if (BP.Hidden())
status.HideAll();
else {
Standard_Boolean HidingShell;
TColStd_Array1OfTransient& Shell = myHShell->ChangeArray1();
Handle(HLRAlgo_PolyShellData)* psd =
(Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
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) {
HidingShell = (s == myCurShell);
TColStd_Array1OfTransient& Face = (*psd)->HidingPolyData();
Standard_Integer nbFace = Face.Upper();
Handle(HLRAlgo_PolyData)* pd =
(Handle(HLRAlgo_PolyData)*)&(Face.ChangeValue(1));
for (Standard_Integer f = 1; f <= nbFace; f++) {
(*pd)->HideByPolyData(Coordinates,
(Standard_Address)myRealPtr,
IndexPtr,
HidingShell,
status);
pd++;
}
}
}
psd++;
}
}
}
//=======================================================================
//function : NextShow
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::NextShow ()
{
myFound = Standard_False;
if (myCurShell != 0) {
mySegListIt.Next();
if (mySegListIt.More()) myFound = Standard_True;
}
if (!myFound) {
myCurShell++;
while (myCurShell <= myNbrShell && !myFound) {
mySegListIt.Initialize((*(Handle(HLRAlgo_PolyShellData)*)&
(myHShell->ChangeValue(myCurShell)))
->Edges());
if (mySegListIt.More()) myFound = Standard_True;
else myCurShell++;
}
}
}
//=======================================================================
//function : Show
//purpose :
//=======================================================================
void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates,
Standard_Integer& Index,
Standard_Boolean& reg1,
Standard_Boolean& regn,
Standard_Boolean& outl,
Standard_Boolean& intl)
{
HLRAlgo_BiPoint& BP = mySegListIt.Value();
Standard_Address IndexPtr = BP.Indices();
Coordinates = BP.Coordinates();
Index = ShapeIndex;
reg1 = BP.Rg1Line();
regn = BP.RgNLine();
outl = BP.OutLine();
intl = BP.IntLine();
}

View File

@@ -0,0 +1,53 @@
// File: HLRAlgo_PolyAlgo.lxx
// Created: Tue Jun 20 11:50:07 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <TColStd_HArray1OfTransient.hxx>
//=======================================================================
//function : PolyShell
//purpose :
//=======================================================================
inline TColStd_Array1OfTransient & HLRAlgo_PolyAlgo::PolyShell () const
{ return myHShell->ChangeArray1(); }
//=======================================================================
//function : InitHide
//purpose :
//=======================================================================
inline void HLRAlgo_PolyAlgo::InitHide ()
{
myCurShell = 0;
NextHide();
}
//=======================================================================
//function : MoreHide
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_PolyAlgo::MoreHide () const
{ return myFound; }
//=======================================================================
//function : InitShow
//purpose :
//=======================================================================
inline void HLRAlgo_PolyAlgo::InitShow ()
{
myCurShell = 0;
NextShow();
}
//=======================================================================
//function : MoreShow
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_PolyAlgo::MoreShow () const
{ return myFound; }

View File

@@ -0,0 +1,92 @@
-- File: HLRAlgo_PolyData.cdl
-- Created: Fri Oct 29 15:19:08 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class PolyData from HLRAlgo inherits TShared from MMgt
uses
Address from Standard,
Integer from Standard,
Boolean from Standard,
Array1OfXYZ from TColgp,
Array1OfTData from HLRAlgo,
Array1OfPHDat from HLRAlgo,
HArray1OfXYZ from TColgp,
HArray1OfTData from HLRAlgo,
HArray1OfPHDat from HLRAlgo,
EdgeStatus from HLRAlgo
is
Create returns mutable PolyData from HLRAlgo;
HNodes(me : mutable; HNodes : HArray1OfXYZ from TColgp)
is static;
HTData(me : mutable; HTData : HArray1OfTData from HLRAlgo)
is static;
HPHDat(me : mutable; HPHDat : HArray1OfPHDat from HLRAlgo)
is static;
FaceIndex(me : mutable; I : Integer from Standard)
---C++: inline
is static;
FaceIndex(me) returns Integer from Standard
---C++: inline
is static;
Nodes(me) returns Array1OfXYZ from TColgp
---C++: inline
---C++: return &
is static;
TData(me) returns Array1OfTData from HLRAlgo
---C++: inline
---C++: return &
is static;
PHDat(me) returns Array1OfPHDat from HLRAlgo
---C++: inline
---C++: return &
is static;
UpdateGlobalMinMax(me : mutable;
ToTMinMax : Address from Standard)
is static;
Hiding(me) returns Boolean from Standard
---C++: inline
is static;
HideByPolyData(me : mutable;
Coordinates : Address from Standard;
RealPtr : Address from Standard;
Indices : Address from Standard;
HidingShell : Boolean from Standard;
status : out EdgeStatus from HLRAlgo)
---Purpose: process hiding between <Pt1> and <Pt2>.
is static;
HideByOneTriangle(me : mutable;
Coordinates : Address from Standard;
RealPtr : Address from Standard;
BooleanPtr : Address from Standard;
PlanPtr : Address from Standard;
status : out EdgeStatus from HLRAlgo)
---Purpose: evident.
is static private;
Indices(me : mutable) returns Address from Standard
---C++: inline
is static;
fields
myIndices : Integer from Standard[3];
myHNodes : HArray1OfXYZ from TColgp;
myHTData : HArray1OfTData from HLRAlgo;
myHPHDat : HArray1OfPHDat from HLRAlgo;
end PolyData;

810
src/HLRAlgo/HLRAlgo_PolyData.cxx Executable file
View File

@@ -0,0 +1,810 @@
// File: HLRAlgo_PolyData.cxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#ifndef No_Exception
//#define No_Exception
#endif
#include <HLRAlgo_PolyData.ixx>
#define EMskGrALin1 ((Standard_Boolean) 8)
#define EMskGrALin2 ((Standard_Boolean) 16)
#define EMskGrALin3 ((Standard_Boolean) 32)
#define FMskHiding ((Standard_Boolean) 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_Boolean*)TriIndices)[3]
#define Crossing ((Standard_Boolean*)BooleanPtr)[0]
#define HideBefore ((Standard_Boolean*)BooleanPtr)[1]
#define TrFlags ((Standard_Boolean*)BooleanPtr)[2]
#define Crosi BooleanPtr[0]
#define HdBef BooleanPtr[1]
#define TFlag BooleanPtr[2]
#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 DEB
static Standard_Integer ERROR = Standard_False;
#endif
//=======================================================================
//function : PolyData
//purpose :
//=======================================================================
HLRAlgo_PolyData::HLRAlgo_PolyData ()
{}
//=======================================================================
//function : HNodes
//purpose :
//=======================================================================
void HLRAlgo_PolyData::HNodes(const Handle(TColgp_HArray1OfXYZ)& HNodes)
{ myHNodes = HNodes; }
//=======================================================================
//function : HTData
//purpose :
//=======================================================================
void HLRAlgo_PolyData::HTData(const Handle(HLRAlgo_HArray1OfTData)& HTData)
{ myHTData = HTData; }
//=======================================================================
//function : HPHDat
//purpose :
//=======================================================================
void HLRAlgo_PolyData::HPHDat(const Handle(HLRAlgo_HArray1OfPHDat)& HPHDat)
{ myHPHDat = HPHDat; }
//=======================================================================
//function : UpdateGlobalMinMax
//purpose :
//=======================================================================
void
HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
{
Standard_Integer i;
Standard_Real X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3;
const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
HLRAlgo_Array1OfTData& TData = myHTData->ChangeArray1();
Standard_Integer nbT = TData.Upper();
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);
X1 = P1.X();
Y1 = P1.Y();
Z1 = P1.Z();
X2 = P2.X();
Y2 = P2.Y();
Z2 = P2.Z();
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;
}
TD++;
}
}
//=======================================================================
//function : HideByPolyData
//purpose :
//=======================================================================
void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
const Standard_Address RealPtr,
const Standard_Address Indices,
const Standard_Boolean HidingShell,
HLRAlgo_EdgeStatus& status)
{
if (((MaxFac - MinSeg) & 0x80100200) == 0 &&
((MaxSeg - MinFac) & 0x80100000) == 0) {
HLRAlgo_Array1OfPHDat& PHDat = myHPHDat->ChangeArray1();
const HLRAlgo_Array1OfTData& TData = myHTData->Array1();
Standard_Real d1,d2;
Standard_Boolean NotConnex,BooleanPtr[3];
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();
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;
}
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;
}
}
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 );
HdBef = Standard_False;
Crosi = Standard_True;
TFlag = TriFlags;
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,
&BooleanPtr,
PlanPtr,
status);
}
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
Param = d1 / ( d1 - d2 );
HdBef = Standard_True;
Crosi = Standard_True;
TFlag = TriFlags;
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,
&BooleanPtr,
PlanPtr,
status);
}
else {
Crosi = Standard_False;
TFlag = TriFlags;
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,
&BooleanPtr,
PlanPtr,
status);
}
}
else if (d2 < -Tolerance) {
Crosi = Standard_False;
TFlag = TriFlags;
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,
&BooleanPtr,
PlanPtr,
status);
}
}
}
PH++;
}
}
}
//=======================================================================
//function : HideByOneTriangle
//purpose :
//=======================================================================
void HLRAlgo_PolyData::
HideByOneTriangle (const Standard_Address Coordinates,
const Standard_Address RealPtr,
const Standard_Address BooleanPtr,
const Standard_Address ,
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;
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) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin1) {
pd1 = (PntXP1 - XV1) / da;
pd2 = (PntXP2 - XV1) / da;
}
else {
pd1 = (PntYP1 - YV1) / db;
pd2 = (PntYP2 - YV1) / db;
}
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;
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;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 1) {
if (nn2 <= 2) return;
else {
psta = - pd1 / (pd2 - pd1);
if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
}
else if (nn1 == 5) {
if (nn2 >= 4) return;
else {
psta = (pd1 - 1.) / (pd1 - pd2);
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
else if (nn1 == 2) {
if (nn2 == 1) return;
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 4) {
if (nn2 == 5) return;
else if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
}
if (CrosSeg) {
Standard_Real ad1 = d1;
if (d1 < 0) ad1 = -d1;
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin1)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV1) / da;
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV1) / db;
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else OutSideP = Standard_True;
if (OutSideP) npiRej++;
else {
npi++;
if (npi < 2) {
p[npi] = pp;
o[npi] = n1 == -1;
m[npi] = Multiple;
}
#ifdef DEB
else if (ERROR) {
cout << " error : HLRAlgo_PolyData::HideByOneTriangle " << endl;
cout << " ( more than 2 points )." << endl;
}
#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) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin2) {
pd1 = (PntXP1 - XV2) / da;
pd2 = (PntXP2 - XV2) / da;
}
else {
pd1 = (PntYP1 - YV2) / db;
pd2 = (PntYP2 - YV2) / db;
}
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;
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;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 1) {
if (nn2 <= 2) return;
else {
psta = - pd1 / (pd2 - pd1);
if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
}
else if (nn1 == 5) {
if (nn2 >= 4) return;
else {
psta = (pd1 - 1.) / (pd1 - pd2);
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
else if (nn1 == 2) {
if (nn2 == 1) return;
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 4) {
if (nn2 == 5) return;
else if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
}
if (CrosSeg) {
Standard_Real ad1 = d1;
if (d1 < 0) ad1 = -d1;
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin2)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV2) / da;
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV2) / db;
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else OutSideP = Standard_True;
if (OutSideP) npiRej++;
else {
npi++;
if (npi < 2) {
p[npi] = pp;
o[npi] = n1 == -1;
m[npi] = Multiple;
}
#ifdef DEB
else if (ERROR) {
cout << " error : HLRAlgo_PolyData::HideByOneTriangle " << endl;
cout << " ( more than 2 points )." << endl;
}
#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) {
n1 = 2;
CrosSeg = Standard_True;
}
else
CrosSeg = Standard_False;
}
else if (d1 < -Tolerance) {
if (d2 > Tolerance) {
n1 = -1;
CrosSeg = Standard_True;
}
else return;
}
else {
if (d2 > Tolerance)
CrosSeg = Standard_False;
else if (d2 < -Tolerance) return;
else {
CrosSeg = Standard_False;
if (TrFlags & EMskGrALin3) {
pd1 = (PntXP1 - XV3) / da;
pd2 = (PntXP2 - XV3) / da;
}
else {
pd1 = (PntYP1 - YV3) / db;
pd2 = (PntYP2 - YV3) / db;
}
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;
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;
else nn2 = 5;
if (nn1 == 3) {
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 1) {
if (nn2 <= 2) return;
else {
psta = - pd1 / (pd2 - pd1);
if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
}
else if (nn1 == 5) {
if (nn2 >= 4) return;
else {
psta = (pd1 - 1.) / (pd1 - pd2);
if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
else if (nn1 == 2) {
if (nn2 == 1) return;
else if (nn2 == 5) pend = (1. - pd1) / (pd2 - pd1);
}
else if (nn1 == 4) {
if (nn2 == 5) return;
else if (nn2 == 1) pend = pd1 / (pd1 - pd2);
}
}
}
if (CrosSeg) {
Standard_Real ad1 = d1;
if (d1 < 0) ad1 = -d1;
Standard_Real ad2 = d2;
if (d2 < 0) ad2 = -d2;
pp = ad1 / ( ad1 + ad2 );
if (TrFlags & EMskGrALin3)
pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV3) / da;
else
pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV3) / db;
Standard_Boolean OutSideP = Standard_False;
Standard_Boolean Multiple = Standard_False;
if (pdp < -TolParam) OutSideP = Standard_True;
else if (pdp < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else if (pdp - 1. < -TolParam) {}
else if (pdp - 1. < TolParam) {
Multiple = Standard_True;
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
m[0] = m[1];
}
npi--;
npiRej++;
}
}
}
}
else OutSideP = Standard_True;
if (OutSideP) npiRej++;
else {
npi++;
if (npi < 2) {
p[npi] = pp;
o[npi] = n1 == -1;
m[npi] = Multiple;
}
#ifdef DEB
else if (ERROR) {
cout << " error : HLRAlgo_PolyData::HideByOneTriangle " << endl;
cout << " ( more than 2 points )." << endl;
}
#endif
}
}
if (npi == -1) {
if (npiRej >= 2) return;
}
else if (npi == 0) {
if (o[0]) {
psta = p[0];
pend = 1.;
}
else {
psta = 0.;
pend = p[0];
}
}
else if (npi == 1) {
if (p[0] > p[1]) {
psta = p[1];
pend = p[0];
}
else {
psta = p[0];
pend = p[1];
}
}
if (Crossing) {
if (HideBefore) {
if (Param-psta < TolParam) return;
else if (Param < pend) pend = Param;
}
else {
if (pend-Param < TolParam) return;
else if (psta < Param) psta = Param;
}
}
Standard_Boolean total;
if (psta > 0) total = psta < TolParam;
else total = psta > -TolParam;
if (total) {
Standard_Real pfin = pend - 1.;
if (pfin > 0) total = pfin < TolParam;
else total = pfin > -TolParam;
}
if (total) status.HideAll();
else status.Hide(psta,(Standard_ShortReal)TolParam,pend,(Standard_ShortReal)TolParam,
Standard_False,Standard_False);
}

View File

@@ -0,0 +1,71 @@
// File: HLRAlgo_PolyData.lxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#include <TColgp_HArray1OfXYZ.hxx>
#include <HLRAlgo_HArray1OfTData.hxx>
#include <HLRAlgo_HArray1OfPHDat.hxx>
//=======================================================================
//function : FaceIndex
//purpose :
//=======================================================================
inline void
HLRAlgo_PolyData::FaceIndex (const Standard_Integer I)
{ myIndices[0] = I; }
//=======================================================================
//function : FaceIndex
//purpose :
//=======================================================================
inline Standard_Integer
HLRAlgo_PolyData::FaceIndex () const
{ return myIndices[0]; }
//=======================================================================
//function : Nodes
//purpose :
//=======================================================================
inline TColgp_Array1OfXYZ &
HLRAlgo_PolyData::Nodes () const
{ return myHNodes->ChangeArray1(); }
//=======================================================================
//function : TData
//purpose :
//=======================================================================
inline HLRAlgo_Array1OfTData &
HLRAlgo_PolyData::TData () const
{ return myHTData->ChangeArray1(); }
//=======================================================================
//function : PHDat
//purpose :
//=======================================================================
inline HLRAlgo_Array1OfPHDat &
HLRAlgo_PolyData::PHDat () const
{ return myHPHDat->ChangeArray1(); }
//=======================================================================
//function : Hiding
//purpose :
//=======================================================================
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

@@ -0,0 +1,35 @@
-- File: HLRAlgo_PolyHidingData.cdl
-- Created: Fri Oct 29 15:19:08 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class PolyHidingData from HLRAlgo
uses
Address from Standard,
Integer from Standard,
Real from Standard
is
Create returns PolyHidingData from HLRAlgo;
---C++: inline
Set(me : in out;
Index,Minim,Maxim : Integer from Standard;
A,B,C,D : Real from Standard)
---C++: inline
is static;
IndexAndMinMax(me) returns Address from Standard
---C++: inline
is static;
Plan(me) returns Address from Standard
---C++: inline
is static;
fields
myMinMax : Integer from Standard[3];
myPlan : Real from Standard[4];
end PolyHidingData;

View File

@@ -0,0 +1,7 @@
// File: HLRAlgo_PolyHidingData.cxx
// Created: Wed Jun 21 19:23:39 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <HLRAlgo_PolyHidingData.ixx>

View File

@@ -0,0 +1,54 @@
// File: HLRAlgo_PolyHidingData.lxx
// Created: Wed Jun 21 19:29:59 1995
// Author: Christophe MARION
// <cma@ecolox>
//=======================================================================
//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

@@ -0,0 +1,127 @@
-- File: HLRAlgo_PolyInternalData.cdl
-- Created: Fri Oct 29 15:19:08 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class PolyInternalData from HLRAlgo inherits TShared from MMgt
uses
Address from Standard,
Integer from Standard,
Boolean from Standard,
Real from Standard,
HArray1OfTData from HLRAlgo,
HArray1OfPISeg from HLRAlgo,
HArray1OfPINod from HLRAlgo,
Array1OfTData from HLRAlgo,
Array1OfPISeg from HLRAlgo,
Array1OfPINod from HLRAlgo
is
Create(nbNod, nbTri : Integer from Standard)
returns mutable PolyInternalData from HLRAlgo;
UpdateLinks(me : mutable;
TData : out Address from Standard;
PISeg : out Address from Standard;
PINod : out Address from Standard)
is static;
AddNode(me : mutable;
Nod1RValues : Address from Standard;
Nod2RValues : Address from Standard;
PINod1,PINod2 : out Address from Standard;
coef1 : Real from Standard;
X3,Y3,Z3 : Real from Standard)
returns Integer from Standard
is static;
UpdateLinks(me : mutable;
ip1,ip2,ip3 : Integer from Standard;
TData1,TData2 : out Address from Standard;
PISeg1,PISeg2 : out Address from Standard;
PINod1,PINod2 : out Address from Standard)
is static;
Dump(me)
is static;
IncTData(me : mutable; TData1,TData2 : out Address from Standard)
is static;
IncPISeg(me : mutable; PISeg1,PISeg2 : out Address from Standard)
is static;
IncPINod(me : mutable; PINod1,PINod2 : out Address from Standard)
is static;
DecTData(me : mutable)
---C++: inline
is static;
DecPISeg(me : mutable)
---C++: inline
is static;
DecPINod(me : mutable)
---C++: inline
is static;
NbTData(me) returns Integer from Standard
---C++: inline
is static;
NbPISeg(me) returns Integer from Standard
---C++: inline
is static;
NbPINod(me) returns Integer from Standard
---C++: inline
is static;
Planar(me) returns Boolean from Standard
---C++: inline
is static;
Planar(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
IntOutL(me) returns Boolean from Standard
---C++: inline
is static;
IntOutL(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
TData (me) returns Array1OfTData from HLRAlgo
---C++: inline
---C++: return &
is static;
PISeg (me) returns Array1OfPISeg from HLRAlgo
---C++: inline
---C++: return &
is static;
PINod (me) returns Array1OfPINod from HLRAlgo
---C++: inline
---C++: return &
is static;
fields
myNbTData : Integer from Standard;
myNbPISeg : Integer from Standard;
myNbPINod : Integer from Standard;
myMxTData : Integer from Standard;
myMxPISeg : Integer from Standard;
myMxPINod : Integer from Standard;
myIntOutL : Boolean from Standard;
myPlanar : Boolean from Standard;
myTData : HArray1OfTData from HLRAlgo;
myPISeg : HArray1OfPISeg from HLRAlgo;
myPINod : HArray1OfPINod from HLRAlgo;
end PolyInternalData;

View File

@@ -0,0 +1,920 @@
// File: HLRAlgo_PolyInternalData.cxx
// Created: Tue Jul 11 16:59:46 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <Standard_Stream.hxx>
#include <HLRAlgo_PolyInternalData.ixx>
#include <HLRAlgo_BiPoint.hxx>
#define Tri1Node1 ((Standard_Integer*)Tri1Indices)[0]
#define Tri1Node2 ((Standard_Integer*)Tri1Indices)[1]
#define Tri1Node3 ((Standard_Integer*)Tri1Indices)[2]
#define Tri1Flags ((Standard_Boolean*)Tri1Indices)[3]
#define Tri2Node1 ((Standard_Integer*)Tri2Indices)[0]
#define Tri2Node2 ((Standard_Integer*)Tri2Indices)[1]
#define Tri2Node3 ((Standard_Integer*)Tri2Indices)[2]
#define Tri2Flags ((Standard_Boolean*)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_Boolean*)Nod1Indices)[1]
#define Nod1Edg1 ((Standard_Boolean*)Nod1Indices)[2]
#define Nod1Edg2 ((Standard_Boolean*)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_Boolean*)Nod2Indices)[1]
#define Nod2Edg1 ((Standard_Boolean*)Nod2Indices)[2]
#define Nod2Edg2 ((Standard_Boolean*)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_Boolean*)Nod3Indices)[1]
#define Nod3Edg1 ((Standard_Boolean*)Nod3Indices)[2]
#define Nod3Edg2 ((Standard_Boolean*)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_Boolean*)Nod4Indices)[1]
#define Nod4Edg1 ((Standard_Boolean*)Nod4Indices)[2]
#define Nod4Edg2 ((Standard_Boolean*)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 DEB
static Standard_Integer TRACE = Standard_False;
static Standard_Integer ERROR = Standard_False;
#endif
//=======================================================================
//function : PolyInternalData
//purpose :
//=======================================================================
HLRAlgo_PolyInternalData::HLRAlgo_PolyInternalData
(const Standard_Integer nbNod,
const Standard_Integer nbTri) :
myNbTData(nbTri),
myNbPISeg(0),
myNbPINod(nbNod),
myMxTData(nbTri),
myMxPINod(nbNod),
myIntOutL(Standard_False),
myPlanar(Standard_False)
{
Standard_Integer i;
myMxPISeg = 2 + (3 * nbTri + nbNod) / 2;
myTData = new HLRAlgo_HArray1OfTData(0,myMxTData);
myPISeg = new HLRAlgo_HArray1OfPISeg(0,myMxPISeg);
myPINod = new HLRAlgo_HArray1OfPINod(0,myMxPINod);
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++;
}
}
//=======================================================================
//function : UpdateLinks
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::UpdateLinks
(Standard_Address& TData,
Standard_Address& PISeg,
Standard_Address& PINod)
{
Standard_Integer i,n1,n2;
Standard_Integer find,iiii,icsv;
Standard_Address A1,A2,A3,Nod1Indices,Nod2Indices,Seg2Indices,Tri2Indices;
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;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
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;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
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; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
}
n1 = Tri2Node2;
n2 = Tri2Node3;
Nod1Indices = A2;
Nod2Indices = A3;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
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;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
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; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
}
n1 = Tri2Node3;
n2 = Tri2Node1;
Nod1Indices = A3;
Nod2Indices = A1;
newSeg = Standard_False;
if (Nod1NdSg == 0 && Nod2NdSg == 0) {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
Nod2NdSg = myNbPISeg;
}
else {
iiii = Nod1NdSg;
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;
icsv = 1;
}
else {
if (Seg2LstSg1 == n2) find = iiii;
else iiii = Seg2NxtSg2;
icsv = 2;
}
}
if (find == 0) {
newSeg = Standard_True;
myNbPISeg++;
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Seg2Conex2 = i;
}
else {
newSeg = Standard_True;
myNbPISeg++;
Nod1NdSg = myNbPISeg;
}
if (newSeg) {
iiii = Nod2NdSg;
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; }
}
if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
else Seg2NxtSg2 = myNbPISeg;
}
else Nod2NdSg = myNbPISeg;
}
}
if (newSeg) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = n1;
Seg2LstSg2 = n2;
Seg2Conex1 = i;
Seg2Conex2 = 0;
Seg2NxtSg1 = 0;
Seg2NxtSg2 = 0;
}
TD++;
}
}
//=======================================================================
//function : AddNode
//purpose :
//=======================================================================
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)
{
Standard_Real coef2 = 1 - coef1;
IncPINod(PINod1,PINod2);
Standard_Integer ip3 = myNbPINod;
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);
if (d > 0) {
Nod3NrmX = x / d;
Nod3NrmY = y / d;
Nod3NrmZ = z / d;
}
else {
Nod3NrmX = 1;
Nod3NrmY = 0;
Nod3NrmZ = 0;
#ifdef DEB
if (ERROR)
cout << "HLRAlgo_PolyInternalData::AddNode" << endl;
#endif
}
return ip3;
}
//=======================================================================
//function : UpdateLinks
//purpose :
//=======================================================================
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& )
{
Standard_Integer find,iiii,iisv,icsv,iip2 =0,cnx1 =0,cnx2 =0;
Standard_Address Seg1Indices,Seg2Indices;
Seg1Indices = 0;
find = 0;
iisv = 0;
icsv = 0;
IncPISeg(PISeg1,PISeg2);
IncPISeg(PISeg1,PISeg2);
IncPISeg(PISeg1,PISeg2);
myNbPISeg--;
myNbPISeg--;
IncTData(TData1,TData2);
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;
while (iiii != 0 && find == 0) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == ip2) {
if (Seg2LstSg2 == 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;
}
else {
iisv = iiii;
icsv = 1;
}
iiii = Seg2NxtSg1;
}
else {
if (Seg2LstSg1 == 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;
}
else {
iisv = iiii;
icsv = 2;
}
iiii = Seg2NxtSg2;
}
Seg1Indices = Seg2Indices;
}
if (find == 0) {
myNbPISeg--;
#ifdef DEB
if (ERROR) {
cout << "HLRAlgo_PolyInternalData::UpdateLinks : segment error";
cout << endl;
}
#endif
}
else {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
Seg2NxtSg1 = 0;
Seg2NxtSg2 = iip2;
Seg2LstSg1 = ip3;
Seg2LstSg2 = ip2;
Seg2Conex1 = cnx1;
Seg2Conex2 = cnx2;
Nod3NdSg = find;
Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
New[0] = cnx1;
New[2] = myNbTData + 1;
if (cnx2 == 0) {
New[1] = 0;
New[3] = 0;
}
else {
New[1] = cnx2;
New[3] = myNbTData + 2;
}
for (skip = 0; skip <= 1; skip++) {
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;
nOld[0] = n1;
nOld[1] = n2;
nOld[2] = n3;
nNew[0] = n1;
nNew[1] = n2;
nNew[2] = n3;
Standard_Boolean found = Standard_False;
if (n1 == ip1 && n2 == ip2) {
found = Standard_True;
nOld[1] = ip3;
nNew[0] = ip3;
itpk[skip] = n3;
}
else if (n1 == ip2 && n2 == ip1) {
found = Standard_True;
nOld[0] = ip3;
nNew[1] = ip3;
itpk[skip] = n3;
}
else if (n2 == ip1 && n3 == ip2) {
found = Standard_True;
nOld[2] = ip3;
nNew[1] = ip3;
itpk[skip] = n1;
}
else if (n2 == ip2 && n3 == ip1) {
found = Standard_True;
nOld[1] = ip3;
nNew[2] = ip3;
itpk[skip] = n1;
}
else if (n3 == ip1 && n1 == ip2) {
found = Standard_True;
nOld[0] = ip3;
nNew[2] = ip3;
itpk[skip] = n2;
}
else if (n3 == ip2 && n1 == ip1) {
found = Standard_True;
nOld[2] = ip3;
nNew[0] = ip3;
itpk[skip] = n2;
}
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;
myNbPISeg++;
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
Seg2LstSg1 = ip3;
Seg2LstSg2 = ip4;
Seg2NxtSg1 = Nod3NdSg;
Seg2NxtSg2 = Nod4NdSg;
Seg2Conex1 = iOld;
Seg2Conex2 = iNew;
Nod3NdSg = myNbPISeg;
Nod4NdSg = myNbPISeg;
}
#ifdef DEB
else if (ERROR) {
cout << "HLRAlgo_PolyInternalData::UpdateLinks : triangle error ";
cout << endl;
}
#endif
}
}
for (iTr = 0; iTr <= 3; iTr++) {
iNew = New [iTr];
if (iTr < 2) skip = iTr;
else skip = iTr - 2;
iOld = New [skip];
ip4 = itpk[skip];
if (iNew != 0) {
Standard_Address Tri2Indices =
((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iNew).Indices();
n1 = Tri2Node1;
n2 = Tri2Node2;
n3 = Tri2Node3;
if (!((n1 == ip3 && n2 == ip4) ||
(n2 == ip3 && n1 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n1)->Indices();
iiii = Nod1NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n1) {
if (Seg2LstSg2 == n2) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
}
else {
if (Seg2LstSg1 == n2) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
}
}
}
if (!((n2 == ip3 && n3 == ip4) ||
(n3 == ip3 && n2 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n2)->Indices();
iiii = Nod1NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n2) {
if (Seg2LstSg2 == n3) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
}
else {
if (Seg2LstSg1 == n3) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
}
}
}
if (!((n3 == ip3 && n1 == ip4) ||
(n1 == ip3 && n3 == ip4))) {
Standard_Boolean found = Standard_False;
Nod1Indices =
((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n3)->Indices();
iiii = Nod1NdSg;
while (iiii != 0 && !found) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
if (Seg2LstSg1 == n3) {
if (Seg2LstSg2 == n1) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg1;
}
else {
if (Seg2LstSg1 == n1) {
found = Standard_True;
if (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
}
else iiii = Seg2NxtSg2;
}
}
}
}
}
}
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
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();
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();
cout << "Node " << setw(6) << i << " : ";
cout << setw(6) << Nod1NdSg;
cout << setw(20)<< Nod1PntX;
cout << setw(20)<< Nod1PntY;
cout << setw(20)<< Nod1PntZ;
cout << endl;
}
for (i = 1; i <= myNbPISeg; i++) {
Seg2Indices =
((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(i).Indices();
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 << endl;
}
for (i = 1; i <= myNbTData; i++) {
Standard_Address Tri2Indices =
((HLRAlgo_Array1OfTData*)TData)->ChangeValue(i).Indices();
cout << "Triangle " << setw(6) << i << " : ";
cout << setw(6) << Tri2Node1;
cout << setw(6) << Tri2Node2;
cout << setw(6) << Tri2Node3;
cout << endl;
}
}
//=======================================================================
//function : IncTData
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncTData (Standard_Address& TData1,
Standard_Address& TData2)
{
if (myNbTData >= myMxTData) {
#ifdef DEB
if (TRACE)
cout << "HLRAlgo_PolyInternalData::IncTData : " << myMxTData << endl;
#endif
Standard_Integer i,j,k;
j = myMxTData;
k = 2 * j;
Handle(HLRAlgo_HArray1OfTData) NwTData =
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++;
}
myMxTData = k;
myTData = NwTData;
if (TData1 == TData2) {
TData1 = &nTData;
TData2 = TData1;
}
else {
TData1 = &nTData;
}
}
myNbTData++;
}
//=======================================================================
//function : IncPISeg
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncPISeg (Standard_Address& PISeg1,
Standard_Address& PISeg2)
{
if (myNbPISeg >= myMxPISeg) {
#ifdef DEB
if (TRACE)
cout << "HLRAlgo_PolyInternalData::IncPISeg : " << myMxPISeg << endl;
#endif
Standard_Integer i,j,k;
j = myMxPISeg;
k = 2 * j;
Handle(HLRAlgo_HArray1OfPISeg) NwPISeg =
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++;
}
myMxPISeg = k;
myPISeg = NwPISeg;
if (PISeg1 == PISeg2) {
PISeg1 = &nPISeg;
PISeg2 = PISeg1;
}
else {
PISeg1 = &nPISeg;
}
}
myNbPISeg++;
}
//=======================================================================
//function : IncPINod
//purpose :
//=======================================================================
void HLRAlgo_PolyInternalData::
IncPINod (Standard_Address& PINod1,
Standard_Address& PINod2)
{
if (myNbPINod >= myMxPINod) {
#ifdef DEB
if (TRACE)
cout << "HLRAlgo_PolyInternalData::IncPINod : " << myMxPINod << endl;
#endif
Standard_Integer i,j,k;
// Standard_Address Nod1Indices;
j = myMxPINod;
k = 2 * j;
Handle(HLRAlgo_HArray1OfPINod) NwPINod =
new HLRAlgo_HArray1OfPINod(0,k);
HLRAlgo_Array1OfPINod& oPINod = myPINod->ChangeArray1();
HLRAlgo_Array1OfPINod& nPINod = NwPINod->ChangeArray1();
Handle(HLRAlgo_PolyInternalNode)* ON = &(oPINod.ChangeValue(1));
Handle(HLRAlgo_PolyInternalNode)* NN = &(nPINod.ChangeValue(1));
for (i = 1; i <= j; i++) {
*NN = *ON;
ON++;
NN++;
}
myMxPINod = k;
myPINod = NwPINod;
if (PINod1 == PINod2) {
PINod1 = &nPINod;
PINod2 = PINod1;
}
else {
PINod1 = &nPINod;
}
}
myNbPINod++;
}

View File

@@ -0,0 +1,129 @@
// File: HLRAlgo_PolyInternalData.lxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfBoolean.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <TColgp_HArray1OfDir.hxx>
#include <HLRAlgo_HArray1OfTData.hxx>
#include <HLRAlgo_HArray1OfPISeg.hxx>
#include <HLRAlgo_HArray1OfPINod.hxx>
//=======================================================================
//function : DecTData
//purpose :
//=======================================================================
inline void HLRAlgo_PolyInternalData::DecTData ()
{ myNbTData--; }
//=======================================================================
//function : DecPISeg
//purpose :
//=======================================================================
inline void HLRAlgo_PolyInternalData::DecPISeg ()
{ myNbPISeg--; }
//=======================================================================
//function : DecPINod
//purpose :
//=======================================================================
inline void HLRAlgo_PolyInternalData::DecPINod ()
{ myNbPINod--; }
//=======================================================================
//function : NbTData
//purpose :
//=======================================================================
inline Standard_Integer
HLRAlgo_PolyInternalData::NbTData () const
{ return myNbTData; }
//=======================================================================
//function : NbPISeg
//purpose :
//=======================================================================
inline Standard_Integer
HLRAlgo_PolyInternalData::NbPISeg () const
{ return myNbPISeg; }
//=======================================================================
//function : NbPINod
//purpose :
//=======================================================================
inline Standard_Integer
HLRAlgo_PolyInternalData::NbPINod () const
{ return myNbPINod; }
//=======================================================================
//function : Planar
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_PolyInternalData::Planar () const
{ return myPlanar; }
//=======================================================================
//function : Planar
//purpose :
//=======================================================================
inline void
HLRAlgo_PolyInternalData::Planar (const Standard_Boolean B)
{ myPlanar = B; }
//=======================================================================
//function : IntOutL
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_PolyInternalData::IntOutL () const
{ return myIntOutL; }
//=======================================================================
//function : IntOutL
//purpose :
//=======================================================================
inline void
HLRAlgo_PolyInternalData::IntOutL (const Standard_Boolean B)
{ myIntOutL = B; }
//=======================================================================
//function : TData
//purpose :
//=======================================================================
inline HLRAlgo_Array1OfTData &
HLRAlgo_PolyInternalData::TData () const
{ return myTData->ChangeArray1(); }
//=======================================================================
//function : PINod
//purpose :
//=======================================================================
inline HLRAlgo_Array1OfPINod &
HLRAlgo_PolyInternalData::PINod () const
{ return myPINod->ChangeArray1(); }
//=======================================================================
//function : PISeg
//purpose :
//=======================================================================
inline HLRAlgo_Array1OfPISeg &
HLRAlgo_PolyInternalData::PISeg () const
{ return myPISeg->ChangeArray1(); }

View File

@@ -0,0 +1,29 @@
-- File: HLRAlgo_PolyInternalNode.cdl
-- Created: Fri Jan 10 22:23:38 1997
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class PolyInternalNode from HLRAlgo inherits TShared from MMgt
uses
Address from Standard,
Integer from Standard
is
Create returns mutable PolyInternalNode from HLRAlgo;
---C++: inline
Indices(me) returns Address from Standard
---C++: inline
is static;
RValues(me) returns Address from Standard
---C++: inline
is static;
fields
myIndices : Integer from Standard[4];
myRValues : Real from Standard[11];
end PolyInternalNode;

View File

@@ -0,0 +1,6 @@
// File: HLRAlgo_PolyInternalNode.cxx
// Created: Fri Jan 10 22:25:33 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRAlgo_PolyInternalNode.ixx>

View File

@@ -0,0 +1,34 @@
// File: HLRAlgo_PolyInternalNode.lxx
// Created: Fri Jan 10 22:25:51 1997
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
//=======================================================================
//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

@@ -0,0 +1,24 @@
-- File: HLRAlgo_PolyInternalSegment.cdl
-- Created: Tue Dec 3 17:00:57 1996
-- Author: Christophe MARION
-- <cma@partox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1996
class PolyInternalSegment from HLRAlgo
uses
Address from Standard,
Integer from Standard
is
Create returns PolyInternalSegment from HLRAlgo;
---C++: inline
Indices(me) returns Address from Standard
---C++: inline
is static;
fields
myIndices : Integer from Standard[6];
end PolyInternalSegment;

View File

@@ -0,0 +1,7 @@
// File: HLRAlgo_PolyInternalSegment.cxx
// Created: Tue Dec 3 17:23:48 1996
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
#include <HLRAlgo_PolyInternalSegment.ixx>

View File

@@ -0,0 +1,21 @@
// File: HLRAlgo_PolyInternalSegment.lxx
// Created: Tue Dec 3 17:09:42 1996
// Author: Christophe MARION
// <cma@partox.paris1.matra-dtv.fr>
//=======================================================================
//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,61 @@
-- File: HLRAlgo_PolyShellData.cdl
-- Created: Fri Oct 29 15:19:08 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class PolyShellData from HLRAlgo inherits TShared from MMgt
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
Array1OfTransient from TColStd,
HArray1OfTransient from TColStd,
ListOfBPoint from HLRAlgo
is
Create(nbFace : Integer from Standard)
returns mutable PolyShellData from HLRAlgo;
UpdateGlobalMinMax(me : mutable;
TotMinMax : Address from Standard)
is static;
UpdateHiding(me : mutable;
nbHiding : Integer from Standard)
is static;
Hiding(me) returns Boolean from Standard
---C++: inline
is static;
PolyData(me : mutable)
---C++: return &
---C++: inline
returns Array1OfTransient from TColStd
is static;
HidingPolyData(me : mutable)
---C++: return &
---C++: inline
returns Array1OfTransient from TColStd
is static;
Edges(me : mutable)
---C++: return &
---C++: inline
returns ListOfBPoint from HLRAlgo
is static;
Indices(me : mutable) returns Address from Standard
---C++: inline
is static;
fields
myMinMax : Integer from Standard[2];
myPolyg : Array1OfTransient from TColStd;
myHPolHi : HArray1OfTransient from TColStd;
mySegList : ListOfBPoint from HLRAlgo;
end PolyShellData;

View File

@@ -0,0 +1,104 @@
// File: HLRAlgo_PolyShellData.cxx
// Created: Fri May 5 15:58:19 1995
// Author: Christophe MARION
// <cma@ecolox>
#ifndef No_Exception
//#define No_Exception
#endif
#include <HLRAlgo_PolyShellData.ixx>
#include <HLRAlgo_ListIteratorOfListOfBPoint.hxx>
#include <HLRAlgo_BiPoint.hxx>
#include <HLRAlgo_PolyData.hxx>
#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 :
//=======================================================================
HLRAlgo_PolyShellData::
HLRAlgo_PolyShellData (const Standard_Integer nbFace)
: myPolyg(0,nbFace)
{}
//=======================================================================
//function : UpdateGlobalMinMax
//purpose :
//=======================================================================
void
HLRAlgo_PolyShellData::
UpdateGlobalMinMax(const Standard_Address TotMinMax)
{
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;
}
else {
if (TotXMin > PntXP2) TotXMin = PntXP2;
else if (TotXMax < PntXP1) TotXMax = PntXP1;
}
if (PntYP1 < PntYP2) {
if (TotYMin > PntYP1) TotYMin = PntYP1;
else if (TotYMax < PntYP2) TotYMax = PntYP2;
}
else {
if (TotYMin > PntYP2) TotYMin = PntYP2;
else if (TotYMax < PntYP1) TotYMax = PntYP1;
}
if (PntZP1 < PntZP2) {
if (TotZMin > PntZP1) TotZMin = PntZP1;
else if (TotZMax < PntZP2) TotZMax = PntZP2;
}
else {
if (TotZMin > PntZP2) TotZMin = PntZP2;
else if (TotZMax < PntZP1) TotZMax = PntZP1;
}
}
Standard_Integer nbFace = myPolyg.Upper();
Handle(HLRAlgo_PolyData)* pd;
if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1));
for (Standard_Integer i = 1; i <= nbFace; i++) {
(*pd)->UpdateGlobalMinMax(TotMinMax);
pd++;
}
}
//=======================================================================
//function : UpdateHiding
//purpose :
//=======================================================================
void HLRAlgo_PolyShellData::
UpdateHiding (const Standard_Integer nbHiding)
{
if (nbHiding > 0)
myHPolHi = new TColStd_HArray1OfTransient(1,nbHiding);
else myHPolHi.Nullify();
}

View File

@@ -0,0 +1,51 @@
// File: HLRAlgo_PolyShellData.lxx
// Created: Fri May 5 15:58:19 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <TColStd_HArray1OfTransient.hxx>
//=======================================================================
//function : Hiding
//purpose :
//=======================================================================
inline Standard_Boolean
HLRAlgo_PolyShellData::Hiding () const
{ return !myHPolHi.IsNull(); }
//=======================================================================
//function : PolyData
//purpose :
//=======================================================================
inline TColStd_Array1OfTransient &
HLRAlgo_PolyShellData::PolyData ()
{ return myPolyg; }
//=======================================================================
//function : HidingPolyData
//purpose :
//=======================================================================
inline TColStd_Array1OfTransient &
HLRAlgo_PolyShellData::HidingPolyData ()
{ return myHPolHi->ChangeArray1(); }
//=======================================================================
//function : Edges
//purpose :
//=======================================================================
inline HLRAlgo_ListOfBPoint &
HLRAlgo_PolyShellData::Edges ()
{ return mySegList; }
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_PolyShellData::Indices ()
{ return (Standard_Address)myMinMax; }

149
src/HLRAlgo/HLRAlgo_Projector.cdl Executable file
View File

@@ -0,0 +1,149 @@
-- File: HLRAlgo_Projector.cdl
-- Created: Thu Mar 12 13:32:28 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class Projector from HLRAlgo
---Purpose: Implements a projector object.
-- This object is designed to be used in the
-- removal of hidden lines and is returned by the
-- Prs3d_Projector::Projector function.
-- You define the projection of the selected shape
-- by calling one of the following functions:
-- - HLRBRep_Algo::Projector, or
-- - HLRBRep_PolyAlgo::Projector
-- The choice depends on the algorithm, which you are using.
-- The parameters of the view are defined at the
-- time of construction of a Prs3d_Projector object.
uses
Real from Standard,
Boolean from Standard,
Trsf from gp,
Lin from gp,
Pnt from gp,
Vec from gp,
Ax2 from gp,
Vec2d from gp,
Pnt2d from gp
raises
NoSuchObject from Standard
is
Create returns Projector from HLRAlgo;
Create(CS : Ax2 from gp)
---Purpose: Creates an axonometric projector. <CS> is the
-- viewing coordinate system.
returns Projector from HLRAlgo;
Create(CS : Ax2 from gp;
Focus : Real from Standard)
---Purpose: Creates a perspective projector. <CS> is the
-- viewing coordinate system.
returns Projector from HLRAlgo;
Create(T : Trsf from gp;
Persp : Boolean from Standard;
Focus : Real from Standard)
---Purpose: build a Projector with automatic minmax directions.
returns Projector from HLRAlgo;
Create(T : Trsf from gp;
Persp : Boolean from Standard;
Focus : Real from Standard;
v1,v2,v3 : Vec2d from gp)
---Purpose: build a Projector with given minmax directions.
returns Projector from HLRAlgo;
Set (me: in out ;
T : Trsf from gp;
Persp : Boolean from Standard;
Focus : Real from Standard)
is static;
Directions(me; D1 , D2 , D3 : out Vec2d from gp)
---C++: inline
is static;
Scaled(me : in out; On : Boolean from Standard = Standard_False)
---Purpose: to compute with the given scale and translation.
is static;
Perspective(me) returns Boolean
---Purpose: Returns True if there is a perspective transformation.
---C++: inline
is static;
Transformation(me) returns Trsf from gp
---Purpose: Returns the active transformation.
---C++: return const &
is static;
InvertedTransformation(me) returns Trsf from gp
---Purpose: Returns the active inverted transformation.
---C++: inline
---C++: return const &
is static;
FullTransformation(me) returns Trsf from gp
---Purpose: Returns the original transformation.
---C++: inline
---C++: return const &
is static;
Focus(me) returns Real from Standard
---Purpose: Returns the focal length.
---C++: inline
raises
NoSuchObject from Standard -- if there is no perspective
is static;
Transform(me; D : in out Vec from gp)
---C++: inline
is static;
Transform(me; Pnt : in out Pnt from gp)
---C++: inline
is static;
Project(me; P : Pnt from gp;
Pout : out Pnt2d from gp)
---Purpose: Transform and apply perspective if needed.
is static;
Project(me; P : Pnt from gp;
X,Y,Z : out Real from Standard)
---Purpose: Transform and apply perspective if needed.
is static;
Project(me; P : Pnt from gp;
D1 : Vec from gp;
Pout : out Pnt2d from gp;
D1out : out Vec2d from gp)
---Purpose: Transform and apply perspective if needed.
is static;
Shoot(me; X , Y : Real from Standard)
returns Lin from gp
---Purpose: return a line going through the eye towards the
-- 2d point <X,Y>.
is static;
SetDirection(me: in out)
is static private;
fields
myType : Integer from Standard;
myPersp : Boolean from Standard;
myFocus : Real from Standard;
myScaledTrsf : Trsf from gp;
myTrsf : Trsf from gp;
myInvTrsf : Trsf from gp;
myD1 : Vec2d from gp;
myD2 : Vec2d from gp;
myD3 : Vec2d from gp;
end Projector;

392
src/HLRAlgo/HLRAlgo_Projector.cxx Executable file
View File

@@ -0,0 +1,392 @@
// File: HLRAlgo_Projector.cxx
// Created: Fri Mar 13 11:08:32 1992
// Author: Christophe MARION
// <cma@sdsun2>
#ifndef No_Exception
// #define No_Exception
#endif
#include <HLRAlgo_Projector.ixx>
#include <Precision.hxx>
#include <gp_Ax3.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
// formula for derivating a perspective, from Mathematica
// X'[t] X[t] Z'[t]
// D1 = -------- + -------------
// Z[t] Z[t] 2
// 1 - ---- f (1 - ----)
// f f
//=======================================================================
//function : HLRAlgo_Projector
//purpose :
//=======================================================================
HLRAlgo_Projector::HLRAlgo_Projector () :
myPersp(Standard_False),myFocus(0)
{
Scaled();
}
//=======================================================================
//function : HLRAlgo_Projector
//purpose :
//=======================================================================
HLRAlgo_Projector::HLRAlgo_Projector (const gp_Ax2& CS) :
myPersp(Standard_False), myFocus(0)
{
myScaledTrsf.SetTransformation(CS);
Scaled();
SetDirection();
}
//=======================================================================
//function : HLRAlgo_Projector
//purpose :
//=======================================================================
HLRAlgo_Projector::HLRAlgo_Projector (const gp_Ax2& CS,
const Standard_Real Focus) :
myPersp(Standard_True), myFocus(Focus)
{
myScaledTrsf.SetTransformation(CS);
Scaled();
SetDirection();
}
//=======================================================================
//function : HLRAlgo_Projector
//purpose :
//=======================================================================
HLRAlgo_Projector::HLRAlgo_Projector (const gp_Trsf& T,
const Standard_Boolean Persp,
const Standard_Real Focus) :
myPersp(Persp),
myFocus(Focus),
myScaledTrsf(T)
{
Scaled();
SetDirection();
}
//=======================================================================
//function : HLRAlgo_Projector
//purpose :
//=======================================================================
HLRAlgo_Projector::HLRAlgo_Projector (const gp_Trsf& T,
const Standard_Boolean Persp,
const Standard_Real Focus,
const gp_Vec2d& v1,
const gp_Vec2d& v2,
const gp_Vec2d& v3) :
myPersp(Persp),
myFocus(Focus),
myScaledTrsf(T),
myD1(v1),
myD2(v2),
myD3(v3)
{
Scaled();
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRAlgo_Projector::Set (const gp_Trsf& T,
const Standard_Boolean Persp,
const Standard_Real Focus)
{
myPersp = Persp;
myFocus = Focus;
myScaledTrsf = T;
Scaled();
SetDirection();
}
//=======================================================================
//function : Scaled
//purpose :
//=======================================================================
#include <gp_Mat.hxx>
static Standard_Integer TrsfType(const gp_Trsf& Trsf) {
const gp_Mat& Mat = Trsf.VectorialPart();
if( (Abs(Mat.Value(1,1)-1.0) < 1e-15)
&& (Abs(Mat.Value(2,2)-1.0) < 1e-15)
&& (Abs(Mat.Value(3,3)-1.0) < 1e-15)) {
return(1); //-- top
}
else if( (Abs(Mat.Value(1,1)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(1,2)+0.5) < 1e-15)
&& (Abs(Mat.Value(1,3)-0.5) < 1e-15)
&& (Abs(Mat.Value(2,1)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(2,2)-0.5) < 1e-15)
&& (Abs(Mat.Value(2,3)+0.5) < 1e-15)
&& (Abs(Mat.Value(3,1)) < 1e-15)
&& (Abs(Mat.Value(3,2)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(3,3)-0.7071067811865476) < 1e-15)) {
return(0); //--
}
else if( (Abs(Mat.Value(1,1)-1.0) < 1e-15)
&& (Abs(Mat.Value(2,3)-1.0) < 1e-15)
&& (Abs(Mat.Value(3,2)+1.0) < 1e-15)) {
return(2); //-- front
}
else if( (Abs(Mat.Value(1,1)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(1,2)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(1,3)) < 1e-15)
&& (Abs(Mat.Value(2,1)+0.5) < 1e-15)
&& (Abs(Mat.Value(2,2)-0.5) < 1e-15)
&& (Abs(Mat.Value(2,3)-0.7071067811865476) < 1e-15)
&& (Abs(Mat.Value(3,1)-0.5) < 1e-15)
&& (Abs(Mat.Value(3,2)+0.5) < 1e-15)
&& (Abs(Mat.Value(3,3)-0.7071067811865476) < 1e-15)) {
return(3); //-- axo
}
return(-1);
}
void HLRAlgo_Projector::Scaled (const Standard_Boolean On)
{
myType=-1;
myTrsf = myScaledTrsf;
if (!On) {
myTrsf.SetScaleFactor(1.);
if (!myPersp) {
myTrsf.SetTranslationPart(gp_Vec(0.,0.,0.));
myType=TrsfType(myTrsf);
}
}
myInvTrsf = myTrsf;
myInvTrsf.Invert();
}
//=======================================================================
//function : Project
//purpose :
//=======================================================================
void HLRAlgo_Projector::Project (const gp_Pnt& P, gp_Pnt2d& Pout) const
{
if(myType!=-1) {
Standard_Real X,Y;
switch (myType) {
case 0: { //-- axono standard
Standard_Real x07 = P.X()*0.7071067811865475;
Standard_Real y05 = P.Y()*0.5;
Standard_Real z05 = P.Z()*0.5;
X=x07-y05+z05;
Y=x07+y05-z05;
//-- Z=0.7071067811865475*(P.Y()+P.Z());
break;
}
case 1: { //-- top
X=P.X(); Y=P.Y(); //-- Z=P.Z();
Pout.SetCoord(X,Y);
break;
}
case 2: {
X=P.X(); Y=P.Z(); //-- Z=-P.Y();
Pout.SetCoord(X,Y);
break;
}
case 3: {
Standard_Real xmy05 = (P.X()-P.Y())*0.5;
Standard_Real z07 = P.Z()*0.7071067811865476;
X=0.7071067811865476*(P.X()+P.Y());
Y=-xmy05+z07;
Pout.SetCoord(X,Y);
//-- Z= xmy05+z07;
break;
}
default: {
gp_Pnt P2 = P;
Transform(P2);
if (myPersp) {
Standard_Real R = 1.-P2.Z()/myFocus;
Pout.SetCoord(P2.X()/R,P2.Y()/R);
}
else
Pout.SetCoord(P2.X(),P2.Y());
break;
}
}
}
else {
gp_Pnt P2 = P;
Transform(P2);
if (myPersp) {
Standard_Real R = 1.-P2.Z()/myFocus;
Pout.SetCoord(P2.X()/R,P2.Y()/R);
}
else
Pout.SetCoord(P2.X(),P2.Y());
}
}
//=======================================================================
//function : Project
//purpose :
//=======================================================================
/* ====== TYPE 0 (??)
(0.7071067811865476, -0.5 , 0.4999999999999999)
(0.7071067811865475, 0.5000000000000001, -0.5 )
(0.0, 0.7071067811865475, 0.7071067811865476)
====== TYPE 1 (top)
(1.0, 0.0, 0.0)
(0.0, 1.0, 0.0)
(0.0, 0.0, 1.0)
======= TYPE 2 (front)
(1.0, 0.0 , 0.0)
(0.0, 1.110223024625157e-16 , 1.0)
(0.0, -1.0 , 1.110223024625157e-16)
======= TYPE 3
( 0.7071067811865476, 0.7071067811865475, 0.0)
(-0.5 , 0.5000000000000001, 0.7071067811865475)
( 0.4999999999999999, -0.5 , 0.7071067811865476)
*/
void HLRAlgo_Projector::Project (const gp_Pnt& P,
Standard_Real& X,
Standard_Real& Y,
Standard_Real& Z) const
{
if(myType!=-1) {
switch (myType) {
case 0: { //-- axono standard
Standard_Real x07 = P.X()*0.7071067811865475;
Standard_Real y05 = P.Y()*0.5;
Standard_Real z05 = P.Z()*0.5;
X=x07-y05+z05;
Y=x07+y05-z05;
Z=0.7071067811865475*(P.Y()+P.Z());
break;
}
case 1: { //-- top
X=P.X(); Y=P.Y(); Z=P.Z();
break;
}
case 2: {
X=P.X(); Y=P.Z(); Z=-P.Y();
break;
}
case 3: {
Standard_Real xmy05 = (P.X()-P.Y())*0.5;
Standard_Real z07 = P.Z()*0.7071067811865476;
X=0.7071067811865476*(P.X()+P.Y());
Y=-xmy05+z07;
Z= xmy05+z07;
break;
}
default: {
gp_Pnt P2 = P;
Transform(P2);
P2.Coord(X,Y,Z);
break;
}
}
}
else {
gp_Pnt P2 = P;
Transform(P2);
P2.Coord(X,Y,Z);
if (myPersp) {
Standard_Real R = 1 - Z / myFocus;
X = X / R;
Y = Y / R;
}
}
}
//=======================================================================
//function : Project
//purpose :
//=======================================================================
void HLRAlgo_Projector::Project (const gp_Pnt& P,
const gp_Vec& D1,
gp_Pnt2d& Pout,
gp_Vec2d& D1out) const
{
gp_Pnt PP = P;
PP.Transform(myTrsf);
gp_Vec DD1 = D1;
DD1.Transform(myTrsf);
if (myPersp) {
Standard_Real R = 1. - PP.Z() / myFocus;
Pout .SetCoord(PP .X()/R , PP.Y()/R);
D1out.SetCoord(DD1.X()/R + PP.X()*DD1.Z()/(myFocus * R*R),
DD1.Y()/R + PP.Y()*DD1.Z()/(myFocus * R*R));
}
else {
Pout .SetCoord(PP .X(),PP .Y());
D1out.SetCoord(DD1.X(),DD1.Y());
}
}
//=======================================================================
//function : Shoot
//purpose :
//=======================================================================
gp_Lin HLRAlgo_Projector::Shoot (const Standard_Real X,
const Standard_Real Y) const
{
gp_Lin L;
if (myPersp) {
L = gp_Lin(gp_Pnt(0,0, myFocus),
gp_Dir(X,Y,-myFocus));
}
else {
L = gp_Lin(gp_Pnt(X,Y,0),
gp_Dir(0,0,-1));
}
L.Transform(myInvTrsf);
return L;
}
//=======================================================================
//function : SetDirection
//purpose :
//=======================================================================
void HLRAlgo_Projector::SetDirection ()
{
gp_Vec V1(1,0,0);
V1.Transform(myTrsf);
if ((Abs(V1.X()) + Abs(V1.Y())) < Precision::Angular()) V1.SetCoord(1,1,0);
gp_Vec2d D1(V1.X(),V1.Y());
myD1.SetCoord(-D1.Y(),D1.X());
gp_Vec V2(0,1,0);
V2.Transform(myTrsf);
if ((Abs(V2.X()) + Abs(V2.Y())) < Precision::Angular()) V2.SetCoord(1,1,0);
gp_Vec2d D2(V2.X(),V2.Y());
myD2.SetCoord(-D2.Y(),D2.X());
gp_Vec V3(0,0,1);
V3.Transform(myTrsf);
if ((Abs(V3.X()) + Abs(V3.Y())) < Precision::Angular()) V3.SetCoord(1,1,0);
gp_Vec2d D3(V3.X(),V3.Y());
myD3.SetCoord(-D3.Y(),D3.X());
}
//=======================================================================
//function : Transformation
//purpose :
//=======================================================================
const gp_Trsf & HLRAlgo_Projector::Transformation() const
{ return myTrsf; }

View File

@@ -0,0 +1,84 @@
// File: HLRAlgo_Projector.lxx
// Created: Thu Jul 9 12:50:25 1992
// Author: Christophe MARION
// <cma@sdsun1>
#include <Standard_NoSuchObject.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
//=======================================================================
//function : Directions
//purpose :
//=======================================================================
inline void
HLRAlgo_Projector::Directions (gp_Vec2d& D1,
gp_Vec2d& D2,
gp_Vec2d& D3) const
{
D1 = myD1;
D2 = myD2;
D3 = myD3;
}
//=======================================================================
//function : Perspective
//purpose :
//=======================================================================
inline Standard_Boolean HLRAlgo_Projector::Perspective() const
{ return myPersp; }
/*
//=======================================================================
//function : Transformation
//purpose :
//=======================================================================
inline const gp_Trsf & HLRAlgo_Projector::Transformation() const
{ return myTrsf; }
*/
//=======================================================================
//function : InvertedTransformation
//purpose :
//=======================================================================
inline const gp_Trsf & HLRAlgo_Projector::InvertedTransformation() const
{ return myInvTrsf; }
//=======================================================================
//function : FullTransformation
//purpose :
//=======================================================================
inline const gp_Trsf & HLRAlgo_Projector::FullTransformation() const
{ return myScaledTrsf; }
//=======================================================================
//function : Focus
//purpose :
//=======================================================================
inline Standard_Real HLRAlgo_Projector::Focus() const
{
Standard_NoSuchObject_Raise_if
(!myPersp,"HLRAlgo_Projector::Not a Perspective");
return myFocus;
}
//=======================================================================
//function : Transform
//purpose :
//=======================================================================
inline void HLRAlgo_Projector::Transform (gp_Vec& D) const
{ D.Transform(myTrsf); }
//=======================================================================
//function : Transform
//purpose :
//=======================================================================
inline void HLRAlgo_Projector::Transform (gp_Pnt& Pnt) const
{ Pnt.Transform(myTrsf); }

View File

@@ -0,0 +1,25 @@
-- File: HLRAlgo_TriangleData.cdl
-- Created: Fri Oct 29 15:19:08 1993
-- Author: Christophe MARION
-- <cma@nonox>
---Copyright: Matra Datavision 1993
class TriangleData from HLRAlgo
uses
Address from Standard,
Integer from Standard,
Boolean from Standard
is
Create returns TriangleData from HLRAlgo;
---C++: inline
Indices(me) returns Address from Standard
---C++: inline
is static;
fields
myIndices : Integer from Standard[4];
end TriangleData;

View File

@@ -0,0 +1,7 @@
// File: HLRAlgo_TriangleData.cxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
#include <HLRAlgo_TriangleData.ixx>

View File

@@ -0,0 +1,21 @@
// File: HLRAlgo_TriangleData.lxx
// Created: Mon Jan 11 13:58:26 1993
// Author: Christophe MARION
// <cma@sdsun1>
//=======================================================================
//function : TriangleData
//purpose :
//=======================================================================
inline HLRAlgo_TriangleData::HLRAlgo_TriangleData ()
{}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_TriangleData::Indices () const
{ return (Standard_Address)myIndices; }

View File

@@ -0,0 +1,51 @@
-- File: HLRAlgo_WiresBlock.cdl
-- Created: Mon Apr 6 17:56:12 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class WiresBlock from HLRAlgo inherits TShared from MMgt
---Purpose: A WiresBlock is a set of Blocks. It is used by the
-- DataStructure to structure the Edges.
--
-- A WiresBlock contains :
--
-- * An Array of Blocks.
uses
Address from Standard,
Boolean from Standard,
Integer from Standard,
EdgesBlock from HLRAlgo,
Array1OfTransient from TColStd
is
Create(NbWires : Integer from Standard)
---Purpose: Create a Block of Blocks.
returns mutable WiresBlock from HLRAlgo;
NbWires(me) returns Integer from Standard
is static;
Set(me : mutable; I : Integer from Standard;
W : EdgesBlock from HLRAlgo)
is static;
Wire(me : mutable; I : Integer from Standard)
returns any EdgesBlock from HLRAlgo
---C++: return &
is static;
UpdateMinMax(me : mutable; TotMinMax : Address from Standard)
is static;
MinMax(me) returns Address from Standard
---C++: inline
is static;
fields
myWires : Array1OfTransient from TColStd;
myMinMax : Integer from Standard[16];
end WiresBlock;

View File

@@ -0,0 +1,55 @@
// File: HLRAlgo_WiresBlock.cxx
// Created: Fri Mar 27 17:08:48 1992
// Author: Christophe MARION
// <cma@sdsun2>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_WiresBlock.ixx>
//=======================================================================
//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

@@ -0,0 +1,13 @@
// File: HLRAlgo_WiresBlock.lxx
// Created: Tue Sep 5 15:11:36 1995
// Author: Christophe MARION
// <cma@ecolox>
//=======================================================================
//function : MinMax
//purpose :
//=======================================================================
inline Standard_Address HLRAlgo_WiresBlock::MinMax () const
{ return (Standard_Address)&myMinMax; }