Example usage for javafx.geometry Bounds getMinZ

List of usage examples for javafx.geometry Bounds getMinZ

Introduction

In this page you can find the example usage for javafx.geometry Bounds getMinZ.

Prototype

public final double getMinZ() 

Source Link

Document

The minimum z coordinate of this Bounds .

Usage

From source file:Main.java

public void setCamPivot(final Cam cam) {
    final Bounds bounds = cam.getBoundsInLocal();
    final double pivotX = bounds.getMinX() + bounds.getWidth() / 2;
    final double pivotY = bounds.getMinY() + bounds.getHeight() / 2;
    final double pivotZ = bounds.getMinZ() + bounds.getDepth() / 2;
    cam.p.setX(pivotX);//from w w  w  . j  ava 2  s  . c  o m
    cam.p.setY(pivotY);
    cam.p.setZ(pivotZ);
    cam.ip.setX(-pivotX);
    cam.ip.setY(-pivotY);
    cam.ip.setZ(-pivotZ);
}

From source file:Main.java

public void setCamScale(final Cam cam, final Scene scene) {
    final Bounds bounds = cam.getBoundsInLocal();
    final double pivotX = bounds.getMinX() + bounds.getWidth() / 2;
    final double pivotY = bounds.getMinY() + bounds.getHeight() / 2;
    final double pivotZ = bounds.getMinZ() + bounds.getDepth() / 2;

    double width = scene.getWidth();
    double height = scene.getHeight();

    double scaleFactor = 1.0;
    double scaleFactorY = 1.0;
    double scaleFactorX = 1.0;
    if (bounds.getWidth() > 0.0001) {
        scaleFactorX = width / bounds.getWidth(); // / 2.0;
    }//from  www .  j  a v a  2s . c  om
    if (bounds.getHeight() > 0.0001) {
        scaleFactorY = height / bounds.getHeight(); //  / 1.5;
    }
    if (scaleFactorX > scaleFactorY) {
        scaleFactor = scaleFactorY;
    } else {
        scaleFactor = scaleFactorX;
    }
    cam.s.setX(scaleFactor);
    cam.s.setY(scaleFactor);
    cam.s.setZ(scaleFactor);
}

From source file:Main.java

public void resetCam() {
    cam.t.setX(0.0);/* w  ww  .j a  va 2s.  c o  m*/
    cam.t.setY(0.0);
    cam.t.setZ(0.0);
    cam.rx.setAngle(45.0);
    cam.ry.setAngle(-7.0);
    cam.rz.setAngle(0.0);
    cam.s.setX(1.25);
    cam.s.setY(1.25);
    cam.s.setZ(1.25);

    cam.p.setX(0.0);
    cam.p.setY(0.0);
    cam.p.setZ(0.0);

    cam.ip.setX(0.0);
    cam.ip.setY(0.0);
    cam.ip.setZ(0.0);

    final Bounds bounds = cam.getBoundsInLocal();
    final double pivotX = bounds.getMinX() + bounds.getWidth() / 2;
    final double pivotY = bounds.getMinY() + bounds.getHeight() / 2;
    final double pivotZ = bounds.getMinZ() + bounds.getDepth() / 2;

    cam.p.setX(pivotX);
    cam.p.setY(pivotY);
    cam.p.setZ(pivotZ);

    cam.ip.setX(-pivotX);
    cam.ip.setY(-pivotY);
    cam.ip.setZ(-pivotZ);
}