
Originally Posted by
catch22
Basically, I don't need much more than basic bounding box testing for my project, however, I do want the ability to rotate rects.
Quads do pretty much exactly that, but their API is fairly limited. They do have the ability to fetch the containing rect of their rotation, but it's not precise (just an unrotated rect that encompasses the size of the rotation).
[snip]
I am not sure that I understand.
CL_Quad - Integer based
CL_Quadf - Float based
CL_Quadd - Double based
These classes have public member variables: p, q, r, s for the 4 corners of the quad.
For example:
Code:
CL_Quad
quad.p = CL_Vec2i(-10, -10);
quad.q = CL_Vec2i(10, -10);
quad.r = CL_Vec2i(10, 10);
quad.s = CL_Vec2i(-10, 10);
quad.rotate(CL_Vec2i(0,0), CL_Angle(45, cl_degrees));
quad.p, quad.q, quad.r, quad.s contains the rotated points.
Note - For floats, and double quads:
- These constructers are missing
Code:
CL_Quadf(const CL_Rectf &rect) : CL_Quadx<float>(rect) {}
CL_Quadd(const CL_Rectd &rect) : CL_Quadx<float>(rect) {}
They currently only have CL_Rect &rect
Bookmarks