Class Maths

java.lang.Object
dev.secondsun.util.Maths

public final class Maths extends Object
  • Constructor Details

    • Maths

      public Maths()
  • Method Details

    • min

      public static int min(int... y)
    • max

      public static int max(int... y)
    • min

      public static float min(float... y)
    • max

      public static float max(float... y)
    • clamp

      public static int clamp(int min, int max, int val)
    • subtract

      public static Vertex subtract(Vertex from, Vertex to)
    • add

      public static Vertex add(Vertex from, Vertex to)
    • normalize

      public static Vertex normalize(Vertex subtract)
    • subtract

      public static Vertex2D subtract(Vertex2D from, Vertex2D to)
    • add

      public static Vertex2D add(Vertex2D from, Vertex2D to)
    • scale

      public static Vertex2D scale(Vertex2D from, float to)
    • reverseBilinear

      public static Vertex2D reverseBilinear(Vertex2D point, Quad quad)
      The vertecies in quad need to be in order such that the first vertx is 0,0 in the texture the clockwise around

      see http://iquilezles.org/www/articles/ibilinear/ibilinear.htm

      Parameters:
      point - point to get the uv of
      quad - where the point is
      Returns:
      uv from 0 to 1