All Projects → lace → vg

lace / vg

Licence: BSD-2-Clause license
Vector-geometry toolbelt for 3D points and vectors

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to vg

Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-73.58%)
Mutual labels:  geometry, vector, linear-algebra
Maker.js
📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
Stars: ✭ 1,185 (+1017.92%)
Mutual labels:  geometry, vector
Sharpmath
A small .NET math library.
Stars: ✭ 36 (-66.04%)
Mutual labels:  geometry, vector
Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (+10.38%)
Mutual labels:  geometry, linear-algebra
ludigraphix.github.io
Documentation for Ludigraphix
Stars: ✭ 21 (-80.19%)
Mutual labels:  geometry, vector
Unity-Int-Vectors
Library that adds Vector2i and Vector3i classes, which are integer counterparts to Vector2 and Vector3.
Stars: ✭ 23 (-78.3%)
Mutual labels:  geometry, vector
Algorithms
A collection of algorithms and data structures
Stars: ✭ 11,553 (+10799.06%)
Mutual labels:  geometry, linear-algebra
Node Sylvester
🐱 Sylvester is a vector, matrix, and geometry library for JavaScript, that runs in the browser and on the server.
Stars: ✭ 144 (+35.85%)
Mutual labels:  vector, linear-algebra
Elm Geometry
2D/3D geometry package for Elm
Stars: ✭ 162 (+52.83%)
Mutual labels:  geometry, vector
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (-79.25%)
Mutual labels:  geometry, linear-algebra
SKLinearAlgebra
Swift extensions for Linear Algebra with SceneKit
Stars: ✭ 53 (-50%)
Mutual labels:  linear-algebra, vectors
Blasjs
Pure Javascript manually written 👌 implementation of BLAS, Many numerical software applications use BLAS computations, including Armadillo, LAPACK, LINPACK, GNU Octave, Mathematica, MATLAB, NumPy, R, and Julia.
Stars: ✭ 241 (+127.36%)
Mutual labels:  vector, linear-algebra
Nalgebra
Linear algebra library for Rust.
Stars: ✭ 2,433 (+2195.28%)
Mutual labels:  vector, linear-algebra
Mather
zzllrr mather(an offline tool for Math learning, education and research)小乐数学,离线可用的数学学习(自学或教学)、研究辅助工具。计划覆盖数学全部学科的解题、作图、演示、探索工具箱。目前是演示Demo版(抛转引玉),但已经支持数学公式编辑显示,部分作图功能,部分学科,如线性代数、离散数学的部分解题功能。最终目标是推动专业数学家、编程专家、教育工作者、科普工作者共同打造出更加专业级的Mather数学工具
Stars: ✭ 270 (+154.72%)
Mutual labels:  geometry, linear-algebra
Math Php
Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
Stars: ✭ 2,009 (+1795.28%)
Mutual labels:  vector, linear-algebra
Graphical Debugging
GraphicalDebugging extension for Visual Studio
Stars: ✭ 88 (-16.98%)
Mutual labels:  geometry, vector
Lacaml
OCaml bindings for BLAS/LAPACK (high-performance linear algebra Fortran libraries)
Stars: ✭ 101 (-4.72%)
Mutual labels:  vector, linear-algebra
Numphp
Mathematical PHP library for scientific computing
Stars: ✭ 120 (+13.21%)
Mutual labels:  vector, linear-algebra
Svg.skia
An SVG rendering library.
Stars: ✭ 122 (+15.09%)
Mutual labels:  geometry, vector
LinAlg
实现一个线性代数库,为Python写扩展。《程序猿的数学3 线性代数》读后笔记
Stars: ✭ 17 (-83.96%)
Mutual labels:  vector, linear-algebra

vg

version python version license build code style

A very good vector-geometry toolbelt for dealing with 3D points and vectors. These are simple NumPy operations made readable, built to scale from prototyping to production.

📖 See the complete documentation: https://vgpy.dev/

Examples

Normalize a stack of vectors:

# 😮
vs_norm = vs / np.linalg.norm(vs, axis=1)[:, np.newaxis]

# 😀
vs_norm = vg.normalize(vs)

Check for the zero vector:

# 😣
is_almost_zero = np.allclose(v, np.array([0.0, 0.0, 0.0]), rtol=0, atol=1e-05)

# 🤓
is_almost_zero = vg.almost_zero(v, atol=1e-05)

Find the major axis of variation (first principal component):

# 😩
mean = np.mean(coords, axis=0)
_, _, pcs = np.linalg.svd(coords - mean)
first_pc = pcs[0]

# 😍
first_pc = vg.major_axis(coords)

Compute pairwise angles between two stacks of vectors:

# 😭
dot_products = np.einsum("ij,ij->i", v1s.reshape(-1, 3), v2s.reshape(-1, 3))
cosines = dot_products / np.linalg.norm(v1s, axis=1) / np.linalg.norm(v1s, axis=1)
angles = np.arccos(np.clip(cosines, -1.0, 1.0))

# 🤯
angles = vg.angle(v1s, v2s)

Installation

pip install numpy vg

Usage

import numpy as np
import vg

projected = vg.scalar_projection(
  np.array([5.0, -3.0, 1.0]),
  onto=vg.basis.neg_y
)

Development

First, install Poetry.

After cloning the repo, run ./bootstrap.zsh to initialize a virtual environment with the project's dependencies.

Subsequently, run ./dev.py install to update the dependencies.

Acknowledgements

This collection was developed at Body Labs by Paul Melnikow and extracted from the Body Labs codebase and open-sourced as part of blmath by Alex Weiss. blmath was subsequently forked by Paul Melnikow and later the vx namespace was broken out into its own package. The project was renamed to vg to resolve a name conflict.

License

The project is licensed under the two-clause BSD license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].