vectormath
Version, currently 0.1.44 versions
- 0.1.5latestApr 5, 2020
- 0.1.4not indexedApr 5, 2020
- 0.1.3not indexedApr 5, 2020
- 0.1.1not indexedApr 5, 2020
github.com/feritarou/vectormath
A pure Crystal linear algebra library providing generic vector, matrix, and quaternion structs.
Nothing has been indexed for 0.1.4 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
vectormath:
github: feritarou/vectormath
version: ~> 0.1.4Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.4. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
vectormath
A pure Crystal linear algebra library providing generic vector, matrix, and quaternion structs.
Installation
-
Add the dependency to your
shard.yml:dependencies: vectormath: github: mathalaxy/vectormath -
Run
shards install
Usage
Example:
require "vectormath"
v = VM.vec3f(3, 4, 5)
a = VM.mat2x3f(
1, 0, -1,
0, 2, 3
)
puts "A=#{a}", "A/2=#{a/2}", "A*v=#{a*v}"
The package comprises generic structs for vectors, matrices, and quaternions.
Those structs are all located under the namespace VM.
Compared with other packages, vectormath classifies vectors and matrices by their underlying scalar type as well as their dimensionality, leading to better type safety. Thus the following are all examples of different types:
Vec2(Int32)Vec2(BigFloat)Vec3(Complex)Mat3x2(Float64)Mat3(Float32)– which is itself an alias for the quadratic matrix typeMat3x3(Float32).
Objects can be created using new, bracket macros on the generic types (e.g., Vec3[1, 2, 3]), or through GLSL-style convenience macros, like in the example at the beginning of this section.
Development
All classes have been thoroughly tested and are so far working well. As I use them for an OpenGL game engine, the types are made with OpenGL (shader) interoperability in mind.
Currently there is only a small subset of linear algebra implemented. Things that might be very nice to have include:
- Matrix inversion
- Linear equation systems
- Other standard LA algorithms
Contributing
- Fork it (https://github.com/mathalaxy/vectormath/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- mathalaxy - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.4- Tagged
- Apr 5, 2020
- Commit
c5178c40ed6c- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/feritarou/vectormath
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 14, 2026
- Versions
- 4