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

three-geometry

v1.4.1

Published

为image3D.js设计开发的三维几何坐标运算库

Downloads

36

Readme

Three-Geometry

image3D.js设计开发的三维几何坐标运算库

Issues

使用的时候遇到任何问题或有好的建议,请点击进入issue,欢迎参与维护!

How to use?

首先,你需要使用npm进行安装:

npm install --save three-geometry

然后就可以引入:

import ThreeGeometry from 'three-geometry';

当然,你也可以通过CDN的方式引入:

<script src="https://cdn.jsdelivr.net/npm/three-geometry@1"></script>

使用语法:

var threeGeometry = ThreeGeometry(options);

通过传递一个json格式的options来获取一个计算实例threeGeometry,其上提供了各种几何体的绘制数据data的方法。

他们的数据格式如下:

  • options
{
    precision:number, // 精度,必输
    normal:boolean, // 是否需要法向量,默认false
}
  • data
{
    // 点数组
    points:Array<x1:number,y1:number,z1:number,x2:number,y2:number,z2:number,...>,

    // 点的个数
    length:number,

    // 字符串,表示应该使用什么方法来绘制这些点
    // 关于这些方法,你可以参考image3D.js中的文档:
    // https://hai2007.gitee.io/image3d/index.html#/api?fixed=painter
    methods:Triangle|StripTriangle|FanTriangle,
}

如果存在法向量,那个就是点points格式就会有改变:

points:Array<x1:number,y1:number,z1:number,x1_normal:number,y1_normal:number,z1_normal:number,x2:number,y2:number,z2:number,...>,

也就是由原来的:

点1、点2.....

变成了:

点1、点1的法向量、点2、点2的法向量.....

List of Geometry

下面,我们来列举一下具体的几何体有哪些(需要注意的是,为了方便计算,默认我们统一是把物体看成平放在xoz平面上)。

圆柱体(cylinder)

// 底部坐标(x,y,z)、半径radius、高height
threeGeometry.cylinder(function(data){
    // todo
},x,y,z,radius,height);

棱柱体(prism)

// 底部坐标(x,y,z)、半径radius、高height、棱的个数num
threeGeometry.prism(function(data){
    // todo
},x,y,z,radius,height,num);

球体(sphere)

// 球心(cx,cy,cz)、半径radius
threeGeometry.sphere(function(data){
    // todo
},cx,cy,cz,radius);

开源协议

MIT

Copyright (c) 2021-2022 hai2007 走一步,再走一步。