static class Vec3{ float x,y,z; Vec3(){ x = -1; y = -1; z = -1; } Vec3(float x, float y, float z){ this.x = x; this.y = y; this.z = z; } float dist(Vec3 c){ float dx = x - c.x; float dy = y - c.y; float dz = z - c.z; return sqrt(dx * dx + dy * dy + dz * dz); } Vec3 lerp(Vec3 c, float step){ float dx = c.x - x; float dy = c.y - y; float dz = c.z - z; return new Vec3(x + (dx * step), y + (dy * step), z + (dz * step)); } } Vec3 [] copyVec3(Vec3 [] vectors){ Vec3 [] temp = new Vec3[vectors.length]; System.arraycopy(vectors, 0, temp, 0, vectors.length); return temp; } Vec3 [] concatVector(Vec3 [] vectors, Vec3 [] addVectors) { Vec3 [] temp = new Vec3[vectors.length + addVectors.length]; System.arraycopy(vectors, 0, temp, 0, vectors.length); System.arraycopy(addVectors, 0, temp, vectors.length, addVectors.length); return temp; } Vec3 [] addVector(Vec3 [] vectors, Vec3 newVector) { Vec3 [] temp = new Vec3[vectors.length + 1]; System.arraycopy(vectors, 0, temp, 0, vectors.length); temp[vectors.length] = newVector; return temp; } static class geoNeuron{ double x,y,z; double wx,wy,wz; geoNeuron(double x, double y, double z){ this.x = x; this.y = y; this.z = z; this.wx = Math.random(); this.wy = Math.random(); this.wz = Math.random(); } double dist(geoNeuron c){ double dx = this.x - c.x; double dy = this.y - c.y; double dz = this.z - c.z; return Math.sqrt(dx * dx + dy * dy + dz * dz); } double wdist(geoNeuron c){ double dx = this.wx - c.wx; double dy = this.wy - c.wy; double dz = this.wz - c.wz; return Math.sqrt(dx * dx + dy * dy + dz * dz); } }