Commit 1882da95 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Merge branch '190-introduce-spacepartioning-module' into 'master'

Resolve "Introduce SpacePartioning module"

Closes #190

See merge request grp-fidentis/analyst2!208
parents fb401659 0c0b05c8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -29,8 +29,11 @@ build:
    paths:
    - application/target/$PROJECT_ARTIFACT_ID-*.zip
    - MeshModel/target/site/apidocs/
    - SpacePartitioning/target/site/apidocs/
    - MeshAlgorithms/target/site/apidocs/
    - HumanFace/target/site/apidocs/
    - Rendering/target/site/apidocs/
    - GUI/target/site/apidocs/
    - Comparison/target/site/apidocs/
    - target/site/apidocs/
    expire_in: 1 hour
    when: on_success
@@ -82,8 +85,11 @@ upload:
    - lftp -c "set ftp:ssl-allow yes; set ssl:verify-certificate false; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; cd $FTP_TARGET_DIR; mput -c $CI_PROJECT_DIR/application/target/$PROJECT_ARTIFACT_ID-$VERSION.zip; put -c $CI_PROJECT_DIR/application/target/$PROJECT_ARTIFACT_ID-$VERSION.zip -o $PROJECT_ARTIFACT_ID-LATEST.zip"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/target/site/apidocs ./$FTP_TARGET_DIR/apidocs --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/MeshModel/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-MeshModel --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/SpacePartitioning/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-SpacePartitioning --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/MeshAlgorithms/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-MeshAlgorithms --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/HumanFace/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-HumanFace --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/Rendering/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-Rendering --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/GUI/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-GUI --ignore-time --parallel=10"
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev $CI_PROJECT_DIR/Comparison/target/site/apidocs ./$FTP_TARGET_DIR/apidocs-Comparison --ignore-time --parallel=10"
  tags:
    - shared-fi
  rules:
+0 −13
Original line number Diff line number Diff line
/**
 * The {@code HumanFace} class serving as the main entry point for
 * dealing with a single face, and related interfaces and classes, e.g.,
 * classes necessary for publish-subscribe notification of changes in the human face.
 * <p>
 * While events triggered directly by the underlying {@link cz.fidentis.analyst.mesh.core.MeshModel}
 * are defined in the {@code cz.fidentis.analyst.mesh.events} package
 * and forwarded by the {@code HumanFace}, events defined in this package are
 * face-specific. They are not triggered by the underlying structures, but fired directly by 
 * the {@code HumanFace}.
 * </p>
 */
package cz.fidentis.analyst.face;
+0 −5
Original line number Diff line number Diff line
/**
 * Visitors used to explore the human face (i.e., implementing the 
 * {@link cz.fidentis.analyst.visitors.face.HumanFaceVisitor}).
 */
package cz.fidentis.analyst.visitors.face;
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
/**
 * Visitors used to explore kd-trees (i.e., implementing the 
 * {@link cz.fidentis.analyst.kdtree.KdTreeVisitor}).
 */
package cz.fidentis.analyst.visitors.kdtree;
+0 −143
Original line number Diff line number Diff line
package cz.fidentis.analyst.visitors.mesh;

import cz.fidentis.analyst.mesh.MeshVisitor;
import cz.fidentis.analyst.mesh.core.MeshFacet;
import cz.fidentis.analyst.mesh.core.MeshPoint;
import java.io.Serializable;
import java.util.List;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

/**
 * Visitor that computes a 3D bounding box (cube).
 * <p>
 * This visitor is thread-safe. 
 * </p>
 * 
 * @author Radek Oslejsek
 */
public class BoundingBox extends MeshVisitor implements Serializable {

    private BBox bbox;
    
    @Override
    public synchronized void visitMeshFacet(MeshFacet facet) {
        if (bbox == null) {
            bbox = new BBox(facet.getVertices());
        } else {
            bbox.compute(facet.getVertices());
        }
    }
    
    /**
     * Returns computed bounding box.
     * 
     * @return Bounding box or {@code null}
     */
    public BBox getBoundingBox() {
        return bbox;
    }
    
    /**
     * 3D bounding box (cube) of {@link MeshPoint}s.
     * 
     * @author Natalia Bebjakova
    */
    public class BBox implements Serializable {
    
        private Point3d maxPoint;
        private Point3d minPoint;

        /** 
         * Creates bounding box from given mesh points.
         * 
         * @param points List of mesh points, must not be null or empty
         * @throws IllegalArgumentException if the @code{points} param is null or empty
         */
        public BBox(List<MeshPoint> points) {
            if (points == null || points.isEmpty()) {
                throw new IllegalArgumentException("points");
            }

            minPoint = new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
            maxPoint = new Point3d(Double.NEGATIVE_INFINITY,Double.NEGATIVE_INFINITY,Double.NEGATIVE_INFINITY);

            compute(points);
        }

        /** 
         * Creates bounding box from given mesh points, possibly extends the existing BB.
         * 
         * @param points List of mesh points, must not be null or empty
         */
        public void compute(List<MeshPoint> points) {
            if (points == null || points.isEmpty()) {
                return;
            }

            for (int i = 0; i < points.size(); i++) {
                MeshPoint point = points.get(i);

                minPoint.x = Math.min(minPoint.x, point.getPosition().x);
                minPoint.y = Math.min(minPoint.y, point.getPosition().y);
                minPoint.z = Math.min(minPoint.z, point.getPosition().z);

                maxPoint.x = Math.max(maxPoint.x, point.getPosition().x);
                maxPoint.y = Math.max(maxPoint.y, point.getPosition().y);
                maxPoint.z = Math.max(maxPoint.z, point.getPosition().z);                    
            }
        }        

        /**
         * Return the upper-bound corner of the bounding cube
         * @return max point of the bounding box
         */
        public Point3d getMaxPoint() {
            return maxPoint;
        }

        /**
         * Return centroid of the bounding cube.
         * @return middle point of the bounding box
         */
        public Point3d getMidPoint() {
            Point3d p = new Point3d(minPoint);
            p.add(maxPoint);
            p.scale(0.5);
            return p;
        }

        /**
         * Return the lower-bound corner of the bounding cube
         * @return min point of the bounding box
         */
        public Point3d getMinPoint() {
            return minPoint;
        }

        /**
         * Return volume diagonal of the bounding box.
         * @return maximal diagonal of bounding box
         */
        public double getDiagonalLength() {
            Vector3d v = new Vector3d(maxPoint);
            v.sub(minPoint);
            return v.length();
        }

        /**
         * Returns description of BoundignBox.
         * 
         * @return String representation of the bounding box
         */
        @Override
        public String toString() {
            String str = "BoundingBox: ";
            str += System.lineSeparator();
            str += "\t" + "- min point : " + this.minPoint + System.lineSeparator();
            str += "\t" + "- max point : " + this.maxPoint + System.lineSeparator();
            return str;
        }      

    }
}
Loading