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

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

Introduction

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

Prototype

public double getZ() 

Source Link

Document

Get the height of the vector.

Usage

From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.world.BWWorld.java

@Override
public Entity addEntity(Vector3D position, Item item) {
    EntityItem entityItem = new EntityItem(world(), position.getX(), position.getY(), position.getZ(),
            Game.natives().toNative(item));
    world().spawnEntityInWorld(entityItem);
    return Game.natives().toNova(entityItem);
}

From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.world.BWWorld.java

@Override
public void playSoundAtPosition(Vector3D position, Sound sound) {
    world().playSoundEffect(position.getX(), position.getY(), position.getZ(), sound.getID(), sound.volume,
            sound.pitch);/*from  w  ww. j a v a  2s . c  om*/
}

From source file:nova.core.wrapper.mc.forge.v18.wrapper.VectorConverter.java

@Override
public BlockPos toNative(Vector3D vec) {
    return new BlockPos(vec.getX(), vec.getY(), vec.getZ());
}

From source file:org.aminb.mathtools.app.math.Line3D.java

public boolean ifHasIntersection(Line3D ln) {
    if (!(isParallelTo(ln))) {
        Vector3D a;
        a = line.intersection(ln.getApacheLine());
        tmpIntersect[0] = a.getX();/*from ww w  .  j  a va2  s  .c  om*/
        tmpIntersect[1] = a.getY();
        tmpIntersect[2] = a.getZ();
        return true;
    } else
        return false;
}

From source file:org.forYoink.math.CommonsVector3D.java

@Override
public Vector ebeMultiply(Vector m) {
    Vector3D tempM = (Vector3D) m.getInternalVector();
    double x = tempM.getX() * this.internalVector.getX();
    double y = tempM.getY() * this.internalVector.getY();
    double z = tempM.getZ() * this.internalVector.getZ();
    tempVector = new Vector3D(x, y, z);
    Vector temp = new CommonsVector3D();
    temp.setInternalVector(tempVector);// ww w. ja v a 2 s  .c om
    return temp;

}

From source file:org.gearvrf.controls.model.Apple.java

public void setAppleRandomPosition(GVRContext context) {

    float angle = (float) Math.random() * 360;
    float distance = (float) (Math.random()
            * (Constants.MAX_APPLE_DISTANCE - (Constants.MAX_APPLE_DISTANCE - Constants.MIN_APPLE_DISTANCE))
            + Constants.MIN_APPLE_DISTANCE);
    this.getTransform().setPositionZ(distance);
    this.getTransform().rotateByAxisWithPivot(angle, 0, 1, 0, 0, 0, 0);

    Vector3D instanceApple = new Vector3D(this.getTransform().getPositionX(),
            this.getTransform().getPositionY(), this.getTransform().getPositionZ());
    if (!checkValidPosition(instanceApple)) {
        setAppleRandomPosition(context);

    } else {// w  w w .  ja v  a2s .c om
        if (!appleList.contains(this)) {
            addApple(this);
            shadow.getTransform().setPosition((float) instanceApple.getX(), -0.9999f,
                    (float) instanceApple.getZ());
            getGVRContext().getMainScene().addSceneObject(shadow);
        }
    }
}

From source file:org.gearvrf.controls.model.Apple.java

private Vector3D setNewApplePosition(GVRContext context, float angle, float distance) {
    float[] vecDistance = context.getMainScene().getMainCameraRig().getLookAt();

    if (vecDistance[1] > CAMERA_DIRECTION_THREASHOLD || vecDistance[1] < -CAMERA_DIRECTION_THREASHOLD) {
        setAppleRandomPosition(context);
        return null;
    }/*from  w  ww .  j  a v  a 2s .  co  m*/

    vecDistance[0] *= distance;
    vecDistance[2] *= distance;
    Vector3D instanceApple = new Vector3D(vecDistance[0], 0, vecDistance[2]);
    instanceApple.normalize();
    this.getTransform().setPositionX((float) instanceApple.getX());
    this.getTransform().setPositionZ((float) instanceApple.getZ());
    this.getTransform().rotateByAxisWithPivot(angle, 0, 1, 0, 0, 0, 0);
    instanceApple = new Vector3D(this.getTransform().getPositionX(), this.getTransform().getPositionY(),
            this.getTransform().getPositionZ());
    shadow.getTransform().setPosition((float) instanceApple.getX(), -0.9999f, (float) instanceApple.getZ());
    shadow.getTransform().setScale(1, 1, 1);
    return instanceApple;
}

From source file:org.gearvrf.keyboard.model.SphereFlag.java

public void moveToCursor() {
    if (followCursorAnimation != null) {
        getGVRContext().getAnimationEngine().stop(followCursorAnimation);
    }/*  ww w . ja  v a 2  s.  co  m*/
    GVRCameraRig cameraObject = getGVRContext().getMainScene().getMainCameraRig();

    float desiredDistance = (float) Math.max(0.7 * Util.distance(getParent(), cameraObject.getTransform()),
            Constants.MINIMUM_DISTANCE_FROM_CAMERA);
    float[] lookAt = getGVRContext().getMainScene().getMainCameraRig().getLookAt();
    Vector3D lookAtVector = new Vector3D(lookAt[0], lookAt[1], lookAt[2]);

    final float desiredX = (float) lookAtVector.getX() * desiredDistance;
    final float desiredY = (float) lookAtVector.getY() * desiredDistance + CURSOR_POSITION_OFFSET_Y;
    final float desiredZ = (float) lookAtVector.getZ() * desiredDistance;

    float x = desiredX - getParent().getTransform().getPositionX();
    float y = desiredY - getParent().getTransform().getPositionY();
    float z = desiredZ - getParent().getTransform().getPositionZ();

    followCursorAnimation = new GVRRelativeMotionAnimation(getParent(), 0.8f, x, y, z)
            .setInterpolator(new InterpolatorExpoEaseOut()).start(getGVRContext().getAnimationEngine());
}

From source file:org.gearvrf.keyboard.model.SphereStaticList.java

private void getSpheres(GVRContext gvrContext, int array) {
    listFlag = new ArrayList<GVRSceneObject>();
    Resources res = gvrContext.getContext().getResources();
    TypedArray spheres = res.obtainTypedArray(array);

    for (int i = 0; i < spheres.length(); i++) {
        int type = spheres.getResourceId(i, -1);
        TypedArray sphere = res.obtainTypedArray(type);
        SphereFlag objectSphere = new SphereFlag(gvrContext, sphere);
        Vector3D parentPosition = objectSphere.getInitialPositionVector();

        GVRSceneObject parent = new GVRSceneObject(gvrContext,
                new GVRAndroidResource(gvrContext, R.drawable.hit_area_half),
                new GVRAndroidResource(gvrContext, R.raw.empty));
        parent.setName(SceneObjectNames.SPHERE_FLAG_PARENT);
        parent.getTransform().setPosition((float) parentPosition.getX(), (float) parentPosition.getY(),
                (float) parentPosition.getZ());
        parent.addChildObject(objectSphere);
        listFlag.add(parent);/*from  www. j a va  2  s.c  om*/
    }
}

From source file:org.gearvrf.keyboard.util.Util.java

public static float getYRotationAngle(Vector3D rotatingVector, GVRSceneObject targetObject) {
    return (float) Math.toDegrees(Math.atan2(targetObject.getTransform().getPositionX() - rotatingVector.getX(),
            targetObject.getTransform().getPositionZ() - rotatingVector.getZ()));
}