public void printTest(float longSide, float shortSide) { StringBuilder sb = new StringBuilder(); sb.Append("\n").Append(longSide + " and " + shortSide); sb.Append("\n").Append("phi = " + GoldenRatio.phi); sb.Append("\n").Append("Phi = " + GoldenRatio.Phi); sb.Append("\n").Append("Long side of " + longSide + " : " + GoldenRatio.LongSideOf(longSide) + " --> " + longSide.LongSideOfLengthGoldenRatio()); sb.Append("\n").Append("Shortside of " + longSide + " : " + GoldenRatio.ShortSideOf(longSide) + " --> " + longSide.ShortSideOfLengthGoldenRatio()); sb.Append("\n").Append("Long side of " + shortSide + " : " + GoldenRatio.LongSideOf(shortSide) + " --> " + shortSide.LongSideOfLengthGoldenRatio()); sb.Append("\n").Append("Shortside of " + shortSide + " : " + GoldenRatio.ShortSideOf(shortSide) + " --> " + shortSide.ShortSideOfLengthGoldenRatio()); sb.Append("\n").Append("Long side for " + longSide + " : " + GoldenRatio.LongSideFor(longSide) + " --> " + longSide.LongSideForShortSideGoldenRatio()); sb.Append("\n").Append("Shortside for " + longSide + " : " + GoldenRatio.ShortSideFor(longSide) + " --> " + longSide.ShortSideForLongSideGoldenRatio()); sb.Append("\n").Append("Long side for " + shortSide + " : " + GoldenRatio.LongSideFor(shortSide) + " --> " + shortSide.LongSideForShortSideGoldenRatio()); sb.Append("\n").Append("Shortside for " + shortSide + " : " + GoldenRatio.ShortSideFor(shortSide) + " --> " + shortSide.ShortSideForLongSideGoldenRatio()); sb.Append("\n").Append(longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(longSide, shortSide)); sb.Append("\n").Append(longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(shortSide, longSide)); sb.Append("\n").Append("Approx: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(longSide, shortSide)); sb.Append("\n").Append("Approx: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(shortSide, longSide)); sb.Append("\n").Append("Rounded 0: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(longSide, shortSide, 0)); sb.Append("\n").Append("Rounded 0: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(shortSide, longSide, 0)); sb.Append("\n").Append("Rounded 2: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(longSide, shortSide, 2)); sb.Append("\n").Append("Rounded 2: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(shortSide, longSide, 2)); sb.Append("\n").Append("Rounded 8: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(longSide, shortSide, 8)); sb.Append("\n").Append("Rounded 8: " + longSide + " and " + shortSide + " GoldenRatio ? " + GoldenRatio.IsGoldenRatio(shortSide, longSide, 8)); sb.Append("\n").Append("ShortSide for " + longSide + " = " + GoldenRatio.ShortSideFor(longSide)); sb.Append("\n").Append("LongSide for " + shortSide + " = " + GoldenRatio.LongSideFor(shortSide)); Debug.Log(sb.ToString()); }
/// <summary> /// <para> o--------given-------o------?-----o </para> /// </summary> /// <param name="longSide"></param> /// <returns></returns> public static float ShortSideForLongSideGoldenRatio(this float longSide) { return(GoldenRatio.ShortSideFor(longSide)); }