Metadata-Version: 2.4
Name: linflex
Version: 0.3.4
Summary: A linear algebra package written in Python
Keywords: math,math-functions,vector,vec2,vec3
Author: Havsalt
Author-email: Havsalt <77575424+Havsalt@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Dist: typing-extensions>=4.4.0 ; python_full_version < '3.11'
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/havsalt/linflex
Project-URL: Repository, https://github.com/havsalt/linflex
Project-URL: Documentation, https://github.com/havsalt/linflex/blob/main/Docs.md
Project-URL: Issues, https://github.com/havsalt/linflex/issues
Project-URL: Changelog, https://github.com/havsalt/linflex/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# Linflex

A linear algebra package written in Python

## Installation

Install using your preferred Python package manager:

```bash
uv add linflex
```

```bash
pip install linflex
```

## Getting started

```python
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`

## Versioning

`linflex` uses [SemVer](https://semver.org/), according to [The Cargo Book](https://doc.rust-lang.org/cargo/reference/semver.html).

## License

MIT
