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

Compare commits

...

30 Commits

Author SHA1 Message Date
bugmaster
1e0440a227 Update version 2013-03-04 11:43:08 +04:00
bugmaster
530f0e97c7 Update OCCT Version up to 6.5.5 2013-02-25 14:18:07 +04:00
nbv
f14977a23c 0023703: Projection algorithm produces incomplete 2D-Curve
Change compare algorithm.
Adding test case for this fix

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:23:58 +04:00
skv
02cf3438e4 0023733: PCurve for edge on face creation failure Adding test case for this fix
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:22:44 +04:00
skv
3436ee9aed 0023705: merge of ViewerTest.cxx 2013-02-22 17:21:39 +04:00
skv
20c76d1afc 0023705: Isoline in the AIS viewer is not trimmed
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:18:21 +04:00
pkv
1f63e9254a 0023738: Boolean Fuse between two faces fails
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:06:06 +04:00
gka
dc9f4206bc 0023587: Operation "2dintersect "in TestHarness can not find intersection point of two intersecting 2d curves.
Modified DRAW command "2dintersect" added optional parameter "tolerance for intersection".
Test case for bug 0023587 : Check intersections of four 2d curves
Adding test cases for this fix
Deleting temporary test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:04:36 +04:00
nbv
c0716da1cd 0023535: Exception in BSplCLib::BuildCache()
Preliminary result. It was tested with spl_2.brep file only.
Add "const"
Adding test cases for this fix

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:03:38 +04:00
epa
cbadf17e88 0023473: Top face of imported STEP part is missing
Fix for constraints for case of complex internal wires
Test case for this bug

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:02:32 +04:00
apn
c48181024e 0022835: IncrementalMesh generates FLT exceptions when running in parallel mode
Adding test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:01:21 +04:00
gka
115a805d6b 0023475: Wrong result of Geom_BSpline_Surface::IsVClosed()
Modifications:
Definition closure surface by U and V by distance between isolines on bounds
Comparison to isolines on identity
Implementation of short dump of surface and curves
Change order of comparison

Fix and test script for bug 0023475
Modification of script to restore surface
Modification for correction regression ( UIso and VIso were confused)
Modified test case and test surface for bug 0023475

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 17:00:07 +04:00
pkv
16a60931d2 0023711: Incorrect result done by fuse operation
Correction of misprint
Adding of test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 15:29:56 +04:00
pkv
e8e63d2a8a 0023732: Exception raised during intersection between two surfaces
Adding of test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 15:24:06 +04:00
pkv
1f52722413 0023716: Boolean Fuse between two faces fails
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 15:18:11 +04:00
pkv
ecd118ebee 0023699: Exception reaised during intersection between two surfaces
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 15:12:52 +04:00
pkv
e7f8ad3c53 0023704: The program hang-up during intersection of two edges.
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 14:53:21 +04:00
pkv
a118a47f7f 0023644: Intersection between coaxial cones produces exception
Small correction: one more tolerance variable has been added.
Test case for this fix
Small correction of test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 14:44:48 +04:00
nbv
9e23727c5b 0023530: Error in Draw command "checkshape": invalid face is not recognized
Add function for determinate closure in 2D and 3D
Change ChoixUV(...) function
Small correction of test case

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 14:16:34 +04:00
apn
e26586550e Adjusting testing cases for current state of OCCT
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 13:25:44 +04:00
abv
8f8fa97696 0023604: Uninitialized variables in debug mode
Removed #ifndef DEB ... #else ... #endif directives where the variables were being initialized only in release mode.
Removed unused part of code.

Signed-off-by: skv <skv@opencascade.com>
2013-02-22 12:14:07 +04:00
pkv
fd462ec24b 0023552: Projection algorithm produces wrong results with default tolerance value. Add TKShHealing to TKFillet/EXTERNLIB Adding test case
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 11:25:25 +04:00
apn
ef26c326ee Adjusting testing cases for current state of OCCT
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 10:59:39 +04:00
pkv
d6af166ca5 0023676: Intersection between edge and a face produces extra vertex
Signed-off-by: skv <skv@opencascade.com>
2013-02-22 10:17:58 +04:00
pkv
20214c3c5d 0023576: Intersection algorithm produces trimmed circle with illegal parametric range.
Signed-off-by: skv <skv@opencascade.com>
2013-02-21 17:05:13 +04:00
pkv
aeb253b168 0023603: Boolean operation between two edges fails
Signed-off-by: skv <skv@opencascade.com>
2013-02-21 16:54:22 +04:00
skv
63e683cd44 0023606: Invalid result of pipe operation
Signed-off-by: skv <skv@opencascade.com>
2013-02-21 14:00:27 +04:00
pkv
ba3f6e3669 0023643: Intersection algorithm produces B-Spline curve in case of coaxial cones
Signed-off-by: skv <skv@opencascade.com>
2013-02-21 13:30:07 +04:00
vsr
53fdf42576 0023567: Wrong STEP unit is returned by STEPControl_Reader.FileUnits() function
Fix bug with using of uninitialized variable.
New version of patch: pass unit object to the getSiName() function directly.
Test case for this bug

Signed-off-by: skv <skv@opencascade.com>
2013-02-21 13:14:55 +04:00
pkv
e40c7b930d 0023548: Boolean operation between two faces fails
Signed-off-by: skv <skv@opencascade.com>
2013-02-21 11:39:21 +04:00
104 changed files with 4523 additions and 2880 deletions

View File

@@ -36,6 +36,7 @@ uses
IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd,
DataMapOfShapeInteger from TopTools,
Shape from TopoDS,
Solid from TopoDS,
State from TopAbs,
ListOfShape from TopTools
@@ -102,6 +103,12 @@ is
theBaseFaceIndex: Integer from Standard)
returns Boolean from Standard
is private;
--fields
PrepareReferences(me:out)
is protected;
fields
myRefObject: Solid from TopoDS is protected;
myRefTool : Solid from TopoDS is protected;
end SolidSolid;

View File

@@ -153,19 +153,20 @@ static Standard_Boolean LocalIsKeepTwice(const TopoDS_Face& aF1,
try {
OCC_CATCH_SIGNALS
// modified by NIZHNY-MKK Fri Sep 3 15:14:17 2004.BEGIN
if(!myDSFiller->IsDone()) {
myErrorStatus = 1;
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
return;
}
// modified by NIZHNY-MKK Fri Sep 3 15:14:20 2004.END
//
PrepareReferences();
//
Standard_Boolean bIsNewFiller;
bIsNewFiller=aDSFiller.IsNewFiller();
if (bIsNewFiller) {
Prepare();
PrepareFaceSplits();
aDSFiller.SetNewFiller(!bIsNewFiller);
@@ -199,7 +200,43 @@ static Standard_Boolean LocalIsKeepTwice(const TopoDS_Face& aF1,
BOPTColStd_Dump::PrintMessage("Can not build result\n");
}
}
//=================================================================================
// function: PrepareReferences
// purpose:
//=================================================================================
void BOP_SolidSolid::PrepareReferences()
{
Standard_Integer i;
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
//
for (i=0; i<2; ++i) {
const TopoDS_Shape& aS=(!i)? aDS.Object() : aDS.Tool();
//
TopoDS_Solid aRefSolid;
//
if(aS.ShapeType() == TopAbs_SOLID) {
aRefSolid = TopoDS::Solid(aS);
}
else {
BRep_Builder aBB;
TopExp_Explorer aExp;
//
aBB.MakeSolid(aRefSolid);
//
aExp.Init(aS, TopAbs_SHELL);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aShell = aExp.Current();
aBB.Add(aRefSolid, aShell);
}
}
if(!i) {
myRefObject=aRefSolid;
}
else {
myRefTool=aRefSolid;
}
}
}
//=================================================================================
// function: BuildResult
// purpose:
@@ -391,7 +428,6 @@ static Standard_Boolean LocalIsKeepTwice(const TopoDS_Face& aF1,
}
}
// modified by NIZHNY-MKK Tue Sep 16 11:11:22 2003.BEGIN
Standard_Boolean bIsCommonalgo = CheckFaceIntersection(nF1, myDSFiller);
BOP_WireEdgeSet atmpWES (myFace);
BOP_WireEdgeSet atmpWESAvoid (myFace);
@@ -726,7 +762,6 @@ static Standard_Boolean LocalIsKeepTwice(const TopoDS_Face& aF1,
}
//end for (; aWES2.MoreStartElements...
}
// modified by NIZHNY-MKK Tue Sep 16 11:11:33 2003.END
//
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@@ -23,6 +23,20 @@
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <gp_Dir.hxx>
#include <gp_Vec.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom_Surface.hxx>
#include <Geom2dHatch_Intersector.hxx>
#include <Geom2dHatch_Hatcher.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <HatchGen_Domain.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
@@ -33,11 +47,23 @@
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
//
#include <TopExp_Explorer.hxx>
#include <BRepTools.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
@@ -48,22 +74,12 @@
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BOPTools_Tools3D.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_StateFiller.hxx>
#include <BOP_BuilderTools.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <BOPTools_StateFiller.hxx>
#include <gp_Dir.hxx>
#include <BRep_Builder.hxx>
static
Standard_Integer GetIndex(const TopoDS_Shape& theShape,
const BooleanOperations_ShapesDataStructure& theDS);
@@ -83,11 +99,12 @@ void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck
Standard_Boolean& bFoundOUTOUT);
static
Standard_Boolean ComputeStateForAnalyticalSurfaces(const Standard_Integer theFaceIndex,
const Standard_Integer theBaseFaceIndex,
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
const BOPTools_DSFiller& theDSFiller,
TopAbs_State& theState);
Standard_Boolean ComputeStateForAnalyticalSurfaces
(const Standard_Integer theFaceIndex,
const Standard_Integer theBaseFaceIndex,
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
const BOPTools_DSFiller& theDSFiller,
TopAbs_State& theState);
static
Standard_Boolean IsEdgeValidForFace(const Standard_Integer theEdgeIndex,
@@ -95,6 +112,28 @@ Standard_Boolean IsEdgeValidForFace(const Standard_Integer theEdgeIndex,
BOPTools_SSInterference& theFF,
const BOPTools_DSFiller& theDSFiller);
static
TopAbs_State ComputeState(const TopoDS_Face& theF,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
const Handle(IntTools_Context)& theCtx);
static
Standard_Integer PntInFace(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D);
static
Standard_Integer PntHoverFace(const TopoDS_Face& aF,
gp_Pnt& theP);
static
TopAbs_State ComputeState(const gp_Pnt& theP,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
const Handle(IntTools_Context)& theCtx);
//=================================================================================
// function: PrepareFaceSplits
// purpose:
@@ -263,15 +302,16 @@ Standard_Boolean BOP_SolidSolid::PropagateFaceStateByEdges(const TopoDS_Shape& t
return Standard_True;
}
// =====================================================================================================================
// function: ComputeStateByInsidePoints
// purpose:
// =====================================================================================================================
Standard_Boolean BOP_SolidSolid::ComputeStateByInsidePoints(const Standard_Integer theFaceIndex,
const Standard_Integer theBaseFaceIndex,
const Standard_Integer theFaceRank,
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
TopAbs_State& theState)
//=======================================================================
//function : ComputeStateByInsidePoints
//purpose :
//=======================================================================
Standard_Boolean BOP_SolidSolid::
ComputeStateByInsidePoints(const Standard_Integer theFaceIndex,
const Standard_Integer theBaseFaceIndex,
const Standard_Integer theFaceRank,
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
TopAbs_State& theState)
{
TopAbs_State aState = TopAbs_ON;
@@ -344,11 +384,10 @@ Standard_Boolean BOP_SolidSolid::ComputeStateByInsidePoints(const Standard_Integ
return Standard_True;
}
// =====================================================================================================================
// function: TakeOnSplit
// purpose:
// =====================================================================================================================
//=======================================================================
//function : TakeOnSplit
//purpose :
//=======================================================================
Standard_Boolean BOP_SolidSolid::TakeOnSplit(const Standard_Integer theFaceIndex,
const Standard_Integer theBaseFaceIndex) const
{
@@ -361,13 +400,59 @@ Standard_Boolean BOP_SolidSolid::TakeOnSplit(const Standard_Integer theFaceIndex
TColStd_MapOfInteger aMapOfUsedIndices;
TColStd_ListOfInteger aListOfFacesToCheck;
aListOfFacesToCheck.Append(theFaceIndex);
GetStatesOfAdjacentFaces(aListOfFacesToCheck, *myDSFiller, aMapOfUsedIndices, binout, binin, boutout);
//DEB
Handle(IntTools_Context) aCtx;
TopAbs_Orientation aOrF1;
TopoDS_Face aF1, aFSp;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const BOPTools_PaveFiller& aPF =myDSFiller->PaveFiller();
BOPTools_PaveFiller* pPF = (BOPTools_PaveFiller*)&aPF;
aCtx=pPF->Context();
//
aF1=TopoDS::Face(aDS.Shape(theBaseFaceIndex));
aOrF1=aF1.Orientation();
aFSp=TopoDS::Face(aDS.Shape(theFaceIndex));
aFSp.Orientation(aOrF1);
//
GetStatesOfAdjacentFaces(aListOfFacesToCheck,
*myDSFiller,
aMapOfUsedIndices,
binout, binin, boutout);
//zzf
if (!binout && !binin && !boutout) {
Standard_Real aTol;
TopAbs_State aState;
//
aTol=1.e-5;
aState=ComputeState(aFSp, myRefTool, aTol, aCtx);
//
if (aState==TopAbs_IN) {
if (myOperation==BOP_FUSE || myOperation==BOP_COMMON) {
bTake=Standard_False;
}
else {
bTake=Standard_True;
}
}
//
else if (aState==TopAbs_OUT) {
if (myOperation==BOP_FUSE || myOperation==BOP_COMMON) {
bTake=Standard_True;
}
else {
bTake=Standard_False;
}
}
//
return bTake;
}//if (!binout && !binin && !boutout) {
//zzt
switch(myOperation) {
case BOP_FUSE: {
if(binout || (!binin && !boutout)) {
bTake = Standard_True;
bTake = Standard_True;
}
break;
}
@@ -477,11 +562,10 @@ void GetAttachedFaces(const Standard_Integer theEdgeIndex,
}
}
}
// ------------------------------------------------------------------------------------
// static function: GetStatesOfAdjacentFaces
// purpose:
// ------------------------------------------------------------------------------------
//=======================================================================
//function : GetStatesOfAdjacentFaces
//purpose :
//=======================================================================
void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck,
const BOPTools_DSFiller& theDSFiller,
TColStd_MapOfInteger& theMapOfUsedIndices,
@@ -489,33 +573,38 @@ void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck
Standard_Boolean& bFoundININ,
Standard_Boolean& bFoundOUTOUT)
{
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
TColStd_ListOfInteger aLisOfON;
Standard_Integer nE, nF, nFa;
BooleanOperations_StateOfShape aStFa;
//
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
//
TColStd_ListIteratorOfListOfInteger anItF(theListOfFacesToCheck);
for(; anItF.More(); anItF.Next()) {
Standard_Integer nF = anItF.Value();
nF = anItF.Value();
const TopoDS_Shape& aF=aDS.Shape(nF);
if(theMapOfUsedIndices.Contains(nF)) {
continue;
}
//
theMapOfUsedIndices.Add(nF);
TopoDS_Shape aFace = aDS.Shape(nF);
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
for(; anExpE.More(); anExpE.Next()) {
const TopoDS_Shape& anEdge = anExpE.Current();
Standard_Integer nE = 0;
nE = GetIndex(anEdge, aDS);
if(nE <= 0)
if(nE <= 0) {
continue;
if(theMapOfUsedIndices.Contains(nE))
}
if(theMapOfUsedIndices.Contains(nE)) {
continue;
}
//
theMapOfUsedIndices.Add(nE);
TColStd_ListOfInteger aListOfFaces, aListOfIN, aListOfOUT;
GetAttachedFaces(nE, nF, theDSFiller, aListOfFaces);
@@ -523,18 +612,23 @@ void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck
TColStd_ListIteratorOfListOfInteger anIt(aListOfFaces);
for(; anIt.More(); anIt.Next()) {
if(theMapOfUsedIndices.Contains(anIt.Value()))
continue;
// if((aDS.GetState(anIt.Value()) != BooleanOperations_IN) &&
// (aDS.GetState(anIt.Value()) != BooleanOperations_OUT))
if(aDS.GetState(anIt.Value()) == BooleanOperations_ON)
aLisOfON.Append(anIt.Value());
if(aDS.GetState(anIt.Value()) == BooleanOperations_IN)
aListOfIN.Append(anIt.Value());
else if(aDS.GetState(anIt.Value()) == BooleanOperations_OUT)
aListOfOUT.Append(anIt.Value());
nFa=anIt.Value();
aStFa=aDS.GetState(nFa);
//
const TopoDS_Shape& aFa=aDS.Shape(nFa);
if(theMapOfUsedIndices.Contains(nFa)) {
continue;
}
//
if(aStFa==BooleanOperations_ON) {
aLisOfON.Append(nFa);
}
if(aStFa==BooleanOperations_IN) {
aListOfIN.Append(nFa);
}
else if(aStFa==BooleanOperations_OUT) {
aListOfOUT.Append(nFa);
}
}
bFoundINOUT = bFoundINOUT || (!aListOfIN.IsEmpty() && !aListOfOUT.IsEmpty());
bFoundININ = bFoundININ || (!aListOfIN.IsEmpty() && aListOfOUT.IsEmpty());
@@ -707,7 +801,193 @@ Standard_Boolean IsEdgeValidForFace(const Standard_Integer theEdgeIndex,
}
}
}
return Standard_False;
}
//=======================================================================
// function: ComputeState
// purpose:
//=======================================================================
TopAbs_State ComputeState(const TopoDS_Face& theF,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
const Handle(IntTools_Context)& theCtx)
{
Standard_Integer iErr;
TopAbs_State aRet;
gp_Pnt aP;
//
aRet=TopAbs_UNKNOWN;
//
iErr=PntHoverFace(theF, aP);
if (iErr) {
return aRet;
}
//
aRet=ComputeState(aP, theRef, theTol, theCtx);
return aRet;
}
//=======================================================================
// function: ComputeState
// purpose:
//=======================================================================
TopAbs_State ComputeState(const gp_Pnt& theP,
const TopoDS_Solid& theRef,
const Standard_Real theTol,
const Handle(IntTools_Context)& theCtx)
{
TopAbs_State aState;
//
BRepClass3d_SolidClassifier& aSC=theCtx->SolidClassifier(theRef);
aSC.Perform(theP, theTol);
//
aState=aSC.State();
//
return aState;
}
//=======================================================================
//function : PntHoverFace
//purpose :
//=======================================================================
Standard_Integer PntHoverFace(const TopoDS_Face& aF,
gp_Pnt& theP)
{
Standard_Integer iErr;
Standard_Real aU, aV, aX;
gp_Pnt aP;
gp_Vec aDN;
gp_Pnt2d aP2D;
//
iErr=PntInFace(aF, aP, aP2D);
if (iErr) {
return iErr;
}
//
aX=1e-4;
//
aP2D.Coord(aU, aV);
BOPTools_Tools2D::FaceNormal(aF, aU, aV, aDN);
//
theP.SetXYZ(aP.XYZ()+aX*aDN.XYZ());
//
return iErr;
}
//=======================================================================
//function : PntInFace
//purpose :
//=======================================================================
Standard_Integer PntInFace(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains, i;
Standard_Real aUMin, aUMax, aVMin, aVMax;
Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
gp_Dir2d aD2D (0., 1.);
gp_Pnt2d aP2D;
gp_Pnt aPx;
Handle(Geom2d_Curve) aC2D;
Handle(Geom2d_TrimmedCurve) aCT2D;
Handle(Geom2d_Line) aL2D;
Handle(Geom_Surface) aS;
TopAbs_Orientation aOrE;
TopoDS_Face aFF;
TopExp_Explorer aExp;
//
aTolHatch2D=1.e-8;
aTolHatch3D=1.e-8;
aTolArcIntr=1.e-10;
aTolTangfIntr=1.e-10;
//
Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
Geom2dHatch_Hatcher aHatcher(aIntr,
aTolHatch2D, aTolHatch3D,
Standard_True, Standard_False);
//
iErr=0;
aEpsT=1.e-12;
//
aFF=aF;
aFF.Orientation (TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFF);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
// 1
aExp.Init (aFF, TopAbs_EDGE);
for (; aExp.More() ; aExp.Next()) {
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
aOrE=aE.Orientation();
//
aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
if (aC2D.IsNull() ) {
iErr=1;
return iErr;
}
if (fabs(aU1-aU2) < aEpsT) {
iErr=2;
return iErr;
}
//
aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
aHatcher.AddElement(aCT2D, aOrE);
}// for (; aExp.More() ; aExp.Next()) {
//
// 2
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
aP2D.SetCoord(aUx, 0.);
aL2D=new Geom2d_Line (aP2D, aD2D);
Geom2dAdaptor_Curve aHCur(aL2D);
//
aIx=aHatcher.AddHatching(aHCur) ;
//
// 3.
aHatcher.Trim();
bIsDone=aHatcher.TrimDone(aIx);
if (!bIsDone) {
iErr=3;
return iErr;
}
//
aHatcher.ComputeDomains(aIx);
bIsDone=aHatcher.IsDone(aIx);
if (!bIsDone) {
iErr=4;
return iErr;
}
//
// 4.
aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) {
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) {
iErr=5;
return iErr;
}
//
aV1=aDomain.FirstPoint().Parameter();
//
bHasSecondPoint=aDomain.HasSecondPoint();
if (!bHasSecondPoint) {
iErr=6;
return iErr;
}
//
aV2=aDomain.SecondPoint().Parameter();
//
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
//
break;
}
//
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);
theP=aPx;
//
return iErr;
}

View File

@@ -369,71 +369,190 @@ BRepCheck_Status BRepCheck_Wire::Closed(const Standard_Boolean Update)
}
return myCstat;
}
//=======================================================================
//function : IsDistanceIn3DTolerance
//purpose : Return Standard_True if distance between thePnt_f and
// thePnt_l is not more, than aTol3d
//=======================================================================
Standard_Boolean IsDistanceIn3DTolerance (const BRepAdaptor_Surface& aFaceSurface,
const gp_Pnt& thePnt_f,
const gp_Pnt& thePnt_l,
const Standard_Real aTol3d)
{
Standard_Real Dist = thePnt_f.Distance(thePnt_l);
if (Dist < aTol3d)
return Standard_True;
#ifdef DEB
cout << endl;
cout << "--------Function IsDistanceIn3DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Closed3d -> Error" << endl;
cout << "--- Dist (" << Dist << ") > Tol3d (" << aTol3d << ")" << endl;
cout << "Pnt1(" << thePnt_f.X() << "; " << thePnt_f.Y() << "; " << thePnt_f.Z() << ")" << endl;
cout << "Pnt2(" << thePnt_l.X() << "; " << thePnt_l.Y() << "; " << thePnt_l.Z() << ")" << endl;
cout << "------------------------------------------------------" << endl;
#endif
return Standard_False;
}
//=======================================================================
//function : IsDistanceIn3DTolerance
//purpose :
//=======================================================================
Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurface,
const gp_Pnt2d& thePnt,
const gp_Pnt2d& thePntRef,
const Standard_Real aTol3d,
const Standard_Boolean PrintWarnings = Standard_True)
{
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
Standard_Real dvmin = Abs(thePnt.Y() - thePntRef.Y());
if((dumin < dumax) && (dvmin < dvmax))
return Standard_True;
#ifdef DEB
if(PrintWarnings)
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Closed2d -> Error" << endl;
cout << "*****************************************************" << endl;
cout << "*dumin = " << dumin << "; dumax = " << dumax << endl;
cout << "* dvmin = " << dvmin << "; dvmax = " << dvmax << endl;
cout << "* (dumin > dumax) or (dvmin > dvmax)." << endl;
cout << "*****************************************************" << endl;
cout << endl;
cout << "UFirst = " << aFaceSurface.FirstUParameter();
cout << "; ULast = " << aFaceSurface.LastUParameter() << endl;
cout << "VFirst = " << aFaceSurface.FirstVParameter();
cout << "; VLast = " << aFaceSurface.LastVParameter() << endl;
}
dumax = aFaceSurface.UResolution(aTol3d);
dvmax = aFaceSurface.VResolution(aTol3d);
if(PrintWarnings)
{
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
}
#else
dumax = aFaceSurface.UResolution(aTol3d);
dvmax = aFaceSurface.VResolution(aTol3d);
#endif
Standard_Real aTol2d = 2*Max( dumax, dvmax);
#ifdef DEB
if((aTol2d <= 0.0) && (PrintWarnings))
{
cout<<"BRepCheck_Wire : UResolution and VResolution = 0.0 (Face too small ?)"<<endl;
cout.flush();
}
#endif
//Standard_Real Dist = thePntRef.Distance(thePnt);
Standard_Real Dist = Max(dumin, dvmin);
if (Dist < aTol2d)
return Standard_True;
#ifdef DEB
if(PrintWarnings)
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Closed2d -> Error" << endl;
cout << "*****************************************************" << endl;
cout << "* Dist = " << Dist << " > Tol2d = " << aTol2d << endl;
cout << "*****************************************************" << endl;
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
}
#endif
return Standard_False;
}
//=======================================================================
//function : Closed2d
//purpose : for periodic faces
//=======================================================================
BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
const Standard_Boolean Update)
{
// 3d closure checked?
{
// 3d closure checked too
BRepCheck_Status aClosedStat = Closed();
if (aClosedStat != BRepCheck_NoError) {
if (Update)
if (aClosedStat != BRepCheck_NoError)
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
// 20/03/02 akm vvv : (OCC234) Hence this method will be used to check
// both periodic and non-periodic faces
// // this check is for periodic faces
return aClosedStat;
}
// 20/03/02 akm vvv : (OCC234) Hence this method will be used to check
// both periodic and non-periodic faces
// // this check is for periodic faces
BRepAdaptor_Surface aFaceSurface (theFace, Standard_False);
// if (!aFaceSurface.IsUPeriodic() && !aFaceSurface.IsVPeriodic())
// {
// if (Update)
// BRepCheck::Add(myMap(myShape),aClosedStat);
// return aClosedStat;
// }
// 20/03/02 akm ^^^
// count edges having FORWARD or REVERSED orientation
// if (!aFaceSurface.IsUPeriodic() && !aFaceSurface.IsVPeriodic())
// {
// if (Update)
// BRepCheck::Add(myMap(myShape),aClosedStat);
// return aClosedStat;
// }
// 20/03/02 akm ^^^
// count edges having FORWARD or REVERSED orientation
Standard_Integer aNbOrirntedEdges = 0;
TopExp_Explorer anEdgeExp(myShape,TopAbs_EDGE);
for (;anEdgeExp.More(); anEdgeExp.Next()) {
for (;anEdgeExp.More(); anEdgeExp.Next())
{
if (IsOriented(anEdgeExp.Current()))
aNbOrirntedEdges++;
}
}
if (aNbOrirntedEdges==0)
{
if (Update)
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
// all those edges must form a closed 2d contour and be found by WireExplorer
}
// all those edges must form a closed 2d contour and be found by WireExplorer
Standard_Integer aNbFoundEdges = 0;
BRepTools_WireExplorer aWireExp(TopoDS::Wire(myShape), theFace);
TopoDS_Edge aFirstEdge = aWireExp.Current();
TopoDS_Vertex aFirstVertex = aWireExp.CurrentVertex();
TopoDS_Edge aLastEdge;
for (;aWireExp.More(); aWireExp.Next())
{
{
aNbFoundEdges++;
aLastEdge = aWireExp.Current();
}
}
if (aNbFoundEdges != aNbOrirntedEdges)
{
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
// Check distance between 2d ends of first and last edges
return aClosedStat;
}
// Check distance between 2d ends of first and last edges
// Modified by Sergey KHROMOV - Mon May 13 12:42:10 2002 Begin
// First check if first and last edges are infinite:
Standard_Real aF;
@@ -444,92 +563,89 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
anOri = aFirstEdge.Orientation();
BRep_Tool::Range(aFirstEdge, aF, aL);
if ((anOri == TopAbs_FORWARD && aF == -Precision::Infinite()) ||
(anOri == TopAbs_REVERSED && aL == Precision::Infinite()))
if ((anOri == TopAbs_FORWARD && Precision::IsNegativeInfinite( aF )) ||
(anOri == TopAbs_REVERSED && Precision::IsPositiveInfinite( aL )))
isFirstInfinite = Standard_True;
anOri = aLastEdge.Orientation();
BRep_Tool::Range(aLastEdge, aF, aL);
if ((anOri == TopAbs_FORWARD && aL == Precision::Infinite()) ||
(anOri == TopAbs_REVERSED && aF == -Precision::Infinite()))
if ((anOri == TopAbs_FORWARD && Precision::IsPositiveInfinite( aL )) ||
(anOri == TopAbs_REVERSED && Precision::IsNegativeInfinite( aF )))
isLastInfinite = Standard_True;
if (isFirstInfinite && isLastInfinite) {
if (Update)
if (isFirstInfinite && isLastInfinite)
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
} else if (aFirstVertex.IsNull()) {
}
else if (aFirstVertex.IsNull())
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// Modified by Sergey KHROMOV - Mon May 13 12:42:10 2002 End
gp_Pnt2d p, p1, p2; // ends of prev edge, next edge, bidon
// get first point
BRep_Tool::UVPoints(aLastEdge, theFace, p2, p);
if (aLastEdge.Orientation() == TopAbs_REVERSED) p = p2;
gp_Pnt2d aP_first, aP_last, aP_temp; // ends of prev edge, next edge, bidon
// get last point
BRep_Tool::UVPoints(aLastEdge, theFace, aP_temp, aP_last);
if (aLastEdge.Orientation() == TopAbs_REVERSED)
aP_last = aP_temp;
// Modified by Sergey KHROMOV - Mon Apr 22 10:36:33 2002 Begin
// Standard_Real aTol, aUResol, aVResol;
// // find 2d tolerance
// aTol = BRep_Tool::Tolerance(aFirstVertex);
// aUResol = 2*aFaceSurface.UResolution(aTol);
// aVResol = 2*aFaceSurface.VResolution(aTol);
// get second point
// get first point
if (aFirstEdge.Orientation() == TopAbs_REVERSED)
BRep_Tool::UVPoints(aFirstEdge, theFace, p2, p1);
BRep_Tool::UVPoints(aFirstEdge, theFace, aP_temp, aP_first);
else
BRep_Tool::UVPoints(aFirstEdge, theFace, p1, p2);
BRep_Tool::UVPoints(aFirstEdge, theFace, aP_first, aP_temp);
// Modified by Sergey KHROMOV - Thu Jun 20 10:55:42 2002 OCC325 Begin
// Check 2d distance for periodic faces with seam edge
if (!IsClosed2dForPeriodicFace(theFace, p, p1, aFirstVertex)) {
if (!IsClosed2dForPeriodicFace(theFace, aP_first, aP_last, aFirstVertex))
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// Modified by Sergey KHROMOV - Thu Jun 20 10:58:05 2002 End
// check distance
// check distance
// Standard_Real dfUDist=Abs(p.X()-p1.X());
// Standard_Real dfVDist=Abs(p.Y()-p1.Y());
// if (dfUDist > aUResol || dfVDist > aVResol)
// {
Standard_Real aTol3d = BRep_Tool::Tolerance(aFirstVertex);
gp_Pnt aPRef = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aP1 = aFaceSurface.Value(p.X(), p.Y());
gp_Pnt aP2 = aFaceSurface.Value(p1.X(), p1.Y());
Standard_Real Dist1 = aPRef.Distance(aP1);
Standard_Real Dist2 = aPRef.Distance(aP2);
if (Dist1 > aTol3d || Dist2 > aTol3d) {
// Modified by Sergey KHROMOV - Mon Apr 22 10:36:44 2002 End
#ifdef DEB
cout << endl;
cout << "------------------------------------------------------" <<endl;
cout << "--- BRepCheck Wire: Closed2d -> Erreur" <<endl;
if (Dist1 > aTol3d)
cout << "--- Dist1 (" << Dist1 << ") > Tol3d (" << aTol3d << ")" <<endl;
if (Dist2 > aTol3d)
cout << "--- Dist2 (" << Dist2 << ") > Tol3d (" << aTol3d << ")" <<endl;
cout << "------------------------------------------------------" <<endl;
#endif
Standard_Real aTol3d = Max(BRep_Tool::Tolerance(aFirstVertex),BRep_Tool::Tolerance(aWireExp.CurrentVertex()));
gp_Pnt aPntRef = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aPnt = BRep_Tool::Pnt(aWireExp.CurrentVertex());
if (!(IsDistanceIn2DTolerance(aFaceSurface, aP_first, aP_last, aTol3d)))
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
if(!IsDistanceIn3DTolerance(aFaceSurface, aPntRef, aPnt, aTol3d))
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
//=======================================================================
//function : Orientation
//purpose :
@@ -548,11 +664,7 @@ BRepCheck_Status BRepCheck_Wire::Orientation(const TopoDS_Face& F,
theOstat = BRepCheck_NoError;
TopoDS_Vertex VF,VL;
#ifndef DEB
TopAbs_Orientation orient, ortmp = TopAbs_FORWARD;
#else
TopAbs_Orientation orient, ortmp;
#endif
TopTools_ListOfShape ledge, ListOfPassedEdge;
TopExp_Explorer exp,vte;
TopTools_MapOfShape mapS;
@@ -1469,186 +1581,156 @@ static TopAbs_Orientation GetOrientation(const TopTools_MapOfShape& mapE,
}
//=======================================================================
//function : ChoixUV
//purpose :
//purpose : For vertex theVertex given function find an edge along
// that we should go further.
//=======================================================================
void ChoixUV(const TopoDS_Vertex& V,
const TopoDS_Edge& Edg,
const TopoDS_Face& F,
TopTools_ListOfShape& L)
{
TopTools_ListIteratorOfListOfShape It( L );
void ChoixUV(const TopoDS_Vertex& theVertex,
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace,
TopTools_ListOfShape& theLOfShape)
{
TopTools_ListIteratorOfListOfShape It( theLOfShape );
while (It.More())
{
if (Edg.IsSame( It.Value() ))
L.Remove( It );
else
It.Next();
if (theEdge.IsSame( It.Value() ))
theLOfShape.Remove( It );
else
It.Next();
}
Standard_Integer index = 0, imin = 0;
TopoDS_Edge Evois;
gp_Pnt2d PntRef, Pnt;
gp_Vec2d DerRef, Der;
Standard_Real MinAngle, MaxAngle, angle;
Standard_Real gpResolution=gp::Resolution();
TopAbs_Orientation aVOrientation, aEdgOrientation;
#ifndef DEB
Standard_Real dist2d = 0, p = 0;
#else
Standard_Real dist2d, p;
#endif
Standard_Real f, l, parpiv;
Standard_Real tolv = BRep_Tool::Tolerance(V);
BRepAdaptor_Surface Ads(F,Standard_False); // no restriction
Standard_Real ures = Ads.UResolution(tolv);
Standard_Real vres = Ads.VResolution(tolv);
Standard_Real tol = Max(ures,vres);
if(tol<=0.0) {
#ifdef DEB
Standard_Real aTol3d = BRep_Tool::Tolerance(theVertex);
cout<<"BRepCheck_Wire : UResolution and VResolution = 0.0 (Face too small ?)"<<endl;cout.flush();
#endif
}
else {
tol += tol;
}
//
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(Edg, F, f, l);
if (C2d.IsNull()) {// JAG 10.12.96
return;
}
Standard_Integer anIndex = 0, anIndMin = 0;
TopoDS_Edge anEFound;
gp_Pnt2d aPntRef, aPnt;
gp_Vec2d aDerRef, aDer;
Standard_Real aMinAngle, aMaxAngle, anAngle;
Standard_Real a_gpResolution=gp::Resolution();
TopAbs_Orientation aVOrientation, anEdgOrientation;
Standard_Real aParam = 0.0, aFirstParam = 0.0, aLastParam = 0.0, aParPiv = 0.0;
BRepAdaptor_Surface aFaceSurface(theFace,Standard_False); // no restriction
aVOrientation=V.Orientation();
aEdgOrientation=Edg.Orientation();
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirstParam, aLastParam);
if (C2d.IsNull())// JAG 10.12.96
return;
parpiv =(aVOrientation==aEdgOrientation) ? f : l;
MinAngle = RealLast();
MaxAngle = RealFirst();
aVOrientation = theVertex.Orientation();
anEdgOrientation = theEdge.Orientation();
aParPiv =(aVOrientation==anEdgOrientation) ? aFirstParam : aLastParam;
aMinAngle = RealLast();
aMaxAngle = RealFirst();
CurveDirForParameter(C2d, parpiv, PntRef, DerRef);
CurveDirForParameter(C2d, aParPiv, aPntRef, aDerRef);
if (aVOrientation != anEdgOrientation)
aDerRef.Reverse();
if (aVOrientation != aEdgOrientation){
DerRef.Reverse();
}
//
It.Initialize(L);
for (; It.More(); It.Next()) {
index++;
const TopoDS_Edge& aE=TopoDS::Edge(It.Value());
C2d = BRep_Tool::CurveOnSurface(aE, F, f, l);
if(C2d.IsNull()) {
It.Initialize(theLOfShape);
for (; It.More(); It.Next())
{
anIndex++;
const TopoDS_Edge& anE=TopoDS::Edge(It.Value());
C2d = BRep_Tool::CurveOnSurface(anE, theFace, aFirstParam, aLastParam);
if(C2d.IsNull())
continue;
}
p =(aVOrientation != aE.Orientation()) ? f : l;
//
Pnt = C2d->Value(p);
dist2d = Pnt.Distance( PntRef );
if (dist2d > tol){
aParam =(aVOrientation != anE.Orientation()) ? aFirstParam : aLastParam;
aPnt = C2d->Value(aParam);
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, Standard_False))
continue;
}
//
CurveDirForParameter(C2d, p, Pnt, Der);
if (aVOrientation == aE.Orientation()){
Der.Reverse();
}
if (DerRef.Magnitude() <= gpResolution ||
Der.Magnitude() <= gpResolution){
CurveDirForParameter(C2d, aParam, aPnt, aDer);
if (aVOrientation == anE.Orientation())
aDer.Reverse();
if ((aDerRef.Magnitude() <= a_gpResolution) ||
(aDer.Magnitude() <= a_gpResolution))
//Vector length is too small
continue;
}
//
angle = DerRef.Angle( Der );
angle *= -1.;
if (angle < 0.)
angle += 2.*M_PI;
if (F.Orientation() == TopAbs_FORWARD) {
if (angle < MinAngle) {
imin = index;
MinAngle = angle;
anAngle = -aDerRef.Angle( aDer );
if ( anAngle < 0. )
anAngle += 2.*M_PI;
if ( theFace.Orientation() == TopAbs_FORWARD )
{
if ( anAngle < aMinAngle )
{
anIndMin = anIndex;
aMinAngle = anAngle;
}
}
}
else { //F.Orientation() != TopAbs_FORWARD
if (angle > MaxAngle){
imin = index;
MaxAngle = angle;
else //theFace.Orientation() != TopAbs_FORWARD
{
if ( anAngle > aMaxAngle )
{
anIndMin = anIndex;
aMaxAngle = anAngle;
}
}
}
}//end of for
//
// Update edge
if (imin == 0)
if (L.Extent() == 1) {
Standard_Boolean onjette = 0; //all right
Evois = TopoDS::Edge(L.First());
if (dist2d > tol) {
#ifdef DEB
cout<<"BRepCheckWire : control closure in 2d --> false"<<endl;cout.flush();
#endif
if(Evois.IsNull() || BRep_Tool::Degenerated(Edg) ||
BRep_Tool::Degenerated(Evois)){
onjette = 1; //bad
}
else {
Ads.Initialize(F);
Standard_Real dumax = 0.01 * (Ads.LastUParameter() - Ads.FirstUParameter());
Standard_Real dvmax = 0.01 * (Ads.LastVParameter() - Ads.FirstVParameter());
Standard_Real dumin = Abs(Pnt.X() - PntRef.X());
Standard_Real dvmin = Abs(Pnt.Y() - PntRef.Y());
if(dumin > dumax || dvmin > dvmax){
onjette = 1;
}
else {
BRepAdaptor_Curve bcEdg(Edg,F);
BRepAdaptor_Curve bcEvois(Evois,F);
gp_Pnt pEdg = bcEdg.Value(parpiv);
gp_Pnt pEvois = bcEvois.Value(p);
Standard_Real d3d = pEvois.Distance(pEdg);
#ifdef DEB
cout<<"point P "<<pEdg.X()<<" "<<pEdg.Y()<<" "<<pEdg.Z()<<endl;
cout<<"distance 3d : "<<d3d<<endl;
cout<<"tolerance vertex : "<<tolv<<endl;
cout.flush();
#endif
//if(d3d > tolv){
if(d3d > 2.*tolv){
onjette = 1;
}
#ifdef DEB
else
cout<<"control closure in 3d --> ok"<<endl;cout.flush();
#endif
}
}
} //if (dist2d > tol)
else {//angle was not defined but points are close
onjette = 0;
}//end of for
// Update edge
if (anIndMin == 0)
if (theLOfShape.Extent() == 1)
{
Standard_Boolean IsFound = Standard_True; //all right
anEFound = TopoDS::Edge(theLOfShape.First());
if(anEFound.IsNull() || BRep_Tool::Degenerated(theEdge) ||
BRep_Tool::Degenerated(anEFound))
IsFound = Standard_False; //bad
else if (!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d))
IsFound = Standard_False; //bad
else
// clousureness in 3D
{
//IsDistanceIn3DTolerance
BRepAdaptor_Curve bcEdg(theEdge, theFace);
BRepAdaptor_Curve bcEvois(anEFound, theFace);
gp_Pnt pEdg = bcEdg.Value(aParPiv);
gp_Pnt pEFound = bcEvois.Value(aParam);
if(!IsDistanceIn3DTolerance(theFace, pEdg, pEFound, aTol3d))
IsFound = Standard_False;
else
//angle was not defined but points are close
IsFound = Standard_True; //all right
}
if(!IsFound)
{
theLOfShape.Clear();
}
}//if (theLOfShape.Extent() == 1)
else //if (anIndMin == 0)
{
theLOfShape.Clear();
}
if(onjette) {
#ifdef DEB
cout<<"control closure in 3d --> false"<<endl;cout.flush();
#endif
L.Clear();
else
{
anIndex = 1;
while (anIndex < anIndMin)
{
theLOfShape.RemoveFirst();
anIndex++;
}
}
else {
L.Clear();
}
else {
index = 1;
while (index < imin) {
L.RemoveFirst();
index++;
}
It.Initialize(L);
It.Initialize(theLOfShape);
It.Next();
while (It.More())
L.Remove(It);
}
}
theLOfShape.Remove(It);
}
}//End of function
//=======================================================================
//function : CurveDirForParameter
//purpose :

View File

@@ -150,6 +150,16 @@ is
DefineRealSegmax(me : in out)
is static private;
ShareFaces(me: in out; theShape: Shape from TopoDS;
theInitialFacesLen: Integer;
theInitialEdgesLen: Integer;
theInitialSectionsLen: Integer)
---Purpose: Performs sharing coincident faces in theShape. Also modifies
-- myFaces, mySections and myEdges to contain shared shapes.
-- Returns the shared shape. If theShape is not modified this
-- method returns it.
returns Shape from TopoDS
is static private;
fields
mySpine : Wire from TopoDS;

View File

@@ -27,6 +27,7 @@
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepTools_Substitution.hxx>
#include <GeomFill_CorrectedFrenet.hxx>
#include <GeomFill_CurveAndTrihedron.hxx>
@@ -44,6 +45,9 @@
#include <TopoDS_Solid.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
@@ -512,6 +516,9 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
Handle(TopTools_HArray2OfShape) Aux, Somme;
Standard_Integer length;
Standard_Integer ii, jj, kk;
const Standard_Integer aNbFaces = myFaces->ColLength();
const Standard_Integer aNbEdges = myEdges->ColLength();
const Standard_Integer aNbSections = mySections->ColLength();
Aux = MkSw.SubShape();
length = Aux->ColLength() + myFaces->ColLength();
@@ -526,7 +533,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
Somme->SetValue(ii, jj, Aux->Value(kk, jj));
}
myFaces = Somme;
Aux = MkSw.Sections();
length = Aux->ColLength() + mySections->ColLength();
@@ -554,7 +560,11 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
kk <=Aux->ColLength(); kk++, ii++)
Somme->SetValue(ii, jj, Aux->Value(kk, jj));
}
myEdges = Somme;
myEdges = Somme;
// Perform sharing faces
result = ShareFaces(result, aNbFaces, aNbEdges, aNbSections);
}
}
}
@@ -771,3 +781,296 @@ void BRepFill_Pipe::DefineRealSegmax()
if (mySegmax < RealSegmax)
mySegmax = RealSegmax;
}
//=======================================================================
//function : ShareFaces
//purpose :
//=======================================================================
TopoDS_Shape BRepFill_Pipe::ShareFaces
(const TopoDS_Shape &theShape,
const Standard_Integer theInitialFacesLen,
const Standard_Integer theInitialEdgesLen,
const Standard_Integer theInitialSectionsLen)
{
TopoDS_Shape aResult = theShape;
// Check if there are shapes to be shared.
TopTools_DataMapOfShapeInteger aMapBndEdgeIndex;
TColStd_DataMapOfIntegerInteger aMapNewOldFIndex;
TColStd_DataMapOfIntegerInteger aMapNewOldEIndex;
TopTools_MapOfShape aMapUsedVtx;
TopExp_Explorer anExp;
Standard_Integer i;
Standard_Integer ii;
Standard_Integer jj;
BRep_Builder aBuilder;
// Check the first and last J index of myFaces.
for (i = 1; i <= 2; i++) {
// Compute jj index of faces.
if (i == 1) {
jj = 1;
} else {
jj == myFaces->RowLength();
if (jj == 1) {
break;
}
}
// Fill the map of boundary edges on initial faces.
for (ii = 1; ii <= theInitialFacesLen; ii++) {
anExp.Init(myFaces->Value(ii, jj), TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
if (aMapBndEdgeIndex.IsBound(anExp.Current())) {
// This is not boundary edge. Remove it.
aMapBndEdgeIndex.UnBind(anExp.Current());
} else {
// Add boundary edge.
aMapBndEdgeIndex.Bind(anExp.Current(), ii);
}
}
}
// Check if edges of newly created faces are shared with old ones.
for (ii = theInitialFacesLen + 1; ii <= myFaces->ColLength(); ii++) {
anExp.Init(myFaces->Value(ii, jj), TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
if (aMapBndEdgeIndex.IsBound(anExp.Current())) {
// This row should be replaced.
Standard_Integer anOldIndex = aMapBndEdgeIndex.Find(anExp.Current());
aMapNewOldFIndex.Bind(ii, anOldIndex);
// Find corresponding new and old edges indices.
TopoDS_Vertex aV[2];
TopExp::Vertices(TopoDS::Edge(anExp.Current()), aV[0], aV[1]);
Standard_Integer ie;
Standard_Integer je;
Standard_Integer indV;
// Compute jj index of edges.
if (i == 1) {
je = 1;
} else {
je == myEdges->RowLength();
}
Standard_Integer j;
for (j = 0; j < 2; j++) {
if (aMapUsedVtx.Contains(aV[j])) {
// This vertex is treated.
continue;
}
// Find old index.
Standard_Integer iEOld = -1;
TopoDS_Vertex aVE[2];
for (ie = 1; ie <= theInitialEdgesLen; ie++) {
const TopoDS_Shape &anEdge = myEdges->Value(ie, je);
TopExp::Vertices(TopoDS::Edge(anEdge), aVE[0], aVE[1]);
if (aV[j].IsSame(aVE[0]) || aV[j].IsSame(aVE[1])) {
iEOld = ie;
break;
}
}
if (iEOld > 0) {
// Find new index.
for (ie = theInitialEdgesLen+1; ie <= myEdges->ColLength(); ie++) {
const TopoDS_Shape &anEdge = myEdges->Value(ie, je);
TopExp::Vertices(TopoDS::Edge(anEdge), aVE[0], aVE[1]);
if (aV[j].IsSame(aVE[0]) || aV[j].IsSame(aVE[1])) {
// This row should be replaced.
aMapNewOldEIndex.Bind(ie, iEOld);
aMapUsedVtx.Add(aV[j]);
break;
}
}
}
}
break;
}
}
}
}
if (!aMapNewOldFIndex.IsEmpty()) {
TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter(aMapNewOldFIndex);
TopTools_ListOfShape aListShape;
BRepTools_Substitution aSubstitute;
for (; anIter.More(); anIter.Next()) {
const Standard_Integer aNewIndex = anIter.Key();
const Standard_Integer anOldIndex = anIter.Value();
// Change new faces by old ones.
for (jj = 1; jj <= myFaces->RowLength(); jj++) {
const TopoDS_Shape &aNewFace = myFaces->Value(aNewIndex, jj);
const TopoDS_Shape &anOldFace = myFaces->Value(anOldIndex, jj);
if (!aSubstitute.IsCopied(aNewFace)) {
aListShape.Append(anOldFace.Oriented(TopAbs_REVERSED));
aSubstitute.Substitute(aNewFace, aListShape);
aListShape.Clear();
}
}
}
// Change new edges by old ones.
for (anIter.Initialize(aMapNewOldEIndex); anIter.More(); anIter.Next()) {
const Standard_Integer aNewIndex = anIter.Key();
const Standard_Integer anOldIndex = anIter.Value();
for (jj = 1; jj <= myEdges->RowLength(); jj++) {
const TopoDS_Shape &aNewEdge = myEdges->Value(aNewIndex, jj);
const TopoDS_Shape &anOldEdge = myEdges->Value(anOldIndex, jj);
if (!aSubstitute.IsCopied(aNewEdge)) {
aListShape.Append(anOldEdge.Oriented(TopAbs_FORWARD));
aSubstitute.Substitute(aNewEdge, aListShape);
aListShape.Clear();
// Change new vertices by old ones.
TopoDS_Iterator aNewIt(aNewEdge);
TopoDS_Iterator anOldIt(anOldEdge);
for (; aNewIt.More() && anOldIt.More();
aNewIt.Next(), anOldIt.Next()) {
if (!aNewIt.Value().IsSame(anOldIt.Value())) {
if (!aSubstitute.IsCopied(aNewIt.Value())) {
aListShape.Append(anOldIt.Value().Oriented(TopAbs_FORWARD));
aSubstitute.Substitute(aNewIt.Value(), aListShape);
aListShape.Clear();
}
}
}
}
}
}
// Perform substitution.
aSubstitute.Build(aResult);
if (aSubstitute.IsCopied(aResult)) {
// Get copied shape.
const TopTools_ListOfShape& listSh = aSubstitute.Copy(aResult);
aResult = listSh.First();
// Update original faces with copied ones.
for (ii = theInitialFacesLen + 1; ii <= myFaces->ColLength(); ii++) {
for (jj = 1; jj <= myFaces->RowLength(); jj++) {
TopoDS_Shape anOldFace = myFaces->Value(ii, jj); // Copy
if (aSubstitute.IsCopied(anOldFace)) {
const TopTools_ListOfShape& aList = aSubstitute.Copy(anOldFace);
if(!aList.IsEmpty()) {
// Store copied face.
const TopoDS_Shape &aCopyFace = aList.First();
TopAbs_Orientation anOri = anOldFace.Orientation();
const Standard_Boolean isShared = aMapNewOldFIndex.IsBound(ii);
if (isShared) {
// Reverse the orientation for shared face.
anOri = TopAbs::Reverse(anOri);
}
myFaces->SetValue(ii, jj, aCopyFace.Oriented(anOri));
// Check if it is necessary to update PCurves on this face.
if (!isShared) {
TopoDS_Face anOldF = TopoDS::Face(anOldFace);
TopoDS_Face aCopyF = TopoDS::Face(aCopyFace);
anOldF.Orientation(TopAbs_FORWARD);
anExp.Init(anOldF, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape &anOldEdge = anExp.Current();
if (aSubstitute.IsCopied(anOldEdge)) {
const TopTools_ListOfShape& aListE =
aSubstitute.Copy(anOldEdge);
if(!aListE.IsEmpty()) {
// This edge is copied. Check if there is a PCurve
// on the face.
TopoDS_Edge aCopyE = TopoDS::Edge(aListE.First());
Standard_Real aFirst;
Standard_Real aLast;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface
(aCopyE, aCopyF, aFirst, aLast);
if (aPCurve.IsNull()) {
// There is no pcurve copy it from the old edge.
TopoDS_Edge anOldE = TopoDS::Edge(anOldEdge);
aPCurve = BRep_Tool::CurveOnSurface
(anOldE, anOldF, aFirst, aLast);
if (aPCurve.IsNull() == Standard_False) {
// Update the shared edge with PCurve from new Face.
Standard_Real aTol = Max(BRep_Tool::Tolerance(anOldE),
BRep_Tool::Tolerance(aCopyE));
aBuilder.UpdateEdge(aCopyE, aPCurve, aCopyF, aTol);
}
}
}
}
}
}
}
}
}
}
// Update new edges with shared ones.
for (ii = theInitialEdgesLen + 1; ii <= myEdges->ColLength(); ii++) {
for (jj = 1; jj <= myEdges->RowLength(); jj++) {
const TopoDS_Shape &aLocalShape = myEdges->Value(ii, jj);
if (aSubstitute.IsCopied(aLocalShape)) {
const TopTools_ListOfShape& aList = aSubstitute.Copy(aLocalShape);
if(!aList.IsEmpty()) {
const TopAbs_Orientation anOri = TopAbs_FORWARD;
myEdges->SetValue(ii, jj, aList.First().Oriented(anOri));
}
}
}
}
// Update new sections with shared ones.
for (ii = theInitialSectionsLen+1; ii <= mySections->ColLength(); ii++) {
for (jj = 1; jj <= mySections->RowLength(); jj++) {
const TopoDS_Shape &aLocalShape = mySections->Value(ii, jj);
if (aSubstitute.IsCopied(aLocalShape)) {
const TopTools_ListOfShape& aList = aSubstitute.Copy(aLocalShape);
if(!aList.IsEmpty()) {
const TopAbs_Orientation anOri = TopAbs_FORWARD;
mySections->SetValue(ii, jj, aList.First().Oriented(anOri));
}
}
}
}
}
}
return aResult;
}

View File

@@ -828,9 +828,9 @@ void BRepMesh_Delaun::RemovePivotTriangles( const Standard_Integer theEdgeInfo,
{
if ( e1[i] == anOldEdge )
{
for ( Standard_Integer i = 0; i < 2; ++i )
{
Standard_Integer aTmpEdgeId = e1[(i + 1) % 3];
for ( Standard_Integer j = 0; j < 2; ++j )
{
Standard_Integer aTmpEdgeId = e1[(j + i + 1) % 3];
const BRepMesh_Edge& anEdge = GetEdge( aTmpEdgeId );
if ( anEdge.FirstNode() == thePivotNode ||
anEdge.LastNode() == thePivotNode )

View File

@@ -64,7 +64,9 @@
#include <ChFi3d_Builder_0.hxx>
#include <TopOpeBRepDS_ListOfInterference.hxx>
#include <BRepLib.hxx>
#include <ShapeFix.hxx>
#include <Precision.hxx>
#ifdef DRAW
#include <TestTopOpeTools.hxx>
@@ -73,6 +75,8 @@
#ifdef DEB
#include <OSD_Chronometer.hxx>
// variables for performances
@@ -559,6 +563,27 @@ void ChFi3d_Builder::Compute()
cout<<"-temps ChFi3d_sameparameter "<<t_sameparam<<"s"<<endl<<endl;
}
#endif
//
// Inspect the new faces to provide sameparameter
// if it is necessary
if (IsDone())
{
Standard_Real SameParTol = Precision::Confusion();
Standard_Integer aNbSurfaces, iF;
TopTools_ListIteratorOfListOfShape aIt;
//
aNbSurfaces=myDS->NbSurfaces();
for (iF=1; iF<=aNbSurfaces; ++iF) {
const TopTools_ListOfShape& aLF=myCoup->NewFaces(iF);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
BRepLib::SameParameter(aF, SameParTol, Standard_True);
ShapeFix::SameParameter(aF, Standard_False, SameParTol);
}
}
}
}
//=======================================================================

View File

@@ -228,8 +228,9 @@ Method:
Us = Sol.Value(NoSol);
Cu = ElCLib::Value(Us,C);
mySqDist[myNbExt] = Cu.SquareDistance(P);
myIsMin[myNbExt] = (NoSol == 1);
myPoint[myNbExt] = Extrema_POnCurv(Us,Cu);
Cu = ElCLib::Value(Us + 0.1, C);
myIsMin[myNbExt] = mySqDist[myNbExt] < Cu.SquareDistance(P);
myNbExt++;
}
myDone = Standard_True;

View File

@@ -365,7 +365,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
if (newV > myvsup) {
newV = myvsup;
newV -= 2. * M_PI;
if (newV + mytolv < myvinf) {
newV = myvsup;
} else if (newV < myvinf) {
newV = myvinf;
}
}
}
V = newV;
@@ -384,8 +390,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
(anACurve->GetType() == GeomAbs_Ellipse)) {
newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
if(newV < myvinf)
newV = myvinf;
if(newV < myvinf) {
newV += 2. * M_PI;
if (newV - mytolv > myvsup) {
newV = myvinf;
} else if (newV > myvsup) {
newV = myvsup;
}
}
}
V = newV;
@@ -424,7 +437,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
if (newV > myvsup) {
newV = myvsup;
newV -= 2. * M_PI;
if (newV + mytolv < myvinf) {
newV = myvsup;
} else if (newV < myvinf) {
newV = myvinf;
}
}
}
V = newV;
@@ -440,8 +459,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
(anACurve->GetType() == GeomAbs_Ellipse)) {
newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
if(newV < myvinf)
newV = myvinf;
if(newV < myvinf) {
newV += 2. * M_PI;
if (newV - mytolv > myvsup) {
newV = myvinf;
} else if (newV > myvsup) {
newV = myvsup;
}
}
}
V = newV;

View File

@@ -992,6 +992,9 @@ is
is static private;
---Purpose : updates the cache and validates it
IsEqual(me; theOther : BSplineCurve from Geom;
thePreci : Real from Standard ) returns Boolean;
---Purpose : Comapare two Bspline curve on identity;

View File

@@ -37,6 +37,7 @@
#include <Standard_DomainError.hxx>
#include <Standard_RangeError.hxx>
#include <Standard_Mutex.hxx>
#include <Precision.hxx>
#define POLES (poles->Array1())
#define KNOTS (knots->Array1())
@@ -827,3 +828,56 @@ void Geom_BSplineCurve::Resolution(const Standard_Real Tolerance3D,
}
UTolerance = Tolerance3D * maxderivinv;
}
//=======================================================================
//function : IsEqual
//purpose :
//=======================================================================
Standard_Boolean Geom_BSplineCurve::IsEqual(const Handle(Geom_BSplineCurve)& theOther,
const Standard_Real thePreci) const
{
if( knots.IsNull() || poles.IsNull() || mults.IsNull() )
return Standard_False;
if( deg != theOther->Degree())
return Standard_False;
if( knots->Length() != theOther->NbKnots() ||
poles->Length() != theOther->NbPoles())
return Standard_False;
Standard_Integer i = 1;
for( i = 1 ; i <= poles->Length(); i++ )
{
const gp_Pnt& aPole1 = poles->Value(i);
const gp_Pnt& aPole2 =theOther->Pole(i);
if( fabs( aPole1.X() - aPole2.X() ) > thePreci ||
fabs( aPole1.Y() - aPole2.Y() ) > thePreci ||
fabs( aPole1.Z() - aPole2.Z() ) > thePreci )
return Standard_False;
}
for( ; i <= knots->Length(); i++ )
{
if( fabs(knots->Value(i) - theOther->Knot(i)) > Precision::Parametric(thePreci) )
return Standard_False;
}
for( i = 1 ; i <= mults->Length(); i++ )
{
if( mults->Value(i) != theOther->Multiplicity(i) )
return Standard_False;
}
if( rational != theOther->IsRational())
return Standard_False;
if(!rational)
return Standard_True;
for( i = 1 ; i <= weights->Length(); i++ )
{
if( fabs( Standard_Real(weights->Value(i) - theOther->Weight(i))) > Epsilon(weights->Value(i)) )
return Standard_False;
}
return Standard_True;
}

View File

@@ -1283,38 +1283,15 @@ Standard_Boolean Geom_BSplineSurface::IsUClosed () const
if (uperiodic)
return Standard_True;
Standard_Boolean Closed = Standard_True;
TColgp_Array2OfPnt & VPoles = poles->ChangeArray2();
Standard_Integer PLower = VPoles.LowerRow();
Standard_Integer PUpper = VPoles.UpperRow();
Standard_Integer PLength = VPoles.RowLength();
Standard_Integer j = VPoles.LowerCol();
if ( urational || vrational) {
TColStd_Array2OfReal & VWeights = weights->ChangeArray2();
Standard_Integer WLower = VWeights.LowerRow();
Standard_Integer WUpper = VWeights.UpperRow();
Standard_Real Alfa = VWeights(WLower,VWeights.LowerCol());
Alfa /= VWeights(WUpper,VWeights.LowerCol());
Standard_Integer k = VWeights.LowerCol();
while (Closed && j <= PLength) {
Closed =
(VPoles (PLower, j).Distance (VPoles (PUpper, j)) <= Precision::Confusion());
j++;
Closed = (Closed &&
((VWeights(WLower,k) / VWeights(WUpper,k)) - Alfa)
< Epsilon(Alfa));
k++;
}
}
else {
while (Closed && j <= PLength) {
Closed =
(VPoles (PLower, j).Distance (VPoles (PUpper, j)) <= Precision::Confusion());
j++;
}
}
return Closed;
Standard_Real aU1, aU2, aV1, aV2;
Bounds( aU1, aU2, aV1, aV2 );
Handle(Geom_Curve) aCUF = UIso( aU1 );
Handle(Geom_Curve) aCUL = UIso( aU2 );
if(aCUF.IsNull() || aCUL.IsNull())
return Standard_False;
Handle(Geom_BSplineCurve) aBsF = Handle(Geom_BSplineCurve)::DownCast(aCUF);
Handle(Geom_BSplineCurve) aBsL = Handle(Geom_BSplineCurve)::DownCast(aCUL);
return (!aBsF.IsNull() && !aBsL.IsNull() && aBsF->IsEqual( aBsL, Precision::Confusion()) );
}
//=======================================================================
@@ -1326,39 +1303,16 @@ Standard_Boolean Geom_BSplineSurface::IsVClosed () const
{
if (vperiodic)
return Standard_True;
Standard_Boolean Closed = Standard_True;
TColgp_Array2OfPnt & VPoles = poles->ChangeArray2();
Standard_Integer PLower = VPoles.LowerCol();
Standard_Integer PUpper = VPoles.UpperCol();
Standard_Integer PLength = VPoles.ColLength();
Standard_Integer i = VPoles.LowerRow();
if ( urational || vrational) {
TColStd_Array2OfReal & VWeights = weights->ChangeArray2();
Standard_Integer WLower = VWeights.LowerCol();
Standard_Integer WUpper = VWeights.UpperCol();
Standard_Real Alfa = VWeights(VWeights.LowerRow(),WLower);
Alfa /= VWeights(VWeights.LowerRow(),WUpper);
Standard_Integer k = VWeights.LowerRow();
while (Closed && i <= PLength) {
Closed =
(VPoles (i, PLower).Distance (VPoles (i, PUpper)) <= Precision::Confusion());
i++;
Closed = (Closed &&
((VWeights(k,WLower) / VWeights(k,WUpper)) - Alfa)
< Epsilon(Alfa));
k++;
}
}
else {
while (Closed && i <= PLength) {
Closed =
(VPoles (i, PLower).Distance (VPoles (i, PUpper)) <= Precision::Confusion());
i++;
}
}
return Closed;
Standard_Real aU1, aU2, aV1, aV2;
Bounds( aU1, aU2, aV1, aV2 );
Handle(Geom_Curve) aCVF = VIso( aV1 );
Handle(Geom_Curve) aCVL = VIso( aV2 );
if(aCVF.IsNull() || aCVL.IsNull())
return Standard_False;
Handle(Geom_BSplineCurve) aBsF = Handle(Geom_BSplineCurve)::DownCast(aCVF);
Handle(Geom_BSplineCurve) aBsL = Handle(Geom_BSplineCurve)::DownCast(aCVL);
return (!aBsF.IsNull() && !aBsL.IsNull() && aBsF->IsEqual(aBsL, Precision::Confusion()));
}
//=======================================================================

View File

@@ -278,12 +278,15 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
//purpose :
//=======================================================================
static Standard_Integer intersect(Draw_Interpretor& /*di*/, Standard_Integer n, const char** a)
static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if( n < 2)
{
cout<< "2dintersect curve curve [Tol]"<<endl;
return 1;
Handle(Geom2d_Curve) C1 = DrawTrSurf::GetCurve2d(a[1]);
}
Standard_Integer k = 1;
Handle(Geom2d_Curve) C1 = DrawTrSurf::GetCurve2d(a[k++]);
if ( C1.IsNull())
return 1;
@@ -291,10 +294,16 @@ static Standard_Integer intersect(Draw_Interpretor& /*di*/, Standard_Integer n,
Geom2dAPI_InterCurveCurve Intersector;
Handle(Geom2d_Curve) C2;
if ( n == 3) {
C2 = DrawTrSurf::GetCurve2d(a[2]);
if ( k < n ) {
C2 = DrawTrSurf::GetCurve2d(a[k++]);
if ( C2.IsNull())
return 1;
}
if(k < n)
Tol = atof(a[k]);
if(!C2.IsNull())
{
Intersector.Init(C1,C2,Tol);
}
else {
@@ -305,6 +314,7 @@ static Standard_Integer intersect(Draw_Interpretor& /*di*/, Standard_Integer n,
for ( i = 1; i <= Intersector.NbPoints(); i++) {
gp_Pnt2d P = Intersector.Point(i);
di<<"Intersection point "<<i<<" : "<<P.X()<<" "<<P.Y()<<"\n";
Handle(Draw_Marker2D) mark = new Draw_Marker2D( P, Draw_X, Draw_vert);
dout << mark;
}
@@ -312,15 +322,14 @@ static Standard_Integer intersect(Draw_Interpretor& /*di*/, Standard_Integer n,
Handle(Geom2d_Curve) S1,S2;
Handle(DrawTrSurf_Curve2d) CD;
if ( n == 3) {
for ( i = 1; i <= Intersector.NbSegments(); i++) {
Intersector.Segment(i,S1,S2);
CD = new DrawTrSurf_Curve2d(S1, Draw_bleu, 30);
dout << CD;
CD = new DrawTrSurf_Curve2d(S2, Draw_violet, 30);
dout << CD;
}
for ( i = 1; i <= Intersector.NbSegments(); i++) {
Intersector.Segment(i,S1,S2);
CD = new DrawTrSurf_Curve2d(S1, Draw_bleu, 30);
dout << CD;
CD = new DrawTrSurf_Curve2d(S2, Draw_violet, 30);
dout << CD;
}
dout.Flush();
return 0;
@@ -353,6 +362,6 @@ void GeomliteTest::API2dCommands(Draw_Interpretor& theCommands)
g = "GEOMETRY intersections";
theCommands.Add("2dintersect", "intersect curve curve",__FILE__,
theCommands.Add("2dintersect", "intersect curve curve [Tol]",__FILE__,
intersect,g);
}

View File

@@ -1842,5 +1842,6 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
__FILE__,
surface_radius,g);
theCommands.Add("compBsplSur","BsplSurf1 BSplSurf2",__FILE__,compBsplSur,g);
}

View File

@@ -51,6 +51,8 @@
static
gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D);
static
void RefineDir(gp_Dir& aDir);
//=======================================================================
//class :
@@ -129,7 +131,9 @@ class AxeOperator {
gp_Dir V2=Axe2.Direction();
gp_Pnt P1=Axe1.Location();
gp_Pnt P2=Axe2.Location();
//
RefineDir(V1);
RefineDir(V2);
thecoplanar= Standard_False;
thenormal = Standard_False;
@@ -1163,6 +1167,9 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
//
Standard_Real tg1, tg2, aDA1A2, aTol2;
gp_Pnt aPApex1, aPApex2;
Standard_Real TOL_APEX_CONF = 1.e-10;
//
tg1=Tan(Con1.SemiAngle());
tg2=Tan(Con2.SemiAngle());
@@ -1187,6 +1194,12 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
Standard_Real d=gp_Vec(D).Dot(gp_Vec(P,Con2.Apex()));
if(Abs(tg1-tg2)>myEPSILON_ANGLE_CONE) {
if (fabs(d) < TOL_APEX_CONF) {
typeres = IntAna_Point;
nbint = 1;
pt1 = P;
return;
}
x=(d*tg2)/(tg1+tg2);
pt1.SetCoord( P.X() + x*D.X()
,P.Y() + x*D.Y()
@@ -1203,7 +1216,7 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
typeres=IntAna_Circle;
}
else {
if (fabs(d)<1.e-10) {
if (fabs(d) < TOL_APEX_CONF) {
typeres=IntAna_Same;
}
else {
@@ -1361,9 +1374,7 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
if (aRD2>(aR2+Tol)) {
iRet=0;
typeres=IntAna_Empty; //nothing
//modified by NIZNHY-PKV Fri Mar 23 08:12:23 2012f
return;
//modified by NIZNHY-PKV Fri Mar 23 08:12:29 2012t
}
//
iRet=1; //touch case => 1 line
@@ -1602,9 +1613,13 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
const gp_Cone& Con,
const Standard_Real)
{
//
done=Standard_True;
//
AxeOperator A1A2(Con.Axis(),Sph.Position().Axis());
gp_Pnt Pt=Sph.Location();
//
if((A1A2.Intersect() && (Pt.Distance(A1A2.PtIntersect())==0.0))
|| A1A2.Same()) {
gp_Pnt ConApex= Con.Apex();
@@ -1929,7 +1944,54 @@ const gp_Pnt& IntAna_QuadQuadGeo::PChar() const
{
return myPChar;
}
//=======================================================================
//function : RefineDir
//purpose :
//=======================================================================
void RefineDir(gp_Dir& aDir)
{
Standard_Integer k, m, n;
Standard_Real aC[3];
//
aDir.Coord(aC[0], aC[1], aC[2]);
//
m=0;
n=0;
for (k=0; k<3; ++k) {
if (aC[k]==1. || aC[k]==-1.) {
++m;
}
else if (aC[k]!=0.) {
++n;
}
}
//
if (m && n) {
Standard_Real aEps, aR1, aR2, aNum;
//
aEps=RealEpsilon();
aR1=1.-aEps;
aR2=1.+aEps;
//
for (k=0; k<3; ++k) {
m=(aC[k]>0.);
aNum=(m)? aC[k] : -aC[k];
if (aNum>aR1 && aNum<aR2) {
if (m) {
aC[k]=1.;
}
else {
aC[k]=-1.;
}
//
aC[(k+1)%3]=0.;
aC[(k+2)%3]=0.;
break;
}
}
aDir.SetCoord(aC[0], aC[1], aC[2]);
}
}

View File

@@ -212,7 +212,28 @@ is
raises ConstructionError from Standard
is static private;
InternalCompositePerform_noRecurs(me: in out;
NbInterC1: Integer from Standard;
C1: TheCurve;
NumInterC1: Integer from Standard;
Tab1: Array1OfReal from TColStd;
D1: Domain from IntRes2d;
NbInterC2: Integer from Standard;
C2: TheCurve;
NumInterC2: Integer from Standard;
Tab2: Array1OfReal from TColStd;
D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Part of InternalCompositePerform function
raises ConstructionError from Standard
is static private;
InternalCompositePerform(me: in out;
C1: TheCurve; D1: Domain from IntRes2d;

View File

@@ -805,6 +805,102 @@ void IntCurve_IntCurveCurveGen::InternalPerform (const TheCurve& C1,
}
}
void IntCurve_IntCurveCurveGen::InternalCompositePerform_noRecurs(
const Standard_Integer NbInterC1,
const TheCurve& C1,
const Standard_Integer NumInterC1,
const TColStd_Array1OfReal& Tab1,
const IntRes2d_Domain& D1,
const Standard_Integer NbInterC2,
const TheCurve& C2,
const Standard_Integer NumInterC2,
const TColStd_Array1OfReal& Tab2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol)
{
if(NumInterC2>NbInterC2)
return;
IntRes2d_Domain DomainC1NumInter;
IntRes2d_Domain DomainC2NumInter;
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C1
//----------------------------------------------------------------------
Standard_Boolean DomainIsOK = Standard_True;
Standard_Real ParamInf,ParamSup;
if(NbInterC1>1) {
TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D1.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D1.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
ParamInf,
D1.FirstTolerance(),
TheCurveTool::Value(C1,ParamSup),
ParamSup,
D1.LastTolerance());
} else {
DomainIsOK = Standard_False;
}
} else {
DomainC1NumInter = D1;
}
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C2
//----------------------------------------------------------------------
if(NbInterC2 > 1) {
TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D2.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D2.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
TheCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
} else {
DomainIsOK = Standard_False;
}
} else {
DomainC2NumInter = D2;
}
if(DomainIsOK) {
InternalPerform(C2,DomainC2NumInter,
C1,DomainC1NumInter,
TolConf,Tol,
Standard_True);
}
}
@@ -826,115 +922,39 @@ IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1,
const Standard_Real Tol,
const Standard_Boolean RecursOnC2) {
Standard_Integer NumInterC2=XXXNumInterC2;
Standard_Integer NumInterC2=XXXNumInterC2;
Standard_Integer NumInterC1=XXXNumInterC1;
// Standard_Boolean Arret=Standard_False;
if(NumInterC2<=NbInterC2) {
if(RecursOnC2) {
for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
NumInterC1=i;
InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
C1,D1,NumInterC1,NbInterC1,Tab1,
TolConf,Tol,
Standard_False);
}
if(NumInterC2<NbInterC2) {
NumInterC2++;
NumInterC1=1;
InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
C2,D2,NumInterC2,NbInterC2,Tab2,
TolConf,Tol,
Standard_True);
}
}
else {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ I n t e r s e c t i o n ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ de C2[NumInterC2] ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ et C1[NumInterC1] ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ (pour respecter l ordre) ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IntRes2d_Domain DomainC1NumInter;
IntRes2d_Domain DomainC2NumInter;
if(NumInterC2>NbInterC2)
return;
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C1
//----------------------------------------------------------------------
Standard_Boolean DomainIsOK = Standard_True;
Standard_Real ParamInf,ParamSup;
if(NbInterC1>1) {
TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D1.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D1.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
ParamInf,
D1.FirstTolerance(),
TheCurveTool::Value(C1,ParamSup),
ParamSup,
D1.LastTolerance());
}
else {
DomainIsOK = Standard_False;
}
}
else {
DomainC1NumInter = D1;
}
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C2
//----------------------------------------------------------------------
if(NbInterC2 > 1) {
TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D2.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D2.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
TheCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
}
else {
DomainIsOK = Standard_False;
}
}
else {
DomainC2NumInter = D2;
}
if(DomainIsOK) {
InternalPerform(C2,DomainC2NumInter,
C1,DomainC1NumInter,
TolConf,Tol,
Standard_True);
}
}
if(!RecursOnC2){
InternalCompositePerform_noRecurs(NbInterC1, C1, NumInterC1, Tab1, D1, NbInterC2, C2, NumInterC2, Tab2, D2, TolConf, Tol);
return;
}
for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
NumInterC1=i;
/*
InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
C1,D1,NumInterC1,NbInterC1,Tab1,
TolConf,Tol,Standard_False);
*/
InternalCompositePerform_noRecurs(NbInterC2,C2,NumInterC2,Tab2,D2,NbInterC1,C1,NumInterC1,Tab1,D1,TolConf,Tol);
}
if(NumInterC2<NbInterC2) {
NumInterC2++;
NumInterC1=1;
InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
C2,D2,NumInterC2,NbInterC2,Tab2,
TolConf,Tol,
Standard_True);
}
}

View File

@@ -144,7 +144,27 @@ is
DeltaU : Real from Standard;
DeltaV : Real from Standard)
is static protected;
is static protected;
findIntersect( me: in out ;
Curve1 : TheCurve;
Domain1: Domain from IntRes2d;
Curve2 : TheCurve;
Domain2: Domain from IntRes2d;
TolConf: Real from Standard;
Tol : Real from Standard;
NbIter : Integer from Standard;
DeltaU : Real from Standard;
DeltaV : Real from Standard;
thePoly1 : ThePolygon2d from IntCurve;
thePoly2 : ThePolygon2d from IntCurve;
isFullRepresentation : Boolean from Standard)
returns Boolean is private;
---Purpose : Method to find intersection between two curves
-- : returns false for case when some points of polygon
-- : were replaced on line and exact point of intersection was not found
-- : for case when point of intersection was found
-- : during prelimanary search for line (case of bad paramerization of Bspline for example).
fields

View File

@@ -49,6 +49,7 @@
#include <math_Vector.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_NewtonFunctionSetRoot.hxx>
#include <NCollection_Handle.hxx>
//======================================================================
@@ -775,11 +776,8 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
,const Standard_Real DeltaU
,const Standard_Real DeltaV) {
gp_Vec2d Tan1,Tan2,Norm1,Norm2;
gp_Pnt2d P1,P2;
Standard_Integer nbsamplesOnC1,nbsamplesOnC2;
done = Standard_False;
Standard_Boolean AnErrorOccurred = Standard_False;
if(NbIter>NBITER_MAX_POLYGON) return;
@@ -811,29 +809,30 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
}
/////////////////////////////////////////////
IntCurve_ThePolygon2d *PtrPoly1,*PtrPoly2;
NCollection_Handle<IntCurve_ThePolygon2d> aPoly1 ,aPoly2;
if(nbsamplesOnC2 > nbsamplesOnC1) {
PtrPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
if(PtrPoly1->DeflectionOverEstimation() < TolConf) {
PtrPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
if(aPoly1->DeflectionOverEstimation() < TolConf) {
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
}
else {
PtrPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol,PtrPoly1->Bounding());
PtrPoly1->SetDeflectionOverEstimation( PtrPoly2->DeflectionOverEstimation()
+PtrPoly1->DeflectionOverEstimation());
PtrPoly1->ComputeWithBox(C1,PtrPoly2->Bounding());
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol,aPoly1->Bounding());
aPoly1->SetDeflectionOverEstimation( aPoly2->DeflectionOverEstimation()
+ aPoly1->DeflectionOverEstimation());
aPoly1->ComputeWithBox(C1,aPoly2->Bounding());
}
}
else {
PtrPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
if(PtrPoly2->DeflectionOverEstimation() < TolConf) {
PtrPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
if(aPoly2->DeflectionOverEstimation() < TolConf) {
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
}
else {
PtrPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol,PtrPoly2->Bounding());
PtrPoly2->SetDeflectionOverEstimation( PtrPoly2->DeflectionOverEstimation()
+PtrPoly1->DeflectionOverEstimation());
PtrPoly2->ComputeWithBox(C2,PtrPoly1->Bounding());
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol,aPoly2->Bounding());
aPoly2->SetDeflectionOverEstimation( aPoly2->DeflectionOverEstimation()
+ aPoly1->DeflectionOverEstimation());
aPoly2->ComputeWithBox(C2,aPoly1->Bounding());
}
}
//----------------------------------------------------------------------
@@ -842,13 +841,64 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
//-- (Detection des Zones de Tangence)
//----------------------------------------------------------------------
if(PtrPoly1->DeflectionOverEstimation() < TolConf) {
PtrPoly1->SetDeflectionOverEstimation(TolConf);
if(aPoly1->DeflectionOverEstimation() < TolConf) {
aPoly1->SetDeflectionOverEstimation(TolConf);
}
if(PtrPoly2->DeflectionOverEstimation() < TolConf) {
PtrPoly2->SetDeflectionOverEstimation(TolConf);
if(aPoly2->DeflectionOverEstimation() < TolConf) {
aPoly2->SetDeflectionOverEstimation(TolConf);
}
Intf_InterferencePolygon2d InterPP(*PtrPoly1,*PtrPoly2);
//for case when a few polygon points were replaced by line
//if exact solution was not found
//then search of precise solution will be repeat
//for polygon conatins all initial points
//secondary search will be performed only for case when initial points
//were dropped
Standard_Boolean isFullRepresentation = ( aPoly1->NbSegments() == nbsamplesOnC1 &&
aPoly2->NbSegments() == nbsamplesOnC2 );
if( !findIntersect( C1, D1, C2, D2, TolConf, Tol, NbIter,
DeltaU, DeltaV, *aPoly1, *aPoly2, isFullRepresentation ) && !isFullRepresentation )
{
if(aPoly1->NbSegments() < nbsamplesOnC1)
{
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
}
if(aPoly2->NbSegments() < nbsamplesOnC2)
{
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
}
findIntersect( C1, D1, C2, D2, TolConf, Tol, NbIter,
DeltaU, DeltaV, *aPoly1, *aPoly2,
Standard_True);
}
done = Standard_True;
}
//======================================================================
// Purpose :
//======================================================================
Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Integer NbIter,
const Standard_Real DeltaU,
const Standard_Real DeltaV,
const IntCurve_ThePolygon2d& thePoly1,
const IntCurve_ThePolygon2d& thePoly2,
Standard_Boolean isFullPolygon )
{
gp_Vec2d Tan1,Tan2,Norm1,Norm2;
gp_Pnt2d P1,P2;
Intf_InterferencePolygon2d InterPP(thePoly1,thePoly2);
IntCurve_ExactIntersectionPoint EIP(C1,C2,TolConf);
Standard_Real U,V;
@@ -856,19 +906,21 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
//-- Traitement des SectionPoint
//----------------------------------------------------------------------
Standard_Integer Nbsp = InterPP.NbSectionPoints();
for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
const Intf_SectionPoint& SPnt = InterPP.PntValue(sp);
Standard_Integer SegIndex1,SegIndex2;
Standard_Real ParamOn1,ParamOn2;
Intf_PIType Type;
if(Nbsp>=1) {
for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
const Intf_SectionPoint& SPnt = InterPP.PntValue(sp);
Standard_Integer SegIndex1,SegIndex2;
Standard_Real ParamOn1,ParamOn2;
Intf_PIType Type;
SPnt.InfoFirst(Type,SegIndex1,ParamOn1);
SPnt.InfoSecond(Type,SegIndex2,ParamOn2);
EIP.Perform(*PtrPoly1,*PtrPoly2,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
AnErrorOccurred = EIP.AnErrorOccurred();
if(EIP.NbRoots()>=1) {
SPnt.InfoFirst(Type,SegIndex1,ParamOn1);
SPnt.InfoSecond(Type,SegIndex2,ParamOn2);
EIP.Perform(thePoly1,thePoly2,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
//AnErrorOccurred = EIP.AnErrorOccurred();
if( !EIP.NbRoots() && !isFullPolygon)
return Standard_False;
//--------------------------------------------------------------------
//-- On verifie que le point trouve est bien une racine
//--------------------------------------------------------------------
@@ -925,11 +977,8 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
IntRes2d_IntersectionPoint IP(P1,U,V,Trans1,Trans2,Standard_False);
Insert(IP);
}
} //-- if(EIP.NbRoots()>=1)
}
}
//----------------------------------------------------------------------
//-- Traitement des TangentZone
//----------------------------------------------------------------------
@@ -962,14 +1011,14 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
Standard_Real _PolyUInf,_PolyVInf;
SPnt1.InfoFirst(Type,SegIndex1onP1,ParamOnLine);
if(SegIndex1onP1 >= PtrPoly1->NbSegments()) { SegIndex1onP1--; ParamOnLine = 1.0; }
if(SegIndex1onP1 >= thePoly1.NbSegments()) { SegIndex1onP1--; ParamOnLine = 1.0; }
if(SegIndex1onP1 <= 0) { SegIndex1onP1=1; ParamOnLine = 0.0; }
_PolyUInf = PtrPoly1->ApproxParamOnCurve(SegIndex1onP1,ParamOnLine);
_PolyUInf = thePoly1.ApproxParamOnCurve(SegIndex1onP1,ParamOnLine);
SPnt1.InfoSecond(Type,SegIndex1onP2,ParamOnLine);
if(SegIndex1onP2 >= PtrPoly2->NbSegments()) { SegIndex1onP2--; ParamOnLine = 1.0; }
if(SegIndex1onP2 >= thePoly2.NbSegments()) { SegIndex1onP2--; ParamOnLine = 1.0; }
if(SegIndex1onP2 <= 0) { SegIndex1onP2=1; ParamOnLine = 0.0; }
_PolyVInf = PtrPoly2->ApproxParamOnCurve(SegIndex1onP2,ParamOnLine);
_PolyVInf = thePoly2.ApproxParamOnCurve(SegIndex1onP2,ParamOnLine);
//----------------------------------------------------------------------
@@ -997,8 +1046,8 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
if( ( (PtrPoly1->DeflectionOverEstimation() > TolConf)
||(PtrPoly2->DeflectionOverEstimation() > TolConf))
if( ( (thePoly1.DeflectionOverEstimation() > TolConf)
||(thePoly2.DeflectionOverEstimation() > TolConf))
&&(NbIter<NBITER_MAX_POLYGON)) {
IntRes2d_Domain RecursD1( TheCurveTool::Value(C1,ParamInfOnCurve1)
@@ -1009,7 +1058,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
,ParamInfOnCurve2,TolConf
,TheCurveTool::Value(C2,ParamSupOnCurve2)
,ParamSupOnCurve2,TolConf);
//-- On ne delete pas PtrPoly1(2) ,
//-- On ne delete pas thePoly1(2) ,
//-- ils sont detruits enfin de fct.
//-- !! Pas de return intempestif !!
Perform(C1,RecursD1,C2,RecursD2,Tol,TolConf,NbIter+1,DeltaU,DeltaV);
@@ -1125,9 +1174,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
}
}
}
//----------------------------------------------------------------------
delete PtrPoly1;
delete PtrPoly2;
done = Standard_True;
return Standard_True;
}

View File

@@ -21,7 +21,7 @@
#include <IntAna_ListOfCurve.hxx>
#include <IntAna_ListIteratorOfListOfCurve.hxx>
//
static
Standard_Boolean ExploreCurve(const gp_Cylinder& aCy,
const gp_Cone& aCo,
@@ -324,11 +324,12 @@ Standard_Boolean IntCyCy(const IntSurf_Quadric& Quad1,
{
gp_Vec Tgt;
gp_Pnt ptref;
IntPatch_Point pmult1;
IntPatch_Point pmult2;
IntPatch_Point pmult1, pmult2;
elipsol = inter.Ellipse(1);
gp_Pnt pttang1(ElCLib::Value(M_PI*0.5,elipsol));
gp_Pnt pttang2(ElCLib::Value(1.5*M_PI,elipsol));
gp_Pnt pttang1(ElCLib::Value(0.5*M_PI, elipsol));
gp_Pnt pttang2(ElCLib::Value(1.5*M_PI, elipsol));
Multpoint = Standard_True;
pmult1.SetValue(pttang1,Tol,Standard_True);
@@ -344,8 +345,7 @@ Standard_Boolean IntCyCy(const IntSurf_Quadric& Quad1,
Quad1.Parameters(pttang2,oU1,oV1);
Quad2.Parameters(pttang2,oU2,oV2);
pmult2.SetParameters(oU1,oV1,oU2,oV2);
// on traite la premiere ellipse
//-- Calcul de la Transition de la ligne
@@ -365,39 +365,53 @@ Standard_Boolean IntCyCy(const IntSurf_Quadric& Quad1,
//-- Transition calculee au point 0 -> Trans2 , Trans1
//-- car ici, on devarit calculer en PI
Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans2,trans1);
pmult1.SetParameter(M_PI/2.);
//
{
Standard_Real aU1, aV1, aU2, aV2;
IntPatch_Point aIP;
gp_Pnt aP (ElCLib::Value(0., elipsol));
//
aIP.SetValue(aP,Tol,Standard_False);
aIP.SetMultiple(Standard_False);
//
Quad1.Parameters(aP, aU1, aV1);
Quad2.Parameters(aP, aU2, aV2);
aIP.SetParameters(aU1, aV1, aU2, aV2);
//
aIP.SetParameter(0.);
glig->AddVertex(aIP);
glig->SetFirstPoint(1);
//
aIP.SetParameter(2.*M_PI);
glig->AddVertex(aIP);
glig->SetLastPoint(2);
}
//
pmult1.SetParameter(0.5*M_PI);
glig->AddVertex(pmult1);
glig->SetFirstPoint(1);
//
pmult2.SetParameter(1.5*M_PI);
glig->AddVertex(pmult2);
glig->SetLastPoint(2);
//
slin.Append(glig);
//-- Transitions calculee au point 0 OK
glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
pmult2.SetParameter(-M_PI/2.);
glig->AddVertex(pmult2);
glig->SetFirstPoint(1);
glig->AddVertex(pmult1);
glig->SetLastPoint(2);
slin.Append(glig);
//
// on traite la deuxieme ellipse
elipsol = inter.Ellipse(2);
Standard_Real param1 = ElCLib::Parameter(elipsol,pttang1);
Standard_Real param2 = ElCLib::Parameter(elipsol,pttang2);
Standard_Real parampourtransition;
if (param1 < param2) {
pmult1.SetParameter(M_PI*0.5);
pmult1.SetParameter(0.5*M_PI);
pmult2.SetParameter(1.5*M_PI);
parampourtransition = M_PI;
}
else {
pmult1.SetParameter(-M_PI*0.5);
pmult2.SetParameter(M_PI*0.5);
pmult1.SetParameter(1.5*M_PI);
pmult2.SetParameter(0.5*M_PI);
parampourtransition = 0.0;
}
@@ -417,25 +431,31 @@ Standard_Boolean IntCyCy(const IntSurf_Quadric& Quad1,
}
//-- La transition a ete calculee sur un point de cette ligne
glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
glig->AddVertex(pmult1);
glig->SetFirstPoint(1);
glig->AddVertex(pmult2);
glig->SetLastPoint(2);
slin.Append(glig);
if (param1 < param2) {
pmult2.SetParameter(-M_PI*0.5);
//
{
Standard_Real aU1, aV1, aU2, aV2;
IntPatch_Point aIP;
gp_Pnt aP (ElCLib::Value(0., elipsol));
//
aIP.SetValue(aP,Tol,Standard_False);
aIP.SetMultiple(Standard_False);
//
Quad1.Parameters(aP, aU1, aV1);
Quad2.Parameters(aP, aU2, aV2);
aIP.SetParameters(aU1, aV1, aU2, aV2);
//
aIP.SetParameter(0.);
glig->AddVertex(aIP);
glig->SetFirstPoint(1);
//
aIP.SetParameter(2.*M_PI);
glig->AddVertex(aIP);
glig->SetLastPoint(2);
}
else {
pmult1.SetParameter(1.5*M_PI);
}
//-- Sur l'autre ligne, on invertse la transition
glig = new IntPatch_GLine(elipsol,Standard_False,trans2,trans1);
glig->AddVertex(pmult2);
glig->SetFirstPoint(1);
//
glig->AddVertex(pmult1);
glig->SetLastPoint(2);
glig->AddVertex(pmult2);
//
slin.Append(glig);
}
break;

View File

@@ -745,10 +745,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
if(ps<0.0) {
ps=-ps;
}
//modified by NIZNHY-PKV Thu Jul 01 12:14:29 2010f
//if(ps<0.1) {
if(ps<0.015) {
//modified by NIZNHY-PKV Thu Jul 01 12:14:35 2010t
TreatAsBiParametric = Standard_True;
}
}
@@ -769,10 +766,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
if(ps<0.0) {
ps=-ps;
}
//modified by NIZNHY-PKV Thu Jul 01 12:15:04 2010f
//if(ps<0.1){
if(ps<0.015){
//modified by NIZNHY-PKV Thu Jul 01 12:15:08 2010t
TreatAsBiParametric = Standard_True;
}
}
@@ -793,7 +787,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
}
}
}
else if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic
else if (a1 > 1.55 && a2 > 1.55) { //quasi-planes: if same domain, treat as canonic
gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsParallel(A2,Precision::Angular())) {
gp_Pnt Apex1 = Con1.Apex(), Apex2 = Con2.Apex();
@@ -803,11 +797,18 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
}
}
}
}
//////////////////////////////////////////////
}
else if ((a1 > 1.55 && a2 < 1.55) || (a2 > 1.55 && a1 < 1.55) ) {
gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion())) {
TreatAsBiParametric = Standard_False;
}
}
}// if (typs1 == GeomAbs_Cone) {
}// if(typs2 == GeomAbs_Cone) {
//
if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) TreatAsBiParametric= Standard_False;
if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) {
TreatAsBiParametric= Standard_False;
}
// Modified by skv - Mon Sep 26 14:58:30 2005 Begin
// if(TreatAsBiParametric) { typs1 = typs2 = GeomAbs_BezierSurface; }
@@ -1079,10 +1080,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
if(ps<0.0) {
ps=-ps;
}
//modified by NIZNHY-PKV Thu Jul 01 12:17:56 2010f
//if(ps<0.1) {
if(ps<0.015) {
//modified by NIZNHY-PKV Thu Jul 01 12:18:09 2010t
TreatAsBiParametric = Standard_True;
}
}
@@ -1104,10 +1102,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
if(ps<0.0){
ps=-ps;
}
//modified by NIZNHY-PKV Thu Jul 01 12:17:44 2010f
//if(ps<0.1){
if(ps<0.015){
//modified by NIZNHY-PKV Thu Jul 01 12:17:48 2010t
TreatAsBiParametric = Standard_True;
}
}
@@ -1147,12 +1142,22 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
TreatAsBiParametric = Standard_False;
}
}
else if ((a1 > 1.55 && a2 < 1.55) || (a2 > 1.55 && a1 < 1.55) ) {
gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion())) {
TreatAsBiParametric = Standard_False;
}
}
}
//////////////////////////////////////////////
if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) TreatAsBiParametric= Standard_False;
if(TreatAsBiParametric) { typs1 = typs2 = GeomAbs_BezierSurface; }
if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) {
TreatAsBiParametric= Standard_False;
}
if(TreatAsBiParametric) {
typs1 = GeomAbs_BezierSurface;
typs2 = GeomAbs_BezierSurface;
}
// Surface type definition
Standard_Integer ts1 = 0;

View File

@@ -1,3 +1,9 @@
IntPolyh_Intersection_1.cxx
IntPolyh_Array.hxx
IntPolyh_ArrayOfSectionLines.hxx
IntPolyh_ArrayOfCouples.hxx
IntPolyh_ArrayOfEdges.hxx
IntPolyh_ArrayOfPoints.hxx
IntPolyh_ArrayOfStartPoints.hxx
IntPolyh_ArrayOfTangentZones.hxx
IntPolyh_ArrayOfTriangles.hxx

View File

@@ -62,7 +62,14 @@ uses
Adaptor3d
is
imported ArrayOfSectionLines from IntPolyh;
imported ArrayOfCouples from IntPolyh;
imported ArrayOfEdges from IntPolyh;
imported ArrayOfPoints from IntPolyh;
imported ArrayOfStartPoints from IntPolyh;
imported ArrayOfTangentZones from IntPolyh;
imported ArrayOfTriangles from IntPolyh;
class Intersection;
---Purpose: the main algorithm. Algorythm outputs are --
-- lines and points like discribe in the last
@@ -77,41 +84,28 @@ is
class Couple;
---Purpose: couple of triangles
class ArrayOfCouples;
class Point;
class ArrayOfPoints;
class StartPoint;
class ArrayOfStartPoints;
class SeqOfStartPoints instantiates Sequence from TCollection
(StartPoint from IntPolyh);
class Edge;
class ArrayOfEdges;
class Triangle;
class ArrayOfTriangles;
class MaillageAffinage;
---Purpose: Provide the algorythms used in the package
class SectionLine;
class ArrayOfSectionLines;
-- class TangentZone; For the moment we use the StartPoint Class
class ArrayOfTangentZones;
-- Modified by skv - Thu Sep 25 18:04:05 2003 OCC567 End
pointer PMaillageAffinage to MaillageAffinage from IntPolyh;
-- Modified by skv - Thu Sep 25 18:04:07 2003 OCC567 Begin
end;

View File

@@ -0,0 +1,233 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_Array_HeaderFile
#define IntPolyh_Array_HeaderFile
#include <NCollection_Vector.hxx>
#include <stdio.h>
/**
* Class IntPolyh_Array (dynamic array of objects)
*
* 1. The Array is dynamic array of objects.
*
* 2. The Array uses NCollection_Vector to store objects
*
* 3. The Array can be created:
* 3.1. with initial length Nb=0.
* In this case Array should be initiated by invoke
* the method Init(Nb).
* 3.2. with initial length Nb>0.
* In this case Array is initiated automatically.
*
* The memory is allocated to store myNbAllocated oblects.
*
* 4. The number of items that are stored in the Array (myNbItems)
* can be increased by calling the method: IncrementNbItems().
* The objects are stored in already allocated memory if it is
* possible.
* Otherwise the new chunk of memory is allocated to store the
* objects.
* The size of chunk <aIncrement> can be defined during the creation
* of the Array.
*
* 5. The start index of the Array is 0, The end index of the Array
* can be obtained by the method NbItems();
* 6. The contents of the element with index "i" can be queried or
* modified by the methods: Value(i), ChangeValue(i), operator[](i)
*/
//=======================================================================
// class : IntPolyh_Array
//
//=======================================================================
template <class Type> class IntPolyh_Array {
public:
typedef NCollection_Vector <Type> IntPolyh_VectorOfType;
/**
* Constructor.
* @param aIncrement
* size of memory (in terms of Items) to expand the array
*/
IntPolyh_Array(const Standard_Integer aIncrement=256) {
myNbAllocated=0;
myNbItems=0;
myIncrement=aIncrement;
}
/**
* Constructor.
* @param aN
* size of memory (in terms of Items) to allocate
* @param aIncrement
* size of memory (in terms of Items) to expand the array
*/
IntPolyh_Array(const Standard_Integer aN,
const Standard_Integer aIncrement=256) {
myNbItems=0;
myIncrement=aIncrement;
Init(aN);
}
/**
* Assignment operator
* @param
* aOther - the array to copy from
* @return
* the array
*/
IntPolyh_Array& operator =(const IntPolyh_Array& aOther) {
return Copy(aOther);
}
/**
* Copy
* @param
* aOther - the array to copy from
* @return
* the array
*/
IntPolyh_Array& Copy(const IntPolyh_Array& aOther) {
myVectorOfType.Clear();
Init(aOther.myNbAllocated);
myVectorOfType=aOther.myVectorOfType;
myNbItems=aOther.myNbItems;
//
return *this;
}
/**
* Init - allocate memory for <aN> items
* @param
* aN - the number of items to allocate the memory
*/
void Init(const Standard_Integer aN) {
Type aSL;
//
myVectorOfType.SetValue(aN, aSL);
myNbAllocated=aN;
}
/**
* IncrementNbItems - increment the number of stored items
*/
void IncrementNbItems() {
myNbItems++;
if (myNbItems>=myNbAllocated) {
Standard_Integer aN;
//
aN=myNbAllocated+myIncrement;
Init(aN);
}
}
/**
* GetN - returns the number of 'allocated' items
* @return
* the number of 'allocated' items
*/
Standard_Integer GetN() const {
return myNbAllocated;
}
/**
* NbItems - returns the number of stored items
* @return
* the number of stored items
*/
Standard_Integer NbItems() const {
return myNbItems;
}
/**
* set the number of stored items
* @param aNb
* the number of stored items
*/
void SetNbItems(const Standard_Integer aNb){
myNbItems=aNb;
}
/**
* query the const value
* @param aIndex
* index
* @return
* the const item
*/
const Type& Value(const Standard_Integer aIndex) const {
return myVectorOfType.Value(aIndex);
}
/**
* query the const value
* @param aIndex
* index
* @return
* the const item
*/
const Type& operator [](const Standard_Integer aIndex) const {
return Value(aIndex);
}
/**
* query the value
* @param aIndex
* index
* @return
* the item
*/
Type& ChangeValue(const Standard_Integer aIndex) {
return myVectorOfType.ChangeValue(aIndex);
}
/**
* query the value
* @param aIndex
* index
* @return
* the item
*/
Type& operator [](const Standard_Integer aIndex) {
return ChangeValue(aIndex);
}
/**
* dump the contents
*/
void Dump() const {
printf("\n ArrayOfSectionLines 0-> %d",myNbItems-1);
for(Standard_Integer i=0;i<myNbItems;i++) {
(*this)[i].Dump();
}
printf("\n");
}
protected:
Standard_Integer myNbAllocated;
Standard_Integer myNbItems;
Standard_Integer myIncrement;
IntPolyh_VectorOfType myVectorOfType;
};
#endif

View File

@@ -1,73 +0,0 @@
-- Created on: 1999-04-08
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfCouples from IntPolyh
uses
Couple from IntPolyh
is
Create;
Create(nn: Integer from Standard);
Init(me: in out; nn: Integer from Standard)
is static;
NbCouples(me)
returns Integer from Standard
is static;
SetNbCouples(me: in out; fint: Integer from Standard)
is static;
IncNbCouples(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Couple from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Couple from IntPolyh
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,eoa : Integer from Standard;
ptr :Address from Standard;
end ArrayOfCouples from IntPolyh;

View File

@@ -1,104 +0,0 @@
// Created on: 1999-04-08
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_ArrayOfCouples.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfCouples::IntPolyh_ArrayOfCouples() : n(0),eoa(0),ptr(0){
}
IntPolyh_ArrayOfCouples::IntPolyh_ArrayOfCouples(const Standard_Integer N) : n(N),eoa(0){
Init(N);
}
void IntPolyh_ArrayOfCouples::Init(const Standard_Integer N) {
Destroy();
ptr = (void *) (new IntPolyh_Couple [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfCouples::NbCouples() const {
return(eoa);
}
void IntPolyh_ArrayOfCouples::SetNbCouples(const Standard_Integer fint) {
eoa=fint;
}
void IntPolyh_ArrayOfCouples::IncNbCouples() {
eoa++;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Couple& IntPolyh_ArrayOfCouples::Value(const Standard_Integer Index) const {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur4 "<<endl;
printf("Value() from IntPolyh_ArrayOfCouples : value out of array\n");
}
#endif
return(ptrCouple[Index]);
}
IntPolyh_Couple& IntPolyh_ArrayOfCouples::ChangeValue(const Standard_Integer Index) {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur4"<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfCouples : value out of array\n");
}
#endif
return(ptrCouple[Index]);
}
void IntPolyh_ArrayOfCouples::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Couple* ptrCouple = (IntPolyh_Couple*) ptr;
delete [] ptrCouple;
ptrCouple=0;
ptr=0;
n=0;
}
}
}
void IntPolyh_ArrayOfCouples::Dump() const{
printf("\n ArrayOfCouples 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,35 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfCouples_HeaderFile
#define IntPolyh_ArrayOfCouples_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_Couple.hxx>
typedef IntPolyh_Array <IntPolyh_Couple> IntPolyh_ArrayOfCouples;
#endif

View File

@@ -1,88 +0,0 @@
-- Created on: 1999-03-09
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfEdges from IntPolyh
uses
Edge from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
GetN(me)
returns Integer from Standard
---C++: return const
is static;
NbEdges(me)
returns Integer from Standard
---C++: return const
is static;
SetNbEdges(me: in out; endaof: Integer from Standard)
is static;
IncNbEdges(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Edge from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Edge from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfEdges from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfEdges from IntPolyh
is static;
Destroy(me:in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,finte : Integer from Standard;
ptr : Address from Standard;
end ArrayOfEdges from IntPolyh;

View File

@@ -1,113 +0,0 @@
// Created on: 1999-03-08
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_ArrayOfEdges.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges() : n(0),finte(0),ptr(0) { }
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges(const Standard_Integer N) : n(N),finte(0) {
Init(N);
}
void IntPolyh_ArrayOfEdges::Init(const Standard_Integer N) {
Destroy();
n=N;
ptr = (void*) (new IntPolyh_Edge [n]);
}
const Standard_Integer IntPolyh_ArrayOfEdges::GetN() const {
return(n);
}
const Standard_Integer IntPolyh_ArrayOfEdges::NbEdges() const {
return(finte);
}
void IntPolyh_ArrayOfEdges::SetNbEdges(const Standard_Integer endaoe) {
finte = endaoe;
}
void IntPolyh_ArrayOfEdges::IncNbEdges(){
finte++;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Edge& IntPolyh_ArrayOfEdges::Value(const Standard_Integer Index) const {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 value"<<endl;
printf("Value() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
IntPolyh_Edge& IntPolyh_ArrayOfEdges::ChangeValue(const Standard_Integer Index) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 chgVal"<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
void IntPolyh_ArrayOfEdges::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
delete [] ptredge;
ptredge=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfEdges & IntPolyh_ArrayOfEdges::Copy(const IntPolyh_ArrayOfEdges& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void*) (new IntPolyh_Edge[n]);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfEdges::Dump() const{
printf("\n ArrayOfEdges 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,35 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfEdges_HeaderFile
#define IntPolyh_ArrayOfEdges_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_Edge.hxx>
typedef IntPolyh_Array <IntPolyh_Edge> IntPolyh_ArrayOfEdges;
#endif

View File

@@ -1,84 +0,0 @@
-- Created on: 1999-03-08
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfPoints from IntPolyh
uses
Point from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Point from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Point from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfPoints from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfPoints from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbPoints(me)
returns Integer from Standard
is static;
IncNbPoints(me: in out)
is static;
SetNbPoints(me: in out; END: Integer from Standard)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,fintp : Integer from Standard;
ptr :Address from Standard;
end ArrayOfPoints from IntPolyh;

View File

@@ -1,119 +0,0 @@
// Created on: 1999-03-08
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_ArrayOfPoints.ixx>
#include <stdio.h>
IntPolyh_ArrayOfPoints::IntPolyh_ArrayOfPoints() : n(0),fintp(0),ptr(0) { }
IntPolyh_ArrayOfPoints::IntPolyh_ArrayOfPoints(const Standard_Integer N): fintp(0){
Init(N);
}
void IntPolyh_ArrayOfPoints::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_Point [N]);
n = N;
}
Standard_Integer IntPolyh_ArrayOfPoints::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfPoints::NbPoints() const {
return(fintp);
}
void IntPolyh_ArrayOfPoints::IncNbPoints() {
fintp++;
}
void IntPolyh_ArrayOfPoints::SetNbPoints(const Standard_Integer endaop) {
fintp = endaop;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Point& IntPolyh_ArrayOfPoints::Value(const Standard_Integer Index) const {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfPoints : ERROR value outside of the array\n");
}
#endif
return(ptrpoint[Index]);
}
IntPolyh_Point& IntPolyh_ArrayOfPoints::ChangeValue(const Standard_Integer Index) {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfPoints : ERROR value outside of the array\n");
}
#endif
return(ptrpoint[Index]);
}
void IntPolyh_ArrayOfPoints::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Point *ptrpoint = (IntPolyh_Point *)ptr;
delete [] ptrpoint;
ptrpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfPoints & IntPolyh_ArrayOfPoints::Copy(const IntPolyh_ArrayOfPoints& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_Point[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfPoints::Dump() const{
printf("\n ArrayOfPoints 0-> %d\n",fintp-1);
printf("size %d, room left%d", n, n-fintp);
for(Standard_Integer i=0;i<fintp;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,36 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfPoints_HeaderFile
#define IntPolyh_ArrayOfPoints_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_Point.hxx>
typedef IntPolyh_Array <IntPolyh_Point> IntPolyh_ArrayOfPoints;
#endif

View File

@@ -1,80 +0,0 @@
-- Created on: 1999-04-06
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfSectionLines from IntPolyh
uses
SectionLine from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns SectionLine from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns SectionLine from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfSectionLines from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfSectionLines from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbSectionLines(me)
returns Integer from Standard
is static;
IncrementNbSectionLines(me: in out)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,nbsectionlines : Integer from Standard;
ptr : Address from Standard;
end ArrayOfSectionLines from IntPolyh;

View File

@@ -1,101 +0,0 @@
// Created on: 1999-04-06
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfSectionLines.ixx>
#include <stdio.h>
IntPolyh_ArrayOfSectionLines::IntPolyh_ArrayOfSectionLines() : n(0),nbsectionlines(0),ptr(0) { }
IntPolyh_ArrayOfSectionLines::IntPolyh_ArrayOfSectionLines(const Standard_Integer N) : nbsectionlines(0){
Init(N);
}
void IntPolyh_ArrayOfSectionLines::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_SectionLine [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfSectionLines::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfSectionLines::NbSectionLines() const {
return(nbsectionlines);
}
void IntPolyh_ArrayOfSectionLines::IncrementNbSectionLines() {
nbsectionlines++;
}
#define BORNES1
const IntPolyh_SectionLine& IntPolyh_ArrayOfSectionLines::Value(const Standard_Integer Index) const {
IntPolyh_SectionLine *ptrstpoint = (IntPolyh_SectionLine *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd";}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_SectionLine& IntPolyh_ArrayOfSectionLines::ChangeValue(const Standard_Integer Index) {
IntPolyh_SectionLine *ptrstpoint = (IntPolyh_SectionLine *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd"; }
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfSectionLines::Destroy() {
if(n) {
if(ptr) {
IntPolyh_SectionLine *ptrsectionline = (IntPolyh_SectionLine *)ptr;
for(Standard_Integer i=0; i<n; i++)
ptrsectionline[i].Destroy();
delete [] ptrsectionline;
ptrsectionline=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfSectionLines & IntPolyh_ArrayOfSectionLines::Copy(const IntPolyh_ArrayOfSectionLines& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_SectionLine[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfSectionLines::Dump() const{
printf("\n ArrayOfSectionLines 0-> %d",nbsectionlines-1);
for(Standard_Integer i=0;i<nbsectionlines;i++) {
(*this)[i].Dump();
}
printf("\n");
}

View File

@@ -0,0 +1,35 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfSectionLines_HeaderFile
#define IntPolyh_ArrayOfSectionLines_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_SectionLine.hxx>
typedef IntPolyh_Array <IntPolyh_SectionLine> IntPolyh_ArrayOfSectionLines;
#endif

View File

@@ -1,74 +0,0 @@
-- Created on: 1999-04-06
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfStartPoints from IntPolyh
uses
StartPoint from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns StartPoint from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns StartPoint from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfStartPoints from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfStartPoints from IntPolyh
is static;
NbPoints(me)
returns Integer from Standard
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n : Integer from Standard;
ptr :Address from Standard;
end ArrayOfStartPoints from IntPolyh;

View File

@@ -1,93 +0,0 @@
// Created on: 1999-04-06
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfStartPoints.ixx>
#include <stdio.h>
IntPolyh_ArrayOfStartPoints::IntPolyh_ArrayOfStartPoints() : n(0),ptr(0) { }
IntPolyh_ArrayOfStartPoints::IntPolyh_ArrayOfStartPoints(const Standard_Integer N){
Init(N);
}
void IntPolyh_ArrayOfStartPoints::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_StartPoint [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfStartPoints::NbPoints() const {
return(n);
}
#define BORNES1
const IntPolyh_StartPoint& IntPolyh_ArrayOfStartPoints::Value(const Standard_Integer Index) const {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd";}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_StartPoint& IntPolyh_ArrayOfStartPoints::ChangeValue(const Standard_Integer Index) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) { cerr<<" Erreur1 "<<endl; cout<<"1dd"; }
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfStartPoints::Destroy() {
if(n) {
if(ptr) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
delete [] ptrstpoint;
ptrstpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfStartPoints & IntPolyh_ArrayOfStartPoints::Copy(const IntPolyh_ArrayOfStartPoints& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.NbPoints();
ptr = (void *) (new IntPolyh_StartPoint[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfStartPoints::Dump() const{
printf("\n ArrayOfStartPoints 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,35 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfStartPoints_HeaderFile
#define IntPolyh_ArrayOfStartPoints_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_StartPoint.hxx>
typedef IntPolyh_Array <IntPolyh_StartPoint> IntPolyh_ArrayOfStartPoints;
#endif

View File

@@ -1,81 +0,0 @@
-- Created on: 1999-04-06
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfTangentZones from IntPolyh
uses
StartPoint from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns StartPoint from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns StartPoint from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfTangentZones from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfTangentZones from IntPolyh
is static;
GetN(me)
returns Integer from Standard
is static;
NbTangentZones(me)
returns Integer from Standard
is static;
IncrementNbTangentZones(me: in out)
is static;
Destroy(me: in out)
---C++: alias ~
is static;
Dump(me)
is static;
fields
n,nbtangentzones : Integer from Standard;
ptr : Address from Standard;
end ArrayOfTangentZones from IntPolyh;

View File

@@ -1,108 +0,0 @@
// Created on: 1999-04-06
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_StartPoint.ixx>
#include <IntPolyh_ArrayOfTangentZones.ixx>
#include <stdio.h>
IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones() : n(0),nbtangentzones(0),ptr(0) { }
IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones(const Standard_Integer N) : nbtangentzones(0){
Init(N);
}
void IntPolyh_ArrayOfTangentZones::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_StartPoint [N]);
n=N;
}
Standard_Integer IntPolyh_ArrayOfTangentZones::GetN() const {
return(n);
}
Standard_Integer IntPolyh_ArrayOfTangentZones::NbTangentZones() const {
return(nbtangentzones);
}
void IntPolyh_ArrayOfTangentZones::IncrementNbTangentZones() {
nbtangentzones++;
}
# ifdef DEB
# define BORNES1
# endif
const IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::Value(const Standard_Integer Index) const {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
}
#endif
return(ptrstpoint[Index]);
}
IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::ChangeValue(const Standard_Integer Index) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur1 "<<endl;
printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
}
#endif
return(ptrstpoint[Index]);
}
void IntPolyh_ArrayOfTangentZones::Destroy() {
if(n) {
if(ptr) {
IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
delete [] ptrstpoint;
ptrstpoint=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfTangentZones & IntPolyh_ArrayOfTangentZones::Copy(const IntPolyh_ArrayOfTangentZones& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *) (new IntPolyh_StartPoint[n]);
for(Standard_Integer i=0;i<=n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfTangentZones::Dump() const{
printf("\n ArrayOfTangentZones 0-> %d",nbtangentzones-1);
for(Standard_Integer i=0;i<nbtangentzones;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}

View File

@@ -0,0 +1,35 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfTangentZones_HeaderFile
#define IntPolyh_ArrayOfTangentZones_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
#include <IntPolyh_StartPoint.hxx>
typedef IntPolyh_Array <IntPolyh_StartPoint> IntPolyh_ArrayOfTangentZones;
#endif

View File

@@ -1,90 +0,0 @@
-- Created on: 1999-03-08
-- Created by: Fabrice SERVANT
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ArrayOfTriangles from IntPolyh
uses
Triangle from IntPolyh
is
Create;
Create(nn : Integer from Standard) ;
Init(me: in out; nn: Integer from Standard)
is static;
GetN(me)
returns Integer from Standard
---C++: return const
is static;
NbTriangles(me)
returns Integer from Standard
---C++: return const
is static;
SetNbTriangles(me : in out; endaot: Integer from Standard)
is static;
IncNbTriangles(me: in out)
is static;
Value(me; nn: Integer from Standard)
---C++: alias operator []
---C++: return const &
returns Triangle from IntPolyh
is static;
ChangeValue(me: in out; nn: Integer from Standard)
---C++: alias operator []
---C++: return &
returns Triangle from IntPolyh
is static;
Copy(me: in out; Other : ArrayOfTriangles from IntPolyh)
---C++: alias operator =
---C++: return &
returns ArrayOfTriangles from IntPolyh
is static;
Destroy(me:in out)
---C++: alias ~
is static;
Dump(me)
is static;
DumpFleches(me)
is static;
fields
n, fintt : Integer from Standard;
ptr : Address from Standard;
end ArrayOfTriangles from IntPolyh;

View File

@@ -1,120 +0,0 @@
// Created on: 1999-03-08
// Created by: Fabrice SERVANT
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntPolyh_ArrayOfTriangles.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfTriangles::IntPolyh_ArrayOfTriangles() : n(0),fintt(0),ptr(0) { }
IntPolyh_ArrayOfTriangles::IntPolyh_ArrayOfTriangles(const Standard_Integer N): fintt(0) {
Init(N);
}
void IntPolyh_ArrayOfTriangles::Init(const Standard_Integer N) {
Destroy();
ptr = (void*) (new IntPolyh_Triangle [N]);
n=N;
}
const Standard_Integer IntPolyh_ArrayOfTriangles::GetN() const {
return(n);
}
const Standard_Integer IntPolyh_ArrayOfTriangles::NbTriangles() const {
return(fintt);
}
void IntPolyh_ArrayOfTriangles::SetNbTriangles(const Standard_Integer endaot) {
fintt=endaot;
}
void IntPolyh_ArrayOfTriangles::IncNbTriangles() {
fintt++;
}
# ifdef DEB
# define BORNES 1
# endif
const IntPolyh_Triangle& IntPolyh_ArrayOfTriangles::Value(const Standard_Integer Index) const {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur31 "<<endl;
printf("Value() from IntPolyh_ArrayOfTriangles.cxx : ERROR value out of array\n");
}
#endif
return(ptrtriangle[Index]);
}
IntPolyh_Triangle& IntPolyh_ArrayOfTriangles::ChangeValue(const Standard_Integer Index) {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur32 "<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfTriangles.cxx : ERROR value out of array\n");
}
#endif
return(ptrtriangle[Index]);
}
IntPolyh_ArrayOfTriangles & IntPolyh_ArrayOfTriangles::Copy(const IntPolyh_ArrayOfTriangles& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void *)(new IntPolyh_Triangle[n]);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfTriangles::Destroy(){
if(n) {
if(ptr) {
IntPolyh_Triangle* ptrtriangle = (IntPolyh_Triangle*)ptr;
delete [] ptrtriangle;
ptrtriangle=0;
ptr=0;
n=0;
}
}
}
void IntPolyh_ArrayOfTriangles::Dump() const{
printf("\n ArrayOfTriangles 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
((*this)[i]).Dump(i);
}
printf("\n");
}
void IntPolyh_ArrayOfTriangles::DumpFleches() const{
printf("\n ArrayOfTriangles 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
((*this)[i]).DumpFleche(i);
}
printf("\n");
}

View File

@@ -0,0 +1,36 @@
// Created on: 2012-11-13
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef IntPolyh_ArrayOfTriangles_HeaderFile
#define IntPolyh_ArrayOfTriangles_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <IntPolyh_Array.hxx>
//#include <IntPolyh_Triangle.hxx>
class IntPolyh_Triangle;
typedef IntPolyh_Array <IntPolyh_Triangle> IntPolyh_ArrayOfTriangles;
#endif

View File

@@ -27,6 +27,7 @@
#include <IntPolyh_StartPoint.hxx>
#include <IntPolyh_MaillageAffinage.hxx>
#include <IntPolyh_Couple.hxx>
#include <IntPolyh_Triangle.hxx>
#ifdef DEB
# define MYDEBUG DEB
@@ -164,8 +165,8 @@ void IntPolyh_Intersection::Perform() {
} // start from advanced
// accept result
nbsectionlines = TSectionLines.NbSectionLines();
nbtangentzones = TTangentZones.NbTangentZones();
nbsectionlines = TSectionLines.NbItems();
nbtangentzones = TTangentZones.NbItems();
// clean up
if(aPMaillageStd) delete aPMaillageStd;
@@ -293,8 +294,8 @@ Standard_Boolean IntPolyh_Intersection::PerformMaillage
// if too many intersections, consider surfaces parallel (eap)
if(FinTTC > 200 &&
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbItems() ||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbItems()) ) {
return Standard_False;
}
@@ -390,7 +391,7 @@ void IntPolyh_Intersection::MergeCouples
anArrays[3] = &anArrayRR;
for (i = 0; i < 4; i++)
aNbCouples[i] = anArrays[i]->NbCouples();
aNbCouples[i] = anArrays[i]->NbItems();
Standard_Boolean isChanged = Standard_True;
@@ -444,7 +445,7 @@ Standard_Boolean IntPolyh_Intersection::PerformStd(IntPolyh_PMaillageAffinage& M
Standard_Integer& NbCouples)
{
Standard_Boolean isdone = PerformMaillage(MaillageS);
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbCouples()) : 0;
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbItems()) : 0;
return isdone;
}
@@ -464,10 +465,10 @@ Standard_Boolean IntPolyh_Intersection::PerformAdv(IntPolyh_PMaillageAffinage& M
isdone = Standard_False;
if(isdone) {
NbCouples = MaillageFF->GetArrayOfCouples().NbCouples() +
MaillageFR->GetArrayOfCouples().NbCouples() +
MaillageRF->GetArrayOfCouples().NbCouples() +
MaillageRR->GetArrayOfCouples().NbCouples();
NbCouples = MaillageFF->GetArrayOfCouples().NbItems() +
MaillageFR->GetArrayOfCouples().NbItems() +
MaillageRF->GetArrayOfCouples().NbItems() +
MaillageRR->GetArrayOfCouples().NbItems();
if(NbCouples > 0)
MergeCouples(MaillageFF->GetArrayOfCouples(),MaillageFR->GetArrayOfCouples(),

View File

@@ -24,6 +24,7 @@
#include <IntPolyh_MaillageAffinage.hxx>
#include <IntPolyh_ArrayOfCouples.hxx>
#include <IntPolyh_Couple.hxx>
#include <IntPolyh_Triangle.hxx>
Standard_Integer MYPRINT1 = 0;
@@ -147,8 +148,8 @@ void IntPolyh_Intersection::Perform(const TColStd_Array1OfReal& Upars1,
} // start from advanced
// accept result
nbsectionlines = TSectionLines.NbSectionLines();
nbtangentzones = TTangentZones.NbTangentZones();
nbsectionlines = TSectionLines.NbItems();
nbtangentzones = TTangentZones.NbItems();
// clean up
if(aPMaillageStd) delete aPMaillageStd;
@@ -218,8 +219,8 @@ Standard_Boolean IntPolyh_Intersection::PerformMaillage(const Standard_Boolean i
Standard_Real cosa = Abs(Couples[i].AngleValue());
if(cosa > eps) ++npara;
}
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbTriangles() ) {
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbItems() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbItems() ) {
return Standard_False;
}
}
@@ -297,8 +298,8 @@ Standard_Boolean IntPolyh_Intersection::PerformMaillage(const TColStd_Array1OfRe
Standard_Real cosa = Abs(Couples[i].AngleValue());
if(cosa > eps) ++npara;
}
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbTriangles() ) {
if(npara >= theMaillageS->GetArrayOfTriangles(1).NbItems() ||
npara >= theMaillageS->GetArrayOfTriangles(2).NbItems() ) {
return Standard_False;
}
}
@@ -339,10 +340,10 @@ Standard_Boolean IntPolyh_Intersection::PerformAdv(const TColStd_Array1OfReal& U
isdone = Standard_False;
if(isdone) {
NbCouples = MaillageFF->GetArrayOfCouples().NbCouples() +
MaillageFR->GetArrayOfCouples().NbCouples() +
MaillageRF->GetArrayOfCouples().NbCouples() +
MaillageRR->GetArrayOfCouples().NbCouples();
NbCouples = MaillageFF->GetArrayOfCouples().NbItems() +
MaillageFR->GetArrayOfCouples().NbItems() +
MaillageRF->GetArrayOfCouples().NbItems() +
MaillageRR->GetArrayOfCouples().NbItems();
if(NbCouples > 0)
MergeCouples(MaillageFF->GetArrayOfCouples(),MaillageFR->GetArrayOfCouples(),
@@ -364,6 +365,6 @@ Standard_Boolean IntPolyh_Intersection::PerformStd(const TColStd_Array1OfReal& U
{
Standard_Boolean isdone = PerformMaillage(Upars1, Vpars1, Upars2, Vpars2,
MaillageS);
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbCouples()) : 0;
NbCouples = (isdone) ? (MaillageS->GetArrayOfCouples().NbItems()) : 0;
return isdone;
}

View File

@@ -126,7 +126,6 @@ static
IntPolyh_StartPoint & SP,
const Standard_Boolean Prepend=Standard_False);
//modified by NIZNHY-PKV Fri Jan 20 11:01:30 2012f
static
Standard_Boolean IsDegenerated(const Handle(Adaptor3d_HSurface)& aS,
const Standard_Integer aIndex,
@@ -139,8 +138,13 @@ static
const Standard_Integer aIsoDirection,
Standard_Integer& aI1,
Standard_Integer& aI2);
//modified by NIZNHY-PKV Fri Jan 20 11:01:32 2012t
static
void EnlargeZone(const Handle(Adaptor3d_HSurface)& MaSurface,
Standard_Real &u0,
Standard_Real &u1,
Standard_Real &v0,
Standard_Real &v1);
//=======================================================================
//function : IntPolyh_MaillageAffinage
//purpose :
@@ -218,11 +222,10 @@ IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage
void IntPolyh_MaillageAffinage::FillArrayOfPnt
(const Standard_Integer SurfID)
{
Standard_Integer NbSamplesU, NbSamplesV;
Standard_Real u0, u1, v0, v1;
Handle(Adaptor3d_HSurface) MaSurface;
Standard_Integer NbSamplesU, NbSamplesV, i, aNbSamplesU1, aNbSamplesV1;
Standard_Real u0, u1, v0, v1, aU, aV, dU, dV;
//
MaSurface=(SurfID==1)? MaSurface1:MaSurface2;
const Handle(Adaptor3d_HSurface&) MaSurface=(SurfID==1)? MaSurface1 : MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
@@ -232,60 +235,36 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
v0 = (MaSurface)->FirstVParameter();
v1 = (MaSurface)->LastVParameter();
if(myEnlargeZone) {
if(MaSurface->GetType() == GeomAbs_BSplineSurface ||
MaSurface->GetType() == GeomAbs_BezierSurface) {
if((!MaSurface->IsUClosed() && !MaSurface->IsUPeriodic()) &&
(Abs(u0) < 1.e+100 && Abs(u1) < 1.e+100) ) {
Standard_Real delta_u = Abs(u1 - u0) / 100.;
u0 -= delta_u;
u1 += delta_u;
}
if((!MaSurface->IsVClosed() && !MaSurface->IsVPeriodic()) &&
(Abs(v0) < 1.e+100 && Abs(v1) < 1.e+100) ) {
Standard_Real delta_v = Abs(v1 - v0) / 100.;
v0 -= delta_v;
v1 += delta_v;
}
}
if(myEnlargeZone) {
EnlargeZone(MaSurface, u0, u1, v0, v1);
}
//
Standard_Integer iCnt, BoucleU, BoucleV;
Standard_Real itU, itV, U, V, Tol;
Bnd_Box *PtrBox;
gp_Pnt PtXYZ;
TColStd_Array1OfReal aUpars(1, NbSamplesU);
TColStd_Array1OfReal aVpars(1, NbSamplesV);
//
iCnt=0;
itU=(u1-u0)/Standard_Real(NbSamplesU-1);
itV=(v1-v0)/Standard_Real(NbSamplesV-1);
PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2);
for(BoucleU=0; BoucleU<NbSamplesU; BoucleU++){
U = (BoucleU == (NbSamplesU - 1)) ? u1 : u0+BoucleU*itU;
for(BoucleV=0; BoucleV<NbSamplesV; BoucleV++){
V = (BoucleV == (NbSamplesV - 1)) ? v1 : v0+BoucleV*itV;
PtXYZ = (MaSurface)->Value(U,V);
IntPolyh_Point& aIPnt=TPoints[iCnt];
aIPnt.Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V);
iCnt++;
PtrBox->Add(PtXYZ);
aNbSamplesU1=NbSamplesU-1;
aNbSamplesV1=NbSamplesV-1;
//
dU=(u1-u0)/Standard_Real(aNbSamplesU1);
dV=(v1-v0)/Standard_Real(aNbSamplesV1);
//
for (i=0; i<NbSamplesU; ++i) {
aU=u0+i*dU;
if (i==aNbSamplesU1) {
aU=u1;
}
aUpars.SetValue(i+1, aU);
}
TPoints.SetNbPoints(iCnt);
//
IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface,
NbSamplesU,
NbSamplesV,
u0,v0,
u1,v1);
Tol=polyhedron.DeflectionOverEstimation();
Tol*=1.2;
for (i=0; i<NbSamplesV; ++i) {
aV=v0+i*dV;
if (i==aNbSamplesV1) {
aV=v1;
}
aVpars.SetValue(i+1, aV);
}
//
Standard_Real a1,a2,a3,b1,b2,b3;
//
PtrBox->Get(a1,a2,a3,b1,b2,b3);
PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol);
PtrBox->Enlarge(MyTolerance);
FillArrayOfPnt(SurfID, aUpars, aVpars);
}
//=======================================================================
//function : FillArrayOfPnt
@@ -296,86 +275,48 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
(const Standard_Integer SurfID,
const Standard_Boolean isShiftFwd)
{
Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2;
Standard_Integer NbSamplesU, NbSamplesV, i, aNbSamplesU1, aNbSamplesV1;
Standard_Real u0, u1, v0, v1, aU, aV, dU, dV;
const Handle(Adaptor3d_HSurface)& MaSurface=(SurfID==1)? MaSurface1 : MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2;
NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2;
Standard_Real u0 = (MaSurface)->FirstUParameter();
Standard_Real u1 = (MaSurface)->LastUParameter();
Standard_Real v0 = (MaSurface)->FirstVParameter();
Standard_Real v1 = (MaSurface)->LastVParameter();
u0 = (MaSurface)->FirstUParameter();
u1 = (MaSurface)->LastUParameter();
v0 = (MaSurface)->FirstVParameter();
v1 = (MaSurface)->LastVParameter();
if(myEnlargeZone) {
if(MaSurface->GetType() == GeomAbs_BSplineSurface ||
MaSurface->GetType() == GeomAbs_BezierSurface) {
if((!MaSurface->IsUClosed() && !MaSurface->IsUPeriodic()) &&
(Abs(u0) < 1.e+100 && Abs(u1) < 1.e+100) ) {
Standard_Real delta_u = Abs(u1 - u0) / 100.;
u0 -= delta_u;
u1 += delta_u;
}
if((!MaSurface->IsVClosed() && !MaSurface->IsVPeriodic()) &&
(Abs(v0) < 1.e+100 && Abs(v1) < 1.e+100) ) {
Standard_Real delta_v = Abs(v1 - v0) / 100.;
v0 -= delta_v;
v1 += delta_v;
}
}
EnlargeZone(MaSurface, u0, u1, v0, v1);
}
IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface,
NbSamplesU,
NbSamplesV,
u0,v0,
u1,v1);
Standard_Real Tol=polyhedron.DeflectionOverEstimation();
Standard_Integer CpteurTabPnt=0;
Standard_Real itU=(u1-u0)/Standard_Real(NbSamplesU-1);
Standard_Real itV=(v1-v0)/Standard_Real(NbSamplesV-1);
Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2);
Standard_Real resol = gp::Resolution();
for(Standard_Integer BoucleU=0; BoucleU<NbSamplesU; BoucleU++){
Standard_Real U = (BoucleU == (NbSamplesU - 1)) ? u1 : u0+BoucleU*itU;
for(Standard_Integer BoucleV=0; BoucleV<NbSamplesV; BoucleV++){
Standard_Real V = (BoucleV == (NbSamplesV - 1)) ? v1 : v0+BoucleV*itV;
gp_Pnt PtXYZ;
gp_Vec aDU;
gp_Vec aDV;
gp_Vec aNorm;
MaSurface->D1(U, V, PtXYZ, aDU, aDV);
aNorm = aDU.Crossed(aDV);
Standard_Real aMag = aNorm.Magnitude();
if (aMag > resol) {
aNorm /= aMag;
aNorm.Multiply(Tol*1.5);
if (isShiftFwd)
PtXYZ.Translate(aNorm);
else
PtXYZ.Translate(aNorm.Reversed());
}
(TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V);
CpteurTabPnt++;
PtrBox->Add(PtXYZ);
//
TColStd_Array1OfReal aUpars(1, NbSamplesU);
TColStd_Array1OfReal aVpars(1, NbSamplesV);
//
aNbSamplesU1=NbSamplesU-1;
aNbSamplesV1=NbSamplesV-1;
//
dU=(u1-u0)/Standard_Real(aNbSamplesU1);
dV=(v1-v0)/Standard_Real(aNbSamplesV1);
//
for (i=0; i<NbSamplesU; ++i) {
aU=u0+i*dU;
if (i==aNbSamplesU1) {
aU=u1;
}
aUpars.SetValue(i+1, aU);
}
TPoints.SetNbPoints(CpteurTabPnt);
Tol*=1.2;
Standard_Real a1,a2,a3,b1,b2,b3;
PtrBox->Get(a1,a2,a3,b1,b2,b3);
PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol);
PtrBox->Enlarge(MyTolerance);
//
for (i=0; i<NbSamplesV; ++i) {
aV=v0+i*dV;
if (i==aNbSamplesV1) {
aV=v1;
}
aVpars.SetValue(i+1, aV);
}
//
FillArrayOfPnt(SurfID, isShiftFwd, aUpars, aVpars);
}
//=======================================================================
//function : FillArrayOfPnt
@@ -398,7 +339,6 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
Handle(Adaptor3d_HSurface)& aS=(SurfID==1)? MaSurface1:MaSurface2;
IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2;
//
//modified by NIZNHY-PKV Fri Jan 20 09:48:57 2012f
aJD1=0;
aJD2=0;
aID1=0;
@@ -407,13 +347,10 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
if (!(aJD1 || aJD2)) {
DegeneratedIndex(Upars, aNbU, aS, 2, aID1, aID2);
}
//modified by NIZNHY-PKV Fri Jan 20 09:49:00 2012t
//
iCnt=0;
for(i=1; i<=aNbU; ++i){
//modified by NIZNHY-PKV Fri Jan 20 13:59:15 2012f
bDegI=(aID1==i || aID2==i);
//modified by NIZNHY-PKV Fri Jan 20 13:59:17 2012t
aU=Upars(i);
for(j=1; j<=aNbV; ++j){
aV=Vpars(j);
@@ -422,18 +359,16 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
IntPolyh_Point& aIP=TPoints[iCnt];
aIP.Set(aX, aY, aZ, aU, aV);
//
//modified by NIZNHY-PKV Fri Jan 20 13:59:06 2012f
bDeg=bDegI || (aJD1==j || aJD2==j);
if (bDeg) {
aIP.SetDegenerated(bDeg);
}
//modified by NIZNHY-PKV Fri Jan 20 13:59:02 2012t
++iCnt;
aBox.Add(aP);
}
}
//
TPoints.SetNbPoints(iCnt);
TPoints.SetNbItems(iCnt);
//
IntCurveSurface_ThePolyhedronOfHInter polyhedron(aS, Upars, Vpars);
//
@@ -480,7 +415,6 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
//
IntCurveSurface_ThePolyhedronOfHInter polyhedron(aS, Upars, Vpars);
Tol=polyhedron.DeflectionOverEstimation();
//modified by NIZNHY-PKV Fri Jan 20 09:48:57 2012f
aJD1=0;
aJD2=0;
aID1=0;
@@ -489,13 +423,10 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
if (!(aJD1 || aJD2)) {
DegeneratedIndex(Upars, aNbU, aS, 2, aID1, aID2);
}
//modified by NIZNHY-PKV Fri Jan 20 09:49:00 2012t
//
iCnt=0;
for(i=1; i<=aNbU; ++i){
//modified by NIZNHY-PKV Fri Jan 20 13:59:15 2012f
bDegI=(aID1==i || aID2==i);
//modified by NIZNHY-PKV Fri Jan 20 13:59:17 2012t
aU = Upars(i);
for(j=1; j<=aNbV; ++j){
aV = Vpars(j);
@@ -519,18 +450,16 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt
aP.Coord(aX, aY, aZ);
aIP.Set(aX, aY, aZ, aU, aV);
//
//modified by NIZNHY-PKV Fri Jan 20 13:59:06 2012f
bDeg=bDegI || (aJD1==j || aJD2==j);
if (bDeg) {
aIP.SetDegenerated(bDeg);
}
//modified by NIZNHY-PKV Fri Jan 20 13:59:02 2012t
++iCnt;
aBox.Add(aP);
}
}
//
TPoints.SetNbPoints(iCnt);
TPoints.SetNbItems(iCnt);
//
Tol*=1.2;
//
@@ -612,7 +541,7 @@ void IntPolyh_MaillageAffinage::CommonBox (const Bnd_Box &,
ZMin-=Z; ZMax+=Z;
//Marking of points included in the common
const Standard_Integer FinTP1 = TPoints1.NbPoints();
const Standard_Integer FinTP1 = TPoints1.NbItems();
// for(Standard_Integer i=0; i<FinTP1; i++) {
Standard_Integer i ;
for( i=0; i<FinTP1; i++) {
@@ -646,7 +575,7 @@ void IntPolyh_MaillageAffinage::CommonBox (const Bnd_Box &,
Pt1.SetPartOfCommon(r);
}
const Standard_Integer FinTP2 = TPoints2.NbPoints();
const Standard_Integer FinTP2 = TPoints2.NbItems();
for(Standard_Integer ii=0; ii<FinTP2; ii++) {
IntPolyh_Point & Pt2 = TPoints2[ii];
Standard_Integer rr;
@@ -806,7 +735,7 @@ void IntPolyh_MaillageAffinage::FillArrayOfEdges
TEdges[CpteurTabEdges].SetSecondTriangle(BoucleMeshV*2*(NbSamplesV-1)+(NbSamplesV-2)*2);
CpteurTabEdges++;
}
TEdges.SetNbEdges(CpteurTabEdges);
TEdges.SetNbItems(CpteurTabEdges);
}
@@ -865,8 +794,8 @@ void IntPolyh_MaillageAffinage::FillArrayOfTriangles
}
PntInit++;//Pass the last point of the column
}
TTriangles.SetNbTriangles(CpteurTabTriangles);
const Standard_Integer FinTT = TTriangles.NbTriangles();
TTriangles.SetNbItems(CpteurTabTriangles);
const Standard_Integer FinTT = TTriangles.NbItems();
if (FinTT==0) {
}
}
@@ -877,8 +806,8 @@ void IntPolyh_MaillageAffinage::FillArrayOfTriangles
//=======================================================================
void IntPolyh_MaillageAffinage::LinkEdges2Triangles()
{
const Standard_Integer FinTT1 = TTriangles1.NbTriangles();
const Standard_Integer FinTT2 = TTriangles2.NbTriangles();
const Standard_Integer FinTT1 = TTriangles1.NbItems();
const Standard_Integer FinTT2 = TTriangles2.NbItems();
for(Standard_Integer uiui1=0; uiui1<FinTT1; uiui1++) {
IntPolyh_Triangle & MyTriangle1=TTriangles1[uiui1];
@@ -904,13 +833,13 @@ void IntPolyh_MaillageAffinage::LinkEdges2Triangles()
//=======================================================================
void IntPolyh_MaillageAffinage::CommonPartRefinement()
{
Standard_Integer FinInit1 = TTriangles1.NbTriangles();
Standard_Integer FinInit1 = TTriangles1.NbItems();
for(Standard_Integer i=0; i<FinInit1; i++) {
if(TTriangles1[i].IndiceIntersectionPossible()!=0)
TTriangles1[i].MiddleRefinement(i,MaSurface1,TPoints1,TTriangles1,TEdges1);
}
Standard_Integer FinInit2=TTriangles2.NbTriangles();
Standard_Integer FinInit2=TTriangles2.NbItems();
for(Standard_Integer ii=0; ii<FinInit2; ii++) {
if(TTriangles2[ii].IndiceIntersectionPossible()!=0)
TTriangles2[ii].MiddleRefinement(ii,MaSurface2,TPoints2,TTriangles2,TEdges2);
@@ -924,7 +853,7 @@ void IntPolyh_MaillageAffinage::CommonPartRefinement()
void IntPolyh_MaillageAffinage::LocalSurfaceRefinement(const Standard_Integer SurfID) {
//refine locally, but systematically the chosen surface
if (SurfID==1) {
const Standard_Integer FinInit1 = TTriangles1.NbTriangles();
const Standard_Integer FinInit1 = TTriangles1.NbItems();
for(Standard_Integer i=0; i<FinInit1; i++) {
if(TTriangles1[i].IndiceIntersectionPossible()!=0)
TTriangles1[i].MiddleRefinement(i,MaSurface1,TPoints1,TTriangles1,TEdges1);
@@ -932,7 +861,7 @@ void IntPolyh_MaillageAffinage::LocalSurfaceRefinement(const Standard_Integer Su
}
//
if (SurfID==2) {
const Standard_Integer FinInit2 = TTriangles2.NbTriangles();
const Standard_Integer FinInit2 = TTriangles2.NbItems();
for(Standard_Integer ii=0; ii<FinInit2; ii++) {
if(TTriangles2[ii].IndiceIntersectionPossible()!=0)
TTriangles2[ii].MiddleRefinement(ii,MaSurface2,TPoints2,TTriangles2,TEdges2);
@@ -962,7 +891,7 @@ void IntPolyh_MaillageAffinage::ComputeDeflections
FlecheMax=-RealLast();
FlecheMin=RealLast();
FlecheMoy=0.0;
const Standard_Integer FinTT = TTriangles.NbTriangles();
const Standard_Integer FinTT = TTriangles.NbItems();
for(CpteurTabFleche=0; CpteurTabFleche<FinTT; CpteurTabFleche++) {
IntPolyh_Triangle &Triangle = TTriangles[CpteurTabFleche];
@@ -990,8 +919,8 @@ void IntPolyh_MaillageAffinage::ComputeDeflections
//=======================================================================
void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB()
{
const Standard_Integer FinTT1 = TTriangles1.NbTriangles();
const Standard_Integer FinTT2 = TTriangles2.NbTriangles();
const Standard_Integer FinTT1 = TTriangles1.NbItems();
const Standard_Integer FinTT2 = TTriangles2.NbItems();
ComputeDeflections(1);
// To estimate a surface in general it can be interesting
@@ -3216,8 +3145,8 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP ()
Standard_Integer CpteurTab=0;
Standard_Integer CpteurTabSP=0;
Standard_Real CoupleAngle=-2.0;
const Standard_Integer FinTT1 = TTriangles1.NbTriangles();
const Standard_Integer FinTT2 = TTriangles2.NbTriangles();
const Standard_Integer FinTT1 = TTriangles1.NbItems();
const Standard_Integer FinTT2 = TTriangles2.NbItems();
for(Standard_Integer i_S1=0; i_S1<FinTT1; i_S1++) {
for(Standard_Integer i_S2=0; i_S2<FinTT2; i_S2++){
@@ -3227,15 +3156,32 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP ()
&& (TTriangles2[i_S2].GetFleche() >= 0.0) ) {
IntPolyh_StartPoint SP1, SP2;
//If a triangle is dead or not in BSB, comparison is not possible
if (TriContact(TPoints1[TTriangles1[i_S1].FirstPoint()],
TPoints1[TTriangles1[i_S1].SecondPoint()],
TPoints1[TTriangles1[i_S1].ThirdPoint()],
TPoints2[TTriangles2[i_S2].FirstPoint()],
TPoints2[TTriangles2[i_S2].SecondPoint()],
TPoints2[TTriangles2[i_S2].ThirdPoint()],
CoupleAngle)){
//
Standard_Integer iDeg1, iDeg2, iDeg3, iDeg;
//
const IntPolyh_Point& P1=TPoints1[TTriangles1[i_S1].FirstPoint()];
const IntPolyh_Point& P2=TPoints1[TTriangles1[i_S1].SecondPoint()];
const IntPolyh_Point& P3=TPoints1[TTriangles1[i_S1].ThirdPoint()];
iDeg1=(P1.Degenerated()) ? 1 : 0;
iDeg2=(P2.Degenerated()) ? 1 : 0;
iDeg3=(P3.Degenerated()) ? 1 : 0;
iDeg=iDeg1+iDeg2+iDeg3;
if (iDeg>1) {
continue;
}
//
const IntPolyh_Point& Q1=TPoints2[TTriangles2[i_S2].FirstPoint()];
const IntPolyh_Point& Q2=TPoints2[TTriangles2[i_S2].SecondPoint()];
const IntPolyh_Point& Q3=TPoints2[TTriangles2[i_S2].ThirdPoint()];
iDeg1=(Q1.Degenerated()) ? 1 : 0;
iDeg2=(Q2.Degenerated()) ? 1 : 0;
iDeg3=(Q3.Degenerated()) ? 1 : 0;
iDeg=iDeg1+iDeg2+iDeg3;
if (iDeg>1) {
continue;
}
//
if (TriContact(P1, P2, P3, Q1, Q2, Q3, CoupleAngle)) {
TTriangles1[i_S1].SetIndiceIntersection(1);//The triangle is cut by another
TTriangles2[i_S2].SetIndiceIntersection(1);
@@ -3283,8 +3229,8 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare ()
{
Standard_Integer CpteurTab=0;
const Standard_Integer FinTT1 = TTriangles1.NbTriangles();
const Standard_Integer FinTT2 = TTriangles2.NbTriangles();
const Standard_Integer FinTT1 = TTriangles1.NbItems();
const Standard_Integer FinTT2 = TTriangles2.NbItems();
Standard_Integer TTClimit = 200;
Standard_Integer NbTTC = FinTT1 * FinTT2 / 10;
@@ -3304,18 +3250,35 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare ()
//If a triangle is dead or not in BSB, comparison is not possible
IntPolyh_Triangle &Triangle1 = TTriangles1[i_S1];
IntPolyh_Triangle &Triangle2 = TTriangles2[i_S2];
if (TriContact(TPoints1[Triangle1.FirstPoint()],
TPoints1[Triangle1.SecondPoint()],
TPoints1[Triangle1.ThirdPoint()],
TPoints2[Triangle2.FirstPoint()],
TPoints2[Triangle2.SecondPoint()],
TPoints2[Triangle2.ThirdPoint()],
CoupleAngle)){
//
Standard_Integer iDeg1, iDeg2, iDeg3, iDeg;
//
const IntPolyh_Point& P1=TPoints1[Triangle1.FirstPoint()];
const IntPolyh_Point& P2=TPoints1[Triangle1.SecondPoint()];
const IntPolyh_Point& P3=TPoints1[Triangle1.ThirdPoint()];
iDeg1=(P1.Degenerated()) ? 1 : 0;
iDeg2=(P2.Degenerated()) ? 1 : 0;
iDeg3=(P3.Degenerated()) ? 1 : 0;
iDeg=iDeg1+iDeg2+iDeg3;
if (iDeg>1) {
continue;
}
//
const IntPolyh_Point& Q1=TPoints2[Triangle2.FirstPoint()];
const IntPolyh_Point& Q2=TPoints2[Triangle2.SecondPoint()];
const IntPolyh_Point& Q3=TPoints2[Triangle2.ThirdPoint()];
iDeg1=(Q1.Degenerated()) ? 1 : 0;
iDeg2=(Q2.Degenerated()) ? 1 : 0;
iDeg3=(Q3.Degenerated()) ? 1 : 0;
iDeg=iDeg1+iDeg2+iDeg3;
if (iDeg>1) {
continue;
}
//
if (TriContact(P1, P2, P3, Q1, Q2, Q3, CoupleAngle)) {
if (CpteurTab >= NbTTC)
{
TTrianglesContacts.SetNbCouples(CpteurTab);
TTrianglesContacts.SetNbItems(CpteurTab);
return(CpteurTab);
}
@@ -3330,7 +3293,7 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare ()
}
}
}
TTrianglesContacts.SetNbCouples(CpteurTab);
TTrianglesContacts.SetNbItems(CpteurTab);
return(CpteurTab);
}
@@ -3342,7 +3305,7 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare ()
//=======================================================================
void IntPolyh_MaillageAffinage::StartPointsCalcul() const
{
const Standard_Integer FinTTC = TTrianglesContacts.NbCouples();
const Standard_Integer FinTTC = TTrianglesContacts.NbItems();
// printf("StartPointsCalcul() from IntPolyh_MaillageAffinage.cxx : StartPoints:\n");
for(Standard_Integer ii=0; ii<FinTTC; ii++) {
IntPolyh_StartPoint SP1,SP2;
@@ -3364,7 +3327,7 @@ Standard_Integer CheckCoupleAndGetAngle(const Standard_Integer T1,
IntPolyh_ArrayOfCouples &TTrianglesContacts)
{
Standard_Integer Test=0;
const Standard_Integer FinTTC = TTrianglesContacts.NbCouples();
const Standard_Integer FinTTC = TTrianglesContacts.NbItems();
for (Standard_Integer oioi=0; oioi<FinTTC; oioi++) {
IntPolyh_Couple TestCouple = TTrianglesContacts[oioi];
if ( (TestCouple.FirstValue()==T1)&&(TestCouple.AnalyseFlagValue()!=1) ) {
@@ -3398,7 +3361,7 @@ Standard_Integer CheckCoupleAndGetAngle2(const Standard_Integer T1,
Standard_Integer Test1=0;
Standard_Integer Test2=0;
Standard_Integer Test3=0;
const Standard_Integer FinTTC = TTrianglesContacts.NbCouples();
const Standard_Integer FinTTC = TTrianglesContacts.NbItems();
for (Standard_Integer oioi=0; oioi<FinTTC; oioi++) {
IntPolyh_Couple TestCouple = TTrianglesContacts[oioi];
if( (Test1==0)||(Test2==0)||(Test3==0) ) {
@@ -3442,7 +3405,7 @@ Standard_Integer CheckNextStartPoint(IntPolyh_SectionLine & SectionLine,
if( (SP.E1()==-1)||(SP.E2()==-1) ) {
//The tops of triangle are analyzed
//It is checked if they are not in the array TTangentZones
Standard_Integer FinTTZ=TTangentZones.NbTangentZones();
Standard_Integer FinTTZ=TTangentZones.NbItems();
for(Standard_Integer uiui=0; uiui<FinTTZ; uiui++) {
IntPolyh_StartPoint TestSP=TTangentZones[uiui];
if ( (Abs(SP.U1()-TestSP.U1())<MyConfusionPrecision)
@@ -3457,7 +3420,7 @@ Standard_Integer CheckNextStartPoint(IntPolyh_SectionLine & SectionLine,
if (Test) {//the top does not belong to the list of TangentZones
SP.SetChainList(-1);
TTangentZones[FinTTZ]=SP;
TTangentZones.IncrementNbTangentZones();
TTangentZones.IncrementNbItems();
Test=0;//the examined point is a top
}
}
@@ -3486,7 +3449,7 @@ Standard_Integer IntPolyh_MaillageAffinage::StartPointsChain
IntPolyh_ArrayOfTangentZones& TTangentZones)
{
//Loop on the array of couples filled in the function COMPARE()
const Standard_Integer FinTTC = TTrianglesContacts.NbCouples();
const Standard_Integer FinTTC = TTrianglesContacts.NbItems();
//Array of tops of triangles
for(Standard_Integer IndexA=0; IndexA<FinTTC; IndexA++) {
@@ -3494,14 +3457,14 @@ Standard_Integer IntPolyh_MaillageAffinage::StartPointsChain
//It is checked if the couple of triangles has not been already examined.
if(TTrianglesContacts[IndexA].AnalyseFlagValue()!=1) {
Standard_Integer SectionLineIndex=TSectionLines.NbSectionLines();
Standard_Integer SectionLineIndex=TSectionLines.NbItems();
// fill last section line if still empty (eap)
if (SectionLineIndex > 0
&&
TSectionLines[SectionLineIndex-1].NbStartPoints() == 0)
SectionLineIndex -= 1;
else
TSectionLines.IncrementNbSectionLines();
TSectionLines.IncrementNbItems();
IntPolyh_SectionLine & MySectionLine=TSectionLines[SectionLineIndex];
if (MySectionLine.GetN() == 0) // eap
@@ -3559,8 +3522,8 @@ Standard_Integer IntPolyh_MaillageAffinage::StartPointsChain
}
else {
if(NbPoints11>1) {//The point is input in the array TTangentZones
TTangentZones[TTangentZones.NbTangentZones()]=SP11;//default list number = -1
TTangentZones.IncrementNbTangentZones();
TTangentZones[TTangentZones.NbItems()]=SP11;//default list number = -1
TTangentZones.IncrementNbItems();
}
else {
@@ -3606,8 +3569,8 @@ Standard_Integer IntPolyh_MaillageAffinage::StartPointsChain
else {
if(NbPoints12>1) {//The points are input in the array TTangentZones
TTangentZones[TTangentZones.NbTangentZones()]=SP12;//default list number = -1
TTangentZones.IncrementNbTangentZones();
TTangentZones[TTangentZones.NbItems()]=SP12;//default list number = -1
TTangentZones.IncrementNbItems();
}
else {
@@ -3878,7 +3841,6 @@ Standard_Boolean IntPolyh_MaillageAffinage::GetEnlargeZone() const
{
return myEnlargeZone;
}
//modified by NIZNHY-PKV Fri Jan 20 10:06:13 2012f
//=======================================================================
//function : DegeneratedIndex
//purpose :
@@ -4000,9 +3962,34 @@ Standard_Boolean IsDegenerated(const Handle(Adaptor3d_HSurface)& aS,
//
return bRet;
}
//modified by NIZNHY-PKV Fri Jan 20 10:06:15 2012t
#ifdef DEB
//=======================================================================
//function : EnlargeZone
//purpose :
//=======================================================================
void EnlargeZone(const Handle(Adaptor3d_HSurface)& MaSurface,
Standard_Real &u0,
Standard_Real &u1,
Standard_Real &v0,
Standard_Real &v1)
{
if(MaSurface->GetType() == GeomAbs_BSplineSurface ||
MaSurface->GetType() == GeomAbs_BezierSurface) {
if((!MaSurface->IsUClosed() && !MaSurface->IsUPeriodic()) &&
(Abs(u0) < 1.e+100 && Abs(u1) < 1.e+100) ) {
Standard_Real delta_u = 0.01*Abs(u1 - u0);
u0 -= delta_u;
u1 += delta_u;
}
if((!MaSurface->IsVClosed() && !MaSurface->IsVPeriodic()) &&
(Abs(v0) < 1.e+100 && Abs(v1) < 1.e+100) ) {
Standard_Real delta_v = 0.01*Abs(v1 - v0);
v0 -= delta_v;
v1 += delta_v;
}
}
}
#ifdef DEB
#include <TopoDS_Shape.hxx>
#include <Poly_Triangulation.hxx>
#include <TColgp_Array1OfPnt.hxx>
@@ -4018,19 +4005,19 @@ static TopoDS_Shape TriangleShape(const IntPolyh_ArrayOfTriangles & TTriangles,
const IntPolyh_ArrayOfPoints & TPoints)
{
TopoDS_Face aFace;
if (TPoints.NbPoints() < 1 || TTriangles.NbTriangles() < 1) return aFace;
if (TPoints.NbItems() < 1 || TTriangles.NbItems() < 1) return aFace;
Handle(Poly_Triangulation) aPTriangulation =
new Poly_Triangulation(TPoints.NbPoints(),TTriangles.NbTriangles(),Standard_False);
new Poly_Triangulation(TPoints.NbItems(),TTriangles.NbItems(),Standard_False);
TColgp_Array1OfPnt & aPNodes = aPTriangulation->ChangeNodes();
Poly_Array1OfTriangle & aPTrialgles = aPTriangulation->ChangeTriangles();
Standard_Integer i;
for (i=0; i<TPoints.NbPoints(); i++) {
for (i=0; i<TPoints.NbItems(); i++) {
const IntPolyh_Point& P = TPoints[i];
aPNodes(i+1).SetCoord(P.X(), P.Y(), P.Z());
}
for (i=0; i<TTriangles.NbTriangles(); i++) {
for (i=0; i<TTriangles.NbItems(); i++) {
const IntPolyh_Triangle& T = TTriangles[i];
aPTrialgles(i+1).Set(T.FirstPoint()+1, T.SecondPoint()+1, T.ThirdPoint()+1);
}

View File

@@ -558,12 +558,12 @@ void NewTriangle(const Standard_Integer P1,
IntPolyh_ArrayOfTriangles &TTriangles,
const Handle(Adaptor3d_HSurface)& MySurface,
IntPolyh_ArrayOfPoints &TPoints) {
const Standard_Integer FinTT = TTriangles.NbTriangles();
const Standard_Integer FinTT = TTriangles.NbItems();
TTriangles[FinTT].SetFirstPoint(P1);
TTriangles[FinTT].SetSecondPoint(P2);
TTriangles[FinTT].SetThirdPoint(P3);
TTriangles[FinTT].TriangleDeflection(MySurface, TPoints);
TTriangles.IncNbTriangles();
TTriangles.IncrementNbItems();
}
//=======================================================================
@@ -577,13 +577,13 @@ void NewEdge(const Standard_Integer P1,
IntPolyh_ArrayOfEdges & TEdges)
{
const Standard_Integer FinTE = TEdges.NbEdges();
const Standard_Integer FinTE = TEdges.NbItems();
TEdges[FinTE].SetFirstPoint(P1);
TEdges[FinTE].SetSecondPoint(P2);
TEdges[FinTE].SetFirstTriangle(T1);
TEdges[FinTE].SetSecondTriangle(T2);
TEdges.IncNbEdges();
TEdges.IncrementNbItems();
}
//=======================================================================
@@ -649,8 +649,8 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
Standard_Integer FinTE = TEdges.NbEdges();
Standard_Integer FinTT = TTriangles.NbTriangles();
Standard_Integer FinTE = TEdges.NbItems();
Standard_Integer FinTT = TTriangles.NbItems();
///Raffinage de la maille et de ses voisines par le milieu du plus grand des cotes
@@ -670,7 +670,7 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
Standard_Real L31 = P3.SquareDistance(P1);
if ((L12>L23) && (L12>L31)) {
const Standard_Integer FinTP = TPoints.NbPoints();
const Standard_Integer FinTP = TPoints.NbItems();
(TPoints[FinTP]).Middle( MySurface,P1, P2);
///les nouveaux triangles
@@ -758,7 +758,7 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
}
else if ((L23>L31) && (L23>L12)){
const Standard_Integer FinTP = TPoints.NbPoints();
const Standard_Integer FinTP = TPoints.NbItems();
(TPoints[FinTP]).Middle(MySurface, P2,P3);
///les nouveaux triangles
@@ -844,7 +844,7 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
}
}
else {
const Standard_Integer FinTP = TPoints.NbPoints();
const Standard_Integer FinTP = TPoints.NbItems();
(TPoints[FinTP]).Middle(MySurface, P3,P1);
Standard_Integer T1,T2,T3,T4;
@@ -934,7 +934,7 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri,
Fleche=-1.0;
IP=0;
TPoints.IncNbPoints();
TPoints.IncrementNbItems();
}
//=======================================================================
@@ -948,7 +948,7 @@ void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffina
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
const Standard_Integer FinTTInit = TTriangles.NbTriangles();
const Standard_Integer FinTTInit = TTriangles.NbItems();
//On sait qu'il faut affiner au moins une fois
TTriangles[NumTri].MiddleRefinement(NumTri,MySurface,TPoints,
@@ -1020,16 +1020,16 @@ void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAff
IntPolyh_ArrayOfTriangles &TTriangles,
IntPolyh_ArrayOfEdges & TEdges) {
const Standard_Integer FinTTInit = TTriangles.NbTriangles();
const Standard_Integer FinTTInit = TTriangles.NbItems();
Standard_Integer CritereArret=FinTTInit+250;
//On sait qu'il faut affiner une fois au moins
MiddleRefinement(NumTri,MySurface,TPoints,
TTriangles,TEdges);
Standard_Integer FinTT = TTriangles.NbTriangles();// FinTT n'est pas une constante, elle augmente avec l'affinage
Standard_Integer FinTT = TTriangles.NbItems();// FinTT n'est pas une constante, elle augmente avec l'affinage
for(Standard_Integer iii=FinTTInit; iii<(FinTT=TTriangles.NbTriangles()); iii++) {
for(Standard_Integer iii=FinTTInit; iii<(FinTT=TTriangles.NbItems()); iii++) {
IntPolyh_Triangle& TriangleCourant = TTriangles[iii];
if(TriangleCourant.CompareBoxTriangle(b,TPoints)==0)
//On n'affine pas le triangle
@@ -1049,7 +1049,7 @@ void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAff
//=======================================================================
void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex,
const IntPolyh_ArrayOfEdges &TEdges) {
const Standard_Integer FinTE = TEdges.NbEdges();
const Standard_Integer FinTE = TEdges.NbItems();
Standard_Integer PE1 =0,PE2 =0;

1
src/IntTools/FILES Normal file
View File

@@ -0,0 +1 @@
IntTools_EdgeEdge_1.cxx

View File

@@ -54,6 +54,7 @@
#include <IntTools_Tools.hxx>
#include <IntTools_BeanBeanIntersector.hxx>
//=======================================================================
//function : IntTools_EdgeEdge::IntTools_EdgeEdge
//purpose :
@@ -634,10 +635,18 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
//function : FindRangeOnCurve2
//purpose :
//=======================================================================
Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt& aCommonPrt)
Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt& aCommonPrt)
{
Standard_Real ttmp, f, l, af1, al1, am1, af2, al2, am2;
Standard_Integer pri;
//
pri=0;
if (aCommonPrt.AllNullFlag()) {
aCommonPrt.SetType(TopAbs_EDGE);
aCommonPrt.AppendRange2 (myTminTo, myTmaxTo);
return pri;
}
//
Standard_Real ttmp, f, l, af1, al1, am1, af2, al2, am2;
gp_Pnt aPf1, aPl1, aPm1, aPf2, aPl2, aPm2;
GeomAPI_ProjectPointOnCurve aProjector;
@@ -1632,313 +1641,3 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
mySeqOfCommonPrts.Append(aCommonPrt);
}
//modified by NIZNHY-PKV Mon Dec 26 13:44:53 2011f
static
Standard_Boolean IsSameReal(const Standard_Real aR1,
const Standard_Real aR2);
static
Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2);
static
Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2);
static
Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2);
static
Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2);
static
Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22);
static
Standard_Boolean IsSameElips(const gp_Elips& aElips1,
const gp_Elips& aElips2);
static
Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom,
const BRepAdaptor_Curve& myCTo);
//=======================================================================
//function : IsSameCurves
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeEdge::IsSameCurves()
{
Standard_Boolean bRet;
GeomAbs_CurveType aCTFrom, aCTTo;
//
aCTFrom=myCFrom.GetType();
aCTTo =myCTo.GetType();
//
bRet=(aCTFrom==aCTTo);
if (!bRet) {
return bRet;
}
//
bRet=IsSameReal(myTminFrom, myTminTo);
if (!bRet) {
return bRet;
}
//
bRet=IsSameReal(myTmaxFrom, myTmaxTo);
if (!bRet) {
return bRet;
}
//
bRet=!bRet; // false
//
if (aCTTo==GeomAbs_Ellipse) {
gp_Elips aC1, aC2;
//
aC1=myCFrom.Ellipse();
aC2=myCTo.Ellipse();
//
bRet=IsSameElips(aC1, aC2);
//
return bRet;
} //if (aCTTo==GeomAbs_Ellipse) {
//
else if (aCTTo==GeomAbs_BSplineCurve) {
bRet=IsSameBSplineCurve(myCFrom, myCTo);
if(!bRet) {
return bRet;
}
}// if (aCTTo==GeomAbs_BSplineCurve) {
return bRet;
}
//=======================================================================
//function : IsSameBSplineCurve
//purpose :
//=======================================================================
Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom,
const BRepAdaptor_Curve& myCTo)
{
Standard_Boolean bRet, bIsRational, bIsPreiodic;
Standard_Integer iNbPoles, iNbKnots, iDegree;
//
bIsRational=myCFrom.IsRational();
bRet=(bIsRational==myCTo.IsRational());
if (!bRet) {
return bRet;
}
//
iNbPoles=myCFrom.NbPoles();
bRet=(iNbPoles==myCTo.NbPoles());
if (!bRet) {
return bRet;
}
//
iNbKnots=myCFrom.NbKnots();
bRet=(iNbKnots==myCTo.NbKnots());
if (!bRet) {
return bRet;
}
//
iDegree=myCFrom.Degree();
bRet=(iDegree==myCTo.Degree());
if (!bRet) {
return bRet;
}
//
bIsPreiodic=myCFrom.IsPeriodic();
bRet=(bIsPreiodic==myCTo.IsPeriodic());
if (!bRet) {
return bRet;
}
//-------------------------------------------
Standard_Integer i, j, aM[2];
Standard_Real aT1[2], aT2[2], aX0[4], aX1[4];
gp_Pnt aP;
Handle(Geom_Curve) aC;
Handle(Geom_BSplineCurve) aBSp[2];
TopoDS_Edge aE[2];
//
aE[0]=myCFrom.Edge();
aE[1]=myCTo.Edge();
//
aC=BRep_Tool::Curve (aE[0], aT1[0], aT2[0]);
aBSp[0]=Handle(Geom_BSplineCurve)::DownCast(aC);
//
aC=BRep_Tool::Curve (aE[1], aT1[1], aT2[1]);
aBSp[1]=Handle(Geom_BSplineCurve)::DownCast(aC);
//
bRet=IsSameReal(aT1[0], aT1[1]);
if (!bRet) {
return bRet;
}
//
bRet=IsSameReal(aT2[0], aT2[1]);
if (!bRet) {
return bRet;
}
//
// Poles / Weights
for(i=1; i<=iNbPoles; ++i) {
aP=aBSp[0]->Pole(i);
aP.Coord(aX0[0], aX0[1], aX0[2]);
aX0[3]=aBSp[0]->Weight(i);
//
aP=aBSp[1]->Pole(i);
aP.Coord(aX1[0], aX1[1], aX1[2]);
aX1[3]=aBSp[1]->Weight(i);
//
for (j=0; j<4; ++j) {
bRet=IsSameReal(aX0[j], aX1[j]);
if(!bRet) {
return bRet;
}
}
}//for(i=1; i<iNbPoles; ++i) {
//
// Knots / Multiplicities
for(i=1; i<=iNbKnots; ++i) {
aX0[0]=aBSp[0]->Knot(i);
aX0[1]=aBSp[1]->Knot(i);
bRet=IsSameReal(aX0[0], aX0[1]);
if(!bRet) {
return bRet;
}
//
aM[0]=aBSp[0]->Multiplicity(i);
aM[1]=aBSp[1]->Multiplicity(i);
bRet=(aM[0]==aM[1]);
if(!bRet) {
return bRet;
}
}// for(i=1; i<=iNbKnots; ++i) {
return bRet;
}
//=======================================================================
//function : IsSameElips
//purpose :
//=======================================================================
Standard_Boolean IsSameElips(const gp_Elips& aElips1,
const gp_Elips& aElips2)
{
Standard_Boolean bRet;
Standard_Real aR1, aR2;
//
aR1=aElips1.MajorRadius();
aR2=aElips2.MajorRadius();
bRet=IsSameReal(aR1, aR2);
if (!bRet) {
return bRet;
}
//
aR1=aElips1.MinorRadius();
aR2=aElips2.MinorRadius();
bRet=IsSameReal(aR1, aR2);
if (!bRet) {
return bRet;
}
//
const gp_Ax2& aAx21=aElips1.Position();
const gp_Ax2& aAx22=aElips2.Position();
bRet=IsSameAx2(aAx21, aAx22);
return bRet;
}
//=======================================================================
//function : IsSameAx2
//purpose :
//=======================================================================
Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22)
{
Standard_Boolean bRet;
//
const gp_Ax1& aAx1=aAx21.Axis();
const gp_Ax1& aAx2=aAx22.Axis();
//
bRet=IsSameAx1(aAx1, aAx2);
if (!bRet) {
return bRet;
}
//
const gp_Dir& aDirX1=aAx21.XDirection();
const gp_Dir& aDirX2=aAx22.XDirection();
//
bRet=IsSameDir(aDirX1, aDirX2);
if (!bRet) {
return bRet;
}
//
//
const gp_Dir& aDirY1=aAx21.YDirection();
const gp_Dir& aDirY2=aAx22.YDirection();
//
bRet=IsSameDir(aDirY1, aDirY2);
//
return bRet;
}
//=======================================================================
//function : IsSameAx1
//purpose :
//=======================================================================
Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2)
{
Standard_Boolean bRet;
//
const gp_Pnt& aP1=aAx1.Location();
const gp_Pnt& aP2=aAx2.Location();
//
bRet=IsSamePnt(aP1, aP2);
if (!bRet) {
return bRet;
}
//
const gp_Dir& aDir1=aAx1.Direction();
const gp_Dir& aDir2=aAx2.Direction();
//
bRet=IsSameDir(aDir1, aDir2);
return bRet;
}
//=======================================================================
//function : IsSamePnt
//purpose :
//=======================================================================
Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2)
{
const gp_XYZ& aXYZ1=aP1.XYZ();
const gp_XYZ& aXYZ2=aP2.XYZ();
return IsSameXYZ(aXYZ1, aXYZ2);
}
//=======================================================================
//function : IsSameDir
//purpose :
//=======================================================================
Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2)
{
const gp_XYZ& aXYZ1=aDir1.XYZ();
const gp_XYZ& aXYZ2=aDir2.XYZ();
return IsSameXYZ(aXYZ1, aXYZ2);
}
//=======================================================================
//function : IsSameXYZ
//purpose :
//=======================================================================
Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2)
{
Standard_Boolean bRet;
Standard_Integer i;
Standard_Real aX1[3], aX2[3];
aXYZ1.Coord(aX1[0], aX1[1], aX1[2]);
aXYZ2.Coord(aX2[0], aX2[1], aX2[2]);
//
for (i=0; i<3; ++i) {
bRet=IsSameReal(aX1[i], aX2[i]);
if(!bRet) {
break;
}
}
return bRet;
}
//=======================================================================
//function : IsSameReal
//purpose :
//=======================================================================
Standard_Boolean IsSameReal(const Standard_Real aR1,
const Standard_Real aR2)
{
Standard_Boolean bRet;
Standard_Real aEpsilon;
//
aEpsilon=Epsilon(aR1);
bRet=(fabs(aR1-aR2)<aEpsilon);
return bRet;
}
//modified by NIZNHY-PKV Mon Dec 26 13:44:55 2011t

View File

@@ -0,0 +1,923 @@
// Created on: 2012-11-29
// Created by: Peter KURNEV
// Copyright (c) 2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <IntTools_EdgeEdge.ixx>
#include <gp_Elips.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_XYZ.hxx>
#include <gp_Ax2.hxx>
#include <gp_Pnt.hxx>
//
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_OffsetCurve.hxx>
//
#include <GeomAPI_ProjectPointOnCurve.hxx>
//
#include <BRep_Tool.hxx>
//=======================================================================
//class : IntTools_ComparatorCurve
//purpose :
//=======================================================================
class IntTools_ComparatorCurve {
public:
IntTools_ComparatorCurve() {
myT11=0.;
myT12=0.;
myT21=0.;
myT22=0.;
myIsSame=Standard_False;
};
//
virtual ~IntTools_ComparatorCurve(){
};
//
void SetCurve1(const BRepAdaptor_Curve& aBC3D) {
myBC1=aBC3D;
};
//
const BRepAdaptor_Curve& Curve1()const {
return myBC1;
};
//
void SetRange1(const Standard_Real aT1,
const Standard_Real aT2) {
myT11=aT1;
myT12=aT2;
};
//
void Range1(Standard_Real& aT1, Standard_Real& aT2)const {
aT1=myT11;
aT2=myT12;
};
//
void SetCurve2(const BRepAdaptor_Curve& aBC3D){
myBC2=aBC3D;
};
//
const BRepAdaptor_Curve& Curve2()const{
return myBC2;
};
//
void SetRange2(const Standard_Real aT1,
const Standard_Real aT2){
myT21=aT1;
myT22=aT2;
};
//
void Range2(Standard_Real& aT1,
Standard_Real& aT2)const {
aT1=myT21;
aT2=myT22;
};
//
Standard_Boolean IsSame()const {
return myIsSame;
};
//
void Perform();
//
//--------------------------------------
protected:
//
void IsSameElipse();
//
void IsSameBSplineCurve();
//
static
Standard_Boolean
IsSameReal(const Standard_Real aR1,
const Standard_Real aR2);
//
static
Standard_Boolean
IsSameAx2(const gp_Ax2& aAx21,
const gp_Ax2& aAx22);
//
static
Standard_Boolean
IsSameAx1(const gp_Ax1& aAx1,
const gp_Ax1& aAx2);
//
static
Standard_Boolean
IsSamePnt(const gp_Pnt& aP1,
const gp_Pnt& aP2);
static
Standard_Boolean
IsSameDir(const gp_Dir& aDir1,
const gp_Dir& aDir2);
//
static
Standard_Boolean
IsSameXYZ(const gp_XYZ& aXYZ1,
const gp_XYZ& aXYZ2);
//
static
void GetCurveBase(const Handle(Geom_Curve)& aC3D,
GeomAbs_CurveType& aTypeBase,
Handle(Geom_Curve)& aCurveBase);
//
static
Standard_Boolean
IsTypeBase(const Handle(Geom_Curve)& aC,
GeomAbs_CurveType& aTypeB);
//
protected:
BRepAdaptor_Curve myBC1;
Standard_Real myT11;
Standard_Real myT12;
//
BRepAdaptor_Curve myBC2;
Standard_Real myT21;
Standard_Real myT22;
//
Standard_Boolean myIsSame;
};
//
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void IntTools_ComparatorCurve::Perform()
{
GeomAbs_CurveType aCurveType1, aCurveType2;
//
myIsSame=Standard_False;
//
aCurveType1=myBC1.GetType();
aCurveType2=myBC2.GetType();
//
myIsSame=(aCurveType1==aCurveType2);
if (!myIsSame) {
return;
}
//
myIsSame=IsSameReal(myT11, myT21);
if (!myIsSame) {
return;
}
//
myIsSame=IsSameReal(myT12, myT22);
if (!myIsSame) {
return;
}
//
if (aCurveType1==GeomAbs_Ellipse) {
IsSameElipse();
return;
}
else if (aCurveType1==GeomAbs_BSplineCurve) {
IsSameBSplineCurve();
return ;
}
else {
myIsSame=Standard_False;
return;
}
}
//=======================================================================
//function : IsSameBSplineCurve
//purpose :
//=======================================================================
void IntTools_ComparatorCurve::IsSameBSplineCurve()
{
Standard_Boolean bIsRational, bIsPreiodic;
Standard_Integer iNbPoles, iNbKnots, iDegree;
//
bIsRational=myBC1.IsRational();
myIsSame=(bIsRational==myBC2.IsRational());
if (!myIsSame) {
return;
}
//
iNbPoles=myBC1.NbPoles();
myIsSame=(iNbPoles==myBC2.NbPoles());
if (!myIsSame) {
return;
}
//
iNbKnots=myBC1.NbKnots();
myIsSame=(iNbKnots==myBC2.NbKnots());
if (!myIsSame) {
return;
}
//
iDegree=myBC1.Degree();
myIsSame=(iDegree==myBC2.Degree());
if (!myIsSame) {
return;
}
//
bIsPreiodic=myBC1.IsPeriodic();
myIsSame=(bIsPreiodic==myBC2.IsPeriodic());
if (!myIsSame) {
return;
}
//-------------------------------------------
Standard_Integer i, j, aM[2];
Standard_Real aT1, aT2, aX0[4], aX1[4];
GeomAbs_CurveType aTypeBase;
gp_Pnt aP;
Handle(Geom_Curve) aC;
Handle(Geom_BSplineCurve) aBSp[2];
TopoDS_Edge aE1, aE2;
//
aE1=myBC1.Edge();
aE2=myBC2.Edge();
//
aC=BRep_Tool::Curve (aE1, aT1, aT2);
GetCurveBase(aC, aTypeBase, aBSp[0]);
//
aC=BRep_Tool::Curve (aE2, aT1, aT2);
GetCurveBase(aC, aTypeBase, aBSp[1]);
//
// Poles / Weights
for(i=1; i<=iNbPoles; ++i) {
aP=aBSp[0]->Pole(i);
aP.Coord(aX0[0], aX0[1], aX0[2]);
aX0[3]=aBSp[0]->Weight(i);
//
aP=aBSp[1]->Pole(i);
aP.Coord(aX1[0], aX1[1], aX1[2]);
aX1[3]=aBSp[1]->Weight(i);
//
for (j=0; j<4; ++j) {
myIsSame=IsSameReal(aX0[j], aX1[j]);
if(!myIsSame) {
return;
}
}
}//for(i=1; i<iNbPoles; ++i) {
//
// Knots / Multiplicities
for(i=1; i<=iNbKnots; ++i) {
aX0[0]=aBSp[0]->Knot(i);
aX0[1]=aBSp[1]->Knot(i);
myIsSame=IsSameReal(aX0[0], aX0[1]);
if(!myIsSame) {
return;
}
//
aM[0]=aBSp[0]->Multiplicity(i);
aM[1]=aBSp[1]->Multiplicity(i);
myIsSame=(aM[0]==aM[1]);
if(!myIsSame) {
return;
}
}
}
//=======================================================================
//function : GetCurveBase
//purpose :
//=======================================================================
void IntTools_ComparatorCurve::GetCurveBase(const Handle(Geom_Curve)& aC3D,
GeomAbs_CurveType& aTypeBase,
Handle(Geom_Curve)& aCurveBase)
{
Standard_Boolean bIsTypeBase;
Standard_Integer iTrimmed, iOffset;
Standard_Real aOffsetBase;
GeomAbs_CurveType aTypeB;
Handle(Geom_Curve) aC3DB;
Handle(Geom_TrimmedCurve) aCT3D;
Handle(Geom_OffsetCurve) aCF3D;
//
aTypeBase=GeomAbs_OtherCurve;
aOffsetBase=0.;
//
aC3DB=aC3D;
bIsTypeBase=IsTypeBase(aC3DB, aTypeB);
if (bIsTypeBase) {
aTypeBase=aTypeB;
aCurveBase=aC3D;
return;
}
//
while(1) {
iTrimmed=0;
iOffset=0;
aCT3D=Handle(Geom_TrimmedCurve)::DownCast(aC3DB);
if (!aCT3D.IsNull()) {
aC3DB=aCT3D->BasisCurve();
++iTrimmed;
}
//
aCF3D=Handle(Geom_OffsetCurve)::DownCast(aC3DB);
if (!aCF3D.IsNull()) {
Standard_Real aOffset;
//
aOffset=aCF3D->Offset();
aOffsetBase=aOffsetBase+aOffset;
//
aC3DB=aCF3D->BasisCurve();
++iOffset;
}
//
if (!(iTrimmed || iOffset)) {
break;
}
//
bIsTypeBase=IsTypeBase(aC3DB, aTypeB);
if (bIsTypeBase) {
aTypeBase=aTypeB;
aCurveBase=aC3DB;
return;
}
}
}
//=======================================================================
//function : IsTypeBase
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsTypeBase(const Handle(Geom_Curve)& aC,
GeomAbs_CurveType& aTypeB)
{
Standard_Boolean bRet;
Handle(Standard_Type) aType;
//
bRet=Standard_True;
//
aType=aC->DynamicType();
if (aType==STANDARD_TYPE(Geom_Line)) {
aTypeB=GeomAbs_Line;
}
else if (aType==STANDARD_TYPE(Geom_Circle)) {
aTypeB=GeomAbs_Circle;
}
else if (aType==STANDARD_TYPE(Geom_Ellipse)) {
aTypeB=GeomAbs_Ellipse;
}
else if (aType==STANDARD_TYPE(Geom_Parabola)) {
aTypeB=GeomAbs_Parabola;
}
else if (aType==STANDARD_TYPE(Geom_Hyperbola)) {
aTypeB=GeomAbs_Hyperbola;
}
else if (aType==STANDARD_TYPE(Geom_BezierCurve)) {
aTypeB=GeomAbs_BezierCurve;
}
else if (aType==STANDARD_TYPE(Geom_BSplineCurve)) {
aTypeB=GeomAbs_BSplineCurve;
}
else {
aTypeB=GeomAbs_OtherCurve;
bRet=!bRet;
}
return bRet;
}
//=======================================================================
//function : IsSameElipse
//purpose :
//=======================================================================
void IntTools_ComparatorCurve::IsSameElipse()
{
Standard_Real aR1, aR2;
gp_Elips aElips1, aElips2;
//
myIsSame=Standard_False;
//
aElips1=myBC1.Ellipse();
aElips2=myBC2.Ellipse();
//
aR1=aElips1.MajorRadius();
aR2=aElips2.MajorRadius();
myIsSame=IsSameReal(aR1, aR2);
if (!myIsSame) {
return;
}
//
aR1=aElips1.MinorRadius();
aR2=aElips2.MinorRadius();
myIsSame=IsSameReal(aR1, aR2);
if (!myIsSame) {
return;
}
//
const gp_Ax2& aAx21=aElips1.Position();
const gp_Ax2& aAx22=aElips2.Position();
myIsSame=IsSameAx2(aAx21, aAx22);
}
//=======================================================================
//function : IsSameAx2
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSameAx2(const gp_Ax2& aAx21,
const gp_Ax2& aAx22)
{
Standard_Boolean bRet;
//
const gp_Ax1& aAx1=aAx21.Axis();
const gp_Ax1& aAx2=aAx22.Axis();
//
bRet=IsSameAx1(aAx1, aAx2);
if (!bRet) {
return bRet;
}
//
const gp_Dir& aDirX1=aAx21.XDirection();
const gp_Dir& aDirX2=aAx22.XDirection();
//
bRet=IsSameDir(aDirX1, aDirX2);
if (!bRet) {
return bRet;
}
//
//
const gp_Dir& aDirY1=aAx21.YDirection();
const gp_Dir& aDirY2=aAx22.YDirection();
//
bRet=IsSameDir(aDirY1, aDirY2);
//
return bRet;
}
//=======================================================================
//function : IsSamePnt
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSamePnt(const gp_Pnt& aP1,
const gp_Pnt& aP2)
{
const gp_XYZ& aXYZ1=aP1.XYZ();
const gp_XYZ& aXYZ2=aP2.XYZ();
return IsSameXYZ(aXYZ1, aXYZ2);
}
//=======================================================================
//function : IsSameAx1
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSameAx1(const gp_Ax1& aAx1,
const gp_Ax1& aAx2)
{
Standard_Boolean bRet;
//
const gp_Pnt& aP1=aAx1.Location();
const gp_Pnt& aP2=aAx2.Location();
//
bRet=IsSamePnt(aP1, aP2);
if (!bRet) {
return bRet;
}
//
const gp_Dir& aDir1=aAx1.Direction();
const gp_Dir& aDir2=aAx2.Direction();
//
bRet=IsSameDir(aDir1, aDir2);
return bRet;
}
//=======================================================================
//function : IsSameDir
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSameDir(const gp_Dir& aDir1,
const gp_Dir& aDir2)
{
const gp_XYZ& aXYZ1=aDir1.XYZ();
const gp_XYZ& aXYZ2=aDir2.XYZ();
return IsSameXYZ(aXYZ1, aXYZ2);
}
//=======================================================================
//function : IsSameXYZ
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSameXYZ(const gp_XYZ& aXYZ1,
const gp_XYZ& aXYZ2)
{
Standard_Boolean bRet;
Standard_Integer i;
Standard_Real aX1[3], aX2[3];
aXYZ1.Coord(aX1[0], aX1[1], aX1[2]);
aXYZ2.Coord(aX2[0], aX2[1], aX2[2]);
//
for (i=0; i<3; ++i) {
bRet=IsSameReal(aX1[i], aX2[i]);
if(!bRet) {
break;
}
}
return bRet;
}
//=======================================================================
//function : IsSameReal
//purpose :
//=======================================================================
Standard_Boolean
IntTools_ComparatorCurve::IsSameReal(const Standard_Real aR1,
const Standard_Real aR2)
{
Standard_Boolean bRet;
Standard_Real aEpsilon;
//
aEpsilon=Epsilon(aR1);
bRet=(fabs(aR1-aR2)<aEpsilon);
return bRet;
}
//
//modified by NIZNHY-PKV Tue Jan 15 07:44:33 2013f
//=======================================================================
// class: IntTools_DistCC
// purpose :
//=======================================================================
class IntTools_DistCC {
public:
IntTools_DistCC() {
myT11=0.;
myT12=0.;
myT21=0.;
myT21=0.;
myErrorStatus=1;
myThreshold=1.e-7;
myDx=0.;
myTx=0.;
myNbP=10;
myIndent=0.3;
myEps=0.001;
};
//
~IntTools_DistCC() {
};
//-------- 1
void SetCurve1(const Handle(Geom_Curve)& aC1) {
myC1=aC1;
};
//
const Handle(Geom_Curve)& Curve1()const {
return myC1;
};
//
void SetRange1(const Standard_Real aT11,
const Standard_Real aT12) {
myT11=aT11;
myT12=aT12;
};
//
void Range1(Standard_Real& aT11,
Standard_Real& aT12)const {
aT11=myT11;
aT12=myT12;
};
//-------- 2
void SetCurve2(const Handle(Geom_Curve)& aC2) {
myC2=aC2;
};
//
const Handle(Geom_Curve)& Curve2()const {
return myC2;
};
//
void SetRange2(const Standard_Real aT21,
const Standard_Real aT22) {
myT21=aT21;
myT22=aT22;
};
//
void Range2(Standard_Real& aT21,
Standard_Real& aT22)const {
aT21=myT21;
aT22=myT22;
};
//
void SetThreshold(const Standard_Real aD) {
myThreshold=aD;
}
//
Standard_Real Threshold() const {
return myThreshold;
}
//
void Perform();
//
Standard_Integer ErrorStatus()const {
return myErrorStatus;
};
//
Standard_Real MaxDeviation()const {
return myDx;
}
//
Standard_Real MaxParameter()const {
return myTx;
}
//-----------------------------------------------------
protected :
//
void Init();
//
void CheckData();
//
Standard_Real Distance(const Standard_Real aT);
//
void FindMaxDeviation();
//
void FindMaxLocal (const Standard_Real aT11,
const Standard_Real aT12,
const Standard_Real aEps,
Standard_Real& aDx,
Standard_Real& aTx);
//
protected :
Standard_Real myT11;
Standard_Real myT12;
Handle(Geom_Curve) myC1;
Standard_Real myT21;
Standard_Real myT22;
Handle(Geom_Curve) myC2;
//
Standard_Real myThreshold;
Standard_Integer myErrorStatus;
//
Standard_Real myDx;
Standard_Real myTx;
//
Standard_Integer myNbP;
Standard_Real myIndent;
Standard_Real myEps;
GeomAPI_ProjectPointOnCurve myPPC2;
};
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void IntTools_DistCC::Perform()
{
myErrorStatus=0;
//
CheckData();
if (myErrorStatus){
return;
}
// Init
myPPC2.Init(myC2, myT21, myT22);
//
FindMaxDeviation();
if (myErrorStatus){
return;
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void IntTools_DistCC::CheckData()
{
myErrorStatus=0;
//
if (myC1.IsNull()) {
myErrorStatus=2;
return;
}
//
if (myC2.IsNull()) {
myErrorStatus=3;
return;
}
}
//
//=======================================================================
//function : FindMaxDeviation
//purpose :
//=======================================================================
void IntTools_DistCC::FindMaxDeviation()
{
Standard_Integer i, aNbP1, aNbP2;
Standard_Real aTmax, aT, aT1, aT2, dT, aDmax, aEps, aD;
//
myErrorStatus=0;
myDx=0.;
myTx=0.;
//
aTmax=0;
aDmax=0.;
aEps=myEps*(myT12-myT11);
//
aNbP1=myNbP-1;
aNbP2=aNbP1-1;
dT=(myT12-myT11)/aNbP1;
for (i=0; i<aNbP1; ++i) {
aT1=myT11+i*dT;
aT2=aT1+dT;
//
if (!i) {
aT1=aT1+myIndent*dT;
}
else if (i==aNbP2) {
aT2=aT2-myIndent*dT;
if (aT2>myT12) {
aT2=myT12;
}
}
//
FindMaxLocal(aT1, aT2, aEps, aD, aT);
if (myErrorStatus) {
return ;
}
//
if (aD>aDmax) {
aDmax=aD;
aTmax=aT;
}
}
//
myTx=aTmax;
myDx=aDmax;
}
//=======================================================================
//function : FindMaxLocal
//purpose : Solver: Golden Mean
//=======================================================================
void IntTools_DistCC::FindMaxLocal(const Standard_Real aT11,
const Standard_Real aT12,
const Standard_Real aEps,
Standard_Real& aDx,
Standard_Real& aTx)
{
Standard_Integer iErr;
Standard_Real aA, aB, aCf, aX1, aX2, aF1, aF2, aX, aF;
//
myErrorStatus=0;
iErr=0;
aDx=0.;
aTx=0.;
//
aCf=1.6180339887498948482045868343656;// =0.5*(1.+sqrt(5.));
//
aA=aT11;
aB=aT12;
//
aX1=aB-(aB-aA)/aCf;
aF1=Distance(aX1);
if (myErrorStatus) {
return ;
}
//
aX2=aA+(aB-aA)/aCf;
aF2=Distance(aX2);
if (myErrorStatus) {
return;
}
//
while(1) {
if (fabs(aA-aB)<aEps) {
aX=0.5*(aA+aB);
aF=Distance(aX);
if (myErrorStatus) {
return;
}
//
break;
}
if (aF1<aF2){
aA=aX1;
aX1=aX2;
aF1=aF2;
aX2=aA+(aB-aA)/aCf;
aF2=Distance(aX2);
if (myErrorStatus) {
return ;
}
}
else {
aB=aX2;
aX2=aX1;
aF2=aF1;
aX1=aB-(aB-aA)/aCf;
aF1=Distance(aX1);
if (myErrorStatus) {
return;
}
}
}
//
aDx=aF;
aTx=aX;
}
//=======================================================================
//function : Distance
//purpose :
//=======================================================================
Standard_Real IntTools_DistCC::Distance(const Standard_Real aT)
{
Standard_Integer aNbP2;
Standard_Real aD;
gp_Pnt aP1;
//
aD=0.;
if (myErrorStatus) {
return aD;
}
//
myC1->D0(aT, aP1);
myPPC2.Perform(aP1);
//
aNbP2=myPPC2.NbPoints();
if (!aNbP2) {
myErrorStatus=4;
return aD;
}
//
aD=myPPC2.LowerDistance();
if (aD>myThreshold) {
myErrorStatus=10;
}
return aD;
}
//modified by NIZNHY-PKV Tue Jan 15 07:44:44 2013t
//
//=======================================================================
//function : IsSameCurves
//purpose :
//=======================================================================
Standard_Boolean IntTools_EdgeEdge::IsSameCurves()
{
Standard_Boolean bRet, bIsBC;
GeomAbs_CurveType aCT1, aCT2;
IntTools_ComparatorCurve aICC;
//
// 1. Check letter
aICC.SetCurve1(myCFrom);
aICC.SetRange1(myTminFrom, myTmaxFrom);
//
aICC.SetCurve2(myCTo);
aICC.SetRange2(myTminTo, myTmaxTo);
//
aICC.Perform();
bRet=aICC.IsSame();
if (bRet) {
return bRet;
}
//
// 2. Check inwards
aCT1=myCFrom.GetType();
aCT2=myCTo.GetType();
bIsBC=(aCT1==GeomAbs_BSplineCurve ||
aCT1==GeomAbs_BezierCurve ||
aCT2==GeomAbs_BSplineCurve ||
aCT2==GeomAbs_BezierCurve);
//
if (bIsBC) {
Standard_Integer iErr;
Standard_Real aT11, aT12, aT21, aT22;
Handle(Geom_Curve) aC1, aC2;
IntTools_DistCC aDistCC;
//
const TopoDS_Edge& aE1=myCFrom.Edge();
aC1=BRep_Tool::Curve(aE1, aT11, aT12);
//
const TopoDS_Edge& aE2=myCTo.Edge();
aC2=BRep_Tool::Curve(aE2, aT21, aT22);
//
aDistCC.SetCurve1(aC1);
aDistCC.SetRange1(myTminFrom, myTmaxFrom);
aDistCC.SetCurve2(aC2);
aDistCC.SetRange2(myTminTo, myTmaxTo);
aDistCC.SetThreshold(myCriteria);
//
aDistCC.Perform();
//
iErr=aDistCC.ErrorStatus();
//
bRet=(!iErr);
//
}
return bRet;
}

View File

@@ -1414,11 +1414,12 @@ void IntTools_EdgeFace::CheckData()
Standard_Real& aTx)
{
Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l, af, al,aDist2, aMinDist2, aTm, aDist2New;
Standard_Real aEpsT;
Standard_Boolean theflag=Standard_False;
Standard_Integer aNbExt, i, iLower ;
aCP.Range1(aTF, aTL);
aEpsT=8.e-5;
aTm=0.5*(aTF+aTL);
aDist2=DistanceFunction(aTm);
aDist2 *= aDist2;
@@ -1472,15 +1473,15 @@ void IntTools_EdgeFace::CheckData()
Extrema_POnSurf aPOnS;
anExtrema.Points(iLower, aPOnC, aPOnS);
aTx=aPOnC.Parameter();
if (fabs (aTx-aTF) < myEpsT) {
return !theflag;
///
if (fabs (aTx-aTF) < aEpsT) {
return theflag;
}
if (fabs (aTx-aTL) < myEpsT) {
return !theflag;
if (fabs (aTx-aTL) < aEpsT) {
return theflag;
}
if (aTx>aTF && aTx<aTL) {

View File

@@ -983,7 +983,6 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
myTolReached3d=sqrt(aD2max);
}
}//if((aType1==GeomAbs_SurfaceOfRevolution ...
//modified by NIZNHY-PKV Thu Aug 30 13:31:10 2012f
else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_Sphere)) {
Standard_Integer i, j, aNbP;
@@ -1041,7 +1040,6 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
myTolReached3d=sqrt(aD2max);
}
}//else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ...
//modified by NIZNHY-PKV Thu Aug 30 13:31:12 2012t
}
//=======================================================================
//function : MakeCurve
@@ -2517,6 +2515,15 @@ Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine
enlarge=Standard_True;
}
//
if (aType==GeomAbs_Sphere) {
Standard_Real dV;
//
dV=thevmax-thevmin;
if (dV+delta<M_PI) {
enlarge=Standard_True;
}
}
//
if(!isuperiodic && enlarge) {
if((theumin - uinf) > delta )
@@ -2679,7 +2686,7 @@ Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine
// because inside degenerated zone of the surface the approx. algo.
// uses wrong values of normal, etc., and resulting curve will have
// oscillations that we would not like to have.
// PKV Tue Feb 12 2002
static

View File

@@ -83,16 +83,21 @@ is
--- for given index of split
---
PeriodicLine(me; L: Line from IntPatch)
is static private;
---PeriodicLine(me; L: Line from IntPatch)
--- is protected;
TreatCircle(me:out;
aLine : Line from IntPatch;
aTol: Real from Standard)
is protected;
fields
done : Boolean from Standard;
seqp : SequenceOfReal from TColStd;
myDom1: TopolTool from Adaptor3d;
myDom2: TopolTool from Adaptor3d;
myHS1 : HSurface from GeomAdaptor;
myHS2 : HSurface from GeomAdaptor;
myHS1 : HSurface from GeomAdaptor;
myHS2 : HSurface from GeomAdaptor;
end LineConstructor;

View File

@@ -225,43 +225,20 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
return;
}// else if(typl == IntPatch_Walking) {
//
//-----------------------------------------------------------
else if (typl != IntPatch_Restriction) {
Standard_Boolean intrvtested;
Standard_Real u1,v1,u2,v2;
//
seqp.Clear();
//
Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
// reject micro circles, ellipses
switch (typl) {
case IntPatch_Circle: {
Standard_Real aR;
gp_Circ aCirc;
//
aCirc=GLine->Circle();
aR=aCirc.Radius();
if (aR<Tol) {
done = Standard_True;
return;
}
break;
}
case IntPatch_Ellipse: {
Standard_Real aR;
gp_Elips aEllipse;
//
aEllipse=GLine->Ellipse();
aR=aEllipse.MajorRadius();
if (aR<Tol) {
done = Standard_True;
return;
}
break;
}
default:
break;
//
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) {
TreatCircle(L, Tol);
done=Standard_True;
return;
}
//modified by NIZNHY-PKV Wed Nov 02 11:50:23 2011t
//----------------------------
Standard_Boolean intrvtested;
Standard_Real u1,v1,u2,v2;
//
nbvtx = GeomInt_LineTool::NbVertex(L);
intrvtested = Standard_False;
@@ -272,30 +249,7 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
intrvtested = Standard_True;
const Standard_Real pmid = (firstp+lastp)*0.5;
gp_Pnt Pmid;
//modified by NIZNHY-PKV Fri Nov 11 10:27:01 2011f
GLinePoint(typl, GLine, pmid, Pmid);
/*
switch (typl) {
case IntPatch_Lin:
Pmid = ElCLib::Value(pmid,GLine->Line());
break;
case IntPatch_Circle:
Pmid = ElCLib::Value(pmid,GLine->Circle());
break;
case IntPatch_Ellipse:
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
break;
case IntPatch_Hyperbola:
Pmid = ElCLib::Value(pmid,GLine->Hyperbola());
break;
case IntPatch_Parabola:
Pmid = ElCLib::Value(pmid,GLine->Parabola());
break;
default:
break;
}
*/
//modified by NIZNHY-PKV Fri Nov 11 12:25:40 2011t
//
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
Recadre(myHS1,myHS2,u1,v1,u2,v2);
@@ -310,42 +264,6 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
}
}
//
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) {
firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
lastp = M_PI + M_PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
Standard_Real acadr = (firstp+lastp)*0.5;
while(acadr < cadrinf) {
acadr+=M_PI+M_PI;
}
while(acadr > cadrsup) {
acadr-=M_PI+M_PI;
}
if(acadr>=cadrinf && acadr<=cadrsup) {
if(Abs(firstp-lastp)>Precision::PConfusion()) {
intrvtested = Standard_True;
const Standard_Real pmid = (firstp+lastp)*0.5;
gp_Pnt Pmid;
if (typl == IntPatch_Circle) {
Pmid = ElCLib::Value(pmid,GLine->Circle());
}
else {
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
}
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
if(in1 != TopAbs_OUT) {
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if(in2 != TopAbs_OUT) {
seqp.Append(firstp);
seqp.Append(lastp);
}
}
}
}
}
if (!intrvtested) {
// Keep a priori. A point 2d on each
// surface is required to make the decision. Will be done in the caller
@@ -353,124 +271,9 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
seqp.Append(GeomInt_LineTool::LastParameter(L));
}
//
// Treatment Circles/Ellipses that are the results of intersection
// between Plane / (Cylinder, Sphere).
// In these cases the intersection curves can contain
// a lot of 'vertices' on the curve that leads to a lot of parts
// of the curve. Some adjacent parts can be united to the one part.
//
Standard_Integer aNbParts;
//
aNbParts = seqp.Length()/2;
if (aNbParts > 1 && (typl == IntPatch_Circle || typl == IntPatch_Ellipse)) {
Standard_Boolean bCond, bPCS, bPCS1, bPCS2, bCC;
GeomAbs_SurfaceType aST1, aST2;
//
aST1 = myHS1->Surface().GetType();
aST2 = myHS2->Surface().GetType();
//
bPCS1=((aST1==GeomAbs_Plane) && (aST2==GeomAbs_Cylinder || aST2==GeomAbs_Sphere));
bPCS2=((aST2==GeomAbs_Plane) && (aST1==GeomAbs_Cylinder || aST1==GeomAbs_Sphere));
bPCS=(bPCS1 || bPCS2);
bCC=(aST1==GeomAbs_Cylinder && aST2==GeomAbs_Cylinder);
//
// ZZ
//modified by NIZNHY-PKV Fri Nov 11 10:13:58 2011f
Standard_Integer j, i1, i2;
Standard_Real aT, aU, aV;
Handle(GeomAdaptor_HSurface) aHS;
//
bCond=Standard_False;
//
if (bCC) {
bCond=Standard_True;
}
else if (bPCS) {
if ((aST1==GeomAbs_Sphere) || (aST2==GeomAbs_Sphere)) {
if (aST1==GeomAbs_Sphere) {
aHS=myHS1;
}
else if (aST2==GeomAbs_Sphere){
aHS=myHS2;
}
//
Standard_Integer aNbP;
Standard_Real aHalfPI, aPPC;
//
bCond=Standard_True;
//
aNbP=seqp.Length();
aPPC=Precision::PConfusion();
aHalfPI=0.5*M_PI;
i1=0;
i2=0;
//
for (i=1; i<=aNbP; ++i) {
gp_Pnt aP;
//
aT=seqp(i);
GLinePoint(typl, GLine, aT, aP);
Parameters(aHS, aP, aU, aV);
if (aV<0.) {
if (fabs(aV+aHalfPI) < aPPC) {
++i2;
}
}
else {
if (fabs(aV-aHalfPI) < aPPC) {
++i1;
}
}
}
if (i1==2 || i2==2) {
bCond=Standard_False;
}
}
}// else if (bPCS1 || bPCS2) {
//modified by NIZNHY-PKV Fri Nov 11 10:14:00 2011t
//
if (bCond){
Standard_Integer i2, j2;
Standard_Real aFi, aLi, aFj, aLj, aF, aL;
TColStd_SequenceOfReal aSeq;
//
aFi=seqp(1);
aSeq.Append(aFi);
for (i=1; i<aNbParts; ++i) {
j=i+1;
i2=2*i;
j2=2*j;
//
aFi=seqp(i2-1);
aLi=seqp(i2);
//
aFj=seqp(j2-1);
aLj=seqp(j2);
//
if (fabs (aFj-aLi) < Tol) {
aL=aLj;
}
else {
aL=aLi;
aSeq.Append(aL);
aF=aFj;
aSeq.Append(aF);
}
}
aSeq.Append(aLj);
//
seqp.Clear();
aNbParts=aSeq.Length();
for (i=1; i<=aNbParts; ++i) {
aF=aSeq(i);
seqp.Append(aF);
}
}
}
//
done =Standard_True;
return;
}// else if (typl != IntPatch_Restriction) {
} // else if (typl != IntPatch_Restriction) {
done = Standard_False;
seqp.Clear();
@@ -688,73 +491,6 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
}
done = Standard_True;
}
//=======================================================================
//function : PeriodicLine
//purpose :
//=======================================================================
void IntTools_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) const
{
const IntPatch_IType typl = L->ArcType();
if (typl != IntPatch_Circle && typl != IntPatch_Ellipse)
return;
const Standard_Real Tol = Precision::PConfusion();
Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
Standard_Integer i,j,nbvtx = glin->NbVertex();
for (i=1; i<=nbvtx; i++)
{
IntPatch_Point thevtx = glin->Vertex(i);
const Standard_Real prm = thevtx.ParameterOnLine();
Standard_Boolean changevtx = Standard_False;
if (thevtx.IsOnDomS1() || thevtx.IsOnDomS2())
{
for (j=1; j<=nbvtx; j++)
{
if (j!=i)
{
const IntPatch_Point& thevtxbis = glin->Vertex(j);
const Standard_Real prmbis = thevtxbis.ParameterOnLine();
if (Abs(prm-prmbis) <= Tol)
{
Standard_Real u,v;
gp_Pnt2d p2d;
if (thevtx.IsOnDomS1() && thevtxbis.IsOnDomS1() &&
thevtxbis.TransitionLineArc1().TransitionType()==IntSurf_In)
{
p2d = thevtx.ArcOnS1()->Value(thevtx.ParameterOnArc1());
u = p2d.X(); v = p2d.Y();
p2d = thevtxbis.ArcOnS1()->Value(thevtxbis.ParameterOnArc1());
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
{
changevtx = Standard_True;
break;
}
}
if (thevtx.IsOnDomS2() && thevtxbis.IsOnDomS2() &&
thevtxbis.TransitionLineArc2().TransitionType()==IntSurf_In)
{
p2d = thevtx.ArcOnS2()->Value(thevtx.ParameterOnArc2());
u = p2d.X(); v = p2d.Y();
p2d = thevtxbis.ArcOnS2()->Value(thevtxbis.ParameterOnArc2());
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
{
changevtx = Standard_True;
break;
}
}
}
}
}
}
if (changevtx) {
thevtx.SetParameter(prm + 2.*M_PI);
glin->Replace(i,thevtx);
}
}
}
//modified by NIZNHY-PKV Fri Nov 11 10:30:34 2011f
//=======================================================================
//function : Recadre
//purpose :
@@ -855,33 +591,9 @@ void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
Standard_Real& U2,
Standard_Real& V2)
{
//modified by NIZNHY-PKV Fri Nov 11 10:07:55 2011f
Parameters(myHS1, Ptref, U1, V1);
Parameters(myHS2, Ptref, U2, V2);
/*
IntSurf_Quadric quad1,quad2;
switch (myHS1->Surface().GetType())
{
case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
}
switch (myHS2->Surface().GetType())
{
case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
}
quad1.Parameters(Ptref,U1,V1);
quad2.Parameters(Ptref,U2,V2);
*/
//modified by NIZNHY-PKV Fri Nov 11 10:08:38 2011t
}
//modified by NIZNHY-PKV Fri Nov 11 10:06:02 2011f
//=======================================================================
//function : Parameter
//purpose :
@@ -941,4 +653,310 @@ void GLinePoint(const IntPatch_IType typl,
Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
}
}
//modified by NIZNHY-PKV Fri Nov 11 10:06:04 2011t
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//
//=======================================================================
//class : IntTools_RealWithFlag
//purpose :
//=======================================================================
class IntTools_RealWithFlag {
public:
IntTools_RealWithFlag() :
myValue(-99.), myFlag(1)
{
};
//
~IntTools_RealWithFlag() {
};
//
void SetValue(const Standard_Real aT) {
myValue=aT;
};
//
Standard_Real Value() const {
return myValue;
}
//
void SetFlag(const Standard_Integer aFlag) {
myFlag=aFlag;
};
//
Standard_Integer Flag() const {
return myFlag;
}
//
Standard_Boolean operator < (const IntTools_RealWithFlag& aOther) {
return myValue<aOther.myValue;
}
//
protected:
Standard_Real myValue;
Standard_Integer myFlag;
};
//------------
static
void SortShell(const Standard_Integer,
IntTools_RealWithFlag *);
static
void RejectDuplicates(Standard_Integer& aNbVtx,
IntTools_RealWithFlag *pVtx,
Standard_Real aTolPrm);
static
void RejectNearBeacons(Standard_Integer& aNbVtx,
IntTools_RealWithFlag *pVtx,
Standard_Real aTolPC1,
const GeomAbs_SurfaceType aTS1,
const GeomAbs_SurfaceType aTS2);
static
Standard_Real AdjustOnPeriod(const Standard_Real aTr,
const Standard_Real aPeriod);
static
Standard_Boolean RejectMicroCircle(const Handle(IntPatch_GLine)& aGLine,
const IntPatch_IType aType,
const Standard_Real aTol3D);
//
//=======================================================================
//function : TreatCircle
//purpose :
//=======================================================================
void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
const Standard_Real aTol)
{
Standard_Boolean bRejected;
IntPatch_IType aType;
//
aType=aLine->ArcType();
Handle(IntPatch_GLine)& aGLine=*((Handle(IntPatch_GLine) *)&aLine);
//
bRejected=RejectMicroCircle(aGLine, aType, aTol);
if (bRejected) {
return;
}
//----------------------------------------
Standard_Integer aNbVtx, aNbVtxWas, i;
Standard_Real aTolPC, aT, aT1, aT2, aTmid, aTwoPI, aTolPC1;
Standard_Real aU1, aV1, aU2, aV2;
TopAbs_State aIn1, aIn2;
GeomAbs_SurfaceType aTS1, aTS2;
gp_Pnt aPmid;
gp_Pnt2d aP2D;
IntTools_RealWithFlag *pVtx;
//-------------------------------------1
aTwoPI=M_PI+M_PI;
aTolPC=Precision::PConfusion();
aNbVtxWas=GeomInt_LineTool::NbVertex(aLine);
aNbVtx=aNbVtxWas+2;
//-------------------------------------2
aTS1=myHS1->GetType();
aTS2=myHS2->GetType();
//
// About the value aTolPC1=1000.*aTolPC,
// see IntPatch_GLine.cxx, line:398
// for more details;
aTolPC1=1000.*aTolPC;
//-------------------------------------
//
pVtx=new IntTools_RealWithFlag [aNbVtx];
//
pVtx[0].SetValue(0.);
pVtx[1].SetValue(2.*M_PI);
//
for(i=1; i<=aNbVtxWas; ++i) {
aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
aT=AdjustOnPeriod(aT, aTwoPI);
pVtx[i+1].SetValue(aT);
}
//
SortShell(aNbVtx, pVtx);
//
RejectNearBeacons(aNbVtx, pVtx, aTolPC1, aTS1, aTS2);
//
RejectDuplicates(aNbVtx, pVtx, aTolPC);
//
for(i=0; i<aNbVtx-1; ++i) {
aT1=pVtx[i].Value();
aT2=pVtx[i+1].Value();
aTmid=(aT1+aT2)*0.5;
GLinePoint(aType, aGLine, aTmid, aPmid);
//
Parameters(myHS1, myHS2, aPmid, aU1, aV1, aU2, aV2);
Recadre(myHS1, myHS2, aU1, aV1, aU2, aV2);
//
aP2D.SetCoord(aU1, aV1);
aIn1=myDom1->Classify(aP2D, aTol);
if(aIn1 != TopAbs_OUT) {
aP2D.SetCoord(aU2, aV2);
aIn2=myDom2->Classify(aP2D, aTol);
if(aIn2 != TopAbs_OUT) {
seqp.Append(aT1);
seqp.Append(aT2);
}
}
}
//
delete [] pVtx;
}
//=======================================================================
//function : RejectNearBeacons
//purpose : Reject the thickenings near the beacon points (if exist)
// The gifts, made by sweep algo.
// chl/930/B5 B8 C2 C5 E2 E5 E8 F2 G8 H2 H5 H8
//=======================================================================
void RejectNearBeacons(Standard_Integer& aNbVtx,
IntTools_RealWithFlag *pVtx,
Standard_Real aTolPC1,
const GeomAbs_SurfaceType aTS1,
const GeomAbs_SurfaceType aTS2)
{
Standard_Integer i, j, iBcn;
Standard_Real aT, aBcn[2];
//
if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) {
aBcn[0]=0.5*M_PI;
aBcn[1]=1.5*M_PI;
//
for (j=0; j<2; ++j) {
iBcn=-1;
for(i=0; i<aNbVtx; ++i) {
aT=pVtx[i].Value();
if (aT==aBcn[j]) {
iBcn=i;
break;
}
}
//
if (iBcn<0) {
// The beacon is not found
continue;
}
//
for(i=0; i<aNbVtx; ++i) {
if (i!=iBcn) {
aT=pVtx[i].Value();
if (fabs(aT-aBcn[j]) < aTolPC1) {
pVtx[i].SetFlag(0);
}
}
}
}// for (j=0; j<2; ++j) {
//------------------------------------------
j=0;
for(i=0; i<aNbVtx; ++i) {
if (pVtx[i].Flag()) {
pVtx[j]=pVtx[i];
++j;
}
}
aNbVtx=j;
}// if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) {
}
//=======================================================================
//function : RejectDuplicates
//purpose :
//=======================================================================
void RejectDuplicates(Standard_Integer& aNbVtx,
IntTools_RealWithFlag *pVtx,
Standard_Real aTolPC)
{
Standard_Integer i, j;
Standard_Real dX, aT1, aT2;
//
for(i=0; i<aNbVtx-1; ++i) {
aT2=pVtx[i+1].Value();
aT1=pVtx[i].Value();
dX=aT2-aT1;
if (dX<aTolPC) {
pVtx[i+1].SetFlag(0);
}
}
//
j=0;
for(i=0; i<aNbVtx; ++i) {
if (pVtx[i].Flag()) {
pVtx[j]=pVtx[i];
++j;
}
}
aNbVtx=j;
}
//=======================================================================
//function : AdjustOnPeriod
//purpose :
//=======================================================================
Standard_Real AdjustOnPeriod(const Standard_Real aTr,
const Standard_Real aPeriod)
{
Standard_Integer k;
Standard_Real aT;
//
aT=aTr;
if (aT<0.) {
k=-(Standard_Integer)(aT/aPeriod)+1;
aT=aT+k*aPeriod;
}
//
if (!(aT>=0. && aT<=aPeriod)) {
k=(Standard_Integer)(aT/aPeriod);
aT=aT-k*aPeriod;
}
//
return aT;
}
//=======================================================================
//function : RejectMicroCrcles
//purpose :
//=======================================================================
Standard_Boolean RejectMicroCircle(const Handle(IntPatch_GLine)& aGLine,
const IntPatch_IType aType,
const Standard_Real aTol3D)
{
Standard_Boolean bRet;
Standard_Real aR;
//
bRet=Standard_False;
//
if (aType==IntPatch_Circle) {
aR=aGLine->Circle().Radius();
bRet=(aR<aTol3D);
}
else if (aType==IntPatch_Ellipse) {
aR=aGLine->Ellipse().MajorRadius();
bRet=(aR<aTol3D);
}
return bRet;
}
//=======================================================================
// function: SortShell
// purpose :
//=======================================================================
void SortShell(const Standard_Integer n,
IntTools_RealWithFlag *a)
{
Standard_Integer nd, i, j, l, d=1;
IntTools_RealWithFlag x;
//
while(d<=n) {
d*=2;
}
//
while (d) {
d=(d-1)/2;
//
nd=n-d;
for (i=0; i<nd; ++i) {
j=i;
m30:;
l=j+d;
if (a[l] < a[j]){
x=a[j];
a[j]=a[l];
a[l]=x;
j-=d;
if (j > -1) goto m30;
}//if (a[l] < a[j]){
}//for (i=0; i<nd; ++i)
}//while (1)
}

View File

@@ -661,22 +661,27 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
// as initial point for aPrjPS, so we switch them
gp_Vec2d D;
if(U == Uinf && mySurface->IsUPeriodic())
if((Abs(U - Uinf) < mySurface->UResolution(Precision::PConfusion())) &&
mySurface->IsUPeriodic())
{
d1(t, U, V, D, myCurve, mySurface);
if (D.X() < 0) U = Usup;
}
else if(U == Usup && mySurface->IsUPeriodic())
{
else if((Abs(U - Usup) < mySurface->UResolution(Precision::PConfusion())) &&
mySurface->IsUPeriodic())
{
d1(t, U, V, D, myCurve, mySurface);
if (D.X() > 0) U = Uinf;
}
if(V == Vinf && mySurface->IsVPeriodic())
if((Abs(V - Vinf) < mySurface->VResolution(Precision::PConfusion())) &&
mySurface->IsVPeriodic())
{
d1(t, U, V, D, myCurve, mySurface);
if (D.Y() < 0) V = Vsup;
}
else if(V == Vsup && mySurface->IsVPeriodic())
else if((Abs(V - Vsup) <= mySurface->VResolution(Precision::PConfusion())) &&
mySurface->IsVPeriodic())
{
d1(t, U, V, D, myCurve, mySurface);
if (D.Y() > 0) V = Vinf;

View File

@@ -558,7 +558,7 @@ static void Project(ProjLib_Projector& P, Handle(Adaptor3d_HCurve)& C)
ProjLib_ProjectedCurve::ProjLib_ProjectedCurve()
{
myTolerance = Precision::PApproximation();
myTolerance = Precision::Confusion();
}
@@ -570,7 +570,7 @@ ProjLib_ProjectedCurve::ProjLib_ProjectedCurve()
ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
(const Handle(Adaptor3d_HSurface)& S)
{
myTolerance = Precision::PApproximation();
myTolerance = Precision::Confusion();
Load(S);
}
@@ -584,7 +584,7 @@ ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
(const Handle(Adaptor3d_HSurface)& S,
const Handle(Adaptor3d_HCurve)& C)
{
myTolerance = Precision::PApproximation();
myTolerance = Precision::Confusion();
Load(S);
Load(C);
}
@@ -600,7 +600,7 @@ ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
const Handle(Adaptor3d_HCurve)& C,
const Standard_Real Tol)
{
myTolerance = Max(Tol, Precision::PApproximation());
myTolerance = Max(Tol, Precision::Confusion());
Load(S);
Load(C);
}
@@ -624,7 +624,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HSurface)& S)
void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
{
myTolerance = Max(myTolerance,Precision::PApproximation());
myTolerance = Max(myTolerance, Precision::Confusion());
myCurve = C;
Standard_Real FirstPar = C->FirstParameter();
Standard_Real LastPar = C->LastParameter();

View File

@@ -433,34 +433,35 @@ void STEPControl_Reader::FileUnits( TColStd_SequenceOfAsciiString& theUnitLength
//purpose :
//=======================================================================
inline static TCollection_AsciiString getSiName(StepBasic_SiUnitName theName,
StepBasic_SiPrefix thePrefix)
inline static TCollection_AsciiString getSiName(const Handle(StepBasic_SiUnit)& theUnit)
{
TCollection_AsciiString aName;
switch (thePrefix) {
case StepBasic_spExa: aName += "exa"; break;
case StepBasic_spPeta: aName += "peta"; break;
case StepBasic_spTera: aName += "tera"; break;
case StepBasic_spGiga: aName += "giga"; break;
case StepBasic_spMega: aName += "mega"; break;
case StepBasic_spHecto: aName += "hecto"; break;
case StepBasic_spDeca: aName += "deca"; break;
case StepBasic_spDeci: aName += "deci"; break;
case StepBasic_spPico: aName += "pico"; break;
case StepBasic_spFemto: aName += "femto"; break;
case StepBasic_spAtto: aName += "atto"; break;
case StepBasic_spKilo : aName += "kilo"; break;
case StepBasic_spCenti :aName += "centi"; break;
case StepBasic_spMilli :aName += "milli"; break;
case StepBasic_spMicro :aName += "micro"; break;
case StepBasic_spNano :aName += "nano"; break;
default: break;
if (theUnit->HasPrefix()) {
switch (theUnit->Prefix()) {
case StepBasic_spExa: aName += "exa"; break;
case StepBasic_spPeta: aName += "peta"; break;
case StepBasic_spTera: aName += "tera"; break;
case StepBasic_spGiga: aName += "giga"; break;
case StepBasic_spMega: aName += "mega"; break;
case StepBasic_spHecto: aName += "hecto"; break;
case StepBasic_spDeca: aName += "deca"; break;
case StepBasic_spDeci: aName += "deci"; break;
case StepBasic_spPico: aName += "pico"; break;
case StepBasic_spFemto: aName += "femto"; break;
case StepBasic_spAtto: aName += "atto"; break;
case StepBasic_spKilo : aName += "kilo"; break;
case StepBasic_spCenti :aName += "centi"; break;
case StepBasic_spMilli :aName += "milli"; break;
case StepBasic_spMicro :aName += "micro"; break;
case StepBasic_spNano :aName += "nano"; break;
default: break;
};
}
switch(theName) {
switch(theUnit->Name()) {
case StepBasic_sunMetre : aName += "metre"; break;
case StepBasic_sunRadian : aName += "radian"; break;
case StepBasic_sunSteradian : aName += "steradian"; break;
@@ -540,7 +541,7 @@ Standard_Boolean STEPControl_Reader::findUnits(
continue;
anUnitFact = (!aSiUnit->HasPrefix() ?
1. : STEPConstruct_UnitContext::ConvertSiPrefix(aSiUnit->Prefix()));
aName = getSiName(aSiUnit->Name(), aSiUnit->Prefix());
aName = getSiName(aSiUnit);
}

View File

@@ -39,7 +39,7 @@
// Primary definitions
#define OCC_VERSION_MAJOR 6
#define OCC_VERSION_MINOR 5
#define OCC_VERSION_MAINTENANCE 4
#define OCC_VERSION_MAINTENANCE 5
//! This macro must be commented in official release, and set to non-empty
//! string in other situations, to identify specifics of the version, e.g.:
@@ -51,7 +51,7 @@
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 6.5
#define OCC_VERSION_STRING "6.5"
#define OCC_VERSION_COMPLETE "6.5.4"
#define OCC_VERSION_COMPLETE "6.5.5"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -146,6 +146,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
gp_Pnt dummypnt;
Standard_Real ddefle= Max(UMax-UMin, VMax-VMin) * aDrawer->DeviationCoefficient();
TColgp_SequenceOfPnt2d tabP;
Standard_Real aHatchingTol = 1.e100;
UMin = VMin = 1.e100;
UMax = VMax = -1.e100;
@@ -173,6 +174,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
UMax = Max(P2.X(), UMax);
VMin = Min(P2.Y(), VMin);
VMax = Max(P2.Y(), VMax);
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
if(Orient == TopAbs_FORWARD ) {
//isobuild.Trim(P1,P2);
@@ -219,6 +221,8 @@ void StdPrs_WFDeflectionRestrictedFace::Add
UMax = Max(P2.X(), UMax);
VMin = Min(P2.Y(), VMin);
VMax = Max(P2.Y(), VMax);
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
if(Orient == TopAbs_FORWARD ) {
// isobuild.Trim(P1,P2);
tabP.Append(P1);
@@ -240,8 +244,13 @@ void StdPrs_WFDeflectionRestrictedFace::Add
FFaceTimer2.Start();
#endif
// Compute the hatching tolerance.
aHatchingTol *= 0.1;
aHatchingTol = Max(Precision::Confusion(), aHatchingTol);
aHatchingTol = Min(1.e-5, aHatchingTol);
// load the isos
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
Hatch_Hatcher isobuild(aHatchingTol, ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed();
Standard_Boolean VClosed = aFace->IsVClosed();

View File

@@ -7,3 +7,4 @@ TKG2d
TKTopAlgo
TKG3d
TKBool
TKShHealing

View File

@@ -54,8 +54,10 @@
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Image_AlienPixMap.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_IsoAspect.hxx>
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -701,6 +703,121 @@ Handle(AIS_InteractiveObject) DetectedFromContext(
return ret;
}
//==============================================================================
//function : CopyIsoAspect
//purpose : Returns copy Prs3d_IsoAspect with new number of isolines.
//==============================================================================
static Handle(Prs3d_IsoAspect) CopyIsoAspect
(const Handle(Prs3d_IsoAspect) &theIsoAspect,
const Standard_Integer theNbIsos)
{
Quantity_Color aColor;
Aspect_TypeOfLine aType;
Standard_Real aWidth;
theIsoAspect->Aspect()->Values(aColor, aType, aWidth);
Handle(Prs3d_IsoAspect) aResult =
new Prs3d_IsoAspect(aColor, aType, aWidth, theNbIsos);
return aResult;
}
//==============================================================================
//function : visos
//purpose : Returns or sets the number of U- and V- isos and isIsoOnPlane flag
//Draw arg : [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]
//==============================================================================
static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (TheAISContext().IsNull()) {
di << argv[0] << " Call 'vinit' before!\n";
return 1;
}
if (argc <= 1) {
di << "Current number of isos : " <<
TheAISContext()->IsoNumber(AIS_TOI_IsoU) << " " <<
TheAISContext()->IsoNumber(AIS_TOI_IsoV) << "\n";
di << "IsoOnPlane mode is " <<
(TheAISContext()->IsoOnPlane() ? "ON" : "OFF") << "\n";
return 0;
}
Standard_Integer aLastInd = argc - 1;
Standard_Boolean isChanged = Standard_False;
Standard_Integer aNbUIsos;
Standard_Integer aNbVIsos;
if (aLastInd >= 3) {
Standard_Boolean isIsoOnPlane = Standard_False;
if (strcmp(argv[aLastInd], "1") == 0) {
isIsoOnPlane = Standard_True;
isChanged = Standard_True;
} else if (strcmp(argv[aLastInd], "0") == 0) {
isIsoOnPlane = Standard_False;
isChanged = Standard_True;
}
if (isChanged) {
aNbVIsos = Draw::Atoi(argv[aLastInd - 1]);
aNbUIsos = Draw::Atoi(argv[aLastInd - 2]);
aLastInd -= 3;
di << "New number of isos : " << aNbUIsos << " " << aNbVIsos << "\n";
di << "New IsoOnPlane mode is " << (isIsoOnPlane ? "ON" : "OFF") << "\n";
TheAISContext()->IsoOnPlane(isIsoOnPlane);
if (aLastInd == 0) {
// If there are no shapes provided set the default numbers.
TheAISContext()->SetIsoNumber(aNbUIsos, AIS_TOI_IsoU);
TheAISContext()->SetIsoNumber(aNbVIsos, AIS_TOI_IsoV);
}
}
}
Standard_Integer i;
for (i = 1; i <= aLastInd; i++) {
TCollection_AsciiString name(argv[i]);
Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
if (IsBound) {
const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
const Handle(AIS_InteractiveObject) aShape =
Handle(AIS_InteractiveObject)::DownCast (anObj);
Handle(AIS_Drawer) CurDrawer = aShape->Attributes();
Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect();
Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect();
if (isChanged) {
CurDrawer->SetUIsoAspect(CopyIsoAspect(aUIso, aNbUIsos));
CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
TheAISContext()->SetLocalAttributes
(aShape, CurDrawer, Standard_False);
TheAISContext()->Redisplay(aShape);
} else {
di << "Number of isos for " << argv[i] << " : "
<< aUIso->Number() << " " << aVIso->Number() << "\n";
}
} else {
di << argv[i] << ": Not an AIS interactive object!\n";
}
} else {
di << argv[i] << ": Use 'vdisplay' before\n";
}
}
if (isChanged) {
TheAISContext()->UpdateCurrentViewer();
}
return 0;
}
//==============================================================================
//function : VDispAreas,VDispSensitive,...
@@ -3556,6 +3673,10 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
const char *group = "AIS_Display";
// display
theCommands.Add("visos",
"visos [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]\n"
"\tIf last 3 optional parameters are not set prints numbers of U-, V- isolines and IsoOnPlane.\n",
__FILE__, visos, group);
theCommands.Add("vdisplay",
"vdisplay : vdisplay2 name1 [name2] ... [name n] ",

View File

@@ -3,7 +3,7 @@
## Test : K7
## Comment : from cts21020
## ====================================
puts "TODO OCC22817 All:Faulty shapes in variables faulty_1 to faulty_14"
puts "TODO OCC22817 All:Faulty shapes in variables faulty_1 to faulty_"
restore [locate_data_file CFI_cts21020.rle] a
explode a e

View File

@@ -3,7 +3,7 @@
## Test : K9
## Comment : from pro13892
## ====================================
puts "TODO OCC22817 All:Faulty shapes in variables faulty_1 to faulty_8"
puts "TODO OCC22817 All:Faulty shapes in variables faulty_1 to faulty_"
restore [locate_data_file CFI_pro13892.rle] a
explode a e

View File

@@ -13,4 +13,4 @@ explode r so
bop r_1 b1
bopcommon result
set square 96
set square empty

View File

@@ -13,4 +13,4 @@ explode r so
bop r_1 b1
bopcut result
set square 600
set square 696

View File

@@ -13,4 +13,4 @@ explode r so
bop r_1 b1
bopfuse result
set square 696
set square 600

View File

@@ -13,4 +13,4 @@ explode r so
bop r_1 b1
boptuc result
set square empty
set square 96

9
tests/bugs/fclasses/bug23535_1 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_13.brep] result

9
tests/bugs/fclasses/bug23535_2 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_14.brep] result

9
tests/bugs/fclasses/bug23535_3 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_2.brep] result

9
tests/bugs/fclasses/bug23535_4 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_3.brep] result

9
tests/bugs/fclasses/bug23535_5 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_5.brep] result

9
tests/bugs/fclasses/bug23535_6 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_7.brep] result

9
tests/bugs/fclasses/bug23535_7 Executable file
View File

@@ -0,0 +1,9 @@
puts "============"
puts "OCC23535"
puts "============"
puts ""
#######################################################################
# Exception in BSplCLib::BuildCache()
#######################################################################
restore [locate_data_file bug23535_spl_8.brep] result

View File

@@ -7,5 +7,4 @@
007 moddata
008 step
009 caf
010 mesh

29
tests/bugs/mesh/begin Executable file
View File

@@ -0,0 +1,29 @@
set Deflection 0.1
set percent_max 5.
# relative tolerance (%)
set rel_tol 1
set area_eps 0
cpulimit 1000
set nbwithouttri(All) 0
set nbfree(All) 0
set nbcross(All) 0
set nbasync(All) 0
set nbfreenodes(All) 0
set bug_area ""
set bug_withouttri ""
set bug_freelinks ""
set bug_cross ""
set bug_async ""
set bug_freenodes ""
if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
pload TOPTEST
}
if { [array get Draw_Groups "ZeViewer"] == "" } {
pload AISV
}

3
tests/bugs/mesh/bug23473 Executable file
View File

@@ -0,0 +1,3 @@
set TheFileName bug23473_Scheibe_1_f867.brep
set command shading

205
tests/bugs/mesh/end Normal file
View File

@@ -0,0 +1,205 @@
# Get name of shape
if { [string compare ${TheFileName} ""] != 0 } {
set is_brep [regexp "\.brep" $TheFileName]
if {$is_brep == 0} {
set is_brep [regexp "\.rle" $TheFileName]
}
if {$is_brep == 1} {
puts [brestore [locate_data_file $TheFileName] res]
} else {
if { [array get Draw_Groups "DE: STEP"] == "" } {
pload XDE
}
stepread [locate_data_file ${TheFileName}] a *
tpcompound res
}
}
puts [checkshape res]
tclean res
if { [string compare $command "shading"] == 0 } {
vinit
vdisplay res
vsetdispmode res 1
vfit
}
if { [string compare $command "incmesh"] == 0 } {
set os "ALL"
if {[array get env os_type] != ""} {
set os $env(os_type)
}
if { $parallel != 1 || [info exists count_parallel] == 0 } {
set count_parallel 1
}
for {set i 1} {$i <= $count_parallel} {incr i} {
tclean res
puts "i = $i"
incmesh res ${Deflection} ${parallel}
}
}
if { [string compare $command "mesh"] == 0 } {
set ResultList [mesh res_mesh res ${Deflection}]
}
# Collect TODO for area
if { [string compare $bug_area ""] != 0 } {
# The difference between square of geometry surface and square of mesh triangles should be less rel_tol value.
# If rel_tol is 100 we suppose the mesh con not be created.
if { $rel_tol == 100 } {
puts "TODO $bug_area All:^\\s*Error : Meshing algo cannot create mesh.\\s*$"
} else {
puts "TODO $bug_area All:^\\s*Error : area by triangles differs from true area by \[-.0-9\]+ %\\s*$"
}
}
# Collect TODO for number of triangles without mesh
if { [string compare $bug_withouttri ""] != 0 } {
# It may be different for different OS
foreach os_withouttri [array names nbwithouttri] {
if { $nbwithouttri($os_withouttri) != 0 } {
puts "TODO $bug_withouttri $os_withouttri:^\\s*Error: Faces without triangulation: $nbwithouttri($os_withouttri)\\b\\s*"
}
}
}
# Collect TODO for number of free links
if { [string compare $bug_freelinks ""] != 0 } {
# It may be different for different OS
foreach os_freelinks [array names nbfree] {
if { $nbfree($os_freelinks) != 0 } {
puts "TODO $bug_freelinks $os_freelinks:^\\s*Error: Free links: $nbfree($os_freelinks)\\b\\s*"
}
}
}
# Collect TODO for number of cross faces
if { [string compare $bug_cross ""] != 0 } {
# It may be different for different OS
foreach os_cross [array names nbcross] {
if { $nbcross($os_cross) != 0 } {
puts "TODO $bug_cross $os_cross:^\\s*Error: Cross face errors: $nbcross($os_cross)\\b\\s*"
}
}
}
# Collect TODO for number of async edges
if { [string compare $bug_async ""] != 0 } {
# It may be different for different OS
foreach os_async [array names nbasync] {
if { $nbasync($os_async) != 0 } {
puts "TODO $bug_async $os_async:^\\s*Error: Async edges: $nbasync($os_async)\\b\\s*"
}
}
}
# Collect TODO for number of free nodes
if { [string compare $bug_freenodes ""] != 0 } {
# It may be different for different OS
foreach os_freenodes [array names nbfreenodes] {
if { $nbfreenodes($os_freenodes) != 0 } {
puts "TODO $bug_freenodes $os_freenodes:^\\s*Error: Free nodes: $nbfreenodes($os_freenodes)\\b\\s*"
}
}
}
# Number of triangles
set tri 0
# Number of nodes
set nod 0
# Deflection
set def 0
# Collect number of triangles, number ofof nodes and deflection.
if { [string compare $command "mesh"] != 0 } {
set full [trinfo res]
regexp "(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[0-9\]|\.+)" $full reg_out tri nod def
} else {
set full [split $ResultList "()"]
set tri [lindex [lindex $full 2] 0]
set lin [lindex [lindex $full 4] 0]
set nod [lindex [lindex $full 6] 0]
}
if { $tri == 0 || $nod == 0 } {
puts " "
puts "Error : Meshing algo cannot create mesh."
}
puts " "
puts "XML property: triangles $tri"
puts "XML property: nodes $nod"
puts " "
# Check if area of triangles is valid
proc CheckTriArea {shape {eps 0}} {
upvar #0 $shape a
set area [triarea a $eps]
set t_area [lindex $area 0]
set g_area [expr abs([lindex $area 1])]
puts "area by triangles: $t_area"
puts "area by geometry: $g_area"
expr ($t_area - $g_area) / $g_area * 100
}
puts "\nChecking triangulation area (triarea command)..."
set rel_err [expr abs([CheckTriArea res $area_eps])]
if { $rel_err > $rel_tol } {
puts "Error : area by triangles differs from true area by $rel_err %"
} else {
if { $rel_tol > 1 && $rel_tol < 100 } {
puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
}
}
# Check if topology of mesh is valid
puts "\nChecking mesh topology (tricheck command)..."
set l [tricheck res]
if {$l != ""} {
puts $l
set withouttri [regsub -all "face \[0-9\]+ has no triangulation" $l "FOUND" ll]
if { $withouttri != 0 } {
puts "Error: Faces without triangulation: $withouttri"
}
if { [regexp "Free_links +(\[0-9\]+) +Cross_face_errors +(\[0-9\]+) +Async_edges +(\[0-9\]+) +Free_nodes +(\[0-9\]+)" $l full freelinks crossfaces asyncedges freenodes] } {
if { $freelinks != 0 } {
puts "Error: Free links: $freelinks"
}
if { $crossfaces != 0 } {
puts "Error: Cross face errors: $crossfaces"
}
if { $asyncedges != 0 } {
puts "Error: Async edges: $asyncedges"
}
if { $freenodes != 0 } {
puts "Error: Free nodes: $freenodes"
}
}
}
if { [info exists imagedir] == 0 } {
set imagedir .
}
if { [info exists test_image ] == 0 } {
set test_image photo
}
if { [string compare $command "shading"] == 0 } {
vdump $imagedir/${test_image}.png
} else {
isos 0
smallview
donly res
fit
triangles res
xwd $imagedir/${test_image}.png
}
puts ""
puts "TEST COMPLETED"
puts ""

18
tests/bugs/modalg/bug23530 Executable file
View File

@@ -0,0 +1,18 @@
puts "========"
puts "CR23530"
puts "========"
puts ""
##################################################
## Error in Draw command "checkshape": invalid face is not recognized
##################################################
restore [locate_data_file bug23530_BadFace.brep] result
pcurve result
decho off
set CheckLog [checkshape result]
decho on
if { [regexp "BRepCheck_UnorientableShape" ${CheckLog}] != 1 } {
puts "CR23530: Error"
}

19
tests/bugs/modalg/bug23606 Executable file
View File

@@ -0,0 +1,19 @@
puts "============"
puts "OCC23606"
puts "============"
puts ""
#######################################################################
# Invalid result of pipe operation
#######################################################################
restore [locate_data_file bug23606_base.brep] sh
restore [locate_data_file bug23606_path.brep] w
pipe result w sh
set n [llength [explode result f]]
if { ${n} != 10 } {
puts "Error : bad number of faces"
}
# Service parameters
set mass -0.1
set m -0.1

26
tests/bugs/modalg/bug23676 Executable file
View File

@@ -0,0 +1,26 @@
puts "============"
puts "CR23676"
puts "============"
puts ""
#########################################################
## Intersection between edge and a face produces extra vertex
#########################################################
restore [locate_data_file bug23676_q1.brep] b1
explode b1
copy b1_1 b1
copy b1_3 b2
bop b1 b2
bopcut result
set nb_v_good 2
set nb_e_good 1
set nb_w_good 1
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
set nb_shape_good 5

18
tests/bugs/modalg/bug23699 Executable file
View File

@@ -0,0 +1,18 @@
puts "========="
puts "CR23699"
puts "========="
puts ""
###############################
## Exception reaised during intersection between two surfaces
###############################
restore [locate_data_file bug23699_Compound_sigsegv.brep] b1
explode b1 f
mksurface s1 b1_1
mksurface s2 b1_2
intersect result s1 s2
set 2dviewer 1

15
tests/bugs/modalg/bug23711 Executable file
View File

@@ -0,0 +1,15 @@
puts "========"
puts "CR23711"
puts "========"
########################################################
## Incorrect result done by fuse operation
########################################################
restore [locate_data_file bug23711_sph1.brep] b1
restore [locate_data_file bug23711_sph2.brep] b2
bop b1 b2
bopfuse result
set square 1256.63
set 2dviewer 1

16
tests/bugs/modalg/bug23716 Executable file
View File

@@ -0,0 +1,16 @@
puts "========"
puts "CR23716"
puts "========"
########################################################
## Boolean Fuse between two faces fails
########################################################
restore [locate_data_file bug23716_qf.brep] b
explode b
bop b_1 b_3
bopfuse result
set square 4844.63
set 2dviewer 1

17
tests/bugs/modalg/bug23732 Executable file
View File

@@ -0,0 +1,17 @@
puts "========="
puts "CR23722"
puts "========="
puts ""
###############################
## Exception reaised during intersection between two surfaces
###############################
restore [locate_data_file bug23732_fx1.brep] b1
restore [locate_data_file bug23732_fx2.brep] b2
mksurface s1 b1
mksurface s2 b1
intersect result s1 s2
set 2dviewer 1

16
tests/bugs/moddata/bug23475 Executable file
View File

@@ -0,0 +1,16 @@
puts "============"
puts "CR23475"
puts "==========="
puts ""
###############################################################################
# Wrong result of Geom_BSpline_Surface::IsVClosed()
###############################################################################
restore [locate_data_file bug23475.brep] s1
set info [dump s1]
if { [regexp "BSplineSurface vclosed" $info] != 1} {
puts "Error : surface is not closed by V"
}

33
tests/bugs/moddata/bug23576 Executable file
View File

@@ -0,0 +1,33 @@
puts "============"
puts "OCC23576"
puts "============"
puts ""
#######################################################################
# Intersection algorithm produces trimmed circle with illegal parametric range.
#######################################################################
restore [locate_data_file bug23576_ff_b1_4_z564.brep] b1
explode b1
bopcurves b1_1 b1_2
copy c_1 result
set log [dump result]
regexp {Parameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full rc1 rc2
puts "rc1=${rc1}"
puts "rc2=${rc2}"
set 2_PI [expr 2. * 2. * asin(1.0)]
puts "2_PI=${2_PI}"
puts ""
if {${rc1} < 0.} {
puts "Error: Bad value of parametric range rc1"
} else {
puts "Good value of parametric range rc1"
}
if {${rc2} > ${2_PI}} {
puts "Error: Bad value of parametric range rc2"
} else {
puts "Good value of parametric range rc2"
}

36
tests/bugs/moddata/bug23587 Executable file
View File

@@ -0,0 +1,36 @@
puts "============"
puts "CR23587"
puts "==========="
puts ""
###############################################################################
# Operation "2dintersect "in TestHarness can not find intersection point of two intersecting 2d curves.
###############################################################################
restore [locate_data_file bug23587_IntEdges.brep] a
explode a
plane pl1 0 0 0 0 0 1
trim trpl1 pl1 -1000 1000 -1000 1000
mkface f1 trpl1
pcurve c1 a_1 f1
pcurve c2 a_2 f1
pcurve c3 a_3 f1
pcurve c4 a_4 f1
set inter1 [2dintersect c1 c2 1.e-6]
set inter2 [2dintersect c3 c2 1.e-6]
set inter3 [2dintersect c1 c4 1.e-6]
set inter4 [2dintersect c3 c4 1.e-6]
set int1 [regexp {Intersection point 1} $inter1]
set int2 [regexp {Intersection point 1} $inter2]
set int3 [regexp {Intersection point 1} $inter3]
set int4 [regexp {Intersection point 1} $inter4]
if { $int1 == 0 || $int2 == 0 || $int3 == 0 || $int4 ==0 } {
puts "Error : Intersection is not found"
}
av2d
2dfit
xwd ${imagedir}/${test_image}.png

14
tests/bugs/moddata/bug23603 Executable file
View File

@@ -0,0 +1,14 @@
puts "============"
puts "CR23603"
puts "============"
puts ""
##########################################################################################################
# Boolean operation between two edges fails
##########################################################################################################
restore [locate_data_file bug23603_ce.brep] b1
explode b1
copy b1_1 e1
copy b1_2 e2
bop e1 e2

29
tests/bugs/moddata/bug23643 Executable file
View File

@@ -0,0 +1,29 @@
puts "========================"
puts "OCC23643"
puts "========================"
puts ""
#######################################################################
# Intersection algorithm produces B-Spline curve in case of coaxial cones
#######################################################################
restore [locate_data_file bug23643_qf3.brep] b
explode b
copy b_1 f1
copy b_2 f2
mksurface s1 f1
mksurface s2 f2
trim s1t s1 0 2*pi -18 10
trim s2t s2 0 2*pi -18 10
intersect result s1t s2t
set log [dump result]
if {[regexp {Trimmed +curve} ${log}]} {
puts "Intersection algorithm work OK"
} else {
puts "Error: Intersection algorithm work bad"
}

20
tests/bugs/moddata/bug23644 Executable file
View File

@@ -0,0 +1,20 @@
puts "========"
puts "CR23644"
puts "========"
##########################################
## Intersection between coaxial cones produces exception
##########################################
pcone cn1 10 0 20
pcone cn2 20 0 20
explode cn1 f
explode cn2 f
copy cn1_1 f1
copy cn2_1 f2
if [catch {bopcurves f1 f2} BOPLog] {
if { [regexp "Tolerance Reached=0\n has no 3d curve" ${BOPLog}] != 1 } {
puts "CR23644: Error"
}
}

20
tests/bugs/moddata/bug23703 Executable file
View File

@@ -0,0 +1,20 @@
puts "========"
puts "CR23703"
puts "========"
puts ""
####################################################################
## Projection algorithm produces incomplete 2D-Curve
####################################################################
restore [locate_data_file bug23703_c2x.brep] c
restore [locate_data_file bug23703_s1.brep] s
mkface f s
pcurve f
project c2d c s
v2d
2dfit
set only_screen_axo 1

40
tests/bugs/moddata/bug23733 Executable file
View File

@@ -0,0 +1,40 @@
puts "================"
puts "CR23733"
puts "================"
puts ""
###############################################
## PCurve for edge on face creation failure
###############################################
pload DCAF TOPTEST
Open [locate_data_file bug_glue_edges_GEOM.sgd] D
GetShape D 0:1:9686:1:1:2 s1
GetShape D 0:1:9449:1:1:2 s2
explode s1 e
explode s2 f
#should create pcurve
bhaspc s1_100 s2_2 do
#should report OK
set info1 [bhaspc s1_100 s2_2]
if { [regexp {No} ${info1}] == 1 } {
puts "Faulty: No 2D curves detected"
}
#should create pcurve
bhaspc s1_40 s2_54 do
#should report OK
set info2 [bhaspc s1_40 s2_54]
if { [regexp {No} ${info2}] == 1 } {
puts "Faulty: No 2D curves detected"
}
#should create pcurve
bhaspc s1_22 s2_123 do
#should report OK
set info3 [bhaspc s1_22 s2_123]
if { [regexp {No} ${info3}] == 1 } {
puts "Faulty: No 2D curves detected"
}

34
tests/bugs/moddata/bug23738 Executable file
View File

@@ -0,0 +1,34 @@
puts "============"
puts "CR23738"
puts "============"
puts ""
#######################################################################
#
#######################################################################
puts "Load first shape ..."
restore [locate_data_file bug23738_b1.brep] b1
puts "Load second shape ..."
restore [locate_data_file bug23738_b2.brep] b2
puts "Prepare boolean operation ..."
bop b1 b2
puts "Start boolean operation ..."
bopfuse result
puts "Finish boolean operation ..."
set square 225009
# Analysis of "nbshapes result"
set nb_v_good 8
set nb_e_good 12
set nb_w_good 8
set nb_f_good 6
set nb_sh_good 1
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
set nb_shape_good 36
set 3dviewer 1

15
tests/bugs/step/bug23567 Executable file
View File

@@ -0,0 +1,15 @@
puts "========================"
puts "OCC23567"
puts "========================"
puts ""
#######################################################################
# Wrong STEP unit is returned by STEPControl_Reader.FileUnits() function
#######################################################################
set info [ stepfileunits [locate_data_file bug23567_a.step] ]
set index1 [lsearch $info metre]
puts ""
if { ${index1} == -1 } {
puts "Error : bad unit"
}

17
tests/bugs/vis/bug22835 Executable file
View File

@@ -0,0 +1,17 @@
puts "============"
puts "CR22835"
puts "============"
puts ""
##########################################################################################################
# IncrementalMesh generates FLT exceptions when running in parallel mode
##########################################################################################################
mpparallel 1
restore [locate_data_file bug22835_hello.brep] result
vinit
vdisplay result
vsetdispmode 1
tclean result
vdisplay result
set 3dviewer 2

22
tests/bugs/vis/bug23705 Executable file
View File

@@ -0,0 +1,22 @@
puts "========"
puts "CR23705"
puts "========"
puts ""
###############################################################
## Isoline in the AIS viewer is not trimmed
###############################################################
restore [locate_data_file bug23705_plancher20igs_face.brep] result
vinit
visos 10 10 1
vdisplay result
vfit
set x 326
set y 295
checkcolor $x $y 0 0 0
set only_screen 1

Some files were not shown because too many files have changed in this diff Show More