• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Cylinder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.j3d.utils.geometry.Cylinder的典型用法代码示例。如果您正苦于以下问题:Java Cylinder类的具体用法?Java Cylinder怎么用?Java Cylinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cylinder类属于com.sun.j3d.utils.geometry包,在下文中一共展示了Cylinder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createPillar

import com.sun.j3d.utils.geometry.Cylinder; //导入依赖的package包/类
/**
	 * Erzeugt eine Saeule, auch mit Lichtquelle obendrauf moeglich
	 * 
	 * @param x			X-Koordinate (bewegliches Objekt) oder X-Achse im Parcours (unbewegliches Objekt)
	 * @param y			Y-Koordinate (bewegliches Objekt) oder Y-Achse im Parcours (unbewegliches Objekt)
	 * @param diameter	Durchmesser der Saeule
	 * @param height	Hoehe der Saeule
	 * @param bodyAppearance	Saeulen-Appearance
	 * @param lightAppearance	Licht-Appearance oder null
	 * @param moveable			Soll das Objekt bewegbar sein?
	 */
	private void createPillar(float x, float y, float diameter, float height, Appearance bodyAppearance, Appearance lightAppearance, boolean moveable) {
		Cylinder pillar = new Cylinder(diameter / 2.0f, height, bodyAppearance);
//		pillar.setName("Object");
		pillar.setCapability(javax.media.j3d.Node.ALLOW_PICKABLE_WRITE);
		
		TransformGroup tg = new TransformGroup();
		tg.addChild(pillar);
		
		Transform3D translate = new Transform3D();
		
		/* Drehen auf vertikal */
		Transform3D rot = new Transform3D();
		rot.rotX(0.5 * Math.PI);
		translate.mul(rot);
		
		/* unteres Ende auf Fussboden "hochschieben" */
		translate.setTranslation(new Vector3f(0, 0, + height / 2.0f - 0.2f));
		tg.setTransform(translate);
		
		if (moveable) {
			parcours.addMoveableObstacle(tg, x, y);
		} else {
			parcours.addObstacle(tg, x + 0.5f, y + 0.5f);
		}
		if (lightAppearance != null) {
			createLight(new BoundingSphere(new Point3d(0d, 0d, 0d), 10d), new Color3f(1.0f, 1.0f, 0.9f), (int) x, (int) y, lightAppearance);
		}
	}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:40,代码来源:ParcoursLoader.java


示例2: createBall

import com.sun.j3d.utils.geometry.Cylinder; //导入依赖的package包/类
/**
 * Create a ball at the given point
 * @param inPosition scaled position of point
 * @param inSphere sphere object
 * @param inMaterial material object
 * @return Group containing sphere
 */
private static Group createBall(Point3d inPosition, Sphere inSphere, Material inMaterial)
{
	Group group = new Group();
	// Create ball and add to group
	Transform3D ballShift = new Transform3D();
	ballShift.setTranslation(new Vector3d(inPosition));
	TransformGroup ballShiftTrans = new TransformGroup(ballShift);
	inMaterial.setLightingEnable(true);
	Appearance ballApp = new Appearance();
	ballApp.setMaterial(inMaterial);
	inSphere.setAppearance(ballApp);
	ballShiftTrans.addChild(inSphere);
	group.addChild(ballShiftTrans);
	// Also create rod for ball to sit on
	Cylinder rod = new Cylinder(0.1f, (float) inPosition.y);
	Material rodMat = new Material(new Color3f(0.2f, 0.2f, 0.2f),
		new Color3f(0.0f, 0.0f, 0.0f), new Color3f(0.2f, 0.2f, 0.2f),
		new Color3f(0.05f, 0.05f, 0.05f), 0.4f);
	rodMat.setLightingEnable(true);
	Appearance rodApp = new Appearance();
	rodApp.setMaterial(rodMat);
	rod.setAppearance(rodApp);
	Transform3D rodShift = new Transform3D();
	rodShift.setTranslation(new Vector3d(inPosition.x, inPosition.y/2.0, inPosition.z));
	TransformGroup rodShiftTrans = new TransformGroup(rodShift);
	rodShiftTrans.addChild(rod);
	group.addChild(rodShiftTrans);
	// return the pair
	return group;
}
 
开发者ID:activityworkshop,项目名称:GpsPrune,代码行数:38,代码来源:Java3DWindow.java


示例3: buildScene

import com.sun.j3d.utils.geometry.Cylinder; //导入依赖的package包/类
@Override
void buildScene(TransformGroup transformGroup) {
    transformGroup.addChild(new Cylinder(0.7f, 0.4f, getColorAppearance(Color.ORANGE)));
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:5,代码来源:CylinderExample.java


示例4: addAxes

import com.sun.j3d.utils.geometry.Cylinder; //导入依赖的package包/类
private void addAxes() {

        /************************* Axes Colors ***************************/

        Appearance xAxisAppearance = new Appearance();
        ColoringAttributes xAxisColor = new ColoringAttributes(1.0f, 0.0f,
                0.0f, ColoringAttributes.NICEST);
        xAxisAppearance.setColoringAttributes(xAxisColor);

        Appearance yAxisAppearance = new Appearance();
        ColoringAttributes yAxisColor = new ColoringAttributes(0.0f, 1.0f,
                0.0f, ColoringAttributes.NICEST);
        yAxisAppearance.setColoringAttributes(yAxisColor);

        Appearance zAxisAppearance = new Appearance();
        ColoringAttributes zAxisColor = new ColoringAttributes(0.0f, 0.0f,
                1.0f, ColoringAttributes.NICEST);
        zAxisAppearance.setColoringAttributes(zAxisColor);

        /************************* Create Axes ****************************/

        Cylinder xAxis = new Cylinder(0.005f, 3.0f, xAxisAppearance);
        xAxis.setUserData(-1);

        Cylinder yAxis = new Cylinder(0.005f, 3.0f, yAxisAppearance);
        yAxis.setUserData(-1);

        Cylinder zAxis = new Cylinder(0.005f, 3.0f, zAxisAppearance);
        zAxis.setUserData(-1);

        /********************** Transform X-Axis *************************/

        TransformGroup xAxisTransformGroup = new TransformGroup();
        Transform3D xAxisTransform = new Transform3D();

        xAxisTransform.rotZ(Math.PI / 2);
        xAxisTransformGroup.setTransform(xAxisTransform);
        xAxisTransformGroup.addChild(xAxis);
        objRotate.addChild(xAxisTransformGroup);

        /******************* Don't Transform Y-Axis **********************/

        objRotate.addChild(yAxis);

        /********************** Transform Z-Axis *************************/

        TransformGroup zAxisTransformGroup = new TransformGroup();
        Transform3D zAxisTransform = new Transform3D();

        zAxisTransform.rotX(Math.PI / 2);
        zAxisTransformGroup.setTransform(zAxisTransform);
        zAxisTransformGroup.addChild(zAxis);
        objRotate.addChild(zAxisTransformGroup);

    }
 
开发者ID:airalcorn2,项目名称:ScatterPlot3D,代码行数:56,代码来源:ScatterPlot3D.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VCFConstants类代码示例发布时间:2022-05-22
下一篇:
Java CrosshairLabelGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap