Vector2d
Ruby library (and gem) for handling two-dimensional vectors
Install / Use
/learn @elektronaut/Vector2dREADME
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
License
Copyright (c) 2006-2025 Inge Jørgensen
Vector2d is released under the MIT License.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
