CartesianGeometricUtilities { public static double bottomScale(double toScale, int maxDimension) { if(maxDimension == 1) { assert toScale == 0 : "If the dimension is 1, then you can only scale 0"; return 0; } return (toScale / (maxDimension - 1)); }  static Tuple2D centerAndScale(Tuple2D toScale, int width, int height); static Vertex centerAndScale(Vertex toScale, int width, int height, int depth); static double centerAndScale(double toScale, int maxDimension); static Tuple2D Bottom1DCenterAndScale(Tuple2D toScale, int width, int height); static Tuple2D bottomCenterAndScale(Tuple2D toScale, int width, int height); static double bottomScale(double toScale, int maxDimension); static double shortestDistanceToLineSegment(ILocated2D p1, ILocated2D l1, ILocated2D l2); static double shortestDistanceToLineSegment(double x, double y, double x1, double x2, double y1, double y2); static double euclideanDistance(ArrayList<Double> x1, ArrayList<Double> x2); static double[] polarToCartesian(double r, double theta); static double signedAngleFromSourceHeadingToTarget(ILocated2D source, ILocated2D target, double sourceRads); static double signedAngleDifference(ILocated2D v1, ILocated2D v2); static double signedAngleDifference(double rad1, double rad2); static boolean sourceHeadingTowardsTarget(double sourceRadians, ILocated2D source, ILocated2D target,
			double allowance); static boolean onSideOf(ILocated2D source, double sourceRadians, ILocated2D other, boolean right); static double restrictRadians(double rads);  }
@Test public void testBottomScale() { double toScale = 8.0; assertEquals(4.0, CartesianGeometricUtilities.bottomScale(toScale, 3), DOUBLE_THRESHOLD); assertEquals(0, CartesianGeometricUtilities.bottomScale(0, 1), DOUBLE_THRESHOLD); assertEquals(2.0, CartesianGeometricUtilities.bottomScale(toScale, 5), DOUBLE_THRESHOLD); assertEquals(1.0, CartesianGeometricUtilities.bottomScale(toScale, 9), DOUBLE_THRESHOLD); }