Merge pull request #2214 from SiboVG/issue-2209
[#2209] Average segment centroids
This commit is contained in:
commit
b8895a1ea0
@ -581,7 +581,8 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
* 5. Return twice that since there is a fillet on each side of the fin.
|
* 5. Return twice that since there is a fillet on each side of the fin.
|
||||||
*/
|
*/
|
||||||
protected Coordinate calculateFilletVolumeCentroid() {
|
protected Coordinate calculateFilletVolumeCentroid() {
|
||||||
if((null == this.parent) || (!SymmetricComponent.class.isAssignableFrom(this.parent.getClass()))){
|
if ((this.filletRadius == 0) || (this.parent == null) ||
|
||||||
|
(!SymmetricComponent.class.isAssignableFrom(this.parent.getClass()))) {
|
||||||
return Coordinate.ZERO;
|
return Coordinate.ZERO;
|
||||||
}
|
}
|
||||||
Coordinate[] mountPoints = this.getRootPoints();
|
Coordinate[] mountPoints = this.getRootPoints();
|
||||||
@ -594,7 +595,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
final Coordinate finLead = getFinFront();
|
final Coordinate finLead = getFinFront();
|
||||||
final double xFinEnd = finLead.x + getLength();
|
final double xFinEnd = finLead.x + getLength();
|
||||||
final Coordinate[] rootPoints = getMountPoints( finLead.x, xFinEnd, -finLead.x, -finLead.y);
|
final Coordinate[] rootPoints = getMountPoints( finLead.x, xFinEnd, -finLead.x, -finLead.y);
|
||||||
if (0 == rootPoints.length) {
|
if (rootPoints.length == 0) {
|
||||||
return Coordinate.ZERO;
|
return Coordinate.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +617,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
|
|
||||||
final Coordinate segmentCentroid = segmentCrossSection.setWeight(segmentVolume);
|
final Coordinate segmentCentroid = segmentCrossSection.setWeight(segmentVolume);
|
||||||
|
|
||||||
filletVolumeCentroid = filletVolumeCentroid.add(segmentCentroid);
|
filletVolumeCentroid = filletVolumeCentroid.average(segmentCentroid);
|
||||||
|
|
||||||
prev = cur;
|
prev = cur;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,32 @@ public class TrapezoidFinSetTest extends BaseTestCase {
|
|||||||
return rkt;
|
return rkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Rocket createFreeformFinOnTransition() {
|
||||||
|
final Rocket rkt = new Rocket();
|
||||||
|
final AxialStage stg = new AxialStage();
|
||||||
|
rkt.addChild(stg);
|
||||||
|
Transition transition = new Transition();
|
||||||
|
transition.setLength(0.2);
|
||||||
|
transition.setForeRadius(0.1);
|
||||||
|
transition.setAftRadius(0.3);
|
||||||
|
transition.setShapeType(Transition.Shape.OGIVE);
|
||||||
|
stg.addChild(transition);
|
||||||
|
FreeformFinSet fins = new FreeformFinSet();
|
||||||
|
fins.setFinCount(1);
|
||||||
|
fins.setAxialOffset(AxialMethod.MIDDLE, 0.0);
|
||||||
|
fins.setMaterial(Material.newMaterial(Material.Type.BULK, "Fin-Test-Material", 1.0, true));
|
||||||
|
fins.setThickness(0.005); // == 5 mm
|
||||||
|
|
||||||
|
transition.addChild(fins);
|
||||||
|
|
||||||
|
fins.setTabLength(0.00);
|
||||||
|
|
||||||
|
fins.setFilletRadius(0.0);
|
||||||
|
|
||||||
|
rkt.enableEvents();
|
||||||
|
return rkt;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiplicity() {
|
public void testMultiplicity() {
|
||||||
final TrapezoidFinSet trapFins = new TrapezoidFinSet();
|
final TrapezoidFinSet trapFins = new TrapezoidFinSet();
|
||||||
@ -187,6 +213,33 @@ public class TrapezoidFinSetTest extends BaseTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFilletCalculationsOnTransition() {
|
||||||
|
final Rocket rkt = createFreeformFinOnTransition();
|
||||||
|
Transition transition = (Transition) rkt.getChild(0).getChild(0);
|
||||||
|
FinSet fins = (FinSet) rkt.getChild(0).getChild(0).getChild(0);
|
||||||
|
|
||||||
|
fins.setFilletRadius(0.005);
|
||||||
|
fins.setFilletMaterial(Material.newMaterial(Material.Type.BULK, "Fillet-Test-Material", 1.0, true));
|
||||||
|
|
||||||
|
// used for fillet and edge calculations:
|
||||||
|
//
|
||||||
|
// [1] +--+ [2]
|
||||||
|
// / \
|
||||||
|
// / \
|
||||||
|
// [0] +--------+ [3]
|
||||||
|
//
|
||||||
|
assertEquals(0.05, fins.getLength(), EPSILON);
|
||||||
|
assertEquals("Transition fore radius doesn't match: ", 0.1, transition.getForeRadius(), EPSILON);
|
||||||
|
assertEquals("Transition aft radius doesn't match: ", 0.3, transition.getAftRadius(), EPSILON);
|
||||||
|
|
||||||
|
final Coordinate actVolume = fins.calculateFilletVolumeCentroid();
|
||||||
|
|
||||||
|
assertEquals("Fin volume doesn't match: ", 5.973e-07, actVolume.weight, EPSILON);
|
||||||
|
assertEquals("Fin mass center.x doesn't match: ", 0.024393025, actVolume.x, EPSILON);
|
||||||
|
assertEquals("Fin mass center.y doesn't match: ", 0.190479957, actVolume.y, EPSILON);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTrapezoidCGComputation() {
|
public void testTrapezoidCGComputation() {
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user