1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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

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

View File

@@ -68,6 +68,12 @@ is
--algorithme cheminement/resolution
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

View File

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

View File

@@ -18,11 +18,14 @@
#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()

View File

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

View File

@@ -22,6 +22,7 @@ OSD_Chronometer Chronrsnld;
#endif
#include <NCollection_IncAllocator.hxx>
#include <Precision.hxx>
IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
@@ -32,11 +33,39 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
pas(Increment),
tolerance(1,2),
epsilon(Epsilon*Epsilon),
wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)),
wd2 (wd1.get_allocator()),
nbMultiplicities (wd1.get_allocator()),
NbPointsConfondusConsecutifs(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
@@ -64,23 +93,12 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
{
Standard_Integer I;
ThePointOfPath PathPnt;
Standard_Boolean Rajout = Standard_False;
Standard_Integer nbPnts1 = Pnts1.Length();
Standard_Integer nbPnts2 = Pnts2.Length();
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();
Clear();
reversed = Reversed;
@@ -90,51 +108,39 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
TColStd_SequenceOfReal Vmult;
Standard_Integer decal=0;
wd1.reserve (nbPnts1+decal);
nbMultiplicities.reserve (nbPnts1+decal);
for (I=1;I <= nbPnts1+decal; I++) {
PathPnt = Pnts1.Value(I-decal);
etat1.Append(1);
const ThePointOfPath& PathPnt = Pnts1.Value(I-decal);
IntWalk_WalkingData aWD1;
aWD1.etat = 1;
if (!ThePointOfPathTool::IsPassingPnt(PathPnt))
etat1(I) = 11;
aWD1.etat = 11;
if (!ThePointOfPathTool::IsTangent(PathPnt))
etat1(I) = etat1(I) + 1;
++aWD1.etat;
Standard_Integer etat1I=etat1(I);
//-- cout<<" \n Etat1("<<I<<") = "<<etat1I<<endl;
if(etat1I==2) { //-- lbr le 15 fev 99
etat1(I)=11;
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);
}
}
else {
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);
}
if(aWD1.etat==2) { //-- lbr le 15 fev 99
aWD1.etat=11;
}
ThePointOfPathTool::Value2d(PathPnt, aWD1.ustart, aWD1.vstart);
wd1.push_back (aWD1);
Standard_Integer aNbMult = ThePointOfPathTool::Multiplicity(PathPnt);
nbMultiplicities.push_back(aNbMult);
for (Standard_Integer J = 1; J <= aNbMult; J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U, V);
Umult.Append(U);
Vmult.Append(V);
}
}
wd2.reserve (nbPnts2);
for (I = 1; I <= nbPnts2; I++) {
etat2.Append(13);
ThePointOfLoopTool::Value2d(Pnts2.Value(I), U,V);
ustart2.Append(U);
vstart2.Append(V);
IntWalk_WalkingData aWD2;
aWD2.etat = 13;
ThePointOfLoopTool::Value2d(Pnts2.Value(I), aWD2.ustart, aWD2.vstart);
wd2.push_back (aWD2);
}
tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
@@ -163,7 +169,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
// calcul de toutes les lignes fermees
if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
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;
}
@@ -181,22 +187,10 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
{
Standard_Integer I;
ThePointOfPath PathPnt;
Standard_Boolean Rajout = Standard_False;
Standard_Integer nbPnts1 = Pnts1.Length();
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;
@@ -205,18 +199,20 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
TColStd_SequenceOfReal Umult;
TColStd_SequenceOfReal Vmult;
wd1.reserve (nbPnts1);
for (I=1;I <= nbPnts1; I++) {
PathPnt = Pnts1.Value(I);
etat1.Append(1);
if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) etat1(I) = 11;
if (!ThePointOfPathTool::IsTangent(PathPnt)) etat1(I) = etat1(I) + 1;
ThePointOfPathTool::Value2d(PathPnt, U,V);
ustart1.Append(U);
vstart1.Append(V);
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
const ThePointOfPath& PathPnt = Pnts1.Value(I);
IntWalk_WalkingData aWD1;
aWD1.etat = 1;
if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) aWD1.etat = 11;
if (!ThePointOfPathTool::IsTangent(PathPnt)) ++aWD1.etat;
ThePointOfPathTool::Value2d(PathPnt, aWD1.ustart, aWD1.vstart);
wd1.push_back (aWD1);
Standard_Integer aNbMult = ThePointOfPathTool::Multiplicity(PathPnt);
nbMultiplicities.push_back(aNbMult);
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U , V);
for (Standard_Integer J = 1; J <= aNbMult; J++) {
ThePointOfPathTool::Parameters(PathPnt, J, U, V);
Umult.Append(U);
Vmult.Append(V);
}
@@ -247,7 +243,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
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;
}

View File

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

View File

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

View File

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

View File

@@ -31,7 +31,7 @@ void IntWalk_IWalking::AddPointInCurrentLine
IntSurf_PntOn2S Psol;
Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt),
reversed,ustart1(N),vstart1(N));
reversed,wd1[N].ustart,wd1[N].vstart);
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