Fix RockSim fin tab import issue
This commit is contained in:
		
							parent
							
								
									59fb50aeb1
								
							
						
					
					
						commit
						903a13cc91
					
				@ -281,8 +281,9 @@ class FinSetHandler extends AbstractElementHandler {
 | 
				
			|||||||
		//Create the fin set and correct for overrides and actual material densities
 | 
							//Create the fin set and correct for overrides and actual material densities
 | 
				
			||||||
		FinSet finSet = asOpenRocket(warnings);
 | 
							FinSet finSet = asOpenRocket(warnings);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (component instanceof Transition && shapeCode == 0)
 | 
							if (component instanceof Transition && shapeCode == 0) {
 | 
				
			||||||
			finSet = FreeformFinSet.convertFinSet(finSet);
 | 
								finSet = FreeformFinSet.convertFinSet(finSet);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		finSet.setAppearance(appearanceBuilder.getAppearance());
 | 
							finSet.setAppearance(appearanceBuilder.getAppearance());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -327,7 +328,7 @@ class FinSetHandler extends AbstractElementHandler {
 | 
				
			|||||||
			((EllipticalFinSet) result).setLength(rootChord);
 | 
								((EllipticalFinSet) result).setLength(rootChord);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (shapeCode == 2) {
 | 
							else if (shapeCode == 2) {
 | 
				
			||||||
 | 
								// Freeform
 | 
				
			||||||
			result = new FreeformFinSet();
 | 
								result = new FreeformFinSet();
 | 
				
			||||||
			((FreeformFinSet) result).setPoints(toCoordinates(pointList, warnings));
 | 
								((FreeformFinSet) result).setPoints(toCoordinates(pointList, warnings));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -338,16 +339,25 @@ class FinSetHandler extends AbstractElementHandler {
 | 
				
			|||||||
		result.setThickness(thickness);
 | 
							result.setThickness(thickness);
 | 
				
			||||||
		result.setName(name);
 | 
							result.setName(name);
 | 
				
			||||||
		result.setFinCount(finCount);
 | 
							result.setFinCount(finCount);
 | 
				
			||||||
		result.setFinish(finish);
 | 
					 | 
				
			||||||
		//All TTW tabs in Rocksim are relative to the front of the fin.
 | 
					 | 
				
			||||||
		result.setTabOffsetMethod( AxialMethod.TOP);
 | 
					 | 
				
			||||||
		result.setTabHeight(tabDepth);
 | 
					 | 
				
			||||||
		result.setTabLength(tabLength);
 | 
					 | 
				
			||||||
		result.setTabOffset(taboffset);
 | 
					 | 
				
			||||||
		result.setBaseRotation(radialAngle);
 | 
					 | 
				
			||||||
		result.setCrossSection(convertTipShapeCode(tipShapeCode));
 | 
					 | 
				
			||||||
		result.setAxialMethod(axialMethod);
 | 
							result.setAxialMethod(axialMethod);
 | 
				
			||||||
		result.setAxialOffset(location);
 | 
							result.setAxialOffset(location);
 | 
				
			||||||
 | 
							result.setBaseRotation(radialAngle);
 | 
				
			||||||
 | 
							result.setCrossSection(convertTipShapeCode(tipShapeCode));
 | 
				
			||||||
 | 
							result.setFinish(finish);
 | 
				
			||||||
 | 
							result.setTabOffsetMethod(AxialMethod.TOP);
 | 
				
			||||||
 | 
							result.setTabOffset(taboffset);
 | 
				
			||||||
 | 
							result.setTabLength(tabLength);
 | 
				
			||||||
 | 
							//All TTW tabs in Rocksim are relative to the front of the fin, so set an offset if the parent's fore radius is larger than the aft radius.
 | 
				
			||||||
 | 
							Double radiusFront = result.getParentFrontRadius(component);
 | 
				
			||||||
 | 
							Double radiusTrailing = result.getParentTrailingRadius(component);
 | 
				
			||||||
 | 
							if (radiusFront == null) {
 | 
				
			||||||
 | 
								radiusFront = 0d;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (radiusTrailing == null) {
 | 
				
			||||||
 | 
								radiusTrailing = 0d;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							double tabDepthOffset = Math.max(radiusFront - radiusTrailing, 0);
 | 
				
			||||||
 | 
							result.setTabHeight(tabDepth - tabDepthOffset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return result;
 | 
							return result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -437,18 +437,60 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
 | 
				
			|||||||
	 * @return maximum tab height value
 | 
						 * @return maximum tab height value
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public double getMaxTabHeight() {
 | 
						public double getMaxTabHeight() {
 | 
				
			||||||
		// check tab height 
 | 
							Double radiusFront = getParentFrontRadius();
 | 
				
			||||||
		if (null != getParent() ){
 | 
							Double radiusTrailing = getParentTrailingRadius();
 | 
				
			||||||
 | 
							if (radiusFront != null && radiusTrailing != null) {
 | 
				
			||||||
 | 
								return MathUtil.min(radiusFront, radiusTrailing);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return Double.MAX_VALUE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Returns the radius of the parent at the front of the fin, or null if no parent is present.
 | 
				
			||||||
 | 
						 * @param parent the fin's parent component
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public Double getParentFrontRadius(RocketComponent parent) {
 | 
				
			||||||
 | 
							if (parent instanceof SymmetricComponent) {
 | 
				
			||||||
			final Coordinate finFront = this.getFinFront();
 | 
								final Coordinate finFront = this.getFinFront();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// pulls the parent-body radius at the fin-tab reference point.
 | 
								// pulls the parent-body radius at the fin-tab reference point.
 | 
				
			||||||
			final double xLead = this.getTabFrontEdge();
 | 
								final double xLead = this.getTabFrontEdge();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								final SymmetricComponent sym = (SymmetricComponent) parent;
 | 
				
			||||||
 | 
								return sym.getRadius(finFront.x + xLead);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return null;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Returns the radius of the parent at the front of the fin, or null if no parent is present.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public Double getParentFrontRadius() {
 | 
				
			||||||
 | 
							return getParentFrontRadius(getParent());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Returns the radius of the parent at the trailing edge of the fin, or null if no parent is present.
 | 
				
			||||||
 | 
						 * @param parent the fin's parent component
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public Double getParentTrailingRadius(RocketComponent parent) {
 | 
				
			||||||
 | 
							if (parent instanceof SymmetricComponent) {
 | 
				
			||||||
 | 
								final Coordinate finFront = this.getFinFront();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// pulls the parent-body radius at the fin-tab reference point.
 | 
				
			||||||
			final double xTrail = this.getTabTrailingEdge();
 | 
								final double xTrail = this.getTabTrailingEdge();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			final SymmetricComponent sym = (SymmetricComponent)this.parent;
 | 
								final SymmetricComponent sym = (SymmetricComponent) parent;
 | 
				
			||||||
			return MathUtil.min(sym.getRadius(finFront.x + xLead), sym.getRadius(finFront.x + xTrail));
 | 
								return sym.getRadius(finFront.x + xTrail);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return Double.MAX_VALUE;
 | 
							return null;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Returns the radius of the parent at the trailing edge of the fin, or null if no parent is present.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public Double getParentTrailingRadius() {
 | 
				
			||||||
 | 
							return getParentTrailingRadius(getParent());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	///////////  Calculation methods  //////////
 | 
						///////////  Calculation methods  //////////
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user