mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-09 18:50:54 +03:00
0024484: sprops gives incorrect matrix of inertia and moments
Added test case bugs/modalg_5/bug24484
This commit is contained in:
parent
12a45e038f
commit
a24c75d908
@ -518,12 +518,14 @@ static Standard_Real CCompute(Face& S,
|
||||
LocIxy = FuncAdd(LocIxy, FuncMul(x, YdS));
|
||||
LocIyz = FuncAdd(LocIyz, FuncMul(y, ZdS));
|
||||
LocIxz = FuncAdd(LocIxz, FuncMul(x, ZdS));
|
||||
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
|
||||
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
|
||||
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
|
||||
LocIxx = FuncAdd(LocIxx, FuncAdd(YdS, ZdS));
|
||||
LocIyy = FuncAdd(LocIyy, FuncAdd(XdS, ZdS));
|
||||
LocIzz = FuncAdd(LocIzz, FuncAdd(XdS, YdS));
|
||||
|
||||
const Standard_Real XXdS = FuncMul(x, XdS);
|
||||
const Standard_Real YYdS = FuncMul(y, YdS);
|
||||
const Standard_Real ZZdS = FuncMul(z, ZdS);
|
||||
|
||||
LocIxx = FuncAdd(LocIxx, FuncAdd(YYdS, ZZdS));
|
||||
LocIyy = FuncAdd(LocIyy, FuncAdd(XXdS, ZZdS));
|
||||
LocIzz = FuncAdd(LocIzz, FuncAdd(XXdS, YYdS));
|
||||
}//for: iU
|
||||
}//for: iGU
|
||||
|
||||
@ -788,12 +790,14 @@ static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, g
|
||||
LocIxy = FuncAdd(LocIxy, FuncMul(x, YdS));
|
||||
LocIyz = FuncAdd(LocIyz, FuncMul(y, ZdS));
|
||||
LocIxz = FuncAdd(LocIxz, FuncMul(x, ZdS));
|
||||
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
|
||||
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
|
||||
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
|
||||
LocIxx = FuncAdd(LocIxx, FuncAdd(YdS, ZdS));
|
||||
LocIyy = FuncAdd(LocIyy, FuncAdd(XdS, ZdS));
|
||||
LocIzz = FuncAdd(LocIzz, FuncAdd(XdS, YdS));
|
||||
|
||||
const Standard_Real XXdS = FuncMul(x, XdS);
|
||||
const Standard_Real YYdS = FuncMul(y, YdS);
|
||||
const Standard_Real ZZdS = FuncMul(z, ZdS);
|
||||
|
||||
LocIxx = FuncAdd(LocIxx, FuncAdd(YYdS, ZZdS));
|
||||
LocIyy = FuncAdd(LocIyy, FuncAdd(XXdS, ZZdS));
|
||||
LocIzz = FuncAdd(LocIzz, FuncAdd(XXdS, YYdS));
|
||||
}
|
||||
|
||||
CArea = FuncAdd(CArea, FuncMul(LocArea, ur));
|
||||
@ -919,12 +923,14 @@ static void Compute(const Face& S,
|
||||
Ixyi = FuncAdd(Ixyi, FuncMul(x, YdS));
|
||||
Iyzi = FuncAdd(Iyzi, FuncMul(y, ZdS));
|
||||
Ixzi = FuncAdd(Ixzi, FuncMul(x, ZdS));
|
||||
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
|
||||
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
|
||||
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
|
||||
Ixxi = FuncAdd(Ixxi, FuncAdd(YdS, ZdS));
|
||||
Iyyi = FuncAdd(Iyyi, FuncAdd(XdS, ZdS));
|
||||
Izzi = FuncAdd(Izzi, FuncAdd(XdS, YdS));
|
||||
|
||||
const Standard_Real XXdS = FuncMul(x, XdS);
|
||||
const Standard_Real YYdS = FuncMul(y, YdS);
|
||||
const Standard_Real ZZdS = FuncMul(z, ZdS);
|
||||
|
||||
Ixxi = FuncAdd(Ixxi, FuncAdd(YYdS, ZZdS));
|
||||
Iyyi = FuncAdd(Iyyi, FuncAdd(XXdS, ZZdS));
|
||||
Izzi = FuncAdd(Izzi, FuncAdd(XXdS, YYdS));
|
||||
}
|
||||
|
||||
dim = FuncAdd(dim, FuncMul(dsi, GaussWV (j)));
|
||||
|
35
tests/bugs/modalg_5/bug24484
Normal file
35
tests/bugs/modalg_5/bug24484
Normal file
@ -0,0 +1,35 @@
|
||||
puts "==========="
|
||||
puts "OCC24484"
|
||||
puts "==========="
|
||||
puts ""
|
||||
#########################################################
|
||||
# sprops gives incorrect matrix of inertia and moments
|
||||
#########################################################
|
||||
|
||||
set IX_ch 2.66667e+08
|
||||
set IY_ch 1.33333e+08
|
||||
set IZ_ch 1.33333e+08
|
||||
set iner_ch1 1.33333e+08
|
||||
set iner_ch2 2.66667e+08
|
||||
set iner_ch3 1.33333e+08
|
||||
restore [locate_data_file bug24484_Face_2.brep] result
|
||||
set info [sprops result]
|
||||
|
||||
regexp {IX += +([-0-9.+eE]+)} $info full IX
|
||||
regexp {IY += +([-0-9.+eE]+)} $info full IY
|
||||
regexp {IZ += +([-0-9.+eE]+)} $info full IZ
|
||||
regexp -all {Matrix of Inertia :[\t\n]*[\s\t]*([-0-9.+eE]+)[\s\t]*[-0-9.+eE]+[\s\t]*[-0-9.+eE]+[\t\n]*[\s\t]*[-0-9.+eE]+[\s\t]*([-0-9.+eE]+)[\s\t]*[-0-9.+eE]+[\t\n]*[\s\t]*[-0-9.+eE]+[\s\t]*[-0-9.+eE]+[\s\t]*([-0-9.+eE]+)} $info full iner1 iner2 iner3
|
||||
|
||||
if { $IX != $IX_ch || $IY != $IY_ch || $IZ != $IZ_ch } {
|
||||
puts "Error : Moments are incorrect"
|
||||
} else {
|
||||
puts "OK : Moments are correct"
|
||||
}
|
||||
|
||||
if { $iner1 != $iner_ch1 || $iner2 != $iner_ch2 || $iner3 != $iner_ch3 } {
|
||||
puts "Error : Matrix of Inertia is incorrect"
|
||||
} else {
|
||||
puts "OK : Matrix of Inertia is correct"
|
||||
}
|
||||
|
||||
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user