Package net.paulem.arcana.math
Class ACosTable
java.lang.Object
net.paulem.arcana.math.ACosTable
A precomputed lookup table for
Math.acos(double), used to approximate the arc cosine faster than
calling Math.acos directly. Values are cached at a resolution of 0.001 over the [-1.0, 1.0] domain,
so results are approximate rather than exact.-
Method Summary
Modifier and TypeMethodDescriptiondoublegetAcos(double x) Returns the approximate arc cosine of the given value, read from the precomputed table.
-
Method Details
-
getAcos
public double getAcos(double x) Returns the approximate arc cosine of the given value, read from the precomputed table. The input is clamped to the [-1.0, 1.0] range before being rounded to the nearest cached step of 0.001.- Parameters:
x- the value whose arc cosine is sought; values outside [-1.0, 1.0] are clamped- Returns:
- the approximate arc cosine of
x, in radians
-