Skip to main content

A linear algebra package written in Python

Project description

Linflex

A linear algebra package written in Python

Installation

Install using either pip or rye:

pip install linflex
rye add linflex

Getting started

from linflex import Vec2

a = Vec2(3, 4)
b = Vec2(2, -1)

assert a + b == Vec2(5, 3)
assert a - b == Vec2(1, 5)
assert a.length() == 5
assert -Vec2(2, -3) == Vec2(-2, 3)

c = Vec2(1, 1)
c += Vec2(0, 1)
assert c == Vec2(1, 2)

x, y = Vec2(3, 4)  # Supports tuple destructuring
assert x == 3 and y == 4

Rational

linflex was created to fill the need for a common Vec2 class accross my projects and packages. It is lightweight, as it only depends on typing-extensions. Aside from linear algebra, I also needed helper functions like lerp, sign and clamp, which was put into good use by <Vec2>.lerp, and alike. Naming and functionality is mainly inspired by the Godot Game Engine.

Includes

  • Functions
    • lerp
    • sign
    • clamp
    • move_toward
  • Datastructures
    • Vec2
    • Vec2i
    • Vec3

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linflex-0.3.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linflex-0.3.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file linflex-0.3.1.tar.gz.

File metadata

  • Download URL: linflex-0.3.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for linflex-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7f6c8848389e02f4c64117e24b114f81104a9ac5295cd5ba052626d833ef6ef9
MD5 43afd6faf4095df8565da06e99936459
BLAKE2b-256 71b67e0559cee07fd476a8f7f842869e7939bcf10308b72460562f2b8d09221d

See more details on using hashes here.

File details

Details for the file linflex-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: linflex-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for linflex-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24d52f99ae3997eeb1b64b261c6648e5483aa124b8dc13d54b42d5bc530d82b0
MD5 357e7f287735b93e3ad44d5ba9a2e3d8
BLAKE2b-256 1191db5ce85e4bf72266f9d5535b7900cb9750a11f21b43d395fdf07a4fd9588

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page