空间圆形轮廓(threejs)(3D)

时间:2017-05-08 18:36:02

标签: javascript 3d three.js

如何在此图片http://joxi.ru/gmvl7YwT7Eg3Aa中删除此行?我只需要轮廓

const intersection = (a, b, c, heightC) => {
    return (u, v) => {
        const height = heightC || c;
        const size = 5;

        u = u * height;
        v = 2 * v * Math.PI;

        const x = a * size * Math.sqrt(u) * Math.cos(v);
        const y = c;
        const z = b * size * Math.sqrt(u) * Math.sin(v);

        return new Three.Vector3(x, y, z);
    }
}

export const projectionIntersection = (a, b, heightC) => {
    const geom = new Three.ParametricGeometry(intersection(a, b, 1, heightC), 1, 25);
    const math = new Three.MeshPhongMaterial({ color: 0x00FF00, wireframe: true });
    const mesh = new Three.Mesh(geom, math);

    return mesh;
}

谁能帮帮我?

2 个答案:

答案 0 :(得分:1)

作为网格的参数化几何体将创建面,这意味着在中心和沿边缘的每个点之间创建链接。如果您只想绘制一条线条,请查看Line Object。看起来你可以做你已经做过的事情,只需将你创建的Vector3推到几何体的顶点并从中创建一条线。

答案 1 :(得分:0)

圆圈的廉价和粗略解决方案:

var circleGeom = new THREE.CircleGeometry(1, 32);
circleGeom.vertices.shift();
circleGeom.vertices.push(circleGeom.vertices[0].clone());
var circle = new THREE.Line(circleGeom, new THREE.LineBasicMaterial({color: "yellow"}));

jsfiddle示例r85