https://github.com/calebowens/vectors
https://github.com/calebowens/vectors
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/calebowens/vectors
- Owner: calebowens
- Created: 2022-06-05T20:49:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-05T21:00:15.000Z (about 4 years ago)
- Last Synced: 2025-12-25T04:48:50.933Z (6 months ago)
- Language: TypeScript
- Size: 79.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Vectors CO
This library is an implementation of N length vectors. I made the initial implementation for a ray tracing demo I was working on. Looking at the vector libraries out there, it seems like there aren't many multi-dimensional ones. So, here is mine.
### Documentation
https://calebowens.github.io/Vectors/
### Git Repo
https://github.com/calebowens/Vectors
## Example
Vec3; Also implemented are Vec2 and Vec4 specializations
```ts
import { Vec3 } from 'vectors-co'
const vec1 = new Vec3([1, 2, 3])
const vec2 = new Vec3([2, 3, 4])
const vec3 = vec1.add(vec2) // is Vec3([3, 5, 7])
const vec4 = vec1.mul(vec2) // is Vec3([2, 6, 12])
```
Vec\
```ts
import { Vec } from 'vectors-co'
const vec1 = new Vec([1, 2, 3], 3)
const vec2 = new Vec([2, 3, 4], 3)
const vec3 = vec1.add(vec2) // is Vec<3>([3, 5, 7], 3)
const vec4 = vec1.mul(vec2) // is Vec<3>([2, 6, 12], 3)
```
### TODO
- N-Length Cross Products, so the product of N-1 vectors crossed together
- No throwing errors. Throwing errors sucks.