Search in sources :

Example 6 with Point3f

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);
    }
}
Also used : Point3f(org.scijava.vecmath.Point3f)

Example 7 with Point3f

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();
}
Also used : Point3f(org.scijava.vecmath.Point3f)

Example 8 with Point3f

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]);
    }
}
Also used : Point3f(org.scijava.vecmath.Point3f)

Example 9 with Point3f

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;
}
Also used : Point3f(org.scijava.vecmath.Point3f)

Example 10 with Point3f

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();
}
Also used : Point3f(org.scijava.vecmath.Point3f)

Aggregations

Point3f (org.scijava.vecmath.Point3f)58 ArrayList (java.util.ArrayList)20 Calibration (ij.measure.Calibration)6 HashMap (java.util.HashMap)5 Color3f (org.scijava.vecmath.Color3f)5 Point (java.awt.Point)4 Color (java.awt.Color)3 Area (java.awt.geom.Area)3 Map (java.util.Map)3 TreeMap (java.util.TreeMap)3 Point3d (com.github.quickhull3d.Point3d)2 QuickHull3D (com.github.quickhull3d.QuickHull3D)2 PolygonRoi (ij.gui.PolygonRoi)2 Rectangle (java.awt.Rectangle)2 AffineTransform (java.awt.geom.AffineTransform)2 HashSet (java.util.HashSet)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Vector3f (org.scijava.vecmath.Vector3f)2 CustomLineMesh (customnode.CustomLineMesh)1 CustomMesh (customnode.CustomMesh)1