Merged changes fixing NaN when computing fin CG.
This commit is contained in:
parent
9c3fce4517
commit
4d77c817d8
@ -440,7 +440,7 @@ public abstract class FinSet extends ExternalComponent {
|
||||
|
||||
double da = (y0 + y1) * (x1 - x0) / 2;
|
||||
finArea += da;
|
||||
if (Math.abs(y0 - y1) < 0.00001) {
|
||||
if (Math.abs(y0 + y1) < 0.00001) {
|
||||
finCGx += (x0 + x1) / 2 * da;
|
||||
finCGy += y0 / 2 * da;
|
||||
} else {
|
||||
|
@ -119,13 +119,13 @@ public class FinSetTest extends BaseTestCase {
|
||||
fins.setPoints(points);
|
||||
Coordinate coords = fins.getCG();
|
||||
assertEquals(3.0, fins.getFinArea(), 0.001);
|
||||
// FIXME - this computes NaN
|
||||
//assertEquals(3.5/3.0, coords.x, 0.001);
|
||||
//assertEquals(0.5/3.0, coords.y, 0.001);
|
||||
assertEquals(3.5/3.0, coords.x, 0.001);
|
||||
assertEquals(0.5/3.0, coords.y, 0.001);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFreeformConvert() {
|
||||
testFreeformConvert(new TrapezoidFinSet());
|
||||
|
Loading…
x
Reference in New Issue
Block a user