use of org.scijava.vecmath.Point3f in project mcib3d-core by mcib3d.
the class Object3DSurface method drawMesh.
// @Override
// public double pcColoc(Object3D obj) {
// double pourc;
// // ArrayList<Voxel3D> al1 = this.getVoxels();
// // ArrayList<Voxel3D> al2 = ((Object3DSurface) obj).getVoxels();
// // double cpt = 0;
// // double dist = 0.25;// normally int values (0.25=0.5²)
// // Voxel3D v1, v2;
// // for (Iterator it1 = al1.iterator(); it1.hasNext();) {
// // v1 = (Voxel3D) it1.next();
// // for (Iterator it2 = al2.iterator(); it2.hasNext();) {
// // v2 = (Voxel3D) it2.next();
// // if (v1.distanceSquare(v2) < dist) {
// // cpt++;
// // }
// // }
// // }
// // pourc = (cpt / al1.size()) * 100;
// Object3DVoxels obj1 = this.getObject3DVoxels();
// Object3DVoxels obj2 = obj.getObject3DVoxels();
//
// return obj1.pcColoc(obj);
// }
public void drawMesh(ObjectCreator3D obj, int col) {
// No volume, only contours
Point3f vox;
for (Point3f vertice : vertices) {
vox = vertice;
obj.createPixel((int) vox.x, (int) vox.y, (int) vox.z, col);
}
}
use of org.scijava.vecmath.Point3f in project mcib3d-core by mcib3d.
the class Object3DSurface method rotate.
public void rotate(Vector3D Axis, double angle) {
GeomTransform3D trans = new GeomTransform3D();
trans.setRotation(Axis, angle);
Vector3D center = this.getCenterAsVector();
for (Point3f v : faces) {
Vector3D tmp = new Vector3D();
tmp.setVectorPoint3f(v);
Vector3D tv = trans.getVectorTransformed(tmp, center);
v.set((float) tv.getX(), (float) tv.getY(), (float) tv.getZ());
}
init();
}
use of org.scijava.vecmath.Point3f in project mcib3d-core by mcib3d.
the class Object3DSurface method computeUniqueVertices.
private void computeUniqueVertices() {
vertices_faces_index = new ArrayList();
faces_vertices_index = new ArrayList();
vertices = new ArrayList();
IJ.showStatus("Unique Vertices : " + faces.size());
ArrayList[] vefa = new ArrayList[faces.size()];
for (int i = 0; i < faces.size(); i++) {
Point3f P = faces.get(i);
if (!vertices.contains(P)) {
vertices.add(P);
int p = vertices.indexOf(P);
// if (p == 50) {
// IJ.log(P + " new " + p + " " + i);
// }
ArrayList list = new ArrayList();
list.add(i);
vefa[p] = list;
faces_vertices_index.add(i, p);
} else {
int p = vertices.indexOf(P);
// if (p == 50) {
// IJ.log(P + " already " + p + " " + i);
// }
vefa[p].add(i);
faces_vertices_index.add(i, p);
}
}
for (int i = 0; i < vertices.size(); i++) {
vertices_faces_index.add(i, vefa[i]);
}
}
use of org.scijava.vecmath.Point3f in project mcib3d-core by mcib3d.
the class Object3DSurface method getSurfaceTrianglesPixels.
/**
* @param smooth
* @return
*/
public List<Point3f> getSurfaceTrianglesPixels(boolean smooth) {
if ((smooth) && (smooth_faces == null)) {
computeSmoothSurfaceArea();
}
List<Point3f> l;
if (smooth) {
l = smooth_faces;
} else {
l = faces;
}
// calibration
ArrayList<Point3f> unit_vertices = new ArrayList();
Iterator it = l.iterator();
Point3f P, PP;
float rxy = (float) resXY;
float rz = (float) resZ;
// coordinates are normally calibrated
while (it.hasNext()) {
P = (Point3f) it.next();
PP = new Point3f(P.x / rxy, P.y / rxy, P.z / rz);
unit_vertices.add(PP);
}
return unit_vertices;
}
use of org.scijava.vecmath.Point3f in project mcib3d-core by mcib3d.
the class Object3DSurface method deCalibratePoints.
private void deCalibratePoints() {
for (Point3f P : faces) {
P.set(P.x / (float) resXY, P.y / (float) resXY, P.z / (float) resZ);
}
for (Point3f P : vertices) {
P.set(P.x / (float) resXY, P.y / (float) resXY, P.z / (float) resZ);
}
this.computeCenter();
this.computeBounding();
}
Aggregations