X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Futil%2FArrayUtils.java;h=59290b12d9c8fd48401436ad62bf93dffc2330f4;hb=cb6cee5e14451dd9b852723a30a5fbdee404d959;hp=67209f323ea4a0db5b5fa014cfdfab96c15744c4;hpb=0be17fea9df8667c018922d9eca1166254dce470;p=debian%2Fopenrocket diff --git a/core/src/net/sf/openrocket/util/ArrayUtils.java b/core/src/net/sf/openrocket/util/ArrayUtils.java index 67209f32..59290b12 100644 --- a/core/src/net/sf/openrocket/util/ArrayUtils.java +++ b/core/src/net/sf/openrocket/util/ArrayUtils.java @@ -4,6 +4,132 @@ import java.lang.reflect.Array; public class ArrayUtils { + /** + * Returns a double array with values from start to end with given step. + * Starts exactly at start and stops at the step before stop is reached. + */ + public static double[] range(double start, double stop, double step){ + + int size = (int) Math.floor(((stop - start) / step)); + + //System.out.println("Range from "+start+" to "+stop+" step "+step+" has length "+size); + + double[] output = new double[size]; + int i = 0; + double x = start; + while (i