Java Code Examples for javafx.geometry.Point3D#getZ()

The following examples show how to use javafx.geometry.Point3D#getZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DockEvent.java    From DockFX with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Constructs new DockEvent event..
 * 
 * @param source the source of the event. Can be null.
 * @param target the target of the event. Can be null.
 * @param eventType The type of the event.
 * @param x The x with respect to the source. Should be in scene coordinates if source == null or
 *        source is not a Node.
 * @param y The y with respect to the source. Should be in scene coordinates if source == null or
 *        source is not a Node.
 * @param screenX The x coordinate relative to screen.
 * @param screenY The y coordinate relative to screen.
 * @param pickResult pick result. Can be null, in this case a 2D pick result without any further
 *        values is constructed based on the scene coordinates
 * @param contents The contents being dragged during this event.
 */
public DockEvent(Object source, EventTarget target, EventType<? extends DockEvent> eventType,
    double x, double y, double screenX, double screenY, PickResult pickResult, Node contents) {
  super(source, target, eventType);
  this.x = x;
  this.y = y;
  this.screenX = screenX;
  this.screenY = screenY;
  this.sceneX = x;
  this.sceneY = y;
  this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y);
  final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null);
  this.x = p.getX();
  this.y = p.getY();
  this.z = p.getZ();
  this.contents = contents;
}
 
Example 2
Source File: Utils.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static String getPickedRotation(int cubie, MeshView mesh){
    Point3D normal = getMeshNormal(mesh);
    String rots = ""; // Rx-Ry 
    switch(cubie){
        case 0: rots = (normal.getZ() > 0.99) ? "Ui-Li" : ((normal.getX() < -0.99) ? "Ui-F" : ((normal.getY() > 0.99) ? "Ui-Li" : ""));
                break;
        case 1: rots = (normal.getZ() > 0.99) ? "F-Mi" : ((normal.getY() > 0.99) ? "Ui-Mi" : ""); // between L and R, as L
                break;
        case 2:  rots = (normal.getZ() > 0.99) ? "Ui-R" : ((normal.getX() > 0.99) ? "Ui-Fi" : ((normal.getY() > 0.99) ? "Ui-R" : ""));
                break;
        case 3: rots = (normal.getZ() > 0.99) ? "E-F" : ((normal.getX() < -0.99) ? "E-Li" : ""); // between U and D, as D
                break;
        case 4:  rots = (normal.getZ() > 0.99) ? "Yi-X" : ""; 
                break;
        case 5: rots = (normal.getZ() > 0.99) ? "E-Fi" : ((normal.getX() > 0.99) ? "E-R" : ""); // between U and D, as D
                break;
        case 6: rots = (normal.getZ() > 0.99) ? "D-Li" : ((normal.getX() < -0.99) ? "D-F" : ((normal.getY() < -0.99) ? "D-Li" : ""));
                break;
        case 7: rots = (normal.getZ() > 0.99) ? "Fi-Mi" : ((normal.getY() < -0.99) ? "Fi-Mi" : ""); // between L and R, as L
                break;
        case 8: rots = (normal.getZ() > 0.99) ? "D-R" : ((normal.getX() > 0.99) ? "D-Fi" : ((normal.getY() < -0.99) ? "D-R" : ""));
                break;
        
        case 9: rots = (normal.getY() > 0.99) ? "S-U" : ((normal.getX() < -0.99) ? "L-S" : ""); // between U and D, as D
                break;
        case 10: rots = (normal.getY() > 0.99) ? "Z-X" : ""; 
                break;
        case 11: rots = (normal.getY() > 0.99) ? "S-Ui" : ((normal.getX() > 0.99) ? "R-Si" : ""); // between U and D, as D
                break;
        case 12: rots = (normal.getX() < -0.99) ? "Yi-Z" : ""; 
                break;
        case 14: rots = (normal.getX() > 0.99) ? "Yi-Zi" : ""; 
                break;
        case 15: rots = (normal.getY() < -0.99) ? "D-S" : ((normal.getX() < -0.99) ? "Li-S" : ""); // between U and D, as D
                break;
        case 16: rots = (normal.getY() < -0.99) ? "Zi-X" : ""; 
                break;
        case 17: rots = (normal.getY() < -0.99) ? "D-S" : ((normal.getX() > 0.99) ? "Ri-Si" : ""); // between U and D, as D
                break;
        
        case 18: rots = (normal.getZ() < -0.99) ? "Ui-L" : ((normal.getX() < -0.99) ? "Ui-Bi" : ((normal.getY() > 0.99) ? "Ui-L" : ""));
                break;
        case 19: rots = (normal.getZ() < -0.99) ? "B-M" : ((normal.getY() > 0.99) ? "U-M" : ""); // between L and R, as L
                break;
        case 20: rots = (normal.getZ() < -0.99) ? "Ui-Ri" : ((normal.getX() > 0.99) ? "Ui-B" : ((normal.getY() > 0.99) ? "Ui-Ri" : ""));
                break;
        case 21: rots = (normal.getZ() < -0.99) ? "E-Bi" : ((normal.getX() < -0.99) ? "E-L" : ""); // between U and D, as D
                break;
        case 22: rots = (normal.getZ() < -0.99) ? "Yi-Xi" : ""; 
                break;
        case 23: rots = (normal.getZ() < -0.99) ? "E-B" : ((normal.getX() > 0.99) ? "E-Ri" : ""); // between U and D, as D
                break;
        case 24: rots = (normal.getZ() < -0.99) ? "D-L" : ((normal.getX() < -0.99) ? "D-Bi" : ((normal.getY() < -0.99) ? "D-L" : ""));
                break;
        case 25: rots = (normal.getZ() < -0.99) ? "Bi-M" : ((normal.getY() < -0.99) ? "Bi-M" : ""); // between L and R, as L
                break;
        case 26: rots = (normal.getZ() < -0.99) ? "D-Ri" : ((normal.getX() > 0.99) ? "D-B" : ((normal.getY() < -0.99) ? "D-B" : ""));
                break;
        
    }
    return rots;
}
 
Example 3
Source File: Utils.java    From RubikFX with GNU General Public License v3.0 4 votes vote down vote up
public static String getPickedRotation(int cubie, MeshView mesh){
    Point3D normal=getMeshNormal(mesh);
    String rots=""; // Rx-Ry 
    switch(cubie){
        case 0: rots=(normal.getZ()>0.99)?"Ui-Li":((normal.getX()<-0.99)?"Ui-F":((normal.getY()>0.99)?"Ui-Li":""));
                break;
        case 1: rots=(normal.getZ()>0.99)?"F-Mi":((normal.getY()>0.99)?"Ui-Mi":""); // between L and R, as L
                break;
        case 2: rots=(normal.getZ()>0.99)?"Ui-R":((normal.getX()>0.99)?"Ui-Fi":((normal.getY()>0.99)?"Ui-R":""));
                break;
        case 3: rots=(normal.getZ()>0.99)?"E-F":((normal.getX()<-0.99)?"E-Li":""); // between U and D, as D
                break;
        case 4: rots=(normal.getZ()>0.99)?"Yi-X":""; 
                break;
        case 5: rots=(normal.getZ()>0.99)?"E-Fi":((normal.getX()>0.99)?"E-R":""); // between U and D, as D
                break;
        case 6: rots=(normal.getZ()>0.99)?"D-Li":((normal.getX()<-0.99)?"D-F":((normal.getY()<-0.99)?"D-Li":""));
                break;
        case 7: rots=(normal.getZ()>0.99)?"Fi-Mi":((normal.getY()<-0.99)?"Fi-Mi":""); // between L and R, as L
                break;
        case 8: rots=(normal.getZ()>0.99)?"D-R":((normal.getX()>0.99)?"D-Fi":((normal.getY()<-0.99)?"D-R":""));
                break;
        
        case 9: rots=(normal.getY()>0.99)?"S-U":((normal.getX()<-0.99)?"L-S":""); // between U and D, as D
                break;
        case 10: rots=(normal.getY()>0.99)?"Z-X":""; 
                break;
        case 11: rots=(normal.getY()>0.99)?"S-Ui":((normal.getX()>0.99)?"R-Si":""); // between U and D, as D
                break;
        case 12: rots=(normal.getX()<-0.99)?"Yi-Z":""; 
                break;
        case 14: rots=(normal.getX()>0.99)?"Yi-Zi":""; 
                break;
        case 15: rots=(normal.getY()<-0.99)?"D-S":((normal.getX()<-0.99)?"Li-S":""); // between U and D, as D
                break;
        case 16: rots=(normal.getY()<-0.99)?"Zi-X":""; 
                break;
        case 17: rots=(normal.getY()<-0.99)?"D-S":((normal.getX()>0.99)?"Ri-Si":""); // between U and D, as D
                break;
        
        case 18: rots=(normal.getZ()<-0.99)?"Ui-L":((normal.getX()<-0.99)?"Ui-Bi":((normal.getY()>0.99)?"Ui-L":""));
                break;
        case 19: rots=(normal.getZ()<-0.99)?"B-M":((normal.getY()>0.99)?"U-M":""); // between L and R, as L
                break;
        case 20: rots=(normal.getZ()<-0.99)?"Ui-Ri":((normal.getX()>0.99)?"Ui-B":((normal.getY()>0.99)?"Ui-Ri":""));
                break;
        case 21: rots=(normal.getZ()<-0.99)?"E-Bi":((normal.getX()<-0.99)?"E-L":""); // between U and D, as D
                break;
        case 22: rots=(normal.getZ()<-0.99)?"Yi-Xi":""; 
                break;
        case 23: rots=(normal.getZ()<-0.99)?"E-B":((normal.getX()>0.99)?"E-Ri":""); // between U and D, as D
                break;
        case 24: rots=(normal.getZ()<-0.99)?"D-L":((normal.getX()<-0.99)?"D-Bi":((normal.getY()<-0.99)?"D-L":""));
                break;
        case 25: rots=(normal.getZ()<-0.99)?"Bi-M":((normal.getY()<-0.99)?"Bi-M":""); // between L and R, as L
                break;
        case 26: rots=(normal.getZ()<-0.99)?"D-Ri":((normal.getX()>0.99)?"D-B":((normal.getY()<-0.99)?"D-B":""));
                break;
        
    }
    return rots;
}