当前位置: 首页>>代码示例>>Java>>正文


Java Cylinder.setRotationAxis方法代码示例

本文整理汇总了Java中javafx.scene.shape.Cylinder.setRotationAxis方法的典型用法代码示例。如果您正苦于以下问题:Java Cylinder.setRotationAxis方法的具体用法?Java Cylinder.setRotationAxis怎么用?Java Cylinder.setRotationAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.shape.Cylinder的用法示例。


在下文中一共展示了Cylinder.setRotationAxis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildMolecule

import javafx.scene.shape.Cylinder; //导入方法依赖的package包/类
private void buildMolecule() {
	
	final PhongMaterial redMaterial = new PhongMaterial();
	redMaterial.setDiffuseColor(Color.DARKRED);
	redMaterial.setSpecularColor(Color.RED);
	
	final PhongMaterial whiteMaterial = new PhongMaterial();
	whiteMaterial.setDiffuseColor(Color.WHITE);
	whiteMaterial.setSpecularColor(Color.LIGHTBLUE);
	
	final PhongMaterial greyMaterial = new PhongMaterial();
	greyMaterial.setDiffuseColor(Color.DARKGREY);
	greyMaterial.setSpecularColor(Color.GREY);
	
	// Molecule Hierarchy
	// [*] moleculeXform
	//     [*] oxygenXform
	//         [*] oxygenSphere
	//     [*] hydrogen1SideXform
	//         [*] hydrogen1Xform
	//             [*] hydrogen1Sphere
	//         [*] bond1Cylinder
	//     [*] hydrogen2SideXform
	//         [*] hydrogen2Xform
	//             [*] hydrogen2Sphere
	//         [*] bond2Cylinder
	
	Xform moleculeXform = new Xform();
	Xform oxygenXform = new Xform();
	Xform hydrogen1SideXform = new Xform();
	Xform hydrogen1Xform = new Xform();
	Xform hydrogen2SideXform = new Xform();
	Xform hydrogen2Xform = new Xform();
	
	Sphere oxygenSphere = new Sphere(40.0);
	oxygenSphere.setMaterial(redMaterial);
	
	Sphere hydrogen1Sphere = new Sphere(30.0);
	hydrogen1Sphere.setMaterial(whiteMaterial);
	hydrogen1Sphere.setTranslateX(0.0);
	
	Sphere hydrogen2Sphere = new Sphere(30.0);
	hydrogen2Sphere.setMaterial(whiteMaterial);
	hydrogen2Sphere.setTranslateZ(0.0);
	
	Cylinder bond1Cylinder = new Cylinder(5, 100);
	bond1Cylinder.setMaterial(greyMaterial);
	bond1Cylinder.setTranslateX(50.0);
	bond1Cylinder.setRotationAxis(Rotate.Z_AXIS);
	bond1Cylinder.setRotate(90.0);
	
	Cylinder bond2Cylinder = new Cylinder(5, 100);
	bond2Cylinder.setMaterial(greyMaterial);
	bond2Cylinder.setTranslateX(50.0);
	bond2Cylinder.setRotationAxis(Rotate.Z_AXIS);
	bond2Cylinder.setRotate(90.0);
	
	moleculeXform.getChildren().add(oxygenXform);
	moleculeXform.getChildren().add(hydrogen1SideXform);
	moleculeXform.getChildren().add(hydrogen2SideXform);
	oxygenXform.getChildren().add(oxygenSphere);
	hydrogen1SideXform.getChildren().add(hydrogen1Xform);
	hydrogen2SideXform.getChildren().add(hydrogen2Xform);
	hydrogen1Xform.getChildren().add(hydrogen1Sphere);
	hydrogen2Xform.getChildren().add(hydrogen2Sphere);
	hydrogen1SideXform.getChildren().add(bond1Cylinder);
	hydrogen2SideXform.getChildren().add(bond2Cylinder);
	
	hydrogen1Xform.setTx(100.0);
	hydrogen2Xform.setTx(100.0);
	hydrogen2SideXform.setRotateY(104.5);
	
	moleculeGroup.getChildren().add(moleculeXform);
	
	world.getChildren().addAll(moleculeGroup);
}
 
开发者ID:Jenna3715,项目名称:3D-Game,代码行数:77,代码来源:MoleculeSampleApp.java


注:本文中的javafx.scene.shape.Cylinder.setRotationAxis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。