I've been looking through the spine-c code because I needed to determine a bounding box for the entire skeleton without needing to define bounding boxes (which the SkeletonBounds seems to require) and I essentially duplicated the functionality of spSkeletonBounds_update in order to determine the absolute min/max values for x/y.

I noticed that the data I was getting back always had two values that were wrong.

This line in the SkeletonBounds.c: ... nds.c#L125

Seems backwards to me. It currently is:
self->minX = (float)INT_MAX;
self->minY = (float)INT_MIN;
self->maxX = (float)INT_MAX;
self->maxY = (float)INT_MIN;
But I think it should be:
self->minX = (float)INT_MAX;
self->minY = (float)INT_MAX;
self->maxX = (float)INT_MIN;
self->maxY = (float)INT_MIN;
In the logic that follows:
if (x < self->minX) self->minX = x;
if (y < self->minY) self->minY = y;
if (x > self->maxX) self->maxX = x;
if (y > self->maxY) self->maxY = y;
y will never be less that self->minY because self->minY is INT_MIN

likewise for self->maxX
  • Messaggi: 25


Fixed, thanks!
Avatar utente

  • Messaggi: 12126

Torna a Bugs