Giter Club home page Giter Club logo

math's Introduction

Math

CI

PHP library containing math related code used in PocketMine-MP

math's People

Contributors

akmalfairuz avatar buchwasa avatar cortexpe avatar dependabot-preview[bot] avatar dependabot[bot] avatar dktapps avatar fuyutsuki avatar jasonw4331 avatar kygekdev avatar luca28pet avatar matcracker avatar nerahikada avatar pemapmodder avatar shoghicp avatar sof3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

math's Issues

Fatal error in Matrix class with PHP 8.1

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of pocketmine\math\Matrix::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///home/pmmp/crash/PocketMine-MP.phar/vendor/pocketmine/math/src/Matrix.php:43

PocketMine-MP version: 4.7.3 [Protocol 544]
Git commit: pmmp/PocketMine-MP@b5a049d
PHP version: 8.1.9
OS: Linux, linux

Composer libraries:

Immutable AxisAlignedBB, Vector3 etc

No one expects the manipulation methods of AxisAlignedBB to alter the AABB directly. Allowing this is also a headache.

We already don't use Vector3 as mutable since PM 4.0.

In PHP 8.1, it's possible to use readonly to make all of the properties immutable. In 8.2, we'll be able to make whole classes readonly, but that also prevents inheritance by non-readonly classes.

Type hinting PHPStan for Facing

It may be useful to specify the expected return type of Facing functions with: value-of<Facing::ALL>.

This can break many static analyses, because depending on the PHPstan levels, it will carry over if you pass a simple integer into a function accepting just a few values.

I think this option is worth considering, as it could prevent certain runtime errors in the event of an unaccepted value being supplied?

Write unit tests

This issue should be updated to include lists of specific things that should be tested against.

calculateIntercept will only return Down Side or North Side

so i was testing the faces from Ray Trace result returns using a pearl no matter from where i throw the pearl the faces will always return Down Side (0) or North Side (2), is it supposed to be like that or that just a bug todo with calculateIntercept in boundingBoxes?

Facing::rotate(): Accept facing on the same axis as given

Rotating Facing::UP or Facing::DOWN around the Axis::Y could just return the facing unchanged, instead of throwing an exception, and this would be valid.

Rotating an axis around itself does not change the positions of the ends of any line segment taken from it.

Bogus return value for Vector3->normalize() when length is zero

A zero vector cannot be normalized. Returning a zero vector for normalized zero vector is unexpected and creates interesting bugs (so far, this has usually been seen in conjuction with NAN for yaw/pitch in PocketMine-MP).

An exception should be thrown in this case instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.