public Vector3d reflect(Vector3d point, Vector3d store) { if (store == null) store = new Vector3d(); double d = pseudoDistance(point); store.set(normal).negateLocal().multLocal(d * 2f); store.addLocal(point); return store; }
/** * Initialize the PlaneD using the given 3 points as coplanar. * * @param v1 the first point * @param v2 the second point * @param v3 the third point */ public void setPlanePoints(Vector3d v1, Vector3d v2, Vector3d v3) { normal.set(v2).subtractLocal(v1); normal.crossLocal(v3.x - v1.x, v3.y - v1.y, v3.z - v1.z).normalizeLocal(); constant = normal.dot(v1); }
public Vector3d getClosestPoint(Vector3d point, Vector3d store) { // double t = constant - normal.dot(point); // return store.set(normal).multLocal(t).addLocal(point); double t = (constant - normal.dot(point)) / normal.dot(normal); return store.set(normal).multLocal(t).addLocal(point); }