Skip to content

0.3.0

Compare
Choose a tag to compare
@dktapps dktapps released this 14 Jul 19:12
· 60 commits to stable since this release
83ec067

This is a feature release, featuring significant API changes compared to 0.2.x.

Changes since 0.2.x

New features

  • Added Facing class, which allows using and manipulating 3D Facing values.
    • Vector3::SIDE_* constants are removed and replaced with Facing::* constants.
    • Vector3::getOppositeSide() is replaced by Facing::opposite().
    • Additional utilities like Facing::axis(), Facing::isPositive(), Facing::rotate() etc are provided.
  • Added Axis class.

Vector3

  • Removed the following API methods:
    • getOppositeSide(): use Facing::opposite() instead
    • setComponents(): mutating Vector3 is now discouraged, and in the future Vector3 will become immutable.
  • Vector3::SIDE_* constants have been removed (use Facing instead).
  • Added the following static API methods:
    • maxComponents(): returns a Vector3 with the highest x, y and z values of all the vectors given.
    • minComponents(): returns a Vector3 with the lowest x, y and z values of all the vectors given.
    • sum(): returns a Vector3 with x, y and z equalling the sums of the x, y and z values of the given vectors respectively.
  • Added the following dynamic API methods:
    • Added Vector3->sides(), which returns a Generator<Facing, Vector3> for all axis-aligned sides of the vector.
    • Added Vector3->sidesArray(), which returns array<Facing, Vector3> for all axis-aligned sides of the vector.
    • Added Vector3->sidesAroundAxis(), which returns Generator<Facing, Vector3> for axis-aligned sides of the vector not on the given axis.
    • Added Vector3->withComponents(), which allows easily creating a copy of a Vector3 while replacing one or more components of it.
  • Vector3->add() is split into two functions:
    • Vector3->add() now requires float, float, float and has no optional parameters.
    • Vector3->addVector() accepts Vector3, replacing the overloaded functionality of Vector3->add().
  • Vector3->subtract() is split into two functions:
    • Vector3->subtract() now requires float, float, float and has no optional parameters.
    • Vector3->subtractVector() accepts Vector3, replacing the overloaded functionality of Vector3->subtract().

AxisAlignedBB

  • AxisAlignedBB->__construct() now throws InvalidArgumentException if any of the min components are larger than their corresponding max components.
  • Removed the following API methods:
    • setBounds(): modifying AxisAlignedBB is now discouraged and AxisAlignedBB will become immutable in the future
    • setBB()
  • Added the following dynamic API methods:
    • extend(): adds a length of distance to the given face of the bounding box
    • extendedCopy()
    • trim(): removes a length of distance from the given face of the bounding box
    • trimmedCopy()
    • stretch(): adds a length of distance to both sides of the bounding box on the given axis
    • stretchedCopy()
    • squash(): removes a length of distance from both sides of the bounding box on the given axis
    • squashedCopy()
    • getXLength(): returns the difference between minX and maxX
    • getYLength(): returns the difference between minY and maxY
    • getZLength(): returns the difference between minZ and maxZ
    • isCube(): returns whether the bounding box's edges are all of approximately equal length
    • getVolume(): returns the amount of space inside the bounding box in cubic units
  • Added the following static API methods:
    • one(): returns a new AxisAlignedBB with min bounds 0,0,0 and max bounds 1,1,1