Java Code Examples for javafx.scene.shape.Sphere#setTranslateY()

The following examples show how to use javafx.scene.shape.Sphere#setTranslateY() . 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: CubeViewer.java    From FXyzLib with GNU General Public License v3.0 6 votes vote down vote up
/**
     * @param data the xAxisData to set
     */
    public void setxAxisData(ArrayList<Double> data) {
        xAxisData = data;
        scatterDataGroup.getChildren().clear();
        for(int i=0;i<xAxisData.size();i++) {
            final Sphere dataSphere = new Sphere(scatterRadius);
//            final Box dataSphere = new Box(getScatterRadius(), getScatterRadius(), getScatterRadius());
            double translateY = 0.0;
            double translateZ = 0.0;
            if(!yAxisData.isEmpty() && yAxisData.size() > i)
                translateY = yAxisData.get(i);
            if(!zAxisData.isEmpty() && zAxisData.size() > i)
                translateZ = zAxisData.get(i);
            dataSphere.setTranslateX(xAxisData.get(i));
            dataSphere.setTranslateY(translateY);
            dataSphere.setTranslateZ(translateZ);
            scatterDataGroup.getChildren().add(dataSphere);
        }        
    }
 
Example 2
Source File: CubeViewer.java    From FXyzLib with GNU General Public License v3.0 6 votes vote down vote up
/**
     * @param data the yAxisData to set
     */
    public void setyAxisData(ArrayList<Double> data) {
        yAxisData = data;
        scatterDataGroup.getChildren().clear();
        for(int i=0;i<yAxisData.size();i++) {
            final Sphere dataSphere = new Sphere(scatterRadius);
//            final Box dataSphere = new Box(getScatterRadius(), getScatterRadius(), getScatterRadius());
            double translateX = 0.0;
            double translateZ = 0.0;
            if(!xAxisData.isEmpty() && xAxisData.size() > i)
                translateX = xAxisData.get(i);
            if(!zAxisData.isEmpty() && zAxisData.size() > i)
                translateZ = zAxisData.get(i);
            dataSphere.setTranslateX(translateX);
            dataSphere.setTranslateY(yAxisData.get(i));
            dataSphere.setTranslateZ(translateZ);
            scatterDataGroup.getChildren().add(dataSphere);
        }        
    }
 
Example 3
Source File: CubeViewer.java    From FXyzLib with GNU General Public License v3.0 6 votes vote down vote up
/**
     * @param data the zAxisData to set
     */
    public void setzAxisData(ArrayList<Double> data) {
        zAxisData = data;
        scatterDataGroup.getChildren().clear();
        for(int i=0;i<zAxisData.size();i++) {
            final Sphere dataSphere = new Sphere(scatterRadius);
//            final Box dataSphere = new Box(getScatterRadius(), getScatterRadius(), getScatterRadius());
        
            double translateX = 0.0;
            double translateY = 0.0;
            if(!xAxisData.isEmpty() && xAxisData.size() > i)
                translateX = xAxisData.get(i);
            if(!yAxisData.isEmpty() && yAxisData.size() > i)
                translateY = yAxisData.get(i);
            dataSphere.setTranslateX(translateX);
            dataSphere.setTranslateY(translateY);
            dataSphere.setTranslateZ(zAxisData.get(i));
            scatterDataGroup.getChildren().add(dataSphere);
        }       
    }
 
Example 4
Source File: ContentModel.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void buildAxes() {
    double length = 2d * dimModel;
    double width = dimModel / 100d;
    double radius = 2d * dimModel / 100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}
 
Example 5
Source File: MarsViewer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private Group buildScene() {
	    Sphere mars = new Sphere(MARS_RADIUS);
	    mars.setTranslateX(VIEWPORT_SIZE / 2d);
	    mars.setTranslateY(VIEWPORT_SIZE / 2d);

	    PhongMaterial material = new PhongMaterial();
	    material.setDiffuseMap(
	      new Image(this.getClass().getResource(DIFFUSE_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );

	    material.setBumpMap(
	      new Image(this.getClass().getResource(NORMAL_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );
/*
	    material.setSpecularMap(
	      new Image(this.getClass().getResource(SPECULAR_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );
*/
	    mars.setMaterial(
	        material
	    );

	    return new Group(mars);
	}
 
Example 6
Source File: EarthViewer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private Group buildScene() {
  Sphere earth = new Sphere(EARTH_RADIUS);
  earth.setTranslateX(VIEWPORT_SIZE / 2d);
  earth.setTranslateY(VIEWPORT_SIZE / 2d);

  PhongMaterial earthMaterial = new PhongMaterial();
  earthMaterial.setDiffuseMap(
    new Image(
      DIFFUSE_MAP,
      MAP_WIDTH,
      MAP_HEIGHT,
      true,
      true
    )
  );
  earthMaterial.setBumpMap(
    new Image(
      NORMAL_MAP,
      MAP_WIDTH,
      MAP_HEIGHT,
      true,
      true
    )
  );
  earthMaterial.setSpecularMap(
    new Image(
      SPECULAR_MAP,
      MAP_WIDTH,
      MAP_HEIGHT,
      true,
      true
    )
  );

  earth.setMaterial(
      earthMaterial
  );

  return new Group(earth);
}
 
Example 7
Source File: ContentModel.java    From RubikFX with GNU General Public License v3.0 5 votes vote down vote up
private void buildAxes() {
    double length = 2d*dimModel;
    double width = dimModel/100d;
    double radius = 2d*dimModel/100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}