/** * Takes the absolute value of all matrix fields locally. */ public void absoluteLocal() { m00 = FastMath.abs(m00); m01 = FastMath.abs(m01); m02 = FastMath.abs(m02); m10 = FastMath.abs(m10); m11 = FastMath.abs(m11); m12 = FastMath.abs(m12); m20 = FastMath.abs(m20); m21 = FastMath.abs(m21); m22 = FastMath.abs(m22); }
public float execute(float x) { return 1.0f - 2.0f * FastMath.abs((float) Math.floor(x * FastMath.INV_TWO_PI + 0.5f) - x * FastMath.INV_TWO_PI); } };
public byte getAlpha(float x, float y) { float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))); return (byte) (d >= r ? 0 : -255.0f * d / r + 255.0f); } });
public byte getAlpha(float x, float y) { float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))); return (byte) (d >= r ? 0 : 255); } });
public static float noise(float x, float y, float z, float noiseSize, int noiseDepth, NoiseFunction noiseFunction, boolean isHard) { if (noiseSize != 0.0) { noiseSize = 1.0f / noiseSize; x *= noiseSize; y *= noiseSize; z *= noiseSize; } float result = noiseFunction.execute(x, y, z); return isHard ? FastMath.abs(2.0f * result - 1.0f) : result; }
public byte getAlpha(float x, float y) { float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))) / r; return d >= 1.0f ? 0 : (byte) ((-FastMath.sqrt((2.0f - d) * d) + 1.0f) * 255.0f); } });
public static boolean equalsEpsilon(Quaternion q1, Quaternion q2) { return (FastMath.abs(q1.getX() - q2.getX()) < epsilon && FastMath.abs(q1.getY() - q2.getY()) < epsilon && FastMath.abs(q1.getZ() - q2.getZ()) < epsilon && FastMath.abs(q1.getW() - q2.getW()) < epsilon) || (FastMath.abs(q1.getX() + q2.getX()) < epsilon && FastMath.abs(q1.getY() + q2.getY()) < epsilon && FastMath.abs(q1.getZ() + q2.getZ()) < epsilon && FastMath.abs(q1.getW() + q2.getW()) < epsilon); }
private boolean insidePlane(Plane p, Vector3f axis1, Vector3f axis2, Vector3f axis3, Vector3f tn) { // transform the plane normal in the box local space. tn.set(axis1.dot(p.getNormal()), axis2.dot(p.getNormal()), axis3.dot(p.getNormal())); // distance check float radius = FastMath.abs(tn.x) + FastMath.abs(tn.y) + FastMath.abs(tn.z); float distance = p.pseudoDistance(transform.getTranslation()); if (distance < -radius) { return false; } return true; }
@Override protected void postQueue(RenderQueue queue) { getClipCoordinates(lightPosition, screenLightPos, viewPort.getCamera()); viewPort.getCamera().getViewMatrix().mult(lightPosition, viewLightPos); if (adaptative) { float densityX = 1f - FastMath.clamp(FastMath.abs(screenLightPos.x - 0.5f), 0, 1); float densityY = 1f - FastMath.clamp(FastMath.abs(screenLightPos.y - 0.5f), 0, 1); innerLightDensity = lightDensity * densityX * densityY; } else { innerLightDensity = lightDensity; } display = innerLightDensity != 0.0 && viewLightPos.z < 0; }
public BoundingVolume transform(Matrix4f trans, BoundingVolume store) { BoundingSphere sphere; if (store == null || store.getType() != BoundingVolume.Type.Sphere) { sphere = new BoundingSphere(1, new Vector3f(0, 0, 0)); } else { sphere = (BoundingSphere) store; } trans.mult(center, sphere.center); Vector3f axes = new Vector3f(1, 1, 1); trans.mult(axes, axes); float ax = getMaxAxis(axes); sphere.radius = FastMath.abs(ax * radius) + RADIUS_EPSILON - 1f; return sphere; }