mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0026443: Offset surface hangs up
D0 computation of offset surface simplification. Update of test-case according to the new behavior Test-cases for issue #26443
This commit is contained in:
parent
e19792fafc
commit
c1a487e468
@ -1589,26 +1589,28 @@ Standard_Boolean Geom_OffsetSurface::VOsculatingSurface(const Standard_Real U, c
|
|||||||
|
|
||||||
void Geom_OffsetSurface::SetD0(const Standard_Real U, const Standard_Real V,
|
void Geom_OffsetSurface::SetD0(const Standard_Real U, const Standard_Real V,
|
||||||
gp_Pnt& P,
|
gp_Pnt& P,
|
||||||
const gp_Vec& D1U, const gp_Vec& D1V) const
|
const gp_Vec& D1U, const gp_Vec& D1V) const // First Derivative
|
||||||
{
|
{
|
||||||
Handle(Geom_BSplineSurface) L;
|
|
||||||
Standard_Boolean IsOpposite=Standard_False;
|
|
||||||
const Standard_Boolean AlongU = UOsculatingSurface(U,V,IsOpposite,L);
|
|
||||||
const Standard_Boolean AlongV = VOsculatingSurface(U,V,IsOpposite,L);
|
|
||||||
const Standard_Real signe = ((AlongV || AlongU) && IsOpposite)? -1. : 1.;
|
|
||||||
|
|
||||||
const Standard_Real MagTol=0.000000001;
|
const Standard_Real MagTol=0.000000001;
|
||||||
gp_Dir Normal;
|
|
||||||
CSLib_NormalStatus NStatus;
|
|
||||||
CSLib::Normal (D1U, D1V, MagTol, NStatus, Normal);
|
|
||||||
|
|
||||||
if (NStatus == CSLib_Defined) // akm - only in singularities && !AlongU && !AlongV)
|
gp_Vec aNorm = D1U.Crossed(D1V);
|
||||||
|
if (aNorm.SquareMagnitude() > MagTol * MagTol)
|
||||||
{
|
{
|
||||||
P.SetXYZ(P.XYZ() + offsetValue * Normal.XYZ());
|
// Non singular case. Simple computations.
|
||||||
|
aNorm.Normalize();
|
||||||
|
P.SetXYZ(P.XYZ() + offsetValue * aNorm.XYZ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Standard_Integer MaxOrder=3;
|
Standard_Boolean AlongU = Standard_False,
|
||||||
|
AlongV = Standard_False;
|
||||||
|
Handle(Geom_BSplineSurface) L;
|
||||||
|
Standard_Boolean IsOpposite=Standard_False;
|
||||||
|
AlongU = UOsculatingSurface(U,V,IsOpposite,L);
|
||||||
|
AlongV = VOsculatingSurface(U,V,IsOpposite,L);
|
||||||
|
gp_Dir Normal;
|
||||||
|
CSLib_NormalStatus NStatus;
|
||||||
|
Standard_Integer MaxOrder=3;
|
||||||
TColgp_Array2OfVec DerNUV(0,MaxOrder,0,MaxOrder);
|
TColgp_Array2OfVec DerNUV(0,MaxOrder,0,MaxOrder);
|
||||||
TColgp_Array2OfVec DerSurf(0,MaxOrder+1,0,MaxOrder+1);
|
TColgp_Array2OfVec DerSurf(0,MaxOrder+1,0,MaxOrder+1);
|
||||||
Standard_Integer OrderU,OrderV;
|
Standard_Integer OrderU,OrderV;
|
||||||
@ -1618,6 +1620,10 @@ void Geom_OffsetSurface::SetD0(const Standard_Real U, const Standard_Real V,
|
|||||||
DerSurf.SetValue(0, 1, D1V);
|
DerSurf.SetValue(0, 1, D1V);
|
||||||
derivatives(MaxOrder,1,U,V,basisSurf,0,0,AlongU,AlongV,L,DerNUV,DerSurf);
|
derivatives(MaxOrder,1,U,V,basisSurf,0,0,AlongU,AlongV,L,DerNUV,DerSurf);
|
||||||
|
|
||||||
|
Standard_Real signe = 1.0;
|
||||||
|
if ((AlongV || AlongU) && IsOpposite)
|
||||||
|
signe = -1;
|
||||||
|
|
||||||
CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
|
CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
|
||||||
if (NStatus == CSLib_Defined)
|
if (NStatus == CSLib_Defined)
|
||||||
P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
|
P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
|
||||||
@ -1652,27 +1658,29 @@ void Geom_OffsetSurface::SetD1(const Standard_Real U, const Standard_Real V,
|
|||||||
|
|
||||||
// Check offset side.
|
// Check offset side.
|
||||||
Handle(Geom_BSplineSurface) L;
|
Handle(Geom_BSplineSurface) L;
|
||||||
|
Standard_Boolean AlongU = Standard_False,
|
||||||
|
AlongV = Standard_False;
|
||||||
Standard_Boolean IsOpposite=Standard_False;
|
Standard_Boolean IsOpposite=Standard_False;
|
||||||
const Standard_Boolean AlongU = UOsculatingSurface(U,V,IsOpposite,L);
|
AlongU = UOsculatingSurface(U,V,IsOpposite,L);
|
||||||
const Standard_Boolean AlongV = VOsculatingSurface(U,V,IsOpposite,L);
|
AlongV = VOsculatingSurface(U,V,IsOpposite,L);
|
||||||
const Standard_Real signe = ((AlongV || AlongU) && IsOpposite)? -1. : 1.;
|
Standard_Real signe = 1.0;
|
||||||
|
if ((AlongV || AlongU) && IsOpposite)
|
||||||
|
signe = -1.0;
|
||||||
|
|
||||||
gp_Dir Normal;
|
Standard_Integer MaxOrder = 0;
|
||||||
CSLib_NormalStatus NStatus;
|
gp_Vec aNorm = D1U.Crossed(D1V);
|
||||||
CSLib::Normal (D1U, D1V, MagTol, NStatus, Normal);
|
if (aNorm.SquareMagnitude() > MagTol * MagTol)
|
||||||
|
|
||||||
Standard_Integer MaxOrder;
|
|
||||||
if (NStatus == CSLib_Defined)
|
|
||||||
{
|
{
|
||||||
MaxOrder=0;
|
MaxOrder=0;
|
||||||
|
|
||||||
if (!AlongV && !AlongU)
|
if (!AlongV && !AlongU)
|
||||||
{
|
{
|
||||||
// AlongU or AlongV leads to more complex D1 computation
|
// AlongU or AlongV leads to more complex D1 computations,
|
||||||
// Try to compute D0 and D1 much simpler
|
// try to compute D0 and D1 much simpler.
|
||||||
P.SetXYZ(P.XYZ() + offsetValue * signe * Normal.XYZ());
|
aNorm.Normalize();
|
||||||
|
P.SetXYZ(P.XYZ() + offsetValue * signe * aNorm.XYZ());
|
||||||
|
|
||||||
gp_Vec aN0(Normal.XYZ()), aN1U, aN1V;
|
gp_Vec aN0(aNorm.XYZ()), aN1U, aN1V;
|
||||||
Standard_Real aScale = (D1U^D1V).Dot(aN0);
|
Standard_Real aScale = (D1U^D1V).Dot(aN0);
|
||||||
aN1U.SetX(D2UU.Y() * D1V.Z() + D1U.Y() * D2UV.Z()
|
aN1U.SetX(D2UU.Y() * D1V.Z() + D1U.Y() * D2UV.Z()
|
||||||
- D2UU.Z() * D1V.Y() - D1U.Z() * D2UV.Y());
|
- D2UU.Z() * D1V.Y() - D1U.Z() * D2UV.Y());
|
||||||
@ -1715,6 +1723,8 @@ void Geom_OffsetSurface::SetD1(const Standard_Real U, const Standard_Real V,
|
|||||||
DerSurf.SetValue(0, 2, D2VV);
|
DerSurf.SetValue(0, 2, D2VV);
|
||||||
derivatives(MaxOrder,2,U,V,basisSurf,1,1,AlongU,AlongV,L,DerNUV,DerSurf);
|
derivatives(MaxOrder,2,U,V,basisSurf,1,1,AlongU,AlongV,L,DerNUV,DerSurf);
|
||||||
|
|
||||||
|
gp_Dir Normal;
|
||||||
|
CSLib_NormalStatus NStatus;
|
||||||
CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
|
CSLib::Normal(MaxOrder,DerNUV,MagTol,U,V,Umin,Umax,Vmin,Vmax,NStatus,Normal,OrderU,OrderV);
|
||||||
if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
|
if (NStatus != CSLib_Defined) Geom_UndefinedValue::Raise();
|
||||||
|
|
||||||
|
20
tests/bugs/modalg_6/bug26443_1
Normal file
20
tests/bugs/modalg_6/bug26443_1
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26443"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###########################
|
||||||
|
# Offset surface hangs up
|
||||||
|
###########################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
|
||||||
|
restore [locate_data_file OCC26443-shell_1.brep] a
|
||||||
|
|
||||||
|
chrono h reset
|
||||||
|
dchrono h start
|
||||||
|
offsetshape r a -2
|
||||||
|
chrono h stop
|
||||||
|
dchrono h show
|
||||||
|
fit
|
||||||
|
|
||||||
|
set only_screen_axo 1
|
20
tests/bugs/modalg_6/bug26443_2
Normal file
20
tests/bugs/modalg_6/bug26443_2
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26443"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###########################
|
||||||
|
# Offset surface hangs up
|
||||||
|
###########################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
|
||||||
|
restore [locate_data_file OCC26443-shell_2.brep] a
|
||||||
|
|
||||||
|
chrono h reset
|
||||||
|
dchrono h start
|
||||||
|
offsetshape r a -2
|
||||||
|
chrono h stop
|
||||||
|
dchrono h show
|
||||||
|
fit
|
||||||
|
|
||||||
|
set only_screen_axo 1
|
@ -1,5 +1,6 @@
|
|||||||
puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape"
|
puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape"
|
||||||
puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape"
|
puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape"
|
||||||
|
puts "TODO OCC26577 All: Faulty shapes in variables faulty_1 to faulty"
|
||||||
restore [locate_data_file bug26663_test_offset_L6.brep] s
|
restore [locate_data_file bug26663_test_offset_L6.brep] s
|
||||||
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
||||||
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape"
|
puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape"
|
||||||
puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape"
|
puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape"
|
||||||
puts "TODO OCC26577 Windows: Faulty shapes in variables faulty_1 to faulty"
|
|
||||||
restore [locate_data_file bug26663_test_offset_L8.brep] s
|
restore [locate_data_file bug26663_test_offset_L8.brep] s
|
||||||
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
||||||
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user