Skip to content

Version 1.0-alpha1

Pre-release
Pre-release
Compare
Choose a tag to compare
@nbraud nbraud released this 25 May 21:48

Getting a pre-release onto PyPI allows us to unblock PPB and more easily get feedback from any testers.
Note that this is not expected to be final, as there are clearly issues we want to resolve before 1.0.

Breaking changes since 0.4.0rc1

  • Vectors are now immutable, as implemented by @dataclass(frozen=True) (#106)
  • The cross-product operator (x ^ y), introduced in 0.4.0rc1, is now removed. (#80)
    This is because its implementation was numerically unstable, and its only user (Vector2.angle) switched to a different method.

New features & improvements since 0.4.0rc1

  • Provide an API reference documentation in docstrings and on Read The Docs.

  • Vector2 is now a dataclass, and as such support all related introspection functions, dataclasses.update, ... (#106)

  • Vector2.asdict is a new method for converting vectors to vector-like dictionaries (#108).

  • Vector2.isclose supports a rel_to argument, to specify additional inputs that are considered for relative error (#64)

  • Vector2.rotate now uses higher-precision trigonometry, and better preserves vector lengths. (#89)

  • Vector2.scale_to is now more precise, at the cost of possible overflows with vectors larger than 1e75. (#87)

  • Support the / operator for vector-scalar division: v / λ is (mostly) equivalent to (1 / λ) * v. (#79)

  • Various performance improvements

    • Reserve space for the coordinates using __slots__ (#115)
      Vectors are now 3× smaller and most methods saw a 30%-50% speedup.
    • Passing a Vector2 instance to the Vector2 constructor doesn't return a new object anymore. (#142)
      This is correct, as vectors are immutable, and saves up memory and time.

Bug fixes since 0.4.0rc1

  • Vector2.scale_to now deals correctly with invalid inputs (#81):
    • raise ValueError when passed a negative length;
    • raise ZeroDivisionError when scaling the null vector to a non-null length. (#95)
  • Vector2.isclose now raises ValueError on negative tolerances. (#96)