跳至主要內容

几何体

大约 4 分钟

几何体

Geometry

继承自Thing对象,拥有一切Thing属性及方法。

属性成员

mesh

网格

  • 类型:{THREE.Mesh}

方法

getGeometry

获取几何实例

  • getGeometry()
  • 类型:{Function}
  • 参数:-
  • 返回:{THREE.BufferGeometry}

updateGeometry

更新几何实例

  • updateGeometry(geometry)
  • 类型:{Function}
  • 参数:
    • geometry {Object} 几何实例参数,根据每个不同的几体物体参数有所不同
  • 返回:无
var box = new VT.Box();

// 更新方体几何参数
box.updateGeometry({width: 2});

Box

Box方体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Box",
    geometry: {
        // 宽度
        width: 1,
        // 高度
        height: 1,
        // 深度
        depth: 1,
        // 宽度分段
        widthSegments: 1,
        // 高度分段
        heightSegments: 1,
        // 深度分段
        depthSegments: 1,
    },
}

Capsule

Capsule 胶囊体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Capsule",
    geometry: {
        // 半径
        radius: 0.5,
        // 体高度
        height: 1.0,
        // 分段
        segments: 30,
        // 起始角度
        phiStart: 0,
        // 结束角度
        phiLength: Math.PI * 2,
    }
}

Cone

Cone 圆锥体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Cone",
    geometry: {
        // 半径
        radius: 1,
        // 高度
        height: 1,
        // 半径分段
        radialSegments: 20,
        // 高度分段
        heightSegments: 1,
        // 是否闭合
        openEnded: false,
        // 水平起始角度
        thetaStart: 0,
        // 水平结束角度
        thetaLength: 2 * Math.PI,
    }
}

Cylinder

Cylinder 圆柱体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Cylinder",
    geometry: {
        // 顶部半径
        radiusTop: 1,
        // 底部半径
        radiusBottom: 1,
        // 半径分段
        radialSegments: 30,
        // 高度
        height: 1,
        // 高度分段
        heightSegments: 1,
        // 是否闭合
        openEnded: false,
        // 水平起始角度
        thetaStart: 0,
        // 水平结束角度
        thetaLength: 2 * Math.PI,
    }
}

Dodecahedron

Dodecahedron 十二面体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Dodecahedron",
    geometry: {
        // 半径
        radius: 0.5,
        // 详情
        detail: 0,
    }
}

Doughnut

Doughnut 环形,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Doughnut",
    geometry: {
        // 半径
        radius: 1,
        // 内径
        innerRadius: 0.5,
        // 分段
        segments: 30,
        // 起始角度
        phiStart: 0,
        // 结束角度
        phiLength: Math.PI * 2,
    }
}

Icosahedron

Icosahedron 二十面体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Icosahedron",
    geometry: {
        // 半径
        radius: 0.5,
        // 详情
        detail: 0,
    }
}

Lathe

Lathe 车削体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
      name: "Lathe",
      geometry: {
        // 点位
        points: [
          {
            "x": 0,
            "y": 0.5
          },
          {
            "x": 0.5,
            "y": 0
          },
          {
            "x": 0,
            "y": -0.5
          }
        ],
        // 分段
        segments: 12,
        // 角度起始
        phiStart: 0,
        // 角度结束
        phiLength: 2 * Math.PI,
      },
}

Octahedron

Octahedron 八面体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Octahedron",
    geometry: {
        // 半径
        radius: 0.5,
        // 详情
        detail: 0,
    },
}

Plane

Plane 平面,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Plane",
    geometry: {
        // 宽
        width: 1,
        // 高(长)
        height: 1,
        // 分段
        widthSegments: 1,
        // 分段
        heightSegments: 1,
    },
}

Circle

Circle 圆,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "circle",
    geometry: {
        // 半径
        radius: 0.5,
        // 分段
        segments: 30, // 最小值为3
        // 水平角度起始
        thetaStart: 0,
        // 水平角度结束
        thetaLength: 2 * Math.PI,
    }
}

Sphere

Sphere 球体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Sphere",
    geometry: {
        // 半径
        radius: 0.5,
        // 分段
        widthSegments: 30,
        // 分段
        heightSegments: 30,
        // 水平角度起始
        phiStart: 0,
        // 水平角度结束 
        phiLength: Math.PI * 2,
        // 角度起始
        thetaStart: 0,
        // 角度结束
        thetaLength: Math.PI,
    },
}

Ring

Ring 环形,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Ring",
    geometry: {
        // 内环半径
        innerRadius: 0.4,
        // 外环半径
        outerRadius: 0.5,
        // 分段
        thetaSegments: 30,  // 最小为3
        // 分段
        phiSegments: 30,
        // 角度起始
        thetaStart: 0,
        // 角度结束 
        thetaLength: Math.PI * 2
    },
}

Tetrahedron

Tetrahedron 四面体,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Tetrahedron",
    geometry: {
        // 半径
        radius: 0.5,
        // 详细
        detail: 0,
    },
}

Torus

Torus 环面,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "Torus",
    geometry: {
        // 半径
        radius: 0.5,
        // 管径
        tube: 0.25,
        // 半径分段
        radialSegments: 16,
        // 分段
        tubularSegments: 16,
        // 弧度
        arc: Math.PI * 2
    },
}

TorusKnot

TorusKnot 环面纽结,继承自Geometry对象,拥有一切Geometry属性及方法,默认构造参数如下:

{
    name: "TorusKnot",
    geometry: {
        // 半径
        radius: 0.5,
        // 管径
        tube: 0.2,
        // 分段
        tubularSegments: 64,
        // 半径分段
        radialSegments: 8,
        p: 2, // 这个值决定了几何体将绕着其旋转对称轴旋转多少次,默认值是2。
        q: 3 //  这个值决定了几何体将绕着其内部圆环旋转多少次,默认值是3。
    }
}

CannedLiquid

CannedLiquid 罐装体,继承自Capsule对象,拥有一切Capsule属性及方法。

{
    name: "CannedLiquid",
    geometry: {
        // 半径
        radius: 0.5,
        // 中间体高度
        height: 1.0,
        // 分段数
        segments: 30,
        // 剖面起始角度
        phiStart: 0,
        // 剖面结束角度
        phiLength: Math.PI * 2,
        // 比例
        ratio: 1,
        // 裁剪
        clip: true,
        // 是否显示头部
        header: true,
        // 是否显示中间体
        body: true,
        // 是否显示底部
        footer: true,
    },
    material: {
        // 材质显示面
        side: 2,
        // 是否透明
        transparent: true,
        // 透明度
        opacity: 0.95,
        // 颜色
        color: "#29C4F5"
    }
}
上次编辑于:
贡献者: dashun