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

0024043: Performance improvements: Modeling Algorithms

Performance improvements: Modeling Algorithms (added Shape Healing)
Added TODO to unstable test cases
This commit is contained in:
Roman Lygin 2013-07-12 12:27:30 +04:00
parent 64531d9c98
commit 96a85238fb
28 changed files with 460 additions and 300 deletions

View File

@ -20,7 +20,7 @@
class POnSurf from Extrema inherits Storable from Standard class POnSurf from Extrema
---Purpose: Definition of a point on surface. ---Purpose: Definition of a point on surface.
uses Pnt from gp uses Pnt from gp
@ -28,10 +28,12 @@ uses Pnt from gp
is is
Create returns POnSurf; Create returns POnSurf;
---Purpose: Creation of an indefinite point on surface. ---Purpose: Creation of an indefinite point on surface.
---C++: inline
Create (U,V: Real; P: Pnt) returns POnSurf; Create (U,V: Real; P: Pnt) returns POnSurf;
---Purpose: Creation of a point on surface with parameter ---Purpose: Creation of a point on surface with parameter
-- values on the surface and a Pnt from gp. -- values on the surface and a Pnt from gp.
---C++: inline
Value (me) returns Pnt Value (me) returns Pnt
---Purpose: Returns the 3d point. ---Purpose: Returns the 3d point.

View File

@ -17,13 +17,3 @@
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
#include <Extrema_POnSurf.ixx> #include <Extrema_POnSurf.ixx>
Extrema_POnSurf::Extrema_POnSurf () {}
Extrema_POnSurf::Extrema_POnSurf ( const Standard_Real U, const Standard_Real V, const gp_Pnt& P)
{
myU = U;
myV = V;
myP = P;
}

View File

@ -17,6 +17,15 @@
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
inline Extrema_POnSurf::Extrema_POnSurf () {}
inline Extrema_POnSurf::Extrema_POnSurf (const Standard_Real U,
const Standard_Real V,
const gp_Pnt& P) :
myU (U), myV (V), myP (P)
{
}
inline void Extrema_POnSurf::Parameter ( Standard_Real& U, Standard_Real& V) const inline void Extrema_POnSurf::Parameter ( Standard_Real& U, Standard_Real& V) const
{ {
U = myU; U = myU;

View File

@ -42,6 +42,11 @@
#include <IntPatch_GLine.hxx> #include <IntPatch_GLine.hxx>
#include <IntPatch_ALineToWLine.hxx> #include <IntPatch_ALineToWLine.hxx>
#include <IntPatch_IType.hxx> #include <IntPatch_IType.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_List.hxx>
#include <NCollection_LocalArray.hxx>
#include <NCollection_StdAllocator.hxx>
#include <vector>
#include <AppParCurves_MultiBSpCurve.hxx> #include <AppParCurves_MultiBSpCurve.hxx>
@ -1260,10 +1265,24 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
const GeomInt_LineConstructor& theLConstructor, const GeomInt_LineConstructor& theLConstructor,
IntPatch_SequenceOfLine& theNewLines) IntPatch_SequenceOfLine& theNewLines)
{ {
typedef NCollection_List<Standard_Integer> ListOfInteger;
//have to use std::vector, not NCollection_Vector in order to use copy constructor of
//ListOfInteger which will be created with specific allocator instance
typedef std::vector<ListOfInteger, NCollection_StdAllocator<
ListOfInteger> > ArrayOfListOfInteger;
Standard_Boolean bIsPrevPointOnBoundary, bIsCurrentPointOnBoundary; Standard_Boolean bIsPrevPointOnBoundary, bIsCurrentPointOnBoundary;
Standard_Integer nblines, aNbPnts, aNbParts, pit, i, j, aNbListOfPointIndex; Standard_Integer nblines, aNbPnts, aNbParts, pit, i, j, aNbListOfPointIndex;
Standard_Real aTol, umin, umax, vmin, vmax; Standard_Real aTol, umin, umax, vmin, vmax;
TColStd_ListOfInteger aListOfPointIndex;
//an inc allocator, it will contain wasted space (upon list's Clear()) but it should
//still be faster than the standard allocator, and wasted memory should not be
//significant and will be limited by time span of this function;
//this is a separate allocator from the anIncAlloc below what provides better data
//locality in the latter (by avoiding wastes which will only be in anIdxAlloc)
Handle(NCollection_IncAllocator) anIdxAlloc = new NCollection_IncAllocator();
ListOfInteger aListOfPointIndex (anIdxAlloc);
//GeomAPI_ProjectPointOnSurf aPrj1, aPrj2; //GeomAPI_ProjectPointOnSurf aPrj1, aPrj2;
ProjectPointOnSurf aPrj1, aPrj2; ProjectPointOnSurf aPrj1, aPrj2;
Handle(Geom_Surface) aSurf1, aSurf2; Handle(Geom_Surface) aSurf1, aSurf2;
@ -1275,8 +1294,13 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
return Standard_False; return Standard_False;
} }
// //
TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts); Handle(NCollection_IncAllocator) anIncAlloc = new NCollection_IncAllocator();
TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts); NCollection_StdAllocator<ListOfInteger> anAlloc (anIncAlloc);
const ListOfInteger aDummy (anIncAlloc); //empty list to be copy constructed from
ArrayOfListOfInteger anArrayOfLines (aNbPnts + 1, aDummy, anAlloc);
NCollection_LocalArray<Standard_Integer> anArrayOfLineTypeArr (aNbPnts + 1);
Standard_Integer* anArrayOfLineType = anArrayOfLineTypeArr;
// //
nblines = 0; nblines = 0;
aTol = Precision::Confusion(); aTol = Precision::Confusion();
@ -1350,8 +1374,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
if(!aListOfPointIndex.IsEmpty()) { if(!aListOfPointIndex.IsEmpty()) {
nblines++; nblines++;
anArrayOfLines.SetValue(nblines, aListOfPointIndex); anArrayOfLines[nblines] = aListOfPointIndex;
anArrayOfLineType.SetValue(nblines, bIsPrevPointOnBoundary); anArrayOfLineType[nblines] = bIsPrevPointOnBoundary;
aListOfPointIndex.Clear(); aListOfPointIndex.Clear();
} }
bIsPrevPointOnBoundary = bIsCurrentPointOnBoundary; bIsPrevPointOnBoundary = bIsCurrentPointOnBoundary;
@ -1362,8 +1386,8 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
aNbListOfPointIndex=aListOfPointIndex.Extent(); aNbListOfPointIndex=aListOfPointIndex.Extent();
if(aNbListOfPointIndex) { if(aNbListOfPointIndex) {
nblines++; nblines++;
anArrayOfLines.SetValue(nblines, aListOfPointIndex); anArrayOfLines[nblines] = aListOfPointIndex;
anArrayOfLineType.SetValue(nblines, bIsPrevPointOnBoundary); anArrayOfLineType[nblines] = bIsPrevPointOnBoundary;
aListOfPointIndex.Clear(); aListOfPointIndex.Clear();
} }
// //
@ -1374,15 +1398,15 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
// Correct wlines.begin // Correct wlines.begin
Standard_Integer aLineType; Standard_Integer aLineType;
TColStd_Array1OfListOfInteger anArrayOfLineEnds(1, nblines); TColStd_Array1OfListOfInteger anArrayOfLineEnds(1, nblines);
Handle(IntSurf_LineOn2S) aSeqOfPntOn2S = new IntSurf_LineOn2S(); Handle(IntSurf_LineOn2S) aSeqOfPntOn2S = new IntSurf_LineOn2S (new NCollection_IncAllocator());
// //
for(i = 1; i <= nblines; i++) { for(i = 1; i <= nblines; i++) {
aLineType=anArrayOfLineType.Value(i); aLineType=anArrayOfLineType[i];
if(aLineType) { if(aLineType) {
continue; continue;
} }
// //
const TColStd_ListOfInteger& aListOfIndex = anArrayOfLines.Value(i); const ListOfInteger& aListOfIndex = anArrayOfLines[i];
if(aListOfIndex.Extent() < 2) { if(aListOfIndex.Extent() < 2) {
continue; continue;
} }
@ -1396,12 +1420,12 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
continue; continue;
} }
// //
aLineTypeNeib=anArrayOfLineType.Value(aneighbourindex); aLineTypeNeib=anArrayOfLineType[aneighbourindex];
if(!aLineTypeNeib){ if(!aLineTypeNeib){
continue; continue;
} }
// //
const TColStd_ListOfInteger& aNeighbour = anArrayOfLines.Value(aneighbourindex); const ListOfInteger& aNeighbour = anArrayOfLines[aneighbourindex];
Standard_Integer anIndex = (!j) ? aNeighbour.Last() : aNeighbour.First(); Standard_Integer anIndex = (!j) ? aNeighbour.Last() : aNeighbour.First();
const IntSurf_PntOn2S& aPoint = theWLine->Point(anIndex); const IntSurf_PntOn2S& aPoint = theWLine->Point(anIndex);
// check if need use derivative.begin .end [absence] // check if need use derivative.begin .end [absence]
@ -1637,10 +1661,10 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S(); Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
// //
for(i = 1; i <= nblines; i++) { for(i = 1; i <= nblines; i++) {
if(anArrayOfLineType.Value(i) != 0) { if(anArrayOfLineType[i] != 0) {
continue; continue;
} }
const TColStd_ListOfInteger& aListOfIndex = anArrayOfLines.Value(i); const ListOfInteger& aListOfIndex = anArrayOfLines[i];
if(aListOfIndex.Extent() < 2) { if(aListOfIndex.Extent() < 2) {
continue; continue;
@ -1666,7 +1690,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First()); const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First());
aLineOn2S->Add(aP); aLineOn2S->Add(aP);
} }
TColStd_ListIteratorOfListOfInteger anIt(aListOfIndex); ListOfInteger::Iterator anIt(aListOfIndex);
for(; anIt.More(); anIt.Next()) { for(; anIt.More(); anIt.Next()) {
const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value()); const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value());
@ -1683,9 +1707,9 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
Standard_Boolean bIsEndOfLine = Standard_True; Standard_Boolean bIsEndOfLine = Standard_True;
if(aneighbour <= nblines) { if(aneighbour <= nblines) {
const TColStd_ListOfInteger& aListOfNeighbourIndex = anArrayOfLines.Value(aneighbour); const ListOfInteger& aListOfNeighbourIndex = anArrayOfLines[aneighbour];
if((anArrayOfLineType.Value(aneighbour) != 0) && if((anArrayOfLineType[aneighbour] != 0) &&
(aListOfNeighbourIndex.IsEmpty())) { (aListOfNeighbourIndex.IsEmpty())) {
bIsEndOfLine = Standard_False; bIsEndOfLine = Standard_False;
} }
@ -1706,7 +1730,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
if(bIsFirstInside && bIsLastInside) { if(bIsFirstInside && bIsLastInside) {
// append inside points between ifprm and ilprm // append inside points between ifprm and ilprm
TColStd_ListIteratorOfListOfInteger anIt(aListOfIndex); ListOfInteger::Iterator anIt(aListOfIndex);
for(; anIt.More(); anIt.Next()) { for(; anIt.More(); anIt.Next()) {
if((anIt.Value() < ifprm) || (anIt.Value() > ilprm)) if((anIt.Value() < ifprm) || (anIt.Value() > ilprm))
@ -1719,7 +1743,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
if(bIsFirstInside) { if(bIsFirstInside) {
// append points from ifprm to last point + boundary point // append points from ifprm to last point + boundary point
TColStd_ListIteratorOfListOfInteger anIt(aListOfIndex); ListOfInteger::Iterator anIt(aListOfIndex);
for(; anIt.More(); anIt.Next()) { for(; anIt.More(); anIt.Next()) {
if(anIt.Value() < ifprm) if(anIt.Value() < ifprm)
@ -1737,9 +1761,9 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
Standard_Boolean bIsEndOfLine = Standard_True; Standard_Boolean bIsEndOfLine = Standard_True;
if(aneighbour <= nblines) { if(aneighbour <= nblines) {
const TColStd_ListOfInteger& aListOfNeighbourIndex = anArrayOfLines.Value(aneighbour); const ListOfInteger& aListOfNeighbourIndex = anArrayOfLines[aneighbour];
if((anArrayOfLineType.Value(aneighbour) != 0) && if((anArrayOfLineType[aneighbour] != 0) &&
(aListOfNeighbourIndex.IsEmpty())) { (aListOfNeighbourIndex.IsEmpty())) {
bIsEndOfLine = Standard_False; bIsEndOfLine = Standard_False;
} }
@ -1762,7 +1786,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First()); const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First());
aLineOn2S->Add(aP); aLineOn2S->Add(aP);
} }
TColStd_ListIteratorOfListOfInteger anIt(aListOfIndex); ListOfInteger::Iterator anIt(aListOfIndex);
for(; anIt.More(); anIt.Next()) { for(; anIt.More(); anIt.Next()) {
if(anIt.Value() > ilprm) if(anIt.Value() > ilprm)
@ -1796,12 +1820,12 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
// //
if ((ilprm-ifprm)==1) { if ((ilprm-ifprm)==1) {
for(i = 1; i <= nblines; i++) { for(i = 1; i <= nblines; i++) {
aLineType=anArrayOfLineType.Value(i); aLineType=anArrayOfLineType[i];
if(aLineType) { if(aLineType) {
continue; continue;
} }
// //
const TColStd_ListOfInteger& aListOfIndex = anArrayOfLines.Value(i); const ListOfInteger& aListOfIndex = anArrayOfLines[i];
aNbPoints=aListOfIndex.Extent(); aNbPoints=aListOfIndex.Extent();
if(aNbPoints==1) { if(aNbPoints==1) {
aIndex=aListOfIndex.First(); aIndex=aListOfIndex.First();

View File

@ -82,7 +82,7 @@ void IntPatch_PolyLine::Prepare()
Standard_Integer i; Standard_Integer i;
myBox.SetVoid(); myBox.SetVoid();
Standard_Integer n=NbPoints(); Standard_Integer n=NbPoints();
Standard_Real eps = myError; const Standard_Real eps_2 = myError * myError;
gp_Pnt2d P1, P2; gp_Pnt2d P1, P2;
if (n >= 3) { if (n >= 3) {
@ -93,12 +93,12 @@ void IntPatch_PolyLine::Prepare()
if (i >= 3) { if (i >= 3) {
gp_XY V13 = P3.XY() - P1.XY(); gp_XY V13 = P3.XY() - P1.XY();
gp_XY V12 = P2.XY() - P1.XY(); gp_XY V12 = P2.XY() - P1.XY();
Standard_Real d13 = V13.Modulus(), d; Standard_Real d13_2 = V13.SquareModulus(), d_2;
if (d13 > eps) if (d13_2 > eps_2)
d = V13.CrossMagnitude(V12) / d13; d_2 = V13.CrossSquareMagnitude(V12) / d13_2;
else else
d = eps; d_2 = eps_2;
if (d > myError) { if (d_2 > myError * myError) {
// try to compute deflection more precisely using parabola interpolation // try to compute deflection more precisely using parabola interpolation
gp_XY V23 = P3.XY() - P2.XY(); gp_XY V23 = P3.XY() - P2.XY();
Standard_Real d12 = V12.Modulus(), d23 = V23.Modulus(); Standard_Real d12 = V12.Modulus(), d23 = V23.Modulus();
@ -133,9 +133,9 @@ void IntPatch_PolyLine::Prepare()
Standard_Real d2 = Abs (A2*xt2 + B2*yt2 + C2); Standard_Real d2 = Abs (A2*xt2 + B2*yt2 + C2);
if (d2 > d1) d1 = d2; if (d2 > d1) d1 = d2;
// select min deflection from linear and parabolic ones // select min deflection from linear and parabolic ones
if (d1 < d) d = d1; if (d1 * d1 < d_2) d_2 = d1 * d1;
} }
if (d > myError) myError=d; if (d_2 > myError * myError) myError=Sqrt(d_2);
} }
P1 = P2; P2 = P3; P1 = P2; P2 = P3;
} }

2
src/IntSurf/FILES Normal file
View File

@ -0,0 +1,2 @@
IntSurf_Allocator.hxx
IntSurf_SequenceOfPntOn2S.hxx

View File

@ -38,8 +38,9 @@ is
class PntOn2S; class PntOn2S;
class SequenceOfPntOn2S instantiates Sequence from TCollection imported Allocator;
(PntOn2S from IntSurf);
imported SequenceOfPntOn2S;
class Couple; class Couple;

View File

@ -0,0 +1,26 @@
// Copyright (c) 2013-2013 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 IntSurf_Allocator_HeaderFile
#define IntSurf_Allocator_HeaderFile
#include <NCollection_BaseAllocator.hxx>
typedef Handle_NCollection_BaseAllocator IntSurf_Allocator;
#endif

View File

@ -27,14 +27,15 @@ class LineOn2S from IntSurf
inherits TShared from MMgt inherits TShared from MMgt
uses PntOn2S from IntSurf, uses Allocator from IntSurf,
PntOn2S from IntSurf,
SequenceOfPntOn2S from IntSurf SequenceOfPntOn2S from IntSurf
raises OutOfRange from Standard raises OutOfRange from Standard
is is
Create Create (theAllocator: Allocator from IntSurf = 0)
returns mutable LineOn2S from IntSurf; returns mutable LineOn2S from IntSurf;

View File

@ -19,7 +19,8 @@
#include <IntSurf_LineOn2S.ixx> #include <IntSurf_LineOn2S.ixx>
IntSurf_LineOn2S::IntSurf_LineOn2S () IntSurf_LineOn2S::IntSurf_LineOn2S (const IntSurf_Allocator& theAllocator) :
mySeq (theAllocator)
{} {}

View File

@ -0,0 +1,27 @@
// Copyright (c) 2013-2013 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 IntSurf_SequenceOfPntOn2S_HeaderFile
#define IntSurf_SequenceOfPntOn2S_HeaderFile
#include <IntSurf_PntOn2S.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<IntSurf_PntOn2S> IntSurf_SequenceOfPntOn2S;
#endif

View File

@ -8,3 +8,5 @@ IntWalk_PWalking_1.gxx
IntWalk_PWalking_2.gxx IntWalk_PWalking_2.gxx
IntWalk_PWalking_3.gxx IntWalk_PWalking_3.gxx
IntWalk_PWalking_4.gxx IntWalk_PWalking_4.gxx
IntWalk_VectorOfInteger.hxx
IntWalk_VectorOfWalkingData.hxx

View File

@ -69,6 +69,12 @@ is
generic class IWalking, TheIWLine, SequenceOfIWLine; generic class IWalking, TheIWLine, SequenceOfIWLine;
imported VectorOfWalkingData;
---Purpose: Defines a dynamic vector of work data.
imported VectorOfInteger;
---Purpose: Defines a dynamic vector of integer.
--algorithme/resolution pour un cheminement sur intersection entre --algorithme/resolution pour un cheminement sur intersection entre
-- 2 surfaces biparametrees -- 2 surfaces biparametrees

View File

@ -41,7 +41,8 @@ inherits TShared from MMgt
-- because no marching points where found to stop -- because no marching points where found to stop
-- beware : the directions are not oriented. -- beware : the directions are not oriented.
uses Couple from IntSurf, uses Allocator from IntSurf,
Couple from IntSurf,
SequenceOfCouple from IntSurf, SequenceOfCouple from IntSurf,
PntOn2S from IntSurf, PntOn2S from IntSurf,
LineOn2S from IntSurf, LineOn2S from IntSurf,
@ -54,7 +55,7 @@ raises OutOfRange from Standard,
is is
Create Create (theAllocator: Allocator from IntSurf = 0)
returns mutable IWLine; returns mutable IWLine;

View File

@ -18,11 +18,14 @@
#include <IntSurf_Couple.hxx> #include <IntSurf_Couple.hxx>
IntWalk_IWLine::IntWalk_IWLine() IntWalk_IWLine::IntWalk_IWLine (const IntSurf_Allocator& theAllocator) :
line (new IntSurf_LineOn2S (theAllocator)),
closed (Standard_False),
hasFirst (Standard_False), hasLast (Standard_False),
firstIndex (-1), lastIndex (-1),
indextg (-1),
istgtbeg (Standard_False), istgtend (Standard_False)
{ {
line = new IntSurf_LineOn2S ();
closed=hasFirst=hasLast=istgtbeg=istgtend=Standard_False;
indextg=-1;
} }
void IntWalk_IWLine::Reverse() void IntWalk_IWLine::Reverse()

View File

@ -44,6 +44,8 @@ uses Vector from math,
SequenceOfInteger from TColStd, SequenceOfInteger from TColStd,
SequenceOfReal from TColStd, SequenceOfReal from TColStd,
StatusDeflection from IntWalk, StatusDeflection from IntWalk,
VectorOfInteger from IntWalk,
VectorOfWalkingData from IntWalk,
Vec from gp, Vec from gp,
Dir2d from gp, Dir2d from gp,
PntOn2S from IntSurf PntOn2S from IntSurf
@ -270,6 +272,9 @@ is
is static protected; is static protected;
Clear (me: in out) is static protected;
---Purpose: Clears up internal containers
fields fields
@ -281,13 +286,9 @@ fields
epsilon : Real from Standard; epsilon : Real from Standard;
reversed : Boolean from Standard; reversed : Boolean from Standard;
ustart1 : SequenceOfReal from TColStd; wd1 : VectorOfWalkingData from IntWalk;
vstart1 : SequenceOfReal from TColStd; wd2 : VectorOfWalkingData from IntWalk;
nbMultiplicities : SequenceOfInteger from TColStd; nbMultiplicities : VectorOfInteger from IntWalk;
etat1 : SequenceOfInteger from TColStd;
ustart2 : SequenceOfReal from TColStd;
vstart2 : SequenceOfReal from TColStd;
etat2 : SequenceOfInteger from TColStd;
Um : Real from Standard; -- Min U de la surf Um : Real from Standard; -- Min U de la surf
UM : Real from Standard; -- Max U de la surf UM : Real from Standard; -- Max U de la surf
Vm : Real from Standard; -- Min V de la surf Vm : Real from Standard; -- Min V de la surf

View File

@ -22,6 +22,7 @@ OSD_Chronometer Chronrsnld;
#endif #endif
#include <NCollection_IncAllocator.hxx>
#include <Precision.hxx> #include <Precision.hxx>
IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon, IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
@ -32,12 +33,40 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
pas(Increment), pas(Increment),
tolerance(1,2), tolerance(1,2),
epsilon(Epsilon*Epsilon), epsilon(Epsilon*Epsilon),
wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)),
wd2 (wd1.get_allocator()),
nbMultiplicities (wd1.get_allocator()),
NbPointsConfondusConsecutifs(0), NbPointsConfondusConsecutifs(0),
EpsilonSembleTropGrand(0) EpsilonSembleTropGrand(0)
{ {
} }
//=======================================================================
//function : Reset
//purpose : Clears NCollection_Vector-based containers and adds
// dummy data to maintain start index of 1 and consistent with
// previous TCollection_Sequence-based implementation and other
// used TCollection-based containers
//=======================================================================
void IntWalk_IWalking::Clear()
{
wd1.clear();
wd2.clear();
IntWalk_WalkingData aDummy;
aDummy.etat = -10;
aDummy.ustart = aDummy.vstart = 0.;
wd1.push_back (aDummy);
wd2.push_back (aDummy);
nbMultiplicities.clear();
nbMultiplicities.push_back (-1);
done = Standard_False;
seqAjout.Clear();
lines.Clear();
}
// *************************************************************************** // ***************************************************************************
// etat1=12 pas tangent,pas passant // etat1=12 pas tangent,pas passant
// etat1=11 tangent,pas passant // etat1=11 tangent,pas passant
@ -64,23 +93,12 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
{ {
Standard_Integer I; Standard_Integer I;
ThePointOfPath PathPnt;
Standard_Boolean Rajout = Standard_False; Standard_Boolean Rajout = Standard_False;
Standard_Integer nbPnts1 = Pnts1.Length(); Standard_Integer nbPnts1 = Pnts1.Length();
Standard_Integer nbPnts2 = Pnts2.Length(); Standard_Integer nbPnts2 = Pnts2.Length();
Standard_Real U,V; Standard_Real U,V;
done = Standard_False; Clear();
ustart1.Clear();
vstart1.Clear();
etat1.Clear();
nbMultiplicities.Clear();
ustart2.Clear();
vstart2.Clear();
etat2.Clear();
seqAjout.Clear();
lines.Clear();
reversed = Reversed; reversed = Reversed;
@ -90,51 +108,39 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
TColStd_SequenceOfReal Vmult; TColStd_SequenceOfReal Vmult;
Standard_Integer decal=0; Standard_Integer decal=0;
wd1.reserve (nbPnts1+decal);
nbMultiplicities.reserve (nbPnts1+decal);
for (I=1;I <= nbPnts1+decal; I++) { for (I=1;I <= nbPnts1+decal; I++) {
PathPnt = Pnts1.Value(I-decal); const ThePointOfPath& PathPnt = Pnts1.Value(I-decal);
etat1.Append(1); IntWalk_WalkingData aWD1;
aWD1.etat = 1;
if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) if (!ThePointOfPathTool::IsPassingPnt(PathPnt))
etat1(I) = 11; aWD1.etat = 11;
if (!ThePointOfPathTool::IsTangent(PathPnt)) if (!ThePointOfPathTool::IsTangent(PathPnt))
etat1(I) = etat1(I) + 1; ++aWD1.etat;
Standard_Integer etat1I=etat1(I); if(aWD1.etat==2) { //-- lbr le 15 fev 99
//-- cout<<" \n Etat1("<<I<<") = "<<etat1I<<endl; aWD1.etat=11;
if(etat1I==2) { //-- lbr le 15 fev 99 }
etat1(I)=11;
ThePointOfPathTool::Value2d(PathPnt, U,V); ThePointOfPathTool::Value2d(PathPnt, aWD1.ustart, aWD1.vstart);
ustart1.Append(U); wd1.push_back (aWD1);
vstart1.Append(V); Standard_Integer aNbMult = ThePointOfPathTool::Multiplicity(PathPnt);
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt)); nbMultiplicities.push_back(aNbMult);
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) { for (Standard_Integer J = 1; J <= aNbMult; J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U, V); ThePointOfPathTool::Parameters(PathPnt, J, U, V);
Umult.Append(U); Umult.Append(U);
Vmult.Append(V); Vmult.Append(V);
} }
} }
else { wd2.reserve (nbPnts2);
ThePointOfPathTool::Value2d(PathPnt, U,V);
ustart1.Append(U);
vstart1.Append(V);
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U , V);
Umult.Append(U);
Vmult.Append(V);
}
}
}
for (I = 1; I <= nbPnts2; I++) { for (I = 1; I <= nbPnts2; I++) {
etat2.Append(13); IntWalk_WalkingData aWD2;
ThePointOfLoopTool::Value2d(Pnts2.Value(I), U,V); aWD2.etat = 13;
ustart2.Append(U); ThePointOfLoopTool::Value2d(Pnts2.Value(I), aWD2.ustart, aWD2.vstart);
vstart2.Append(V); wd2.push_back (aWD2);
} }
tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion()); tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
@ -163,7 +169,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
// calcul de toutes les lignes fermees // calcul de toutes les lignes fermees
if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout); if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
for (I = 1; I <= nbPnts1; I++) { for (I = 1; I <= nbPnts1; I++) {
if (etat1(I) >0) seqSingle.Append(Pnts1(I)); if (wd1[I].etat >0) seqSingle.Append(Pnts1(I));
} }
done = Standard_True; done = Standard_True;
} }
@ -181,22 +187,10 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
{ {
Standard_Integer I; Standard_Integer I;
ThePointOfPath PathPnt;
Standard_Boolean Rajout = Standard_False; Standard_Boolean Rajout = Standard_False;
Standard_Integer nbPnts1 = Pnts1.Length(); Standard_Integer nbPnts1 = Pnts1.Length();
Standard_Real U,V; Standard_Real U,V;
done = Standard_False;
ustart1.Clear();
vstart1.Clear();
etat1.Clear();
nbMultiplicities.Clear();
ustart2.Clear();
vstart2.Clear();
etat2.Clear();
seqAjout.Clear();
lines.Clear();
reversed = Reversed; reversed = Reversed;
@ -205,17 +199,19 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
TColStd_SequenceOfReal Umult; TColStd_SequenceOfReal Umult;
TColStd_SequenceOfReal Vmult; TColStd_SequenceOfReal Vmult;
wd1.reserve (nbPnts1);
for (I=1;I <= nbPnts1; I++) { for (I=1;I <= nbPnts1; I++) {
PathPnt = Pnts1.Value(I); const ThePointOfPath& PathPnt = Pnts1.Value(I);
etat1.Append(1); IntWalk_WalkingData aWD1;
if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) etat1(I) = 11; aWD1.etat = 1;
if (!ThePointOfPathTool::IsTangent(PathPnt)) etat1(I) = etat1(I) + 1; if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) aWD1.etat = 11;
ThePointOfPathTool::Value2d(PathPnt, U,V); if (!ThePointOfPathTool::IsTangent(PathPnt)) ++aWD1.etat;
ustart1.Append(U); ThePointOfPathTool::Value2d(PathPnt, aWD1.ustart, aWD1.vstart);
vstart1.Append(V); wd1.push_back (aWD1);
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt)); Standard_Integer aNbMult = ThePointOfPathTool::Multiplicity(PathPnt);
nbMultiplicities.push_back(aNbMult);
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) { for (Standard_Integer J = 1; J <= aNbMult; J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U, V); ThePointOfPathTool::Parameters(PathPnt, J, U, V);
Umult.Append(U); Umult.Append(U);
Vmult.Append(V); Vmult.Append(V);
@ -247,7 +243,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
for (I = 1; I <= nbPnts1; I++) { for (I = 1; I <= nbPnts1; I++) {
if (etat1(I) >0) seqSingle.Append(Pnts1(I)); if (wd1[I].etat >0) seqSingle.Append(Pnts1(I));
} }
done = Standard_True; done = Standard_True;
} }

View File

@ -203,7 +203,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
// l espace UV. // l espace UV.
{ {
Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest; Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest;
Standard_Integer i, j, k, N, ind; Standard_Integer j, N, ind;
Standard_Real tolu = tolerance(1); Standard_Real tolu = tolerance(1);
Standard_Real tolv = tolerance(2); Standard_Real tolv = tolerance(2);
Standard_Real tolu2 = 10.*tolerance(1); Standard_Real tolu2 = 10.*tolerance(1);
@ -221,14 +221,14 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
previousPoint.ParametersOnS1(Up,Vp); previousPoint.ParametersOnS1(Up,Vp);
} }
for (i = 1; i <= etat2.Length(); i++) { for (size_t i = 1; i < wd2.size(); i++) {
if (etat2(i) > 0) { if (wd2[i].etat > 0) {
// debug jag 05.04.94 // debug jag 05.04.94
// if ((Up-ustart2(i))*(UV(1)-ustart2(i)) + // if ((Up-wd2[i].ustart)*(UV(1)-wd2[i].ustart) +
// (Vp-vstart2(i))*(UV(2)-vstart2(i)) <= 0) // (Vp-wd2[i].vstart)*(UV(2)-wd2[i].vstart) <= 0)
Utest = ustart2(i); Utest = wd2[i].ustart;
Vtest = vstart2(i); Vtest = wd2[i].vstart;
Du = UV(1)-Utest; Du = UV(1)-Utest;
Dv = UV(2)-Vtest; Dv = UV(2)-Vtest;
@ -242,7 +242,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
if ((Abs(Du) < tolu2 && Abs(Dv) < tolv2) || if ((Abs(Du) < tolu2 && Abs(Dv) < tolv2) ||
(Abs(Dup) < tolu2 && Abs(Dvp) < tolv2)) { (Abs(Dup) < tolu2 && Abs(Dvp) < tolv2)) {
etat2(i) = -etat2(i); wd2[i].etat = -wd2[i].etat;
} }
else { else {
Standard_Real DDu = (UV(1)-Up); Standard_Real DDu = (UV(1)-Up);
@ -252,7 +252,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
if(DD1<=DDD) { if(DD1<=DDD) {
Standard_Real DD2 = Dup*Dup+Dvp*Dvp; Standard_Real DD2 = Dup*Dup+Dvp*Dvp;
if(DD2<=DDD && ((Du*Dup) + (Dv*Dvp*tolu/tolv) <= 0.)) { if(DD2<=DDD && ((Du*Dup) + (Dv*Dvp*tolu/tolv) <= 0.)) {
etat2(i) = -etat2(i); wd2[i].etat = -wd2[i].etat;
} }
} }
} }
@ -279,19 +279,19 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
for (l = 1; l <= 2 && !Arrive; l++) { for (l = 1; l <= 2 && !Arrive; l++) {
Standard_Boolean isToCheck; Standard_Boolean isToCheck;
for (i = 1; i <= etat1.Length(); i++) { for (size_t i = 1; i < wd1.size(); i++) {
if (l == 1) if (l == 1)
isToCheck = (etat1(i) > 0); isToCheck = (wd1[i].etat > 0);
else else
isToCheck = (etat1(i) < 0); isToCheck = (wd1[i].etat < 0);
if (isToCheck) { if (isToCheck) {
// Modified by Sergey KHROMOV - Tue Nov 20 11:03:16 2001 End // Modified by Sergey KHROMOV - Tue Nov 20 11:03:16 2001 End
// debug jag voir avec isg // debug jag voir avec isg
Utest = ustart1(i); Utest = wd1[i].ustart;
Vtest = vstart1(i); Vtest = wd1[i].vstart;
Dup = Up - Utest; Dup = Up - Utest;
Dvp = Vp - Vtest; Dvp = Vp - Vtest;
if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) { if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) {
@ -309,12 +309,12 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
UV(2) = Vtest; UV(2) = Vtest;
*/ */
} }
else if (nbMultiplicities(i) > 0 && i_candidates.IsEmpty()) { else if (nbMultiplicities[i] > 0 && i_candidates.IsEmpty()) {
N=0; N=0;
for (k = 1; k < i; k++) { for (size_t k = 1; k < i; k++) {
N+=nbMultiplicities(k); N+=nbMultiplicities[k];
} }
for (j = N + 1; j <= N + nbMultiplicities(i); j++) { for (j = N + 1; j <= N + nbMultiplicities[i]; j++) {
if (((Up-Umult(j))*(UV(1)-Umult(j)) + if (((Up-Umult(j))*(UV(1)-Umult(j)) +
(Vp-Vmult(j))*(UV(2)-Vmult(j)) < 0) || (Vp-Vmult(j))*(UV(2)-Vmult(j)) < 0) ||
(Abs(UV(1)-Umult(j)) < tolu && (Abs(UV(1)-Umult(j)) < tolu &&
@ -336,7 +336,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
} }
} }
} }
} //end of for (i = 1; i <= etat1.Length(); i++) } //end of for (i = 1; i < wd1.size(); i++)
if (!i_candidates.IsEmpty()) if (!i_candidates.IsEmpty())
{ {
Standard_Real MinSqDist = RealLast(); Standard_Real MinSqDist = RealLast();
@ -347,8 +347,8 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
Irang = i_candidates(ind); Irang = i_candidates(ind);
} }
Arrive = Standard_True; Arrive = Standard_True;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
} }
} //end of for (l = 1; l <= 2 && !Arrive; l++) } //end of for (l = 1; l <= 2 && !Arrive; l++)
return Arrive; return Arrive;
@ -412,10 +412,10 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
Standard_Real dPreviousCurrent = (Up-UV1)*(Up-UV1)+(Vp-UV2)*(Vp-UV2); Standard_Real dPreviousCurrent = (Up-UV1)*(Up-UV1)+(Vp-UV2)*(Vp-UV2);
for (k = 1; k <= etat2.Length(); k++) { for (k = 1; k < (int)wd2.size(); k++) {
if (etat2(k) > 0) { if (wd2[k].etat > 0) {
Utest = ustart2(k); Utest = wd2[k].ustart;
Vtest = vstart2(k); Vtest = wd2[k].vstart;
Utest/=deltau; Utest/=deltau;
Vtest/=deltav; Vtest/=deltav;
@ -426,7 +426,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
&& (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) { && (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) {
if(Index!=k) { if(Index!=k) {
//-- cout<<"* etat2 : ("<<k<<")"<<endl; //-- cout<<"* etat2 : ("<<k<<")"<<endl;
etat2(k)=-etat2(k); //-- marque le point comme point de passage wd2[k].etat=-wd2[k].etat; //-- marque le point comme point de passage
} }
else { //-- Index == k else { //-- Index == k
//-- cout<<"* Arrive"<<endl; //-- cout<<"* Arrive"<<endl;
@ -443,7 +443,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
if( (Abs(UpmUtest)<tolu && Abs(VpmVtest)<tolv)) { if( (Abs(UpmUtest)<tolu && Abs(VpmVtest)<tolv)) {
if(Index != k ) { if(Index != k ) {
//-- cout<<"** etat2 : ("<<k<<")"<<endl; //-- cout<<"** etat2 : ("<<k<<")"<<endl;
etat2(k) = -etat2(k); wd2[k].etat = -wd2[k].etat;
} }
} }
else if(Scal<0 && (dPreviousStart+dCurrentStart < dPreviousCurrent)) { else if(Scal<0 && (dPreviousStart+dCurrentStart < dPreviousCurrent)) {
@ -453,18 +453,18 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
} }
else { else {
//-- cout<<"*** etat2 : ("<<k<<")"<<endl; //-- cout<<"*** etat2 : ("<<k<<")"<<endl;
etat2(k) = -etat2(k); // marque le point point de passage wd2[k].etat = -wd2[k].etat; // marque le point point de passage
} }
} }
else if(k!=Index) { else if(k!=Index) {
if(dPreviousStart < dPreviousCurrent*0.25) { if(dPreviousStart < dPreviousCurrent*0.25) {
etat2(k) = -etat2(k); // marque le point point de passage wd2[k].etat = -wd2[k].etat; // marque le point point de passage
//-- cout<<"**** etat2 : ("<<k<<")"<<endl; //-- cout<<"**** etat2 : ("<<k<<")"<<endl;
} }
else { else {
if(dCurrentStart < dPreviousCurrent*0.25) { if(dCurrentStart < dPreviousCurrent*0.25) {
//-- cout<<"***** etat2 : ("<<k<<")"<<endl; //-- cout<<"***** etat2 : ("<<k<<")"<<endl;
etat2(k) = -etat2(k); // marque le point point de passage wd2[k].etat = -wd2[k].etat; // marque le point point de passage
} }
else { else {
Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest; Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest;
@ -473,7 +473,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
if(dMiddleStart < dPreviousCurrent*0.5) { if(dMiddleStart < dPreviousCurrent*0.5) {
//-- cout<<"*********** etat2 : ("<<k<<")"<<endl; //-- cout<<"*********** etat2 : ("<<k<<")"<<endl;
etat2(k) = -etat2(k); // marque le point point de passage wd2[k].etat = -wd2[k].etat; // marque le point point de passage
} }
} }
} }
@ -485,20 +485,20 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
// test de passage sur points passant. // test de passage sur points passant.
Irang =0; Irang =0;
for (i = 1; i <= etat1.Length(); i++) { for (i = 1; i < (int)wd1.size(); i++) {
if (etat1(i) > 0 && etat1(i) < 11) { //test des points passant if (wd1[i].etat > 0 && wd1[i].etat < 11) { //test des points passant
Utest = ustart1(i); Utest = wd1[i].ustart;
Vtest = vstart1(i); Vtest = wd1[i].vstart;
Utest/=deltau; Utest/=deltau;
Vtest/=deltav; Vtest/=deltav;
if (((Up-Utest) * (UV1-Utest) + (Vp-Vtest) * (UV2-Vtest) < 0) || if (((Up-Utest) * (UV1-Utest) + (Vp-Vtest) * (UV2-Vtest) < 0) ||
(Abs(UV1-Utest) < tolu && Abs(UV2-Vtest) < tolv)) (Abs(UV1-Utest) < tolu && Abs(UV2-Vtest) < tolv))
Irang = i; Irang = i;
else if (nbMultiplicities(i) > 0) { else if (nbMultiplicities[i] > 0) {
N=0; N=0;
for (k = 1; k < i; k++) N = N + nbMultiplicities(k); for (k = 1; k < i; k++) N = N + nbMultiplicities[k];
for (Standard_Integer j = N + 1; j <= N + nbMultiplicities(i); j++) { for (Standard_Integer j = N + 1; j <= N + nbMultiplicities[i]; j++) {
Standard_Real Umultj = Umult(j)/deltau; Standard_Real Umultj = Umult(j)/deltau;
Standard_Real Vmultj = Vmult(j)/deltav; Standard_Real Vmultj = Vmult(j)/deltav;
if (((Up-Umultj)*(UV1-Umultj) + if (((Up-Umultj)*(UV1-Umultj) +
@ -605,12 +605,12 @@ void IntWalk_IWalking::TestArretCadre
Irang =0; Irang =0;
for (Standard_Integer i = 1; i <= etat1.Length(); i++) { for (Standard_Integer i = 1; i < (int)wd1.size(); i++) {
if (etat1(i) < 0) { if (wd1[i].etat < 0) {
N=0; // rang dans UVMult. N=0; // rang dans UVMult.
if (nbMultiplicities(i) > 0) { if (nbMultiplicities[i] > 0) {
for (Standard_Integer k = 1; k < i; k++) for (Standard_Integer k = 1; k < i; k++)
N+=nbMultiplicities(k); N+=nbMultiplicities[k];
} }
if (!reversed) { if (!reversed) {
Line->Value(1).ParametersOnS2(Up,Vp); Line->Value(1).ParametersOnS2(Up,Vp);
@ -627,33 +627,33 @@ void IntWalk_IWalking::TestArretCadre
Line->Value(j).ParametersOnS1(Uc,Vc); Line->Value(j).ParametersOnS1(Uc,Vc);
} }
Scal = (Up-ustart1(i)) * (Uc-ustart1(i)) + Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) +
(Vp-vstart1(i)) * (Vc-vstart1(i)); (Vp-wd1[i].vstart) * (Vc-wd1[i].vstart);
// si on a trouve un point d arret : on arrete la ligne sur ce point. // si on a trouve un point d arret : on arrete la ligne sur ce point.
if (Scal < 0) { if (Scal < 0) {
Line->Cut(j); nbp= Line->NbPoints(); Line->Cut(j); nbp= Line->NbPoints();
Irang = i; Irang = i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
} }
else if (Abs(Uc-ustart1(i)) < tolerance(1) && else if (Abs(Uc-wd1[i].ustart) < tolerance(1) &&
Abs(Vc-vstart1(i)) < tolerance(2) ) { Abs(Vc-wd1[i].vstart) < tolerance(2) ) {
Line->Cut(j); nbp= Line->NbPoints(); Line->Cut(j); nbp= Line->NbPoints();
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
} }
else if (nbMultiplicities(i) > 0) { else if (nbMultiplicities[i] > 0) {
for (Standard_Integer k = N+1; k <= N + nbMultiplicities(i); k++) { for (Standard_Integer k = N+1; k <= N + nbMultiplicities[i]; k++) {
Scal = (Up-Umult(k)) * (Uc-Umult(k)) + Scal = (Up-Umult(k)) * (Uc-Umult(k)) +
(Vp-Vmult(k)) * (Vc-Vmult(k)); (Vp-Vmult(k)) * (Vc-Vmult(k));
if (Scal < 0) { if (Scal < 0) {
Line->Cut(j); nbp= Line->NbPoints(); Line->Cut(j); nbp= Line->NbPoints();
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
break; break;
} }
@ -661,8 +661,8 @@ void IntWalk_IWalking::TestArretCadre
Abs(Vc-Vmult(k)) < tolerance(2)) { Abs(Vc-Vmult(k)) < tolerance(2)) {
Line->Cut(j); nbp= Line->NbPoints(); Line->Cut(j); nbp= Line->NbPoints();
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
break; break;
} }
@ -704,40 +704,40 @@ void IntWalk_IWalking::TestArretCadre
// point calcule. // point calcule.
// il n y aura pas besoin de "Cuter" // il n y aura pas besoin de "Cuter"
Scal = (Up-ustart1(i)) * (UV(1)-ustart1(i)) + Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) +
// (Vp-ustart1(i)) * (UV(2)-vstart1(i)); // (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);
// modified by NIZHNY-MKK Fri Oct 27 12:29:41 2000 // modified by NIZHNY-MKK Fri Oct 27 12:29:41 2000
(Vp-vstart1(i)) * (UV(2)-vstart1(i)); (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);
if (Scal < 0) { if (Scal < 0) {
Irang = i; Irang = i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
} }
else if (Abs(UV(1)-ustart1(i)) < tolerance(1) && else if (Abs(UV(1)-wd1[i].ustart) < tolerance(1) &&
Abs(UV(2)-vstart1(i)) < tolerance(2)) { Abs(UV(2)-wd1[i].vstart) < tolerance(2)) {
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
} }
else if (nbMultiplicities(i) > 0) { else if (nbMultiplicities[i] > 0) {
for (Standard_Integer j = N+1; j <= N+nbMultiplicities(i); j++) { for (Standard_Integer j = N+1; j <= N+nbMultiplicities[i]; j++) {
Scal = (Up-Umult(j)) * (UV(1)-Umult(j)) + Scal = (Up-Umult(j)) * (UV(1)-Umult(j)) +
(Vp-Vmult(j)) * (UV(2)-Vmult(j)); (Vp-Vmult(j)) * (UV(2)-Vmult(j));
if (Scal < 0) { if (Scal < 0) {
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
break; break;
} }
else if (Abs(UV(1)-Umult(j)) < tolerance(1) && else if (Abs(UV(1)-Umult(j)) < tolerance(1) &&
Abs(UV(2)-Vmult(j)) < tolerance(2)) { Abs(UV(2)-Vmult(j)) < tolerance(2)) {
Irang=i; Irang=i;
UV(1) = ustart1(Irang); UV(1) = wd1[Irang].ustart;
UV(2) = vstart1(Irang); UV(2) = wd1[Irang].vstart;
Found = Standard_True; Found = Standard_True;
break; break;
} }

View File

@ -18,20 +18,17 @@
#ifndef DEB #include <NCollection_IncAllocator.hxx>
#define No_Standard_RangeError #include <NCollection_LocalArray.hxx>
#define No_Standard_OutOfRange
#endif
// modified by NIZHNY-MKK Thu Nov 2 15:07:26 2000.BEGIN // modified by NIZHNY-MKK Thu Nov 2 15:07:26 2000.BEGIN
static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_SequenceOfInteger& etat, static Standard_Boolean TestPassedSolutionWithNegativeState(const IntWalk_VectorOfWalkingData& wd,
const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Umult,
const TColStd_SequenceOfReal& Vmult, const TColStd_SequenceOfReal& Vmult,
const TColStd_SequenceOfReal& ustart,
const TColStd_SequenceOfReal& vstart,
const Standard_Real& prevUp, const Standard_Real& prevUp,
const Standard_Real& prevVp, const Standard_Real& prevVp,
const TColStd_SequenceOfInteger& nbMultiplicities, const IntWalk_VectorOfInteger& nbMultiplicities,
const math_Vector& tolerance, const math_Vector& tolerance,
TheIWFunction& sp, TheIWFunction& sp,
math_Vector& UV, math_Vector& UV,
@ -101,32 +98,33 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
Standard_Integer nbPath = Pnts1.Length(); Standard_Integer nbPath = Pnts1.Length();
// modified by NIZHNY-MKK Fri Oct 27 12:32:34 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:32:34 2000.BEGIN
TColStd_SequenceOfInteger movementdirectioninfo; NCollection_LocalArray<Standard_Integer> movementdirectioninfoarr (nbPath + 1);
for (I = 1; I <= nbPath; I++) { Standard_Integer* movementdirectioninfo = movementdirectioninfoarr;
movementdirectioninfo.Append(0); for (I = 0; I <= nbPath; I++) {
movementdirectioninfo[I] = 0;
} }
// modified by NIZHNY-MKK Fri Oct 27 12:32:38 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:32:38 2000.END
for (I = 1; I <= nbPath; I++) { for (I = 1; I <= nbPath; I++) {
//start point of the progression //start point of the progression
// if (etat1(I) > 11) { // if (wd1[I].etat > 11) {
// modified by NIZHNY-MKK Fri Oct 27 12:33:37 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:33:37 2000.BEGIN
if ((etat1(I) > 11) || ((etat1(I) < -11) && (movementdirectioninfo(I)!=0))) { if ((wd1[I].etat > 11) || ((wd1[I].etat < -11) && (movementdirectioninfo[I]!=0))) {
// modified by NIZHNY-MKK Fri Oct 27 12:33:43 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:33:43 2000.END
PathPnt = Pnts1.Value(I); PathPnt = Pnts1.Value(I);
CurrentLine = new IntWalk_TheIWLine (); CurrentLine = new IntWalk_TheIWLine (new NCollection_IncAllocator());
CurrentLine->SetTangencyAtBegining(Standard_False); CurrentLine->SetTangencyAtBegining(Standard_False);
Tgtend = Standard_False; Tgtend = Standard_False;
CurrentLine->AddStatusFirst(Standard_False, Standard_True, I, PathPnt); CurrentLine->AddStatusFirst(Standard_False, Standard_True, I, PathPnt);
UVap(1) = ustart1(I); UVap(1) = wd1[I].ustart;
UVap(2) = vstart1(I); UVap(2) = wd1[I].vstart;
MakeWalkingPoint(11, UVap(1), UVap(2), Func, previousPoint); MakeWalkingPoint(11, UVap(1), UVap(2), Func, previousPoint);
previousd3d = Func.Direction3d(); previousd3d = Func.Direction3d();
previousd2d = Func.Direction2d(); previousd2d = Func.Direction2d();
CurrentLine->AddPoint(previousPoint); CurrentLine->AddPoint(previousPoint);
// modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN
if(movementdirectioninfo(I) !=0) { if(movementdirectioninfo[I] !=0) {
if(movementdirectioninfo(I) < 0) { if(movementdirectioninfo[I] < 0) {
StepSign = -1; StepSign = -1;
CurrentLine->SetTangentVector(previousd3d.Reversed(),1); CurrentLine->SetTangentVector(previousd3d.Reversed(),1);
} else { } else {
@ -147,8 +145,8 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
// modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin // Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin
etat1(I) = - abs(etat1(I)); wd1[I].etat = - abs(wd1[I].etat);
movementdirectioninfo(I) = (movementdirectioninfo(I)==0) ? StepSign : 0; movementdirectioninfo[I] = (movementdirectioninfo[I]==0) ? StepSign : 0;
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End // Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End
// first step of advancement // first step of advancement
Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dx = Abs(previousd2d.X());
@ -227,7 +225,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
else { else {
previousPoint.ParametersOnS1(prevUp, prevVp); previousPoint.ParametersOnS1(prevUp, prevVp);
} }
Arrive = TestPassedSolutionWithNegativeState(etat1, Umult, Vmult, ustart1, vstart1, prevUp, prevVp, Arrive = TestPassedSolutionWithNegativeState(wd1, Umult, Vmult, prevUp, prevVp,
nbMultiplicities, tolerance, Func, UVap, N); nbMultiplicities, tolerance, Func, UVap, N);
if(Arrive) { if(Arrive) {
Cadre = Standard_False; Cadre = Standard_False;
@ -294,7 +292,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
// point of stop given at input // point of stop given at input
PathPnt = Pnts1.Value(N); PathPnt = Pnts1.Value(N);
Standard_Integer etat1N=etat1(N); Standard_Integer etat1N=wd1[N].etat;
// modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN // modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN
// if (etat1N < 11) { // passing point that is a stop // if (etat1N < 11) { // passing point that is a stop
if (Abs(etat1N) < 11) { // passing point that is a stop if (Abs(etat1N) < 11) { // passing point that is a stop
@ -317,10 +315,10 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
AddPointInCurrentLine(N,PathPnt,CurrentLine); AddPointInCurrentLine(N,PathPnt,CurrentLine);
if ((etat1N != 1 && etat1N != 11)) { if ((etat1N != 1 && etat1N != 11)) {
// modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN
// etat1(N)= - etat1N; // wd1[N].etat= - wd1[N].etat;
etat1(N)= - Abs(etat1N); wd1[N].etat = - Abs(etat1N);
movementdirectioninfo(N) = (movementdirectioninfo(N)==0) ? StepSign : 0; movementdirectioninfo[N] = (movementdirectioninfo[N]==0) ? StepSign : 0;
if(Arrive && movementdirectioninfo(N)!=0) { if(Arrive && movementdirectioninfo[N]!=0) {
IndexOfPathPointDoNotCheck = N; IndexOfPathPointDoNotCheck = N;
} }
@ -367,23 +365,23 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
CurrentLine->SetTangencyAtEnd(Tgtend); CurrentLine->SetTangencyAtEnd(Tgtend);
lines.Append(CurrentLine); lines.Append(CurrentLine);
// modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN
movementdirectioninfo(I)=0; movementdirectioninfo[I]=0;
if(etat1(I) > 0) if(wd1[I].etat > 0)
// modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END
etat1(I)=-etat1(I); wd1[I].etat=-wd1[I].etat;
//-- lbr le 5 juin 97 (Pb ds Contap) //-- lbr le 5 juin 97 (Pb ds Contap)
for(Standard_Integer av=1; av<=nbPath; av++) { for(Standard_Integer av=1; av<=nbPath; av++) {
// modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN
// if (etat1(av) > 11) { // if (wd1[av].etat > 11) {
if ((etat1(av) > 11) || if ((wd1[av].etat > 11) ||
((av!=I) && ((av!=I) &&
(av!=IndexOfPathPointDoNotCheck) && (av!=IndexOfPathPointDoNotCheck) &&
(etat1(av) < -11) && (wd1[av].etat < -11) &&
(movementdirectioninfo(av)!=0))) { (movementdirectioninfo[av]!=0))) {
// modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END // modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END
Standard_Real Uav=ustart1(av); Standard_Real Uav=wd1[av].ustart;
Standard_Real Vav=vstart1(av); Standard_Real Vav=wd1[av].vstart;
Standard_Real Uavp,Vavp; Standard_Real Uavp,Vavp;
const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints()); const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints());
if (!reversed) { if (!reversed) {
@ -397,12 +395,12 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
Uav*=0.001; Vav*=0.001; Uav*=0.001; Vav*=0.001;
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) { if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
// modified by NIZHNY-MKK Fri Oct 27 13:01:38 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 13:01:38 2000.BEGIN
// etat1(av)=-etat1(av); // wd1[av].etat=-wd1[av].etat;
if(etat1(av) < 0) { if(wd1[av].etat < 0) {
movementdirectioninfo(av) = 0; movementdirectioninfo[av] = 0;
} else { } else {
etat1(av)=-etat1(av); wd1[av].etat=-wd1[av].etat;
movementdirectioninfo(av) = StepSign; movementdirectioninfo[av] = StepSign;
} }
// modified by NIZHNY-MKK Fri Oct 27 13:01:42 2000.END // modified by NIZHNY-MKK Fri Oct 27 13:01:42 2000.END
CurrentLine->AddStatusLast(Standard_True, av, Pnts1.Value(av)); CurrentLine->AddStatusLast(Standard_True, av, Pnts1.Value(av));
@ -416,19 +414,19 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
else { else {
avPP.ParametersOnS1(Uavp,Vavp); avPP.ParametersOnS1(Uavp,Vavp);
} }
Uav=ustart1(av); Uav=wd1[av].ustart;
Vav=vstart1(av); Vav=wd1[av].vstart;
Uav-=Uavp; Uav-=Uavp;
Vav-=Vavp; Vav-=Vavp;
Uav*=0.001; Vav*=0.001; Uav*=0.001; Vav*=0.001;
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) { if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
// modified by NIZHNY-MKK Fri Oct 27 13:02:49 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 13:02:49 2000.BEGIN
// etat1(av)=-etat1(av); // wd1[av].etat=-wd1[av].etat;
if(etat1(av) < 0) { if(wd1[av].etat < 0) {
movementdirectioninfo(av) = 0; movementdirectioninfo[av] = 0;
} else { } else {
etat1(av)=-etat1(av); wd1[av].etat=-wd1[av].etat;
movementdirectioninfo(av) = -StepSign; movementdirectioninfo[av] = -StepSign;
} }
// modified by NIZHNY-MKK Fri Oct 27 13:02:52 2000.END // modified by NIZHNY-MKK Fri Oct 27 13:02:52 2000.END
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl; //-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
@ -443,14 +441,12 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
} }
// modified by NIZHNY-MKK Thu Nov 2 15:07:53 2000.BEGIN // modified by NIZHNY-MKK Thu Nov 2 15:07:53 2000.BEGIN
static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_SequenceOfInteger& etat, static Standard_Boolean TestPassedSolutionWithNegativeState(const IntWalk_VectorOfWalkingData& wd,
const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Umult,
const TColStd_SequenceOfReal& Vmult, const TColStd_SequenceOfReal& Vmult,
const TColStd_SequenceOfReal& ustart,
const TColStd_SequenceOfReal& vstart,
const Standard_Real& prevUp, const Standard_Real& prevUp,
const Standard_Real& prevVp, const Standard_Real& prevVp,
const TColStd_SequenceOfInteger& nbMultiplicities, const IntWalk_VectorOfInteger& nbMultiplicities,
const math_Vector& tolerance, const math_Vector& tolerance,
TheIWFunction& sp, TheIWFunction& sp,
math_Vector& UV, math_Vector& UV,
@ -460,13 +456,13 @@ static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_Sequen
Standard_Real tolu = tolerance(1); Standard_Real tolu = tolerance(1);
Standard_Real tolv = tolerance(2); Standard_Real tolv = tolerance(2);
Standard_Integer i, j, k, N; Standard_Integer i, j, k, N;
for (i = 1; i <= etat.Length(); i++) { for (i = 1; i < (int)wd.size(); i++) {
if (etat(i) < -11) { if (wd[i].etat < -11) {
// debug jag see with isg // debug jag see with isg
Utest = ustart(i); Utest = wd[i].ustart;
Vtest = vstart(i); Vtest = wd[i].vstart;
Dup = prevUp - Utest; Dup = prevUp - Utest;
Dvp = prevVp - Vtest; Dvp = prevVp - Vtest;
if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) { if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) {
@ -480,12 +476,12 @@ static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_Sequen
UV(1) = Utest; UV(1) = Utest;
UV(2) = Vtest; UV(2) = Vtest;
} }
else if (nbMultiplicities(i) > 0) { else if (nbMultiplicities[i] > 0) {
N=0; N=0;
for (k = 1; k < i; k++) { for (k = 1; k < i; k++) {
N+=nbMultiplicities(k); N+=nbMultiplicities[k];
} }
for (j = N + 1; j <= N + nbMultiplicities(i); j++) { for (j = N + 1; j <= N + nbMultiplicities[i]; j++) {
if (((prevUp-Umult(j))*(UV(1)-Umult(j)) + if (((prevUp-Umult(j))*(UV(1)-Umult(j)) +
(prevVp-Vmult(j))*(UV(2)-Vmult(j)) < 0) || (prevVp-Vmult(j))*(UV(2)-Vmult(j)) < 0) ||
(Abs(UV(1)-Umult(j)) < tolu && (Abs(UV(1)-Umult(j)) < tolu &&

View File

@ -17,11 +17,7 @@
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
#include <NCollection_IncAllocator.hxx>
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult, void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
const TColStd_SequenceOfReal& Vmult, const TColStd_SequenceOfReal& Vmult,
@ -88,21 +84,21 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Standard_Integer nbLoop = Pnts2.Length(); Standard_Integer nbLoop = Pnts2.Length();
for (I = 1;I<=nbLoop;I++) { for (I = 1;I<=nbLoop;I++) {
if (etat2(I) > 12) { // start point of closed line if (wd2[I].etat > 12) { // start point of closed line
LoopPnt = Pnts2.Value(I); LoopPnt = Pnts2.Value(I);
previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed, previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed,
ustart2(I),vstart2(I)); wd2[I].ustart,wd2[I].vstart);
previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt); previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt);
previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt); previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt);
CurrentLine = new IntWalk_TheIWLine (); CurrentLine = new IntWalk_TheIWLine (new NCollection_IncAllocator());
CurrentLine->AddPoint(previousPoint); CurrentLine->AddPoint(previousPoint);
CurrentLine->SetTangentVector(previousd3d,1); CurrentLine->SetTangentVector(previousd3d,1);
Tgtbeg = Standard_False; Tgtbeg = Standard_False;
Tgtend = Standard_False; Tgtend = Standard_False;
Uvap(1) = ustart2(I); Uvap(1) = wd2[I].ustart;
Uvap(2) = vstart2(I); Uvap(2) = wd2[I].vstart;
StepSign = 1; StepSign = 1;
@ -183,7 +179,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
else { else {
Tgtend = lines.Value(-N)->IsTangentAtBegining(); Tgtend = lines.Value(-N)->IsTangentAtBegining();
} }
Arrive = (etat2(I) == 12); Arrive = (wd2[I].etat == 12);
} }
} }
@ -196,7 +192,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Tgtend = Func.IsTangent(); // jag 940616 Tgtend = Func.IsTangent(); // jag 940616
N = -N; N = -N;
} }
Arrive = (etat2(I) == 12); // the line is open Arrive = (wd2[I].etat == 12); // the line is open
} }
} }
Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent, Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
@ -227,7 +223,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
} }
else { // open else { // open
etat2(I) = 12; // declare it open wd2[I].etat = 12; // declare it open
Tgtbeg = Tgtend; Tgtbeg = Tgtend;
Tgtend = Standard_False; Tgtend = Standard_False;
ArretAjout = Standard_False; ArretAjout = Standard_False;
@ -252,8 +248,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Arrive = Standard_False; Arrive = Standard_False;
break; break;
} }
if (etat2(I) >12) { //the line should become open if (wd2[I].etat >12) { //the line should become open
etat2(I) = 12; //declare it open wd2[I].etat = 12; //declare it open
ArretAjout = Standard_False; ArretAjout = Standard_False;
OpenLine(0,Psol,Pnts1,Func,CurrentLine); OpenLine(0,Psol,Pnts1,Func,CurrentLine);
StepSign = -1; StepSign = -1;
@ -271,7 +267,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
} }
} }
else if (Arrive) { else if (Arrive) {
if (etat2(I) > 12) { //line closed good case if (wd2[I].etat > 12) { //line closed good case
CurrentLine->AddStatusFirstLast(Standard_True, CurrentLine->AddStatusFirstLast(Standard_True,
Standard_False,Standard_False); Standard_False,Standard_False);
CurrentLine->AddPoint(CurrentLine->Value(1)); CurrentLine->AddPoint(CurrentLine->Value(1));
@ -283,8 +279,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
} }
} }
else if (Status == IntWalk_ArretSurPoint) { else if (Status == IntWalk_ArretSurPoint) {
if (etat2(I) >12) { //line should become open if (wd2[I].etat >12) { //line should become open
etat2(I) = 12; //declare it open wd2[I].etat = 12; //declare it open
Tgtbeg = Standard_True; Tgtbeg = Standard_True;
Tgtend = Standard_False; Tgtend = Standard_False;
N= -lines.Length()-1; N= -lines.Length()-1;
@ -344,7 +340,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
CurrentLine->SetTangencyAtEnd(Tgtend); CurrentLine->SetTangencyAtEnd(Tgtend);
lines.Append(CurrentLine); lines.Append(CurrentLine);
etat2(I)=-etat2(I); //mark point as processed wd2[I].etat=-wd2[I].etat; //mark point as processed
} }
} //end of processing of start point } //end of processing of start point
} //end of all start points } //end of all start points

View File

@ -31,7 +31,7 @@ void IntWalk_IWalking::AddPointInCurrentLine
IntSurf_PntOn2S Psol; IntSurf_PntOn2S Psol;
Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt), Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt),
reversed,ustart1(N),vstart1(N)); reversed,wd1[N].ustart,wd1[N].vstart);
CurrentLine->AddPoint(Psol); CurrentLine->AddPoint(Psol);
} }

View File

@ -0,0 +1,30 @@
// Created on: 2013-0603
// Created by: Roman LYGIN
// Copyright (c) 2013-2013 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 IntWalk_VectorOfInteger_HeaderFile
#define IntWalk_VectorOfInteger_HeaderFile
#include <vector>
#include <NCollection_StdAllocator.hxx>
typedef std::vector<Standard_Integer, NCollection_StdAllocator<Standard_Integer> >
IntWalk_VectorOfInteger;
#endif

View File

@ -0,0 +1,37 @@
// Created on: 2013-0603
// Created by: Roman LYGIN
// Copyright (c) 2013-2013 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 IntWalk_VectorOfWalkingData_HeaderFile
#define IntWalk_VectorOfWalkingData_HeaderFile
#include <vector>
#include <NCollection_StdAllocator.hxx>
struct IntWalk_WalkingData
{
Standard_Real ustart;
Standard_Real vstart;
Standard_Integer etat;
};
typedef std::vector<IntWalk_WalkingData, NCollection_StdAllocator<IntWalk_WalkingData> >
IntWalk_VectorOfWalkingData;
#endif

View File

@ -162,23 +162,25 @@ void Intf_InterferencePolygon2d::Interference
Bnd_Box2d bSO; Bnd_Box2d bSO;
Bnd_Box2d bST; Bnd_Box2d bST;
Standard_Integer iObje1, iObje2; Standard_Integer iObje1, iObje2, n1 = nbso, n2 = Obje2.NbSegments();
Standard_Real d1 = Obje1.DeflectionOverEstimation(),
d2 = Obje2.DeflectionOverEstimation();
gp_Pnt2d p1b, p1e, p2b, p2e; gp_Pnt2d p1b, p1e, p2b, p2e;
for (iObje1=1; iObje1<=Obje1.NbSegments(); iObje1++) for (iObje1=1; iObje1<=n1; iObje1++)
{ {
bSO.SetVoid(); bSO.SetVoid();
Obje1.Segment(iObje1,p1b,p1e); Obje1.Segment(iObje1,p1b,p1e);
bSO.Add(p1b); bSO.Add(p1b);
bSO.Add(p1e); bSO.Add(p1e);
bSO.Enlarge(Obje1.DeflectionOverEstimation()); bSO.Enlarge(d1);
if (!Obje2.Bounding().IsOut(bSO)) { if (!Obje2.Bounding().IsOut(bSO)) {
for (iObje2=1; iObje2<=Obje2.NbSegments(); iObje2++) { for (iObje2=1; iObje2<=n2; iObje2++) {
bST.SetVoid(); bST.SetVoid();
Obje2.Segment(iObje2,p2b,p2e); Obje2.Segment(iObje2,p2b,p2e);
bST.Add(p2b); bST.Add(p2b);
bST.Add(p2e); bST.Add(p2e);
bST.Enlarge(Obje2.DeflectionOverEstimation()); bST.Enlarge(d2);
if (!bSO.IsOut(bST)) if (!bSO.IsOut(bST))
Intersect(iObje1, iObje2, p1b, p1e, p2b, p2e); Intersect(iObje1, iObje2, p1b, p1e, p2b, p2e);
} }
@ -197,22 +199,23 @@ void Intf_InterferencePolygon2d::Interference
Bnd_Box2d bSO; Bnd_Box2d bSO;
Bnd_Box2d bST; Bnd_Box2d bST;
Standard_Integer iObje1, iObje2; Standard_Integer iObje1, iObje2, n = Obje.NbSegments();
Standard_Real d = Obje.DeflectionOverEstimation();
gp_Pnt2d p1b, p1e, p2b, p2e; gp_Pnt2d p1b, p1e, p2b, p2e;
for (iObje1=1; iObje1<=Obje.NbSegments(); iObje1++) { for (iObje1=1; iObje1<=n; iObje1++) {
bSO.SetVoid(); bSO.SetVoid();
Obje.Segment(iObje1,p1b,p1e); Obje.Segment(iObje1,p1b,p1e);
bSO.Add(p1b); bSO.Add(p1b);
bSO.Add(p1e); bSO.Add(p1e);
bSO.Enlarge(Obje.DeflectionOverEstimation()); bSO.Enlarge(d);
if (!Obje.Bounding().IsOut(bSO)) { if (!Obje.Bounding().IsOut(bSO)) {
for (iObje2=iObje1+1;iObje2<=Obje.NbSegments();iObje2++){ for (iObje2=iObje1+1;iObje2<=n;iObje2++){
bST.SetVoid(); bST.SetVoid();
Obje.Segment(iObje2,p2b,p2e); Obje.Segment(iObje2,p2b,p2e);
bST.Add(p2b); bST.Add(p2b);
bST.Add(p2e); bST.Add(p2e);
bST.Enlarge(Obje.DeflectionOverEstimation()); bST.Enlarge(d);
if (!bSO.IsOut(bST)) if (!bSO.IsOut(bST))
Intersect(iObje1, iObje2, p1b, p1e, p2b, p2e); Intersect(iObje1, iObje2, p1b, p1e, p2b, p2e);
} }

View File

@ -70,14 +70,17 @@ static void ProjectOnSegments (const Adaptor3d_Curve& AC, const gp_Pnt& P3D,
// On considere <nbseg> points sur [uMin,uMax] // On considere <nbseg> points sur [uMin,uMax]
// Quel est le plus proche. Et quel est le nouvel intervalle // Quel est le plus proche. Et quel est le nouvel intervalle
// (il ne peut pas deborder l ancien) // (il ne peut pas deborder l ancien)
Standard_Real u, dist, delta = (nbseg == 0)? 0 : (uMax-uMin)/nbseg; //szv#4:S4163:12Mar99 anti-exception Standard_Real u, dist2, delta = (nbseg == 0)? 0 : (uMax-uMin)/nbseg; //szv#4:S4163:12Mar99 anti-exception
Standard_Real distmin2 = distmin * distmin;
Standard_Boolean aHasChanged = Standard_False;
for (Standard_Integer i = 0; i <= nbseg; i ++) { for (Standard_Integer i = 0; i <= nbseg; i ++) {
u = uMin + (delta * i); u = uMin + (delta * i);
gp_Pnt PU = AC.Value (u); gp_Pnt PU = AC.Value (u);
dist = PU.Distance (P3D); dist2 = PU.SquareDistance (P3D);
if (dist < distmin) { distmin = dist; proj = PU; param = u; } if (dist2 < distmin2) { distmin2 = dist2; proj = PU; param = u; aHasChanged = Standard_True; }
} }
if (aHasChanged)
distmin = Sqrt (distmin2);
#ifdef DEBUG #ifdef DEBUG
cout<<"ShapeAnalysis_Geom:Project, param="<<param<<" -> distmin="<<distmin<<endl; cout<<"ShapeAnalysis_Geom:Project, param="<<param<<" -> distmin="<<distmin<<endl;
#endif #endif

View File

@ -1,3 +1,5 @@
puts "TODO ?OCC7287 ALL: Tcl Exception: Memory leak detected"
puts "TODO ?OCC7287 ALL: TEST INCOMPLETE"
puts "============" puts "============"
puts "OCC7287" puts "OCC7287"
puts "============" puts "============"

View File

@ -2,7 +2,8 @@
puts "TODO CR23096 ALL: TPSTAT : Faulty" puts "TODO CR23096 ALL: TPSTAT : Faulty"
puts "TODO CR23096 ALL: NBSHAPES : Faulty" puts "TODO CR23096 ALL: NBSHAPES : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty" puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO ?CR23096 ALL: CHECKSHAPE : Faulty"
puts "TODO ?CR23096 ALL: Error : 5 differences with reference data found"
set filename BUC60291.igs set filename BUC60291.igs

View File

@ -1,5 +1,5 @@
# !!!! This file is generated automatically, do not edit manually! See end script # !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 Mandriva2010: Error : 2 differences with reference data found :" puts "TODO ?CR23096 ALL: Error : 1 differences with reference data found :"
puts "TODO CR23096 Mandriva2010: STATSHAPE : Faulty" puts "TODO CR23096 Mandriva2010: STATSHAPE : Faulty"
set LinuxDiff 2 set LinuxDiff 2