Coder Social home page Coder Social logo

Comments (6)

Jondolf avatar Jondolf commented on September 22, 2024 1

Rectangle and Cuboid are defined just by their half-extents, and don't have any notion of their position. This is useful for things like colliders (more efficient and ergonomic), but means that they cannot be used as AABBs or replace the rect types.

from bevy.

mockersf avatar mockersf commented on September 22, 2024 1

I think having a single type for every usages is more confusing than having specific types whose documentation can be tailored to what they're used for. And names of those types should convey their usage.

There's also UiRect which is not a rectangle

from bevy.

rparrett avatar rparrett commented on September 22, 2024

I have been wanting to get rid of NodeRect in the animation_graph example.

from bevy.

s-puig avatar s-puig commented on September 22, 2024

Eliminate bevy_render::Aabb in favor of the bevy_math types. Needs benchmarking.

Render::Aabb is a component and has a trait implementation for a render primitive so you can't remove it. I wouldn't be against newtyping, but delegation in Rust is terrible so i don't think there is anything to win either.

from bevy.

viridia avatar viridia commented on September 22, 2024

Just as an aside, the equivalent types in three.js are Box2 and Box3, both of which are defined by min/max vectors. (Theoretically you could have BoxN for any N whose min/max values are VecN. In practice, N is always either 2 or 3.)

from bevy.

ua-kxie avatar ua-kxie commented on September 22, 2024

I think having a single type for every usages is more confusing than having specific types whose documentation can be tailored to what they're used for. And names of those types should convey their usage.

A valid point, but it doesn't feel like this is being applied. prelude::* exports Rectangle, URect, and Rect which all reads as "rectangle". Rectangle contains no position information, but that's not apparent from the name. URect has essentially the same documentation as Rect and it's not suggested anywhere why I might want to use it over Rect.

Rectangle and Cuboid are defined just by their half-extents, and don't have any notion of their position. This is useful for things like colliders (more efficient and ergonomic), but means that they cannot be used as AABBs or replace the rect types.

I ran into a bit of a snag with AabbCast2d where I wasn't sure if I should be providing the positional data in the ray or the aabb. Is Rectangle more suitable here?

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.