https://github.com/sisl/vec.jl
2D and 3D vectors and their operations for Julia
https://github.com/sisl/vec.jl
Last synced: 9 months ago
JSON representation
2D and 3D vectors and their operations for Julia
- Host: GitHub
- URL: https://github.com/sisl/vec.jl
- Owner: sisl
- License: other
- Created: 2016-01-25T19:28:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-02-09T15:58:35.000Z (over 1 year ago)
- Last Synced: 2025-02-09T16:36:57.264Z (over 1 year ago)
- Language: Julia
- Size: 101 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Vec
Provides 2D and 3D vector types for vector operations in Julia.
[](https://github.com/sisl/Vec.jl/actions/workflows/CI.yaml)
[](https://coveralls.io/r/sisl/Vec.jl)
# Installation
Run one of those commands in the Julia REPL:
- Through the SISL registry:
```julia
] registry add https://github.com/sisl/Registry
add Vec
```
- Through `Pkg`
```julia
import Pkg
Pkg.add(PackageSpec(url="https://github.com/sisl/Vec.jl.git"))
```
# Usage
`Vec.jl` provides several vector types, named after their groups. All types are immutable and are subtypes of ['StaticArrays'](https://github.com/JuliaArrays/StaticArrays.jl)' `FieldVector`, so they can be indexed and used as vectors in many contexts.
* `VecE2` provides an (x,y) type of the Euclidean-2 group.
* `VecE3` provides an (x,y,z) type of the Euclidean-3 group.
* `VecSE2` provides an (x,y,theta) type of the special-Euclidean 2 group.
```julia
v = VecE2(0, 1)
v = VecSE2(0,1,0.5)
v = VecE3(0, 1, 2)
```
Additional geometry types include `Quat` for quaternions, `Line`, `LineSegment`, and `Projectile`.
The switch to StaticArrays brings several breaking changes. If you need a backwards-compatible version, please checkout the `v0.1.0` tag with ```cd(Pkg.dir("Vec")); run(`git checkout v0.1.0`)```.