[address 618] improves display of freeform fin tabs on transition bodies

This commit is contained in:
Daniel_M_Williams 2020-04-18 12:37:28 -04:00 committed by Billy Olsen
parent 37e1180963
commit 4326c71c71

View File

@ -203,7 +203,7 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
/** /**
* *
* @param cant -- new cant angle, in radians * @param newCantRadians -- new cant angle, in radians
*/ */
public void setCantAngle(final double newCantRadians) { public void setCantAngle(final double newCantRadians) {
final double clampedCant = MathUtil.clamp(newCantRadians, -MAX_CANT_RADIANS, MAX_CANT_RADIANS); final double clampedCant = MathUtil.clamp(newCantRadians, -MAX_CANT_RADIANS, MAX_CANT_RADIANS);
@ -264,16 +264,16 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
* Note this function also does bounds checking, and will not set * Note this function also does bounds checking, and will not set
* a tab height that passes through it's parent's midpoint. * a tab height that passes through it's parent's midpoint.
* *
* @param newHeightRequest how deep the fin tab should project * @param newTabHeight how deep the fin tab should project
* from the fin root, at the reference point * from the fin root, at the reference point
* *
*/ */
public void setTabHeight(final double heightRequest) { public void setTabHeight(final double newTabHeight) {
if (MathUtil.equals(this.tabHeight, MathUtil.max(heightRequest, 0))){ if (MathUtil.equals(this.tabHeight, MathUtil.max(newTabHeight, 0))){
return; return;
} }
tabHeight = heightRequest; tabHeight = newTabHeight;
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
} }
@ -300,7 +300,6 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
* internally, set the internal offset and optionally validate tab * internally, set the internal offset and optionally validate tab
* *
* @param offsetRequest new requested shift of tab -- from * @param offsetRequest new requested shift of tab -- from
* @param validate wehther or not to validate
*/ */
public void setTabOffset( final double offsetRequest) { public void setTabOffset( final double offsetRequest) {
tabOffset = offsetRequest; tabOffset = offsetRequest;
@ -906,24 +905,23 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
final double xTabFront = getTabFrontEdge(); final double xTabFront = getTabFrontEdge();
final double xTabTrail = getTabTrailingEdge(); final double xTabTrail = getTabTrailingEdge();
final double xTabReference = finFront.x + getTabOffset(); // // limit the new heights to be no greater than the current body radius.
double yTabFront = Double.NaN;
double yTabFront = 0; double yTabTrail = Double.NaN;
double yTabTrail = 0; double yTabBottom = Double.NaN;
double yTabBottom = -tabHeight;
if( null != body ){ if( null != body ){
yTabFront = body.getRadius( finFront.x + xTabFront ) - finFront.y; yTabFront = body.getRadius( finFront.x + xTabFront ) - finFront.y;
yTabTrail = body.getRadius( finFront.x + xTabTrail ) - finFront.y; yTabTrail = body.getRadius( finFront.x + xTabTrail ) - finFront.y;
yTabBottom = body.getRadius( xTabReference ) - tabHeight - finFront.y; yTabBottom = MathUtil.min(yTabFront, yTabTrail) - tabHeight;
} }
points[0] = new Coordinate(xTabFront, yTabFront); points[0] = new Coordinate(xTabFront, yTabFront);
points[1] = new Coordinate(xTabFront, yTabBottom ); points[1] = new Coordinate(xTabFront, yTabBottom );
points[2] = new Coordinate(xTabTrail, yTabBottom ); points[2] = new Coordinate(xTabTrail, yTabBottom );
points[3] = new Coordinate(xTabTrail, yTabTrail); points[3] = new Coordinate(xTabTrail, yTabTrail);
return points; return points;
} }
public Coordinate getFinFront() { public Coordinate getFinFront() {