Important: Please read the Qt Code of Conduct -

OBB (Oriented Bounding Box)

  • is there any class in Qt for OBB?

    I have checked QRectf but it seems that it is AABB (Axis aligned bounding box). Infact, I couldn't find any method in it for rotating it or setting angle in it.

  • Lifetime Qt Champion


    Are you looking for QTransform ?

  • I suppose it only transforms(rotates) the QRectf. What I really need is QRectf::intersect method. I seems to me it only works when two QRectf are aligned to the axies.

    I have tested QGraphicsItem::collidesWithItem. it works finely with rotted objects. yet it is a graphic item, not a class for testing collision.

  • Qt Champions 2017

    QRect and QRectF are normal rectangles, they can't be rotated as such. QTransform can be used with them, but will give you again a normal rectangle (i.e. the bounding box of the operation). You can however apply the transformation to points (QPoint), lines (QLine), polygons (QPolygon) and paths (QPainterPath). You can get the intersection of polygons though (QPolygon::intersected).

Log in to reply