Class SySnapping

java.lang.Object
com.io7m.jsycamore.api.layout.SySnapping

public final class SySnapping extends Object
Snapping functions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    snapDouble(double x, double f)
    Snap a real number x to a snapping value.
    static <T extends SySpaceType>
    com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T>
    snapSize(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> v, int snapping)
    Snap the given size.
    static <T extends SySpaceType>
    com.io7m.jtensors.core.parameterized.vectors.PVector2I<T>
    snapVector(com.io7m.jtensors.core.parameterized.vectors.PVector2I<T> v, int snapping)
    Snap the given vector.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • snapDouble

      public static double snapDouble(double x, double f)
      Snap a real number x to a snapping value. The value of f is a fractional value in the range [0, 1].
      Parameters:
      x - The number to be snapped
      f - The snapping value
      Returns:
      The snapped value
    • snapVector

      public static <T extends SySpaceType> com.io7m.jtensors.core.parameterized.vectors.PVector2I<T> snapVector(com.io7m.jtensors.core.parameterized.vectors.PVector2I<T> v, int snapping)
      Snap the given vector. Each element of the vector will be snapped to the nearest multiple of snapping.
      Type Parameters:
      T - The vector space
      Parameters:
      v - The vector
      snapping - The snapping value
      Returns:
      The vector
    • snapSize

      public static <T extends SySpaceType> com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> snapSize(com.io7m.jregions.core.parameterized.sizes.PAreaSizeI<T> v, int snapping)
      Snap the given size. Each element of the size will be snapped to the nearest multiple of snapping.
      Type Parameters:
      T - The vector space
      Parameters:
      v - The vector
      snapping - The snapping value
      Returns:
      The vector