- 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
Stay organized with collections
Save and categorize content based on your preferences.
Static functions for common math operations.
Public Methods
static
boolean
|
|
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
From class
java.lang.Object
Object
|
clone()
|
boolean
|
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
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.
public
static
float
clamp
(float value, float min, float max)
Clamps a value between a minimum and maximum range.
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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["The `MathHelper` class provides static functions for common mathematical operations."],["It includes methods for comparing floats with tolerance (`almostEqualRelativeAndAbs`), clamping values within a range (`clamp`), and linear interpolation (`lerp`)."],["These functions are designed to simplify common math tasks in AR development."],["The class is part of the Sceneform library and helps with tasks like comparing float values, clamping them within bounds, and smooth transitions between values using interpolation."]]],["The `MathHelper` class provides static functions for math operations. It includes `almostEqualRelativeAndAbs(float a, float b)` to compare floats within a tolerance, `clamp(float value, float min, float max)` to restrict a value within a range, and `lerp(float a, float b, float t)` for linear interpolation between two values by a given ratio. Additionally, the class inherits several methods from `java.lang.Object` like `equals()`, `hashCode()`, and `toString()`.\n"]]