public void normalizeCoords(final Point3f min, final Point3f max) { final float dx = max.x - min.x; final float dy = max.y - min.y; final float dz = max.z - min.z; final float maxd = Math.max(dx, Math.max(dy, dz)); final Point3f center = new Point3f(); center.add(min, max); center.scale(0.5f); for (final Point3f p : coords) { p.sub(center); p.scale(1 / maxd); } }
private void calculateMinMaxCenterPoint() { min = new Point3f(); max = new Point3f(); center = new Point3f(); if (customMeshes.isEmpty()) return; customMeshes.get(0).calculateMinMaxCenterPoint(min, max, center); final Point3f mint = new Point3f(); final Point3f maxt = new Point3f(); final int n = customMeshes.size(); if (n == 1) return; for (int i = 1; i < n; i++) { final CustomMesh mesh = customMeshes.get(i); mesh.calculateMinMaxCenterPoint(mint, maxt, center); adjustMinMax(mint, min, max); adjustMinMax(maxt, min, max); } center.sub(max, min); center.scale(0.5f); }
public static void decompose(final Matrix4f mat, final Vector3f origin, final AxisAngle4f rotation, final Vector3f translation) { final Matrix3f rot = new Matrix3f(); mat.get(rot); rotation.set(rot); final Point3f tmp = new Point3f(origin); rot.transform(tmp); tmp.sub(origin); mat.get(translation); translation.add(tmp); }
/** * computes the interpolated point along a specified whose intensity equals * the reference value * * @param v1 first extremity of the edge * @param v2 second extremity of the edge * @param result stores the resulting edge return the point on the edge where * intensity equals the isovalue; * @return false if the interpolated point is beyond edge boundaries */ private boolean computeEdge(final Point3f v1, final int i1, final Point3f v2, final int i2, final Point3f result, final Carrier car) { // 30 --- 50 --- 70 : t=0.5 // 70 --- 50 --- 30 : t=0.5 // /int i1 = car.intensity(v1); // /int i2 = car.intensity(v2); if (i2 < i1) return computeEdge(v2, i2, v1, i1, result, car); final float t = (car.threshold - i1) / (i2 - i1); if (t >= 0 && t <= 1) { // v1 + t*(v2-v1) result.set(v2); result.sub(v1); result.scale(t); result.add(v1); return true; } result.set(-1, -1, -1); return false; }
/** * computes the interpolated point along a specified whose * intensity equals the reference value * @param v1 first extremity of the edge * @param v2 second extremity of the edge * @param result stores the resulting edge * return the point on the edge where intensity equals the isovalue; * @return false if the interpolated point is beyond edge boundaries */ private boolean computeEdge(final Point3f v1, final int i1, final Point3f v2, final int i2, final Point3f result, final Carrier car) { // 30 --- 50 --- 70 : t=0.5 // 70 --- 50 --- 30 : t=0.5 ///int i1 = car.intensity(v1); ///int i2 = car.intensity(v2); if(i2 < i1) return computeEdge(v2, i2, v1, i1, result, car); final float t = (car.threshold - i1) / (float) (i2 - i1); if (t >= 0 && t <= 1) { // v1 + t*(v2-v1) result.set(v2); result.sub(v1); result.scale(t); result.add(v1); return true; } result.set(-1, -1, -1); return false; }
workingPosition.sub(workingCenterEar); // offset sound pos. by head origin