2dv 中文文档教程

发布于 4年前 浏览 26 项目主页 更新于 3年前

2dv — Vector calculation package written in TypeScript

build npm

非常有用的小类来执行矢量计算。 作为对象在二维空间中移动的各种模拟和游戏的基础非常实用。

Get started

npm i 2dv

在你的 JavaScript/Typescript 项目中使用

import { Vector } from '2dv';
// OR
const { Vector } = require('2dv');

const myVector = new Vector(10, 20);

myVector.add(100);
…

const newVector = Vector.add(myVector, 10);
…

Overview

详细文档:https://wetterben.github.io/2dv/

Properties

  • x
  • y

Accessors

  • angle
  • length
  • magnitude
  • max
  • min

Methods

Instance

  • add
  • angleTo
  • clone
  • crossProduct
  • divide
  • dotProduct
  • equals
  • inverse
  • multiply
  • normalize
  • set
  • sub
  • toArray

Static

  • add
  • angleBetween
  • closestPointBetween
  • crossProduct
  • distance
  • divide
  • dotProduct
  • equals
  • fromArray
  • inverse
  • isOnLine
  • multiply
  • normalize
  • pointBetween
  • sub

Documentation

您可以在此处找到所有方法的详细文档: https://wetterben.github.io/2dv/

Roadmap

  • [ ] Automated tests
  • [ ] Visual Demo
  • [ ] More methods

Contribute

随意添加缺失的功能或修复事物。 做个公关就好了。

2dv — Vector calculation package written in TypeScript

build npm

Very useful small class to perform vector calculations. Very practical as basis for all kinds of simulations and games where objects move through a two-dimensional space.

Get started

npm i 2dv

Use in your JavaScript/Typescript project

import { Vector } from '2dv';
// OR
const { Vector } = require('2dv');

const myVector = new Vector(10, 20);

myVector.add(100);
…

const newVector = Vector.add(myVector, 10);
…

Overview

Detailed documentation: https://wetterben.github.io/2dv/

Properties

  • x
  • y

Accessors

  • angle
  • length
  • magnitude
  • max
  • min

Methods

Instance

  • add
  • angleTo
  • clone
  • crossProduct
  • divide
  • dotProduct
  • equals
  • inverse
  • multiply
  • normalize
  • set
  • sub
  • toArray

Static

  • add
  • angleBetween
  • closestPointBetween
  • crossProduct
  • distance
  • divide
  • dotProduct
  • equals
  • fromArray
  • inverse
  • isOnLine
  • multiply
  • normalize
  • pointBetween
  • sub

Documentation

You can find a detailed documentation of all methods here: https://wetterben.github.io/2dv/

Roadmap

  • [ ] Automated tests
  • [ ] Visual Demo
  • [ ] More methods

Contribute

Feel free to add missing functions or fix things. Just do a PR.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文