Example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D.

Prototype

public Vector3D(double x, double y, double z) 

Source Link

Document

Simple constructor.

Usage

From source file:NewEmptyJUnitTest.java

@Test
public void hello() {
    Line line = new Line(new Vector3D(-1, -1, -1), new Vector3D(1, -1, -1));
    boolean result = line.contains(new Vector3D(2, -1, -1));
    assertTrue(result);//from ww  w . ja v  a2  s .c  om
}

From source file:com.diozero.api.imu.ImuDataFactory.java

public static Vector3D createVector(short[] data, double scale) {
    return new Vector3D(data[0] * scale, data[1] * scale, data[2] * scale);
}

From source file:Engine.BoundingBox.java

public BoundingBox(double x, double y, double z, double x1, double y1, double z1, boolean useDiagonals) {
    if (useDiagonals) {
        double sideXLen = x1 - x;
        double sideYLen = y1 - y;
        double halfDiagonal = Math.sqrt((sideXLen * sideXLen) + (sideYLen * sideYLen)) / 2;
        double centerX = x + (sideXLen / 2.0);
        double centerY = y + (sideYLen / 2.0);
        this.bottomLeftFront = new Vector3D(centerX - halfDiagonal, centerY - halfDiagonal, z);
        this.topRightBack = new Vector3D(centerX + halfDiagonal, centerY + halfDiagonal, z1);
    } else {/*from www  . j a  v  a2s.c  om*/
        this.bottomLeftFront = new Vector3D(x, y, z);
        this.topRightBack = new Vector3D(x1, y1, z1);
    }
}

From source file:com.mapr.synth.drive.GeoPoint.java

public GeoPoint(double latitude, double longitude) {
    double c = Math.cos(latitude);
    r = new Vector3D(Math.cos(longitude) * c, Math.sin(longitude) * c, Math.sin(latitude));
}

From source file:jtrace.object.transformation.Translation.java

/**
 * Construct new translation using given translation vector components.
 * /*from w ww . ja  v a2  s .  c  o  m*/
 * @param deltaX
 * @param deltaY
 * @param deltaZ 
 */
public Translation(double deltaX, double deltaY, double deltaZ) {
    this.delta = new Vector3D(deltaX, deltaY, deltaZ);
}

From source file:jtrace.object.transformation.Scale.java

/**
 * Construct new scale transformation from individual X, Y and Z
 * scaling magnitudes.//from   ww w . ja v a  2 s.  com
 * 
 * @param scaleX
 * @param scaleY
 * @param scaleZ 
 */
public Scale(double scaleX, double scaleY, double scaleZ) {
    this.scaleVec = new Vector3D(scaleX, scaleY, scaleZ);
}

From source file:Engine.Player.java

public Vector3D GetPosition() {
    return new Vector3D(ViewFrom[0], ViewFrom[1], ViewFrom[2] - headPosition);
}

From source file:Engine.Projectile.java

public Projectile(Vector3D[] forces, Vector3D size, Vector3D intialPosition, Vector3D velocities[],
        boolean affectedByGravity, Screen screen, IProjectileFunction projectileFunction,
        double magicMultiplayer, Object[] ownserId) {
    this.ownerId = ownserId;
    this.magicMultiplayer = magicMultiplayer;
    this.intialPosition = new Vector3D(intialPosition.getX(), intialPosition.getY(), intialPosition.getZ());
    this.actualPosition = new Vector3D(intialPosition.getX(), intialPosition.getY(), intialPosition.getZ());

    //this. boundingSphere = new BoundingSphere(actualPosition.getX(),actualPosition.getY(), actualPosition.getZ(), Math.max(Math.max(size.getX(), size.getY()), size.getZ()));
    this.boundingBox = new BoundingBox(intialPosition.getX() - (size.getX() / 2.0),
            intialPosition.getY() - (size.getY() / 2.0), intialPosition.getZ() - (size.getZ() / 2.0),
            intialPosition.getX() + (size.getX() / 2.0), intialPosition.getY() + (size.getY() / 2.0),
            intialPosition.getZ() + (size.getZ() / 2.0), true);

    this.screen = screen;
    this.size = size;
    this.projectileFunction = projectileFunction;
    if (velocities != null) {
        this.velocities = new Vector3D[velocities.length];
        for (int a = 0; a < velocities.length; a++)
            this.velocities[a] = new Vector3D(velocities[a].getX(), velocities[a].getY(), velocities[a].getZ());
    }/*from   w  w  w. j a  va2 s .c  o m*/
    int forcesCount = 0;
    if (forces != null) {
        forcesCount += forces.length;
        if (affectedByGravity)
            forcesCount++;
        this.forces = new Vector3D[forcesCount];
        for (int a = 0; a < forces.length; a++)
            this.forces[a] = new Vector3D(forces[a].getX(), forces[a].getY(), forces[a].getZ());
        if (affectedByGravity)
            this.forces[forcesCount - 1] = new Vector3D(gravity.getX(), gravity.getY(), gravity.getZ());
    } else {
        if (affectedByGravity) {
            forcesCount++;
            this.forces = new Vector3D[forcesCount];
            this.forces[forcesCount - 1] = new Vector3D(gravity.getX(), gravity.getY(), gravity.getZ());
        }
    }
}

From source file:edu.mit.fss.tutorial.part2.MobileElement.java

/**
 * Instantiates a new mobile element./* www  .j a v  a 2s  .c  o  m*/
 *
 * @param name the name
 */
public MobileElement(String name, Vector3D initialVelocity) {
    this.name = name;
    position = new Vector3D(0, 0, 0);
    initialPosition = new Vector3D(0, 0, 0);
    velocity = new Vector3D(0, 0, 0);
    this.initialVelocity = initialVelocity;
}

From source file:jtrace.object.transformation.Scale.java

/**
 * Construct new scale transformation that scales an object uniformly
 * in all directions.//  ww  w  . j  a v  a2s.c o  m
 * 
 * @param scale scale factor
 */
public Scale(double scale) {
    this.scaleVec = new Vector3D(scale, scale, scale);
}