Examples of Vector3d


Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

                throw new MathInternalError();
            }

            // compute the geometrical properties of the convex cell
            final double area  = convexCellArea(boundary.get(0));
            final Vector3D barycenter = convexCellBarycenter(boundary.get(0));
            convexCellsInsidePoints.add(barycenter);

            // add the cell contribution to the global properties
            summedArea      += area;
            summedBarycenter = new Vector3D(1, summedBarycenter, area, barycenter);

        }
    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

        // loop around the cell
        for (Edge e = start.getOutgoing(); n == 0 || e.getStart() != start; e = e.getEnd().getOutgoing()) {

            // find path interior angle at vertex
            final Vector3D previousPole = e.getCircle().getPole();
            final Vector3D nextPole     = e.getEnd().getOutgoing().getCircle().getPole();
            final Vector3D point        = e.getEnd().getLocation().getVector();
            double alpha = FastMath.atan2(Vector3D.dotProduct(nextPole, Vector3D.crossProduct(point, previousPole)),
                                          -Vector3D.dotProduct(nextPole, previousPole));
            if (alpha < 0) {
                alpha += MathUtils.TWO_PI;
            }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

     * @return barycenter
     */
    private Vector3D convexCellBarycenter(final Vertex start) {

        int n = 0;
        Vector3D sumB = Vector3D.ZERO;

        // loop around the cell
        for (Edge e = start.getOutgoing(); n == 0 || e.getStart() != start; e = e.getEnd().getOutgoing()) {
            sumB = new Vector3D(1, sumB, e.getLength(), e.getCircle().getPole());
            n++;
        }

        return sumB.normalize();

    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

     * @see #toSpace(Point)
     * @see #getXAxis()
     * @see #getYAxis()
     */
    public Vector3D getPointAt(final double alpha) {
        return new Vector3D(FastMath.cos(alpha), x, FastMath.sin(alpha), y);
    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

        final double cosTheta = FastMath.cos(theta);
        final double sinTheta = FastMath.sin(theta);
        final double cosPhi   = FastMath.cos(phi);
        final double sinPhi   = FastMath.sin(phi);

        return new Vector3D(cosTheta * sinPhi, sinTheta * sinPhi, cosPhi);

    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

                {-3, 0, -9}
        }, new double[]{1, 1, 1});

        Optimum optimum = optimizer.optimize(problem.getBuilder().build());

        Plane span = new Plane(Vector3D.ZERO, new Vector3D(1, 2, -3), new Vector3D(2, 1, 0), TOl);
        double expected = FastMath.abs(span.getOffset(new Vector3D(1, 1, 1)));
        double actual = optimum.getResiduals().getNorm();

        //verify
        Assert.assertEquals(expected, actual, TOl);
    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

    }

    @Test
    public void testReducingBall() {
        List<Vector3D> list =
                Arrays.asList(new Vector3D(-7.140397329568118, -16.57166124258217711.714458961735405),
                              new Vector3D(-7.137986707455888, -16.57076732337572011.708602108715928),
                              new Vector3D(-7.139185068549035, -16.57089120470225011.715554057357394),
                              new Vector3D(-7.142682716997507, -16.57160981823429011.710787934580328),
                              new Vector3D(-7.139018392423351, -16.57440561415702011.710518716711425),
                              new Vector3D(-7.140870659936730, -16.56799307424045511.710914678204503),
                              new Vector3D(-7.136350173659562, -16.57049822882093011.713965225900928),
                              new Vector3D(-7.141675762759172, -16.57285247140702811.714033471449508),
                              new Vector3D(-7.140453077221105, -16.57021282078064711.708624578004980),
                              new Vector3D(-7.140322188726825, -16.57415289455771711.710305611121410),
                              new Vector3D(-7.141116131477088, -16.57406116462456011.712938509321699));
        WelzlEncloser<Euclidean3D, Vector3D> encloser =
                new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, new SphereGenerator());
        EnclosingBall<Euclidean3D, Vector3D> ball = encloser.enclose(list);
        Assert.assertTrue(ball.getRadius() > 0);
    }
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

    @Test
    public void testInfiniteLoop() {
        // this test used to generate an infinite loop
        List<Vector3D> list =
                Arrays.asList(new Vector3D( -0.89227075512164380,  -2.8931769464571390014.84572323743355500),
                              new Vector3D( -0.92099498940693580,  -2.3108610826390894012.92071026467688300),
                              new Vector3D( -0.85227999411005200,  -3.0631473144132073015.40163831651287000),
                              new Vector3D( -1.77399413020785970,  -3.6563039137811426014.13190097751873400),
                              new Vector3D0.33157833272465354,  -2.2281359175779216014.21225234159008200),
                              new Vector3D( -1.53065579165484400,  -1.6569208477013957014.61483055714788500),
                              new Vector3D( -1.08457093941217140,  -1.9610032593560298013.09265170575555000),
                              new Vector3D0.30029469589708850,  -3.0547083139566737014.56352400426342600),
                              new Vector3D( -0.95007443938638460,  -1.8681094648611836015.14491234340057000),
                              new Vector3D( -1.89661503804130830,  -2.1700408088518586014.81235128513927000),
                              new Vector3D( -0.72193328761607530,  -1.4451314283361827014.52355724218561800),
                              new Vector3D( -0.26895980939606550,  -3.6951237152208414014.72272846327652000),
                              new Vector3D( -1.53501693431786170,  -3.2505516661102190015.15509062584274800),
                              new Vector3D( -0.71727553535519410,  -3.6228427946079910013.26256700929380700),
                              new Vector3D( -0.30220950676137365,  -3.2541041250077907013.13682612771606000),
                              new Vector3D( -0.04543996608267075,  -1.9308185392379775014.79497997883171400),
                              new Vector3D( -1.53348892951571640,  -3.6668891970352490014.73095600812074200),
                              new Vector3D( -0.98034899533935820,  -3.3400448116276396013.03245014017556800));

        WelzlEncloser<Euclidean3D, Vector3D> encloser =
                new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, new SphereGenerator());
        EnclosingBall<Euclidean3D, Vector3D> ball = encloser.enclose(list);
        Assert.assertTrue(ball.getRadius() > 0);
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

        for (int k = 0; k < 50; ++k) {

            // define the reference sphere we want to compute
            double d = 25 * random.nextDouble();
            double refRadius = 10 * random.nextDouble();
            Vector3D refCenter = new Vector3D(d, new Vector3D(sr.nextVector()));
            // set up a large sample inside the reference sphere
            int nbPoints = random.nextInt(1000);
            List<Vector3D> points = new ArrayList<Vector3D>();
            for (int i = 0; i < nbPoints; ++i) {
                double r = refRadius * random.nextDouble();
                points.add(new Vector3D(1.0, refCenter, r, new Vector3D(sr.nextVector())));
            }

            // test we find a sphere at most as large as the one used for random drawings
            checkSphere(points, refRadius);

View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

        double closest = tolerance;
        Edge following = null;
        for (final BSPTree<Sphere2D> node : candidates) {
            for (final Edge edge : nodeToEdgesList.get(node)) {
                if (edge != previous && edge.getStart().getIncoming() == null) {
                    final Vector3D edgeStart = edge.getStart().getLocation().getVector();
                    final double gap         = Vector3D.angle(point.getVector(), edgeStart);
                    if (gap <= closest) {
                        closest   = gap;
                        following = edge;
                    }
                }
            }
        }

        if (following == null) {
            final Vector3D previousStart = previous.getStart().getLocation().getVector();
            if (Vector3D.angle(point.getVector(), previousStart) <= tolerance) {
                // the edge connects back to itself
                return previous;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.