fwcd / fwcd/swift-utils

Improve API of `Vec2`, `Mat2`, `Vector` and `Matrix` in the next major version

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
14
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Specifically...

- Using the initializer style where possible (e.g. `Mat2.init(NDArray)` should be preferred over `NDArray.asMat2`)
- Making `.zero` and `.identity` a property/constant in `Vec2` and `Mat2`, to be consistent with `AdditiveArithmetic`
- Renaming `Vec2.mapBoth` to `.mapEach` (since `mapBoth` could also be read as applying to both components at once)
- Possibly renaming `T` to `Element` to be consistent with Swift types like `Array` (see e.g. [here](https://developer.apple.com/documentation/swift/sequence/map(_:)))
- Conforming the types to `Sendable` if `T: Sendable`

Internally, the types could also be refactored, e.g.

- By implementing elementwise arithmetic in terms of map/zip (like e.g. [`Coordinates`](https://github.com/fwcd/swift-geodesy/blob/1eae39a90ff057da486681d4a194d13b0139fa08/Sources/Geodesy/Coordinates.swift) from `swift-geodesy`)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.