SkillAgentSearch skills...

Vector2d

Ruby library (and gem) for handling two-dimensional vectors

Install / Use

/learn @elektronaut/Vector2d
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Version Build

Vector2d

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-2025 Inge Jørgensen

Vector2d is released under the MIT License.

Related Skills

View on GitHub
GitHub Stars9
CategoryDevelopment
Updated8d ago
Forks2

Languages

Ruby

Security Score

90/100

Audited on Mar 24, 2026

No findings