Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby library (and gem) for handling two-dimensional vectors
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
vector2d.gemspec

README.md

Vector2d Build Status Code Climate Code Climate

Vector2d handles two-dimensional coordinates and vectors. Vectors are immutable, meaning this is a purely functional library.

Quick example

require 'vector2d'

vector = Vector2d(50, 70)

vector.aspect_ratio        # => 0.714285714285714
vector.length              # => 86.0232526704263

vector * 2                 # => Vector2d(100,140)
vector + Vector2d(20, 30)  # => Vector2d(70,100)

vector.fit(Vector2d(64, 64)) # => Vector2d(64,45)

Vector2d.parse([50, 70])   # => Vector2d(50,70)
Vector2d.parse("50x70")    # => Vector2d(50,70)

Documentation

API documentation

License

Copyright (c) 2006-2014 Inge Jørgensen

Vector2d is released under the MIT License.

Something went wrong with that request. Please try again.