Coder Social home page Coder Social logo

Comments (3)

viridia avatar viridia commented on September 22, 2024 1

I want to point out that in three.js the initial values are +INFINITY and -INFINITY, not FLOAT_MAX and FLOAT_MIN. For integer rects, there's no infinity, so MAX/MIN are the correct values.

This works because min(value, INFINITY) == value for all finite numbers. The converse is true for max/-INFINITY.

In practice, of course, no one is going to actually use a rectangle of either infinite or max size in rendering. The only purpose for having this is as a starting point for geometrical calculations.

Both Box2 and Box3 (the 3D version of Box) in three.js use this construction.

from bevy.

viridia avatar viridia commented on September 22, 2024 1

One more comment: A classic use case here is finding a bounding box of a set of points. By setting the initial rectangle to negative infinite size, we can then call union_point(pt) for each point in the set, without needing to treat the first point in the list as a special case.

from bevy.

Olle-Lukowski avatar Olle-Lukowski commented on September 22, 2024 1

I could go ahead and change this, I assume it is just updating the implementation of rect and updating docs accordingly that is needed?

from bevy.

Related Issues (20)

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.