• Sceneform SDK for Android was open sourced and archived (github.com/google-ar/sceneform-android-sdk) with version 1.16.0.
  • This site (developers.google.com/sceneform) serves as the documentation archive for the previous version, Sceneform SDK for Android 1.15.0.
  • Do not use version 1.17.0 of the Sceneform Maven artifacts.
  • The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.

MathHelper

public class MathHelper

Static functions for common math operations.

Public Constructors

Public Methods

static boolean
almostEqualRelativeAndAbs(float a, float b)
Returns true if two floats are equal within a tolerance.
static float
clamp(float value, float min, float max)
Clamps a value between a minimum and maximum range.
static float
lerp(float a, float b, float t)
Linearly interpolates between a and b by a ratio.

Inherited Methods

Public Constructors

public MathHelper ()

Public Methods

public static boolean almostEqualRelativeAndAbs (float a, float b)

Returns true if two floats are equal within a tolerance. Useful for comparing floating point numbers while accounting for the limitations in floating point precision.

Parameters
a
b

public static float clamp (float value, float min, float max)

Clamps a value between a minimum and maximum range.

Parameters
value
min
max

public static float lerp (float a, float b, float t)

Linearly interpolates between a and b by a ratio.

Parameters
a the beginning value
b the ending value
t ratio between the two floats
Returns
  • interpolated value between the two floats