1 package net.sf.openrocket.rocketcomponent;
3 import net.sf.openrocket.l10n.Translator;
4 import net.sf.openrocket.startup.Application;
5 import net.sf.openrocket.util.Coordinate;
6 import net.sf.openrocket.util.MathUtil;
8 public class EllipticalFinSet extends FinSet {
9 private static final Translator trans = Application.getTranslator();
11 public static final int POINTS = 21;
13 private static final double[] POINT_X = new double[POINTS];
14 private static final double[] POINT_Y = new double[POINTS];
16 for (int i=0; i < POINTS; i++) {
17 double a = Math.PI * (POINTS-1-i)/(POINTS-1);
18 POINT_X[i] = (Math.cos(a)+1)/2;
19 POINT_Y[i] = Math.sin(a);
23 POINT_X[POINTS-1] = 1;
24 POINT_Y[POINTS-1] = 0;
28 private double height = 0.05;
30 public EllipticalFinSet() {
36 public Coordinate[] getFinPoints() {
37 Coordinate[] points = new Coordinate[POINTS];
38 for (int i=0; i < POINTS; i++) {
39 points[i] = new Coordinate(POINT_X[i]*length, POINT_Y[i]*height);
45 public double getSpan() {
50 public String getComponentName() {
51 //// Elliptical fin set
52 return trans.get("EllipticalFinSet.Ellipticalfinset");
56 public double getHeight() {
60 public void setHeight(double height) {
61 if (MathUtil.equals(this.height, height))
64 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
68 public void setLength(double length) {
69 if (MathUtil.equals(this.length, length))
72 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);