Reset integration results for zero-length components

This commit is contained in:
SiboVG 2022-09-15 23:18:19 +02:00
parent ac120e8fc1
commit 7602756dee

View File

@ -312,13 +312,15 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
double x, r1, r2; double x, r1, r2;
double cgx; double cgx;
// Check length > 0
if (length <= 0) {
wetArea = 0; wetArea = 0;
planArea = 0; planArea = 0;
planCenter = 0; planCenter = 0;
fullVolume = 0;
volume = 0; volume = 0;
cg = Coordinate.NUL; cg = Coordinate.NUL;
// Check length > 0
if (length <= 0) {
return; return;
} }
@ -329,11 +331,6 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
final double pi3 = Math.PI / 3.0; final double pi3 = Math.PI / 3.0;
r1 = getRadius(0); r1 = getRadius(0);
x = 0; x = 0;
wetArea = 0;
planArea = 0;
planCenter = 0;
fullVolume = 0;
volume = 0;
cgx = 0; cgx = 0;
for (int n = 1; n <= DIVISIONS; n++) { for (int n = 1; n <= DIVISIONS; n++) {
@ -423,14 +420,17 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
private void integrateInertiaVolume() { private void integrateInertiaVolume() {
double x, r1, r2; double x, r1, r2;
longitudinalInertia = 0;
rotationalInertia = 0;
if (length <= 0) return;
final double l = length / DIVISIONS; final double l = length / DIVISIONS;
final double pil = Math.PI * l; // PI * l final double pil = Math.PI * l; // PI * l
final double pil3 = Math.PI * l / 3; // PI * l/3 final double pil3 = Math.PI * l / 3; // PI * l/3
r1 = getRadius(0); r1 = getRadius(0);
x = 0; x = 0;
longitudinalInertia = 0;
rotationalInertia = 0;
double vol = 0; double vol = 0;
@ -490,14 +490,16 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
private void integrateInertiaSurface() { private void integrateInertiaSurface() {
double x, r1, r2; double x, r1, r2;
longitudinalInertia = 0;
rotationalInertia = 0;
if (length <= 0) return;
final double l = length / DIVISIONS; final double l = length / DIVISIONS;
r1 = getRadius(0); r1 = getRadius(0);
x = 0; x = 0;
longitudinalInertia = 0;
rotationalInertia = 0;
double surface = 0; double surface = 0;
for (int n = 1; n <= DIVISIONS; n++) { for (int n = 1; n <= DIVISIONS; n++) {