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

        for (int i = 0; i < numPointsRing1; i++) {
            final double[] v = unit.nextVector();
            final double r = radius1.sample();
            // First ring is in the xy-plane, centered at (0, 0, 0).
            firstRing[i] = new Vector3D(v[0] * r,
                                        v[1] * r,
                                        widthRing1.sample());
        }

        final RealDistribution radius2
            = new UniformRealDistribution(radiusRing2 - halfWidthRing2,
                                          radiusRing2 + halfWidthRing2);
        final RealDistribution widthRing2
            = new UniformRealDistribution(-halfWidthRing2, halfWidthRing2);

        for (int i = 0; i < numPointsRing2; i++) {
            final double[] v = unit.nextVector();
            final double r = radius2.sample();
            // Second ring is in the xz-plane, centered at (radiusRing1, 0, 0).
            secondRing[i] = new Vector3D(radiusRing1 + v[0] * r,
                                         widthRing2.sample(),
                                         v[1] * r);
        }

        // Move first and second rings into position.
View Full Code Here

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

    private final ChineseRings rings;
    /** Distance function. */
    private final DistanceMeasure distance = new EuclideanDistance();

  public static void main(String[] args) {
        final ChineseRings rings = new ChineseRings(new Vector3D(1, 2, 3),
                                                    25, 2,
                                                    20, 1,
                                                    2000, 1500);
        final ChineseRingsClassifier classifier = new ChineseRingsClassifier(rings, 15, 15);
        printU("before.chinese.U.seq.dat", classifier);
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

public class CircleTest {

    @Test
    public void testEquator() {
        Circle circle = new Circle(new Vector3D(0, 0, 1000), 1.0e-10).copySelf();
        Assert.assertEquals(Vector3D.PLUS_K, circle.getPole());
        Assert.assertEquals(1.0e-10, circle.getTolerance(), 1.0e-20);
        circle.revertSelf();
        Assert.assertEquals(Vector3D.MINUS_K, circle.getPole());
        Assert.assertEquals(Vector3D.PLUS_K, circle.getReverse().getPole());
View Full Code Here

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

    }

    @Test
    public void testPhase() {
        Circle circle = new Circle(new S2Point(1.2, 2.5), new S2Point(-4.3, 0), 1.0e-10);
        Vector3D p = new Vector3D(1, 2, -4);
        Vector3D samePhase = circle.getPointAt(circle.getPhase(p));
        Assert.assertEquals(0.0,
                            Vector3D.angle(Vector3D.crossProduct(circle.getPole(), p),
                                           Vector3D.crossProduct(circle.getPole(), samePhase)),
                            1.0e-10);
        Assert.assertEquals(0.5 * FastMath.PI, Vector3D.angle(circle.getPole(), samePhase), 1.0e-10);
View Full Code Here

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

    @Test
    public void testSubSpace() {
        Circle circle = new Circle(new S2Point(1.2, 2.5), new S2Point(-4.3, 0), 1.0e-10);
        Assert.assertEquals(0.0, circle.toSubSpace(new S2Point(circle.getXAxis())).getAlpha(), 1.0e-10);
        Assert.assertEquals(0.5 * FastMath.PI, circle.toSubSpace(new S2Point(circle.getYAxis())).getAlpha(), 1.0e-10);
        Vector3D p = new Vector3D(1, 2, -4);
        Assert.assertEquals(circle.getPhase(p), circle.toSubSpace(new S2Point(p)).getAlpha(), 1.0e-10);
    }
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.