Class SySnapping
java.lang.Object
com.io7m.jsycamore.api.layout.SySnapping
Snapping functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublesnapDouble(double x, double f) Snap a real numberxto 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.
-
Method Details
-
snapDouble
public static double snapDouble(double x, double f) Snap a real numberxto a snapping value. The value offis a fractional value in the range[0, 1].- Parameters:
x- The number to be snappedf- 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 ofsnapping.- Type Parameters:
T- The vector space- Parameters:
v- The vectorsnapping- 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 ofsnapping.- Type Parameters:
T- The vector space- Parameters:
v- The vectorsnapping- The snapping value- Returns:
- The vector
-