recp / cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
MIT License
2.26k stars 229 forks source link

aabb2d_zero, aabb2d_diagonal and aabb2d_size #392

Closed duarm closed 7 months ago

duarm commented 7 months ago

Problem

Currently aabb2d_size returns vec2_distance(min, max), which would be the diagonal of the aabb, if you want to use the size to resolve collisions, you need to work backwards from what aabb2d_size does when it calls vec2_distance.

Solution

image

Looking for feedback if this is desirable, maybe come up with another name to avoid a breaking change on _size?

duarm commented 7 months ago

I should also split _zero into another PR

recp commented 7 months ago

Hi @duarm,

Sorry for the delay, I like the your new interpretation of _size and _diagonal/_diag we can go in this way. This will break existing codebase so keeping and deprecating _size for backward compatibility, introduce _sizev ( v/vector suffix ) for sizes as vector and _diagonal/_diag for size of diagonal would be an option.

Feedbacks are welcome

duarm commented 7 months ago

size -> diag and new _sizev function, made a macro for _size to _diag. Should we do the same for aabb, or should I open another PR?

recp commented 7 months ago

Should we do the same for aabb, or should I open another PR?

Yes other PR would be better, thanks 👍

recp commented 7 months ago

@duarm the PR is merged, thanks for your contributions 🚀