本文整理汇总了Java中javafx.scene.shape.Sphere.setTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java Sphere.setTranslateY方法的具体用法?Java Sphere.setTranslateY怎么用?Java Sphere.setTranslateY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Sphere
的用法示例。
在下文中一共展示了Sphere.setTranslateY方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMultipleShapes3D
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
private Group buildMultipleShapes3D() {
Box box = new Box(100, 100, 100);
Sphere sphere = new Sphere(50);
Cylinder cyl = new Cylinder(50, 100);
Cone cone = new Cone(50, 100);
box.setTranslateX(-100);
box.setTranslateY(-150);
sphere.setTranslateX(100);
sphere.setTranslateY(-50);
cyl.setTranslateX(-100);
cyl.setTranslateY(50);
cone.getMesh().setTranslateX(100);
cone.getMesh().setTranslateY(150);
nodes.add(box);
nodes.add(sphere);
nodes.add(cyl);
nodes.add(cone.getMesh());
return new Group(box, sphere, cyl, cone.getMesh());
}
示例2: initScene
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
@Override
protected void initScene() {
DefaultMeshBuilder dmb = new DefaultMeshBuilder() {
@Override
protected double function(double fx, double fy) {
return 1;
}
};
MeshView meshView = new MeshView(dmb.getTriangleMesh());
meshView.setScaleX(100);
meshView.setScaleY(100);
meshView.setScaleZ(100);
Sphere s = new Sphere(50);
s.setTranslateX(WIDTH / 2);
s.setTranslateY(HEIGHT / 2);
Group root = new Group(s, meshView);
scene = createScene(root, WIDTH, HEIGHT);
scene.setCamera(new PerspectiveCamera());
}
示例3: setxAxisData
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
/**
* @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);
}
}
示例4: setyAxisData
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
/**
* @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);
}
}
示例5: setzAxisData
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
/**
* @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);
}
}
示例6: buildMultipleShapes
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
private Group buildMultipleShapes() {
Box box = new Box(100, 100, 100);
Sphere sphere = new Sphere(50);
Cylinder cyl = new Cylinder(50, 100);
Cone cone = new Cone(50, 100);
Rectangle rect = new Rectangle(50, 50);
rect.setFill(Color.WHITESMOKE);
box.setTranslateX(-100);
box.setTranslateY(-150);
sphere.setTranslateX(100);
sphere.setTranslateY(-50);
cyl.setTranslateX(-100);
cyl.setTranslateY(50);
cone.getMesh().setTranslateX(100);
cone.getMesh().setTranslateY(150);
rect.setTranslateX(-25);
rect.setTranslateY(-25);
rect.setRotationAxis(Rotate.Y_AXIS);
rect.setRotate(45);
nodes.add(box);
nodes.add(sphere);
nodes.add(cyl);
nodes.add(cone.getMesh());
nodes.add(rect);
return new Group(box, sphere, cyl, cone.getMesh(), rect);
}
示例7: buildAxes
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
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);
}
示例8: addAtom
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
private void addAtom(LeafSubstructure<?> origin, Atom atom) {
Sphere atomShape = new Sphere(1.0);
atomShape.setMaterial(getMaterial(origin, atom));
atomShape.setTranslateX(atom.getPosition().getX());
atomShape.setTranslateY(atom.getPosition().getY());
atomShape.setTranslateZ(atom.getPosition().getZ());
// add tooltip
Tooltip tooltip = new Tooltip(atom.getElement().getName() + " (" + (atom.getAtomName()) + ":" +
atom.getAtomIdentifier() + ") of " + origin.getFamily().getThreeLetterCode() + ":" + origin.getIdentifier());
Tooltip.install(atomShape, tooltip);
moleculeGroup.getChildren().add(atomShape);
}
示例9: buildScene
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
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);
}
示例10: buildScene
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
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);
}
示例11: addSphere
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
public void addSphere(double x, double y, double z, Material material) {
Sphere sphere = new Sphere(RADIUS);
sphere.setTranslateX(x * SCALE_FACTOR);
sphere.setTranslateY(y * SCALE_FACTOR);
sphere.setTranslateZ(z * SCALE_FACTOR);
sphere.setMaterial(material);
getChildren().add(sphere);
}
示例12: createSphere
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
private Sphere createSphere(Physical ball) {
Sphere sphere = new Sphere(this.radius);
ViewPoint location = ViewPoint.of(ball.getLocation());
sphere.setTranslateX(location.x);
sphere.setTranslateY(location.y);
sphere.setTranslateZ(location.z);
Material material = new PhongMaterial(this.color);
sphere.setMaterial(material);
return sphere;
}
示例13: buildAxes
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
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);
}
示例14: start
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
final PhongMaterial red = new PhongMaterial(Color.RED);
final PhongMaterial green = new PhongMaterial(Color.GREEN);
final PhongMaterial blue = new PhongMaterial(Color.BLUE);
final Box cube = new Box(200, 200, 200);
cube.setLayoutX(150);
cube.setLayoutY(800);
cube.setDrawMode(DrawMode.LINE);
cube.setMaterial(red);
final Cylinder cylinder = new Cylinder(150, 50);
cylinder.setLayoutX(500);
cylinder.setLayoutY(800);
cylinder.setDrawMode(DrawMode.LINE);
cylinder.setMaterial(green);
final Sphere sphere = new Sphere(100);
sphere.setLayoutX(850);
sphere.setLayoutY(800);
sphere.setDrawMode(DrawMode.LINE);
sphere.setMaterial(blue);
final AmbientLight light = new AmbientLight(Color.WHITE);
final Pane root = new Pane();
root.setStyle("-fx-background-color: transparent;");
root.getChildren().addAll(cube, cylinder, sphere, light);
final int[] tesselations = {1, 5, 10, 50, 100};
for (int index = 0; index < tesselations.length; index++) {
final int dx = 1000 / tesselations.length;
final int tesselation = tesselations[index];
final Sphere tesselatedSphere = new Sphere(75, tesselation);
tesselatedSphere.setDrawMode(DrawMode.LINE);
root.getChildren().add(tesselatedSphere);
tesselatedSphere.setTranslateX(100 + dx * index);
tesselatedSphere.setTranslateY(400);
final Cylinder tesselatedCylinder = new Cylinder(75, 50, tesselation);
tesselatedCylinder.setDrawMode(DrawMode.LINE);
root.getChildren().add(tesselatedCylinder);
tesselatedCylinder.setTranslateX(100 + dx * index);
tesselatedCylinder.setTranslateY(100);
}
final Scene scene = new Scene(root, 1000, 1000);
scene.setFill(Color.BLACK);
scene.setCamera(new PerspectiveCamera());
primaryStage.setScene(scene);
primaryStage.setTitle("Test_Triangle");
primaryStage.show();
}