npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vis-three/module-geometry

v0.7.1

Published

<img alt="version" src="https://img.shields.io/npm/v/@vis-three/module-geometry">

Downloads

9

Readme

@vis-three/module-geometry

最新版本

license

模块信息

module.type

  • : geometry

module.lifeOrder

  • : SUPPORT_LIFE_CYCLE.TWO - 200

提供配置

几何基础-Geometry

  • 类型Geometry
  • 配置类型:
/**
 * 几何组配置
 */
export interface GeometryGroup {
  /**开始几何点 */
  start: number;
  /**结束几何点 */
  count: number;
  /**材质索引 */
  materialIndex: number;
}
/**
 * 几何配置基础
 */
export interface GeometryConfig extends SymbolConfig {
  /**是否居中几何,开启后会先居中几何,再进行其他几何运算,这对于几何中心不再原点的模型很有用。 */
  center: boolean;
  /**几何锚点中心位置 */
  position: Vector3Config;
  /**几何锚点旋转 */
  rotation: Vector3Config;
  /**几何锚点缩放 */
  scale: Vector3Config;
  /**几何组 */
  groups: GeometryGroup[];
}
  • 默认配置
{
  vid: "",
  type: "Geometry",
  name: "",
  center: true,
  position: {
    x: 0, // percent
    y: 0, // percent
    z: 0, // percent
  },
  rotation: {
    x: 0,
    y: 0,
    z: 0,
  },
  scale: {
    x: 1,
    y: 1,
    z: 1,
  },
  groups: [],
}

:::tip

  • position属性为百分比值。例如几何中心在最右侧:position.x = 1
  • 此类型为内部调用 :::

立方体几何-BoxGeometry

  • 类型BoxGeometry
  • 配置类型:
export interface BoxGeometryConfig extends GeometryConfig {
  /**立方体宽 */
  width: number;
  /**立方体高 */
  height: number;
  /** 立方体深度 */
  depth: number;
  /** 宽分段数 */
  widthSegments: number;
  /** 高分段数 */
  heightSegments: number;
  /** 深分段数 */
  depthSegments: number;
}
  • 默认配置
{
  width: 5,
  height: 5,
  depth: 5,
  widthSegments: 1,
  heightSegments: 1,
  depthSegments: 1,
}

球型几何-SphereGeometry

export interface SphereGeometryConfig extends GeometryConfig {
  radius: number;
  widthSegments: number;
  heightSegments: number;
  phiStart: number;
  phiLength: number;
  thetaStart: number;
  thetaLength: number;
}
  • 默认配置
{
  radius: 3,
  widthSegments: 32,
  heightSegments: 32,
  phiStart: 0,
  phiLength: Math.PI * 2,
  thetaStart: 0,
  thetaLength: Math.PI,
}

平面几何-PlaneGeometry

export interface PlaneGeometryConfig extends GeometryConfig {
  width: number;
  height: number;
  widthSegments: number;
  heightSegments: number;
}
  • 默认配置
{
  width: 5,
  height: 5,
  widthSegments: 1,
  heightSegments: 1,
}

圆形几何-CircleGeometry

export interface CircleGeometryConfig extends GeometryConfig {
  radius: number;
  segments: number;
  thetaStart: number;
  thetaLength: number;
}
  • 默认配置
{
  radius: 3,
  segments: 8,
  thetaStart: 0,
  thetaLength: Math.PI * 2,
}

圆锥几何-ConeGeometry

export interface ConeGeometryConfig extends GeometryConfig {
  radius: number;
  height: number;
  radialSegments: number;
  heightSegments: number;
  openEnded: boolean;
  thetaStart: number;
  thetaLength: number;
}
  • 默认配置
{
  radius: 3,
  height: 5,
  radialSegments: 8,
  heightSegments: 1,
  openEnded: false,
  thetaStart: 0,
  thetaLength: Math.PI * 2,
}

圆柱几何-CylinderGeometry

export interface CylinderGeometryConfig extends GeometryConfig {
  radiusTop: number;
  radiusBottom: number;
  height: number;
  radialSegments: number;
  heightSegments: number;
  openEnded: boolean;
  thetaStart: number;
  thetaLength: number;
}
  • 默认配置
{
  radiusTop: 3,
  radiusBottom: 3,
  height: 5,
  radialSegments: 8,
  heightSegments: 1,
  openEnded: false,
  thetaStart: 0,
  thetaLength: Math.PI * 2,
}

十二面几何-DodecahedronGeometry

export interface DodecahedronGeometryConfig extends GeometryConfig {
  radius: number;
  detail: number;
}
  • 默认配置
{
  radius: 3,
  detail: 0,
}

边缘几何-EdgesGeometry

export interface EdgesGeometryConfig extends GeometryConfig {
  /**目标几何vid标识 */
  url: string;
  thresholdAngle: number;
}
  • 默认配置
{
  url: "",
  thresholdAngle: 1,
}

圆环几何-TorusGeometry

export interface TorusGeometryConfig extends GeometryConfig {
  radius: number;
  tube: number;
  radialSegments: number;
  tubularSegments: number;
  arc: number;
}
  • 默认配置
{
  radius: 3,
  tube: 0.4,
  radialSegments: 8,
  tubularSegments: 6,
  arc: Math.PI * 2,
}

圆环平面几何-RingGeometry

export interface RingGeometryConfig extends GeometryConfig {
  innerRadius: number;
  outerRadius: number;
  thetaSegments: number;
  phiSegments: number;
  thetaStart: number;
  thetaLength: number;
}
  • 默认配置
{
  innerRadius: 2,
  outerRadius: 3,
  thetaSegments: 8,
  phiSegments: 8,
  thetaStart: 0,
  thetaLength: Math.PI * 2,
}

加载几何-LoadGeometry

  • 类型LoadGeometry
  • 配置类型:
/**
 * 加载几何
 */
export interface LoadGeometryConfig extends GeometryConfig {
  /**目标几何资源地址,通过ResourceManagerPlugin解析 */
  url: string;
}
  • 默认配置
{
  url: "",
}

自定义几何-CustomGeometry

  • 类型CustomGeometry
  • 配置类型:
export interface CustomGeometryConfig extends GeometryConfig {
  attribute: {
    position: number[];
    color: number[];
    index: number[];
    normal: number[];
    uv: number[];
    uv2: number[];
  };
}
  • 默认配置
{
  attribute: {
    position: [],
    color: [],
    index: [],
    normal: [],
    uv: [],
    uv2: [],
  },
}

曲线路径几何-CurveGeometry

  • 类型CurveGeometry
  • 配置类型:
export interface CurveGeometryConfig extends GeometryConfig {
  /**曲线参数点集 */
  path: Vector3Config[];
  /**曲线分段数 */
  divisions: number;
  /**是否等距分段 */
  space: boolean;
}
  • 默认配置
{
  center: false,
  path: [],
  divisions: 36,
  space: true,
}

:::tip 此类型为内部其他曲线几何调用 :::

直线路径几何-LineCurveGeometry

  • 类型LineCurveGeometry
  • 配置类型:
export interface LineCurveGeometryConfig extends CurveGeometryConfig {}
  • 默认配置
{
  center: false;
}

样条曲线路径几何-SplineCurveGeometry

  • 类型SplineCurveGeometry
  • 配置类型:
export interface SplineCurveGeometryConfig extends CurveGeometryConfig {}
  • 默认配置
{
  center: false;
}

二维三次贝塞尔曲线路径几何-CubicBezierCurveGeometry

  • 类型CubicBezierCurveGeometry
  • 配置类型:
export interface CubicBezierCurveGeometryConfig extends CurveGeometryConfig {}
  • 默认配置
{
  center: false;
}

二维二次贝塞尔曲线路径几何-QuadraticBezierCurveGeometry

  • 类型QuadraticBezierCurveGeometry
  • 配置类型:
export interface QuadraticBezierCurveGeometryConfig
  extends CurveGeometryConfig {}
  • 默认配置
{
  center: false;
}

管道几何-TubeGeometry

export interface TubeGeometryConfig extends GeometryConfig {
  /**曲线参数点集 */
  path: Vector3Config[];
  tubularSegments: number;
  radius: number;
  radialSegments: number;
  closed: boolean;
}
  • 默认配置
{
  center: false,
  path: [],
  tubularSegments: 64,
  radius: 1,
  radialSegments: 8,
  closed: false,
}

:::tip 此类型为内部其他管道几何调用 :::

直线管道几何-LineTubeGeometry

  • 类型LineTubeGeometry
  • 配置类型:
export interface LineTubeGeometryConfig extends TubeGeometryConfig {}
  • 默认配置
{
  center: false;
}

曲线管道几何-SplineTubeGeometry

  • 类型SplineTubeGeometry
  • 配置类型:
export interface SplineTubeGeometryConfig extends TubeGeometryConfig {}
  • 默认配置
{
  center: false;
}

形状几何-ShapeGeometry

  • 类型ShapeGeometry
  • 配置类型:
export interface ShapeGeometryConfig extends GeometryConfig {
  /**形状vid标识 */
  shape: string;
  curveSegments: number;
}
  • 默认配置
{
  center: false,
  shape: "",
  curveSegments: 12,
}

挤压几何-ExtrudeGeometry

  • 类型ExtrudeGeometry
  • 配置类型:
export interface ExtrudeGeometryConfig extends GeometryConfig {
  /**挤压形状vid标识 */
  shapes: string;
  options: {
    curveSegments: number;
    steps: number;
    depth: number;
    bevelEnabled: boolean;
    bevelThickness: number;
    bevelSize: number;
    bevelOffset: number;
    bevelSegments: number;
    extrudePath: string;
  };
}
  • 默认配置
{
  center: false,
  shapes: "",
  options: {
    curveSegments: 12,
    steps: 1,
    depth: 1,
    bevelEnabled: true,
    bevelThickness: 0.2,
    bevelSize: 0.1,
    bevelOffset: 0,
    bevelSegments: 3,
    extrudePath: "",
  },
}

路径几何-PathGeometry

  • 类型PathGeometry
  • 配置类型:
export interface PathGeometryConfig extends GeometryConfig {
  /**路径vid标识 */
  path: string;
  space: boolean;
  divisions: number;
}
  • 默认配置
{
  center: false,
  path: "",
  space: false,
  divisions: 36,
}