initial commit

This commit is contained in:
2025-12-22 20:15:23 +01:00
commit f452c54368
8 changed files with 102 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
# Distribution / packaging
build/
dist/
*.egg-info/

9
INSTALL Normal file
View File

@@ -0,0 +1,9 @@
* Installation
python -m pip install . --break-system-packages
# or in 'development mode'
python -m pip install -e . --break-system-packages
# or inside a virtual environment using e.g. poetry
poetry install
* Uninstallation
python -m pip uninstall fvr --break-system-packages

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# fvr
fvr; a suite of tools designed to enhance efficiency and productivity.

38
pyproject.toml Normal file
View File

@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "fvr"
dynamic = ["version"]
description = "Various tools"
license = "MIT"
license-files = ["LICEN[CS]E.*"]
authors = [
{ name = "Daniel Weschke", email = "daniel.weschke@directbox.de" },
]
keywords = [
"mechanics", "materials",
]
readme = "README.md"
classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Office/Business",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
[tool.setuptools.dynamic]
version = {attr = "fvr.__version__"}
[tool.setuptools.packages.find]
where = ["src"]
include = ["fvr*"]
# namespaces = false

23
src/fvr/__init__.py Normal file
View File

@@ -0,0 +1,23 @@
import sys
import pathlib
import importlib
__version__ = "2025.12.22"
def rundir():
"""
returns the path of the script running or the current working directory.
"""
if sys.argv[0] == '-c':
return pathlib.Path.cwd()
return pathlib.Path(sys.argv[0]).parent
# return pathlib.Path(sys.argv[0]).parent.resolve()
def reload(module):
importlib.reload(module)
def printdoc(object):
res = object.__doc__
print(res)

16
src/fvr/geom.py Normal file
View File

@@ -0,0 +1,16 @@
from fvr.typing import FloatArray
def area(vertices: FloatArray) -> float:
r"""Determine the area of a simple polygon.
Shoelace formula, Gauss's area formula, surveyor's formula
https://en.wikipedia.org/wiki/Shoelace_formula
"""
count = len(vertices) # of corners
result = 0.0
for i in range(count):
j = (i + 1) % count
result += vertices[i][0] * vertices[j][1] - vertices[i][1] * vertices[j][0]
result = abs(result) / 2.0
return result

0
src/fvr/py.typed Normal file
View File

5
src/fvr/typing.py Normal file
View File

@@ -0,0 +1,5 @@
from collections.abc import Sequence
import numpy as np
from numpy.typing import NDArray
type FloatArray = Sequence[float] | NDArray[np.float64]