mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027720: HLRBrep_Algo BSpline missing edges
The algorithm that builds outlines ("silhouettes") makes an outline in 2d parametric space of the surface starting from some previously detected point where normal is orthogonal to direction of view. So, the surface is previously discretized into (m*n) sample points and some of them become starting points for future outlines. If the surface has non-uniform parametrization and/or some local extremums of curvature, the outlines can not be built without breaks, so there are several groups of consequent outlines in this case. Unfortunately, it leads to the situation when current number of sample points becomes insufficient to build all the parts of outlines. The idea is to detect the "holes" between already constructed parts of outlines and then complete the construction. New auxiliary draw command for testing of HLR. Correction according to the remarks. Update of test case according to the developer's directive
This commit is contained in:
@@ -70,7 +70,8 @@ static Standard_Boolean IsTangentExtCheck(TheIWFunction& theFunc,
|
||||
|
||||
IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real Increment ) :
|
||||
const Standard_Real Increment,
|
||||
const Standard_Boolean theToFillHoles) :
|
||||
done(Standard_False),
|
||||
fleche(Deflection),
|
||||
pas(Increment),
|
||||
@@ -78,7 +79,8 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
|
||||
epsilon(Epsilon*Epsilon),
|
||||
wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)),
|
||||
wd2 (wd1.get_allocator()),
|
||||
nbMultiplicities (wd1.get_allocator())
|
||||
nbMultiplicities (wd1.get_allocator()),
|
||||
ToFillHoles(theToFillHoles)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -215,7 +217,35 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
|
||||
// calculation of all closed lines
|
||||
if (nbPnts2 != 0)
|
||||
ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
|
||||
ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
|
||||
|
||||
if (ToFillHoles)
|
||||
{
|
||||
Standard_Integer MaxNbIter = 10, nb_iter = 0;
|
||||
while (seqAlone.Length() > 1 && nb_iter < MaxNbIter)
|
||||
{
|
||||
nb_iter++;
|
||||
IntSurf_SequenceOfInteriorPoint PntsInHoles;
|
||||
TColStd_SequenceOfInteger CopySeqAlone = seqAlone;
|
||||
FillPntsInHoles(Func, CopySeqAlone, PntsInHoles);
|
||||
wd2.clear();
|
||||
IntWalk_WalkingData aDummy;
|
||||
aDummy.etat = -10;
|
||||
aDummy.ustart = aDummy.vstart = 0.;
|
||||
wd2.push_back (aDummy);
|
||||
Standard_Integer nbHoles = PntsInHoles.Length();
|
||||
wd2.reserve(nbHoles);
|
||||
for (I = 1; I <= nbHoles; I++)
|
||||
{
|
||||
IntWalk_WalkingData aWD2;
|
||||
aWD2.etat = 13;
|
||||
const IntSurf_InteriorPoint& anIP = PntsInHoles.Value(I);
|
||||
ThePointOfLoopTool::Value2d(anIP, aWD2.ustart, aWD2.vstart);
|
||||
wd2.push_back (aWD2);
|
||||
}
|
||||
ComputeCloseLine(Umult,Vmult,Pnts1,PntsInHoles,Func,Rajout);
|
||||
}
|
||||
}
|
||||
|
||||
for (I = 1; I <= nbPnts1; I++) {
|
||||
if (wd1[I].etat >0) seqSingle.Append(Pnts1(I));
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
//-- IntWalk_IWalking_2.gxx
|
||||
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
@@ -573,6 +575,158 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout
|
||||
return Arrive;
|
||||
}
|
||||
|
||||
void IntWalk_IWalking::FillPntsInHoles(TheIWFunction& sp,
|
||||
TColStd_SequenceOfInteger& CopySeqAlone,
|
||||
IntSurf_SequenceOfInteriorPoint& PntsInHoles)
|
||||
{
|
||||
math_Vector BornInf(1,2), BornSup(1,2);
|
||||
BornInf(1) = Um;
|
||||
BornSup(1) = UM;
|
||||
BornInf(2) = Vm;
|
||||
BornSup(2) = VM;
|
||||
PointLineLine.Clear();
|
||||
TColStd_SequenceOfInteger SeqToRemove;
|
||||
TColStd_MapOfInteger BadSolutions;
|
||||
|
||||
for (Standard_Integer i = 1; i < CopySeqAlone.Length(); i++)
|
||||
{
|
||||
Standard_Integer Irang1 = CopySeqAlone(i);
|
||||
if (Irang1 == 0)
|
||||
continue;
|
||||
Standard_Boolean ToRemove = Standard_False;
|
||||
IntSurf_PntOn2S PointAlone1, PointAlone2;
|
||||
const Handle(IntWalk_TheIWLine)& Line1 = lines.Value(Abs(Irang1));
|
||||
if (Irang1 > 0)
|
||||
PointAlone1 = Line1->Value(Line1->NbPoints());
|
||||
else
|
||||
PointAlone1 = Line1->Value(1);
|
||||
gp_Pnt2d P2d1 = PointAlone1.ValueOnSurface(reversed), P2d2;
|
||||
Standard_Real MinSqDist = RealLast();
|
||||
Standard_Integer MinRang = 0, MinIndex = 0;
|
||||
for (Standard_Integer j = i+1; j <= CopySeqAlone.Length(); j++)
|
||||
{
|
||||
Standard_Integer Irang2 = CopySeqAlone(j);
|
||||
if (Irang2 == 0 ||
|
||||
BadSolutions.Contains(Irang2))
|
||||
continue;
|
||||
const Handle(IntWalk_TheIWLine)& Line2 = lines.Value(Abs(Irang2));
|
||||
if (Irang2 > 0)
|
||||
PointAlone2 = Line2->Value(Line2->NbPoints());
|
||||
else
|
||||
PointAlone2 = Line2->Value(1);
|
||||
P2d2 = PointAlone2.ValueOnSurface(reversed);
|
||||
Standard_Real aSqDist = P2d1.SquareDistance(P2d2);
|
||||
if (aSqDist < MinSqDist)
|
||||
{
|
||||
MinSqDist = aSqDist;
|
||||
MinRang = Irang2;
|
||||
MinIndex = j;
|
||||
}
|
||||
}
|
||||
//processing points from Irang1 and MinRang
|
||||
if (MinRang == 0)
|
||||
{
|
||||
SeqToRemove.Append(Irang1);
|
||||
BadSolutions.Clear();
|
||||
continue;
|
||||
}
|
||||
//Ends of same line
|
||||
if (Abs(Irang1) == Abs(MinRang) &&
|
||||
lines.Value(Abs(Irang1))->NbPoints() == 2)
|
||||
{
|
||||
SeqToRemove.Append(Irang1);
|
||||
SeqToRemove.Append(MinRang);
|
||||
CopySeqAlone(i) = 0;
|
||||
CopySeqAlone(MinIndex) = 0;
|
||||
BadSolutions.Clear();
|
||||
continue;
|
||||
}
|
||||
///////////////////
|
||||
const Handle(IntWalk_TheIWLine)& Line2 = lines.Value(Abs(MinRang));
|
||||
if (MinRang > 0)
|
||||
PointAlone2 = Line2->Value(Line2->NbPoints());
|
||||
else
|
||||
PointAlone2 = Line2->Value(1);
|
||||
gp_Pnt Pnt1 = PointAlone1.Value();
|
||||
gp_Pnt Pnt2 = PointAlone2.Value();
|
||||
P2d2 = PointAlone2.ValueOnSurface(reversed);
|
||||
Standard_Real MinSqDist3d = Pnt1.SquareDistance(Pnt2);
|
||||
if (MinSqDist3d <= epsilon ||
|
||||
(Abs(P2d1.X() - P2d2.X()) <= tolerance(1) &&
|
||||
Abs(P2d1.Y() - P2d2.Y()) <= tolerance(2))) //close points
|
||||
ToRemove = Standard_True;
|
||||
else //real curve
|
||||
{
|
||||
math_Vector UVap(1,2), UV(1,2);
|
||||
UVap(1) = (P2d1.X() + P2d2.X())/2;
|
||||
UVap(2) = (P2d1.Y() + P2d2.Y())/2;
|
||||
math_FunctionSetRoot Rsnld(sp, tolerance);
|
||||
Rsnld.Perform(sp, UVap, BornInf, BornSup);
|
||||
if (Rsnld.IsDone() &&
|
||||
Abs(sp.Root()) <= sp.Tolerance() &&
|
||||
!sp.IsTangent())
|
||||
{
|
||||
Rsnld.Root(UV);
|
||||
gp_Pnt2d Pmid(UV(1),UV(2));
|
||||
gp_Vec2d P1P2(P2d1, P2d2);
|
||||
gp_Vec2d P1Pmid(P2d1, Pmid);
|
||||
gp_Vec2d P2Pmid(P2d2, Pmid);
|
||||
Standard_Real ScalProd1 = P1P2 * P1Pmid;
|
||||
Standard_Real ScalProd2 = P1P2 * P2Pmid;
|
||||
Standard_Boolean IsPmidValid = (ScalProd1 > 0. && ScalProd2 < 0); //Pmid is in the middle
|
||||
if (IsPmidValid)
|
||||
{
|
||||
for (Standard_Integer iline = 1; iline <= lines.Length(); iline++)
|
||||
if (IsPointOnLine(Pmid,iline))
|
||||
{
|
||||
IsPmidValid = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (IsPmidValid)
|
||||
{
|
||||
IntSurf_InteriorPoint aPoint(sp.Point(), UV(1), UV(2),
|
||||
sp.Direction3d(),
|
||||
sp.Direction2d());
|
||||
PntsInHoles.Append(aPoint);
|
||||
TColStd_ListOfInteger LineLine;
|
||||
LineLine.Append(Irang1);
|
||||
LineLine.Append(MinRang);
|
||||
PointLineLine.Bind(PntsInHoles.Length(), LineLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
BadSolutions.Add(MinRang);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BadSolutions.Add(MinRang);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
CopySeqAlone(i) = 0;
|
||||
CopySeqAlone(MinIndex) = 0;
|
||||
if (ToRemove)
|
||||
{
|
||||
SeqToRemove.Append(Irang1);
|
||||
SeqToRemove.Append(MinRang);
|
||||
}
|
||||
BadSolutions.Clear();
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= SeqToRemove.Length(); i++)
|
||||
for (Standard_Integer j = 1; j <= seqAlone.Length(); j++)
|
||||
if (seqAlone(j) == SeqToRemove(i))
|
||||
{
|
||||
seqAlone.Remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void IntWalk_IWalking::TestArretCadre
|
||||
(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
|
@@ -63,7 +63,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
// end of conditions.
|
||||
|
||||
{
|
||||
Standard_Integer I, N;
|
||||
Standard_Integer I, N = 0, SaveN = 0;
|
||||
Standard_Real aBornInf[2], aBornSup[2], aUVap[2];
|
||||
math_Vector BornInf(aBornInf,1,2), BornSup(aBornSup,1,2), UVap(aUVap,1,2);
|
||||
Standard_Real PasC, PasCu, PasCv;
|
||||
@@ -190,6 +190,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // check
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length() + 1);
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
}
|
||||
@@ -203,6 +204,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
else {
|
||||
if (Rajout) {
|
||||
ArretAjout =TestArretAjout(Func, UVap, N, Psol);
|
||||
SaveN = N;
|
||||
if (ArretAjout) {
|
||||
// jag 940615
|
||||
Tgtend = lines.Value(N)->IsTangentAtEnd();
|
||||
@@ -253,9 +255,16 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
else if (ArretAjout || Cadre) {
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
if (Status != IntWalk_ArretSurPointPrecedent) {
|
||||
CurrentLine->AddPoint(Psol);
|
||||
}
|
||||
//if (Status != IntWalk_ArretSurPointPrecedent)
|
||||
CurrentLine->AddPoint(Psol);
|
||||
//Remove <SaveN> from <seqAlone>
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAlone.Length(); iseq++)
|
||||
if (seqAlone(iseq) == SaveN)
|
||||
{
|
||||
seqAlone.Remove(iseq);
|
||||
break;
|
||||
}
|
||||
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
@@ -268,6 +277,8 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
}
|
||||
Arrive = Standard_True;
|
||||
Rajout = Standard_True;
|
||||
//AddAlonePoint();
|
||||
seqAlone.Append(lines.Length() + 1);
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // check
|
||||
@@ -329,6 +340,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
MakeWalkingPoint(1, UVap(1), UVap(2), Func, Psol);
|
||||
CurrentLine->AddPoint(Psol);
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length() + 1);
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
else if (Status == IntWalk_OK) {
|
||||
@@ -353,6 +365,7 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // need check
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length() + 1);
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
//
|
||||
// ********************************************************************
|
||||
{
|
||||
Standard_Integer I,N = 0;
|
||||
Standard_Integer I,N = 0,SaveN = 0;
|
||||
Standard_Real aBornInf[2], aBornSup[2], aUVap[2];
|
||||
math_Vector BornInf(aBornInf,1,2), BornSup(aBornSup,1,2);
|
||||
math_Vector Uvap(aUVap,1,2);// parameters of current approach
|
||||
@@ -180,13 +180,40 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints()==1) break;
|
||||
if (CurrentLine->NbPoints()==1)
|
||||
{
|
||||
RemoveTwoEndPoints(I);
|
||||
break; //cancel the line
|
||||
}
|
||||
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;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
Arrive = Standard_False;
|
||||
PasC = PasSav;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(-lines.Length()-1);
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
}
|
||||
else { // line s is open
|
||||
Arrive =Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
Tgtend = Standard_True;
|
||||
}
|
||||
/*
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusFirstLast(Standard_False,
|
||||
Standard_False,Standard_False);
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
Tgtend = Standard_True;
|
||||
*/
|
||||
}
|
||||
}
|
||||
else { // there is a solution
|
||||
@@ -246,6 +273,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
else { // modif jag 940615
|
||||
if (Rajout) { // test on added points
|
||||
ArretAjout =TestArretAjout(Func,Uvap,N,Psol);
|
||||
SaveN = N;
|
||||
if (ArretAjout) {
|
||||
if (N >0) {
|
||||
Tgtend = lines.Value(N)->IsTangentAtEnd();
|
||||
@@ -259,8 +287,13 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
}
|
||||
|
||||
if (!ArretAjout&& Cadre) { // test on already marked points
|
||||
if (CurrentLine->NbPoints() == 1) break; // cancel the line
|
||||
if (CurrentLine->NbPoints() == 1)
|
||||
{
|
||||
RemoveTwoEndPoints(I);
|
||||
break; // cancel the line
|
||||
}
|
||||
TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N);
|
||||
SaveN = N;
|
||||
// if (N==0) {
|
||||
if (N <= 0) { // jag 941017
|
||||
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
|
||||
@@ -289,11 +322,42 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
|
||||
if (Arrive) { // line s is open
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
if (Status != IntWalk_ArretSurPointPrecedent) {
|
||||
CurrentLine->AddPoint(Psol);
|
||||
//if (Status != IntWalk_ArretSurPointPrecedent)
|
||||
CurrentLine->AddPoint(Psol);
|
||||
|
||||
//Remove <SaveN> from <seqAlone> and, if it is first found point,
|
||||
//from <seqAjout> too
|
||||
if (IsValidEndPoint(I, SaveN))
|
||||
{
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAlone.Length(); iseq++)
|
||||
if (seqAlone(iseq) == SaveN)
|
||||
{
|
||||
seqAlone.Remove(iseq);
|
||||
break;
|
||||
}
|
||||
if (CurrentLine->NbPoints() <= 3)
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAjout.Length(); iseq++)
|
||||
if (seqAjout(iseq) == SaveN)
|
||||
{
|
||||
seqAjout.Remove(iseq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (seqAlone.Last() == -lines.Length()-1)
|
||||
{
|
||||
seqAlone.Remove(seqAlone.Length());
|
||||
seqAjout.Remove(seqAjout.Length());
|
||||
}
|
||||
RemoveTwoEndPoints(I);
|
||||
Arrive = Standard_False;
|
||||
break; //cancel the line
|
||||
}
|
||||
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
//seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
|
||||
@@ -307,11 +371,36 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
PasC = PasSav;
|
||||
if (Status == IntWalk_ArretSurPointPrecedent) {
|
||||
CurrentLine->AddPoint(Psol);
|
||||
OpenLine(0,Psol,Pnts1,Func,CurrentLine);
|
||||
}
|
||||
else {
|
||||
OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine);
|
||||
}
|
||||
//Remove <SaveN> from <seqAlone> and, if it is first found point,
|
||||
//from <seqAjout> too
|
||||
if (IsValidEndPoint(I, SaveN))
|
||||
{
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAlone.Length(); iseq++)
|
||||
if (seqAlone(iseq) == SaveN)
|
||||
{
|
||||
seqAlone.Remove(iseq);
|
||||
break;
|
||||
}
|
||||
if (CurrentLine->NbPoints() <= 2)
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAjout.Length(); iseq++)
|
||||
if (seqAjout(iseq) == SaveN)
|
||||
{
|
||||
seqAjout.Remove(iseq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveTwoEndPoints(I);
|
||||
break; //cancel the line
|
||||
}
|
||||
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
@@ -321,6 +410,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
else if ( Status == IntWalk_ArretSurPointPrecedent) {
|
||||
if (CurrentLine->NbPoints() == 1) { //cancel the line
|
||||
Arrive = Standard_False;
|
||||
RemoveTwoEndPoints(I);
|
||||
break;
|
||||
}
|
||||
if (wd2[I].etat >12) { //the line should become open
|
||||
@@ -332,12 +422,14 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
Arrive = Standard_False;
|
||||
PasC = PasSav;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(-lines.Length()-1);
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
}
|
||||
else { // line s is open
|
||||
Arrive =Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
@@ -363,6 +455,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
OpenLine(N,Psol,Pnts1,Func,CurrentLine);
|
||||
StepSign = -1;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(N);
|
||||
seqAjout.Append(N);
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
Arrive = Standard_False;
|
||||
@@ -381,6 +474,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
|
||||
CurrentLine->AddPoint(newP);
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
@@ -404,13 +498,40 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints() == 1) break; // cancel the line
|
||||
if (CurrentLine->NbPoints() == 1)
|
||||
{
|
||||
RemoveTwoEndPoints(I);
|
||||
break; // cancel the line
|
||||
}
|
||||
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;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
Arrive = Standard_False;
|
||||
PasC = PasSav;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(-lines.Length()-1);
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
}
|
||||
else { // line s is open
|
||||
Arrive =Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
/*
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusFirstLast(Standard_False,Standard_False,
|
||||
Standard_False);
|
||||
Tgtend = Standard_True;
|
||||
Rajout = Standard_True;
|
||||
seqAlone.Append(lines.Length()+1);
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -115,10 +115,55 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N,
|
||||
Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());
|
||||
}
|
||||
|
||||
Standard_Boolean IntWalk_IWalking::IsValidEndPoint(const Standard_Integer IndOfPoint,
|
||||
const Standard_Integer IndOfLine)
|
||||
{
|
||||
if (PointLineLine.IsEmpty())
|
||||
return Standard_True;
|
||||
|
||||
TColStd_ListIteratorOfListOfInteger itl(PointLineLine(IndOfPoint));
|
||||
for (; itl.More(); itl.Next())
|
||||
if (itl.Value() == IndOfLine)
|
||||
{
|
||||
PointLineLine(IndOfPoint).Remove(itl);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
void IntWalk_IWalking::RemoveTwoEndPoints(const Standard_Integer IndOfPoint)
|
||||
{
|
||||
if (PointLineLine.IsBound(IndOfPoint))
|
||||
{
|
||||
Standard_Integer Line1 = PointLineLine(IndOfPoint).First();
|
||||
Standard_Integer Line2 = PointLineLine(IndOfPoint).Last();
|
||||
for (Standard_Integer iseq = 1; iseq <= seqAlone.Length(); iseq++)
|
||||
{
|
||||
if (seqAlone(iseq) == Line1 ||
|
||||
seqAlone(iseq) == Line2)
|
||||
seqAlone.Remove(iseq--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_Boolean IntWalk_IWalking::IsPointOnLine(const gp_Pnt2d& theP2d,
|
||||
const Standard_Integer Irang)
|
||||
{
|
||||
const Handle(IntWalk_TheIWLine)& aLine = lines.Value(Abs(Irang));
|
||||
for (Standard_Integer i = 1; i <= aLine->NbPoints(); i++)
|
||||
{
|
||||
gp_Pnt2d P2d1 = aLine->Value(i).ValueOnSurface(reversed);
|
||||
if (Abs(P2d1.X() - theP2d.X()) <= tolerance(1) &&
|
||||
Abs(P2d1.Y() - theP2d.Y()) <= tolerance(2))
|
||||
return Standard_True;
|
||||
if (i < aLine->NbPoints())
|
||||
{
|
||||
gp_Pnt2d P2d2 = aLine->Value(i+1).ValueOnSurface(reversed);
|
||||
gp_Vec2d PP1(theP2d, P2d1);
|
||||
gp_Vec2d PP2(theP2d, P2d2);
|
||||
if (PP1 * PP2 < 0)
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
Reference in New Issue
Block a user