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


Java Vector3d类代码示例

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


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

示例1: servoHeadMale

import eu.mihosoft.vrl.v3d.Vector3d; //导入依赖的package包/类
public CSG servoHeadMale(double headHeight, double headDiameter, int toothCount, double toothHeight,
		double toothWidth, double toothLength) {
	double clear = 0.3;
	double radius = headDiameter / 2 - toothHeight + clear;
	CSG cylinder = new eu.mihosoft.vrl.v3d.Cylinder(new Vector3d(0, 0, 0), new Vector3d(0, 0, headHeight),
			radius + 0.03, toothCount * 2).toCSG();

	CSG t = Extrude.points(new Vector3d(0, 0, headHeight), new Vector3d(-toothLength / 2, 0),
			new Vector3d(-toothWidth / 2, toothHeight), new Vector3d(toothWidth / 2, toothHeight),
			new Vector3d(toothLength / 2, 0));

	double delta = 360.0 / toothCount;
	CSG result = makeTooth(radius, 0, t);
	for (int i = 1; i < toothCount; i++) {
		CSG tooth = makeTooth(radius, i * delta, t);
		result = result.union(tooth);
	}
	return result.union(cylinder);
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:20,代码来源:ScadaApplication.java

示例2: mesh2CSG

import eu.mihosoft.vrl.v3d.Vector3d; //导入依赖的package包/类
public static CSG mesh2CSG(Mesh mesh) throws IOException {

        List<Polygon> polygons = new ArrayList<>();
        List<Vector3d> vertices = new ArrayList<>();
        if(mesh instanceof TriangleMesh){
            // Get faces
            ObservableFaceArray faces = ((TriangleMesh)mesh).getFaces();
            int[] f=new int[faces.size()];
            faces.toArray(f);

            // Get vertices
            ObservableFloatArray points = ((TriangleMesh)mesh).getPoints();
            float[] p = new float[points.size()];
            points.toArray(p);

            // convert faces to polygons
            for(int i=0; i<faces.size()/6; i++){
                int i0=f[6*i], i1=f[6*i+2], i2=f[6*i+4];
                vertices.add(new Vector3d(p[3*i0], p[3*i0+1], p[3*i0+2]));
                vertices.add(new Vector3d(p[3*i1], p[3*i1+1], p[3*i1+2]));
                vertices.add(new Vector3d(p[3*i2], p[3*i2+1], p[3*i2+2]));
                polygons.add(Polygon.fromPoints(vertices));
                vertices = new ArrayList<>();
            }
        }

        return CSG.fromPolygons(new PropertyStorage(),polygons);
    }
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:29,代码来源:MeshUtils.java

示例3: resetBotPosition

import eu.mihosoft.vrl.v3d.Vector3d; //导入依赖的package包/类
static void resetBotPosition() {
    groupAPI.pos = new Vector3d(0, 0);
    groupAPI.direction = Vector3d.y(-1);

    Timeline tl = new Timeline(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(groupAPI.poi.xProperty(), groupAPI.poi.getX()),
                    new KeyValue(groupAPI.poi.yProperty(), groupAPI.poi.getY())),
            new KeyFrame(Duration.millis(500),
                    new KeyValue(groupAPI.poi.xProperty(), 0),
                    new KeyValue(groupAPI.poi.yProperty(), 0)));

    tl.play();
}
 
开发者ID:miho,项目名称:PiOnWheels,代码行数:15,代码来源:Main.java

示例4: concaveToConvex

import eu.mihosoft.vrl.v3d.Vector3d; //导入依赖的package包/类
public static List<eu.mihosoft.vrl.v3d.Polygon> concaveToConvex(
        eu.mihosoft.vrl.v3d.Polygon concave) {

    List<eu.mihosoft.vrl.v3d.Polygon> result = new ArrayList<>();

    Vector3d normal = concave.vertices.get(0).normal.clone();

    boolean cw = !Extrude.isCCW(concave);

    eu.mihosoft.vrl.v3d.ext.org.poly2tri.Polygon p
            = fromCSGPolygon(concave);

    eu.mihosoft.vrl.v3d.ext.org.poly2tri.Poly2Tri.triangulate(p);

    List<DelaunayTriangle> triangles = p.getTriangles();

    List<Vertex> triPoints = new ArrayList<>();

    for (DelaunayTriangle t : triangles) {

        int counter = 0;
        for (TriangulationPoint tp : t.points) {

            triPoints.add(new Vertex(
                    new Vector3d(tp.getX(), tp.getY(), tp.getZ()),
                    normal));

            if (counter == 2) {
                if (!cw) {
                    Collections.reverse(triPoints);
                }
                eu.mihosoft.vrl.v3d.Polygon poly =
                        new eu.mihosoft.vrl.v3d.Polygon(
                                triPoints, concave.getStorage());
                result.add(poly);
                counter = 0;
                triPoints = new ArrayList<>();

            } else {
                counter++;
            }
        }
    }

    return result;
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:47,代码来源:PolygonUtil.java


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