Java Code Examples for org.apache.commons.math3.geometry.partitioning.Region#getSize()

The following examples show how to use org.apache.commons.math3.geometry.partitioning.Region#getSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NPEfix10_ten_t.java    From coming with MIT License 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter((Point<Euclidean3D>) new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 2
Source File: NPEfix10_ten_s.java    From coming with MIT License 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter((Point<Euclidean3D>) new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 3
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter((Point<Euclidean3D>) new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 4
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 5
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 6
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 7
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 8
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 9
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter(Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter(new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}
 
Example 10
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Add he contribution of a boundary facet.
 * @param facet boundary facet
 * @param reversed if true, the facet has the inside on its plus side
 */
private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {

    final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
    final double area    = polygon.getSize();

    if (Double.isInfinite(area)) {
        setSize(Double.POSITIVE_INFINITY);
        setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
    } else {

        final Plane    plane  = (Plane) facet.getHyperplane();
        final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
        double   scaled = area * facetB.dotProduct(plane.getNormal());
        if (reversed) {
            scaled = -scaled;
        }

        setSize(getSize() + scaled);
        setBarycenter((Point<Euclidean3D>) new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));

    }

}