Skip to content

Add a method to calculate a Puppet's bounds#117

Open
ArcturusEmrys wants to merge 6 commits into
Inochi2D:mainfrom
ArcturusEmrys:puppet-bounds
Open

Add a method to calculate a Puppet's bounds#117
ArcturusEmrys wants to merge 6 commits into
Inochi2D:mainfrom
ArcturusEmrys:puppet-bounds

Conversation

@ArcturusEmrys
Copy link
Copy Markdown
Contributor

This also includes a home-grown Rect type, as I didn't see any in Inox's math libraries.

Currently, we calculate puppet bounds as the union of all points, which seems to work well enough for what I'm doing right now.

Normally, I'd keep this code in my own project, but the ECS isn't part of the public API so I can't get at this information normally.

Comment thread inox2d/src/math/rect.rs
use glam::Vec2;

#[derive(Clone, Copy)]
pub struct Rect {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, since it's home-grown, I think I'd rather call it RectBounds, since it stores the top left and bottom right rather than a position and size like I would personally expect.

…rely.

This is about a 4-5x speedup of bounds calculation on myself. I haven't found
out why yet; I assume it either results in way better vector codegen or the
index list has a lot of repeats. Probably both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants