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

@behaver/coordinate

v3.4.0

Published

A toolkit about coordinate.

Downloads

35

Readme

Coordinate

GitHub license npm version PRs Welcome

简介

Coordinate 组件库可被用于 坐标的变换 和 坐标系统的转换 等。

组件库又分成了两个子库:2D 和 3D,其中 2D 库用于平面坐标的处理,3D 库用于空间坐标的处理。

Coordinate 组件库目前主要支持以下坐标变换操作:

  • 平移
  • 缩放
  • 旋转
  • 手性翻转
  • 系统切换

其中 2d 组件库目前支持以下坐标系统:

  • 直角坐标系(RC)
  • 极坐标系(PC)

3d 组件库目前支持以下坐标系统:

  • 直角坐标系(RC)
  • 柱面坐标系(CC)
  • 球坐标系(SC)

组件

Coordinate 2D 库组件:

Coordinate2D


Coordinate 3D 库组件:

Coordinate3D

用例

使用 npm 安装组件库,在项目目录下执行:

npm install @behaver/coordinate

Coordinate 组件调用:

const { SphericalCoordinate3D, PolarCoordinate2D } = require('@behaver/coordinate');

// 实例化一个球坐标 (10, π / 3, π)
let sc = new SphericalCoordinate3D(10, Math.PI / 3, Math.PI);

当只使用 3D 库中涉及的组件时(2D 库同理),可以使用如下方式调用:

// 3d 库组件调用
const { SphericalCoordinate3D, RectangularCoordinate3D } = require('@behaver/coordinate/3d');

// 2d 库组件调用
const { PolarCoordinate2D, RectangularCoordinate2D } = require('@behaver/coordinate/2d');

使用 SphericalCoordinate3D 组件处理空间球坐标:

let sc = new SphericalCoordinate3D(10, Math.PI / 3, Math.PI);

// 将坐标围绕 x 轴旋转 60°
sc.rotateX(Math.PI / 3);

// 输出球坐标
console.log(sc.r, sc.theta, sc.phi);

// 转换为直角坐标
let rc = sc.toRC();

*用于处理空间直角坐标的 RectangularCoordinate3D 组件 和 用于处理空间柱面坐标的 CylindricalCoordinate3D 组件 的使用方法相同

许可证书

The MIT license.