Example usage for javafx.geometry Bounds getDepth

List of usage examples for javafx.geometry Bounds getDepth

Introduction

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

Prototype

public final double getDepth() 

Source Link

Document

The depth 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);// w  w w .  j av  a  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  ww  w  . j a  va2  s .co  m
    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  w w . j  a  v  a2  s  . co  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);
}