package NET.worlds.scape; public class Point3Temp { public float x; public float y; public float z; private static Recycler recycler = new Recycler(); static { nativeInit(); } public static native void nativeInit(); public static Point3Temp make(float x, float y, float z) { Point3Temp p = (Point3Temp)recycler.alloc(); if (p == null) { recycler.recycle(new Point3Temp(0)); p = (Point3Temp)recycler.alloc(); } p.x = x; p.y = y; p.z = z; return p; } public static Point3Temp make() { return make(0.0F, 0.0F, 0.0F); } public static Point3Temp make(Point3Temp p) { return make(p.x, p.y, p.z); } protected Point3Temp(int dummy) { } public Point3Temp copy(Point3Temp b) { this.set(b.x, b.y, b.z); return this; } public void set(float _x, float _y, float _z) { this.x = _x; this.y = _y; this.z = _z; } public float length() { return (float)Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); } public float squaredLength() { return this.x * this.x + this.y * this.y + this.z * this.z; } public native Point3Temp times(Transform var1); public native Point3Temp vectorTimes(Transform var1); public Point3Temp normalize() { float len = this.length(); if (len > 0.0F) { this.dividedBy(len); } return this; } public Point3Temp negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; } public Point3Temp abs() { this.x = Math.abs(this.x); this.y = Math.abs(this.y); this.z = Math.abs(this.z); return this; } public static Point3Temp getDirVector(float amount, float angle) { angle = (float)(angle * (Math.PI / 180.0)); return make(-amount * (float)Math.sin(angle), amount * (float)Math.cos(angle), 0.0F); } public Point3Temp plus(Point3Temp p) { this.x = this.x + p.x; this.y = this.y + p.y; this.z = this.z + p.z; return this; } public Point3Temp cross(Point3Temp p) { float xNew = this.y * p.z - this.z * p.y; float yNew = this.z * p.x - this.x * p.z; this.z = this.x * p.y - this.y * p.x; this.x = xNew; this.y = yNew; return this; } public Point3Temp plus(float v) { this.x += v; this.y += v; this.z += v; return this; } public Point3Temp minus(float v) { return this.plus(-v); } public Point3Temp minus(Point3Temp p) { this.x = this.x - p.x; this.y = this.y - p.y; this.z = this.z - p.z; return this; } public Point3Temp times(float v) { this.x *= v; this.y *= v; this.z *= v; return this; } public Point3Temp times(Point3Temp p) { this.x = this.x * p.x; this.y = this.y * p.y; this.z = this.z * p.z; return this; } public Point3Temp dividedBy(float v) { this.x /= v; this.y /= v; this.z /= v; return this; } public Point3Temp dividedBy(Point3Temp p) { this.x = this.x / p.x; this.y = this.y / p.y; this.z = this.z / p.z; return this; } public float dot(Point3Temp p) { return p.x * this.x + p.y * this.y + p.z * this.z; } public float det(Point3Temp a, Point3Temp b) { return this.x * a.y * b.z + a.x * b.y * this.z + b.x * this.y * a.z - this.z * a.y * b.x - a.z * b.y * this.x - b.z * this.y * a.x; } public boolean sameValue(Point3Temp p) { return p == null ? false : this.x == p.x && this.y == p.y && this.z == p.z; } @Override public String toString() { return this.x + "," + this.y + "," + this.z; } }