本文整理汇总了Java中javafx.scene.shape.Sphere.setTranslateX方法的典型用法代码示例。如果您正苦于以下问题:Java Sphere.setTranslateX方法的具体用法?Java Sphere.setTranslateX怎么用?Java Sphere.setTranslateX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Sphere
的用法示例。
在下文中一共展示了Sphere.setTranslateX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: start
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Box floor = new Box(1000, 10, 1000);
floor.setTranslateY(150);
root.getChildren().add(floor);
Sphere s = new Sphere(150);
s.setTranslateX(5);
s.setPickOnBounds(true);
root.getChildren().add(s);
showStage(stage);
}
示例7: buildGroup
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
private static Group buildGroup() {
Group grp = new Group();
Sphere s = new Sphere();
Box b = new Box();
s.setScaleX(SCALE);
s.setScaleY(SCALE);
s.setScaleZ(SCALE);
s.setTranslateX(-130);
b.setScaleX(SCALE);
b.setScaleY(SCALE);
b.setScaleZ(SCALE);
b.setTranslateX(130);
PhongMaterial material = new PhongMaterial();
material.setDiffuseColor(Color.LIGHTGRAY);
material.setSpecularColor(Color.rgb(30, 30, 30));
s.setMaterial(material);
b.setMaterial(material);
PointLight pl = new PointLight(Color.AQUA);
pl.setTranslateZ(-1000);
Sphere lightBalance = new Sphere();
// lightBalance.setScaleX(0.1);
// lightBalance.setScaleX(0.1);
// lightBalance.setScaleX(0.1);
lightBalance.setTranslateZ(1000);
grp.getChildren().addAll(s, b,pl,lightBalance);
return grp;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: start
import javafx.scene.shape.Sphere; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Box floor = new Box(1000, 10, 1000);
floor.setTranslateY(150);
root.getChildren().add(floor);
Sphere s = new Sphere(150);
s.setTranslateX(5);
s.setPickOnBounds(true);
root.getChildren().add(s);
showStage(stage);
}
示例15: 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;
}