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

0031986: Visualization - Regression in StdPrs_WFDeflectionRestrictedFace::Add()

Fixed misplaced closing bracket after #0030146 fix.
This commit is contained in:
kgv 2020-12-07 13:39:07 +03:00 committed by bugmaster
parent 954caad094
commit c74e3dc300

View File

@ -107,30 +107,26 @@ void StdPrs_WFDeflectionRestrictedFace::Add
const Standard_Integer NBUiso, const Standard_Integer NBUiso,
const Standard_Integer NBViso, const Standard_Integer NBViso,
const Handle(Prs3d_Drawer)& aDrawer, const Handle(Prs3d_Drawer)& aDrawer,
Prs3d_NListOfSequenceOfPnt& Curves) { Prs3d_NListOfSequenceOfPnt& Curves)
{
#ifdef OCCT_DEBUG_MESH #ifdef OCCT_DEBUG_MESH
FFaceTimer1.Start(); FFaceTimer1.Start();
#endif #endif
StdPrs_ToolRFace ToolRst (aFace); StdPrs_ToolRFace ToolRst (aFace);
Standard_Real UF, UL, VF, VL; const Standard_Real UF = aFace->FirstUParameter();
UF = aFace->FirstUParameter(); const Standard_Real UL = aFace->LastUParameter();
UL = aFace->LastUParameter(); const Standard_Real VF = aFace->FirstVParameter();
VF = aFace->FirstVParameter(); const Standard_Real VL = aFace->LastVParameter();
VL = aFace->LastVParameter();
Standard_Real aLimit = aDrawer->MaximalParameterValue(); const Standard_Real aLimit = aDrawer->MaximalParameterValue();
// compute bounds of the restriction // compute bounds of the restriction
Standard_Real UMin,UMax,VMin,VMax; Standard_Real UMin = Max (UF, -aLimit);
//Standard_Real u,v,step; Standard_Real UMax = Min (UL, aLimit);
Standard_Integer i;//,nbPoints = 10; Standard_Real VMin = Max (VF, -aLimit);
Standard_Real VMax = Min (VL, aLimit);
UMin = Max(UF, -aLimit);
UMax = Min(UL, aLimit);
VMin = Max(VF, -aLimit);
VMax = Min(VL, aLimit);
// update min max for the hatcher. // update min max for the hatcher.
@ -144,21 +140,26 @@ void StdPrs_WFDeflectionRestrictedFace::Add
UMin = VMin = 1.e100; UMin = VMin = 1.e100;
UMax = VMax = -1.e100; UMax = VMax = -1.e100;
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next())
TopAbs_Orientation Orient = ToolRst.Orientation(); {
const TopAbs_Orientation anOrient = ToolRst.Orientation();
const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value(); const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
if (TheRCurve->GetType() != GeomAbs_Line) { if (TheRCurve->GetType() != GeomAbs_Line)
GCPnts_QuasiUniformDeflection UDP(*TheRCurve, ddefle); {
if (UDP.IsDone()) { GCPnts_QuasiUniformDeflection UDP (*TheRCurve, ddefle);
Standard_Integer NumberOfPoints = UDP.NbPoints(); if (UDP.IsDone())
if ( NumberOfPoints >= 2 ) { {
dummypnt = UDP.Value(1); const Standard_Integer aNumberOfPoints = UDP.NbPoints();
P2.SetCoord(dummypnt.X(), dummypnt.Y()); if (aNumberOfPoints >= 2)
{
dummypnt = UDP.Value (1);
P2.SetCoord (dummypnt.X(), dummypnt.Y());
UMin = Min(P2.X(), UMin); UMin = Min(P2.X(), UMin);
UMax = Max(P2.X(), UMax); UMax = Max(P2.X(), UMax);
VMin = Min(P2.Y(), VMin); VMin = Min(P2.Y(), VMin);
VMax = Max(P2.Y(), VMax); VMax = Max(P2.Y(), VMax);
for (i = 2; i <= NumberOfPoints; i++) { for (Standard_Integer i = 2; i <= aNumberOfPoints; i++)
{
P1 = P2; P1 = P2;
dummypnt = UDP.Value(i); dummypnt = UDP.Value(i);
P2.SetCoord(dummypnt.X(), dummypnt.Y()); P2.SetCoord(dummypnt.X(), dummypnt.Y());
@ -166,42 +167,54 @@ void StdPrs_WFDeflectionRestrictedFace::Add
UMax = Max(P2.X(), UMax); UMax = Max(P2.X(), UMax);
VMin = Min(P2.Y(), VMin); VMin = Min(P2.Y(), VMin);
VMax = Max(P2.Y(), VMax); VMax = Max(P2.Y(), VMax);
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol); aHatchingTol = Min (P1.SquareDistance (P2), aHatchingTol);
if(Orient == TopAbs_FORWARD ) { if (anOrient == TopAbs_FORWARD)
//isobuild.Trim(P1,P2); {
tabP.Append(P1); //isobuild.Trim (P1, P2);
tabP.Append(P2); tabP.Append (P1);
tabP.Append (P2);
} }
else { else
//isobuild.Trim(P2,P1); {
tabP.Append(P2); //isobuild.Trim (P2, P1);
tabP.Append(P1); tabP.Append (P2);
tabP.Append (P1);
} }
} }
} }
#ifdef OCCT_DEBUG
else {
std::cout << "Cannot evaluate curve on surface"<<std::endl;
} }
#endif else
{
#ifdef OCCT_DEBUG
std::cout << "Cannot evaluate curve on surface" << std::endl;
#endif
} }
else { }
else
{
U1 = TheRCurve->FirstParameter(); U1 = TheRCurve->FirstParameter();
U2 = TheRCurve->LastParameter(); U2 = TheRCurve->LastParameter();
// MSV 17.08.06 OCC13144: U2 occured less than U1, to overcome it // MSV 17.08.06 OCC13144: U2 occurred less than U1,
// ensure that distance U2-U1 is not greater than aLimit*2, // to overcome it ensure that distance U2-U1 is not greater than aLimit*2,
// if greater then choose an origin and use aLimit to define // if greater then choose an origin and use aLimit to define U1 and U2 anew
// U1 and U2 anew
Standard_Real aOrigin = 0.; Standard_Real aOrigin = 0.;
if (!Precision::IsNegativeInfinite(U1) || !Precision::IsPositiveInfinite(U2)) { if (!Precision::IsNegativeInfinite (U1)
if (Precision::IsNegativeInfinite(U1)) || !Precision::IsPositiveInfinite (U2))
{
if (Precision::IsNegativeInfinite (U1))
{
aOrigin = U2 - aLimit; aOrigin = U2 - aLimit;
else if (Precision::IsPositiveInfinite(U2)) }
else if (Precision::IsPositiveInfinite (U2))
{
aOrigin = U1 + aLimit; aOrigin = U1 + aLimit;
}
else else
{
aOrigin = (U1 + U2) * 0.5; aOrigin = (U1 + U2) * 0.5;
} }
}
U1 = Max(aOrigin - aLimit, U1); U1 = Max(aOrigin - aLimit, U1);
U2 = Min(aOrigin + aLimit, U2); U2 = Min(aOrigin + aLimit, U2);
P1 = TheRCurve->Value(U1); P1 = TheRCurve->Value(U1);
@ -216,24 +229,23 @@ void StdPrs_WFDeflectionRestrictedFace::Add
VMax = Max(P2.Y(), VMax); VMax = Max(P2.Y(), VMax);
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol); aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
if(Orient == TopAbs_FORWARD ) { if (anOrient == TopAbs_FORWARD)
// isobuild.Trim(P1,P2); {
tabP.Append(P1); // isobuild.Trim (P1, P2);
tabP.Append(P2); tabP.Append (P1);
tabP.Append (P2);
} }
else { else
//isobuild.Trim(P2,P1); {
tabP.Append(P2); //isobuild.Trim (P2, P1);
tabP.Append(P1); tabP.Append (P2);
tabP.Append (P1);
} }
} }
} }
}
#ifdef OCCT_DEBUG_MESH #ifdef OCCT_DEBUG_MESH
FFaceTimer1.Stop(); FFaceTimer1.Stop();
FFaceTimer2.Start(); FFaceTimer2.Start();
#endif #endif
@ -243,35 +255,41 @@ void StdPrs_WFDeflectionRestrictedFace::Add
aHatchingTol = Min(1.e-5, aHatchingTol); aHatchingTol = Min(1.e-5, aHatchingTol);
// load the isos // load the isos
Hatch_Hatcher isobuild(aHatchingTol, ToolRst.IsOriented()); Hatch_Hatcher isobuild (aHatchingTol, ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed(); Standard_Boolean isUClosed = aFace->IsUClosed();
Standard_Boolean VClosed = aFace->IsVClosed(); Standard_Boolean isVClosed = aFace->IsVClosed();
if (!isUClosed)
if ( ! UClosed ) { {
UMin = UMin + ( UMax - UMin) /1000.; UMin = UMin + (UMax - UMin) / 1000.;
UMax = UMax - ( UMax - UMin) /1000.; UMax = UMax - (UMax - UMin) / 1000.;
}
if (!isVClosed)
{
VMin = VMin + (VMax - VMin) / 1000.;
VMax = VMax - (VMax - VMin) / 1000.;
} }
if ( ! VClosed ) { if (DrawUIso)
VMin = VMin + ( VMax - VMin) /1000.; {
VMax = VMax - ( VMax - VMin) /1000.; if (NBUiso > 0)
} {
isUClosed = Standard_False; // En attendant un hatcher de course.
if (DrawUIso){ Standard_Real du= isUClosed ? (UMax - UMin) / NBUiso : (UMax - UMin) / (1 + NBUiso);
if (NBUiso > 0) { for (Standard_Integer i = 1; i <= NBUiso; i++)
UClosed = Standard_False; // En attendant un hatcher de course. {
Standard_Real du= UClosed ? (UMax-UMin)/NBUiso : (UMax-UMin)/(1+NBUiso); isobuild.AddXLine (UMin + du * i);
for (i=1; i<=NBUiso;i++){
isobuild.AddXLine(UMin+du*i);
} }
} }
} }
if (DrawVIso){ if (DrawVIso)
if ( NBViso > 0) { {
VClosed = Standard_False; if (NBViso > 0)
Standard_Real dv= VClosed ?(VMax-VMin)/NBViso : (VMax-VMin)/(1+NBViso); {
for (i=1; i<=NBViso;i++){ isVClosed = Standard_False;
isobuild.AddYLine(VMin+dv*i); Standard_Real dv= isVClosed ? (VMax - VMin) / NBViso : (VMax - VMin) / (1 + NBViso);
for (Standard_Integer i = 1; i <= NBViso; i++)
{
isobuild.AddYLine (VMin + dv * i);
} }
} }
} }
@ -283,11 +301,11 @@ void StdPrs_WFDeflectionRestrictedFace::Add
Standard_Integer ll = tabP.Length(); Standard_Integer ll = tabP.Length();
for (i = 1; i <= ll; i+=2) { for (Standard_Integer i = 1; i <= ll; i+=2)
isobuild.Trim(tabP(i),tabP(i+1)); {
isobuild.Trim (tabP(i), tabP(i+1));
} }
#ifdef OCCT_DEBUG_MESH #ifdef OCCT_DEBUG_MESH
FFaceTimer3.Stop(); FFaceTimer3.Stop();
FFaceTimer4.Start(); FFaceTimer4.Start();
@ -301,49 +319,64 @@ void StdPrs_WFDeflectionRestrictedFace::Add
const BRepAdaptor_Surface& BS = *(BRepAdaptor_Surface*)&(aFace->Surface()); const BRepAdaptor_Surface& BS = *(BRepAdaptor_Surface*)&(aFace->Surface());
GeomAbs_SurfaceType thetype = aFace->GetType(); GeomAbs_SurfaceType thetype = aFace->GetType();
Standard_Integer NumberOfLines = isobuild.NbLines();
Handle(Geom_Surface) GB; Handle(Geom_Surface) GB;
if (thetype == GeomAbs_BezierSurface) { if (thetype == GeomAbs_BezierSurface)
{
GB = BS.Bezier(); GB = BS.Bezier();
} }
else if (thetype == GeomAbs_BSplineSurface){ else if (thetype == GeomAbs_BSplineSurface)
{
GB = BS.BSpline(); GB = BS.BSpline();
} }
Standard_Real anAngle = aDrawer->DeviationAngle(); const Standard_Real anAngle = aDrawer->DeviationAngle();
const Standard_Integer aNumberOfLines = isobuild.NbLines();
for (i = 1; i <= NumberOfLines; i++) { for (Standard_Integer i = 1; i <= aNumberOfLines; i++)
{
Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i); Standard_Integer NumberOfIntervals = isobuild.NbIntervals(i);
Standard_Real Coord = isobuild.Coordinate(i); Standard_Real Coord = isobuild.Coordinate(i);
for (Standard_Integer j = 1; j <= NumberOfIntervals; j++) { for (Standard_Integer j = 1; j <= NumberOfIntervals; j++)
Standard_Real b1=isobuild.Start(i,j),b2=isobuild.End(i,j); {
Standard_Real b1 = isobuild.Start (i, j), b2 = isobuild.End (i, j);
if (!GB.IsNull())
if (!GB.IsNull()) { {
if (isobuild.IsXLine(i)) if (isobuild.IsXLine (i))
BC = GB->UIso(Coord); {
BC = GB->UIso (Coord);
}
else else
BC = GB->VIso(Coord); {
GeomAdaptor_Curve GC(BC); BC = GB->VIso (Coord);
FindLimits(GC, aLimit,b1, b2); }
if (b2-b1>Precision::Confusion()) {
Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt; GeomAdaptor_Curve GC (BC);
FindLimits (GC, aLimit,b1, b2);
if (b2 - b1 > Precision::Confusion())
{
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
StdPrs_DeflectionCurve::Add (aPresentation, GC, b1, b2, Deflection, StdPrs_DeflectionCurve::Add (aPresentation, GC, b1, b2, Deflection,
Points->ChangeSequence(), anAngle, Standard_False); aPoints->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points); Curves.Append (aPoints);
} }
} }
else {
if (isobuild.IsXLine(i))
anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
else else
anIso.Load(GeomAbs_IsoV,Coord,b1,b2); {
FindLimits(anIso, aLimit,b1, b2); if (isobuild.IsXLine (i))
if (b2-b1>Precision::Confusion()) { {
Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt; anIso.Load (GeomAbs_IsoU,Coord,b1,b2);
}
else
{
anIso.Load (GeomAbs_IsoV,Coord,b1,b2);
}
FindLimits (anIso, aLimit, b1, b2);
if (b2 - b1 > Precision::Confusion())
{
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
StdPrs_DeflectionCurve::Add (aPresentation, anIso, b1, b2, Deflection, StdPrs_DeflectionCurve::Add (aPresentation, anIso, b1, b2, Deflection,
Points->ChangeSequence(), anAngle, Standard_False); aPoints->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points); Curves.Append (aPoints);
} }
} }
} }