Boundary box of rotated object



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/10/2004 at 04:02, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.206 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi,

    I'm trying to find the boundary box of an object. To do this im using BaseObject::GetRad()
    That's works fine if the object isn't rotated.

    If for example I rotated a default cube by 45 degrees on the Pitch axis, the boundary box would be slightly larger than Vector(50,50,50)(which GetRad() returns).

    Will I have to calculate it myself?

    Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/10/2004 at 05:23, xxxxxxxx wrote:

    To avoid to calculate yourself the bounding box, you could try something like this:

        
        
        
        
        // PSEUDOCODE
        
        
        
        
        1. Make a copy of the object global matrix (oldMtx = obj->GetMg())
        
        
        
        
        2. Assign an identity global matrix to the object (obj->SetMg(identity))
        
        
        
        
        3. Calculate the object bounding box (obj->GetRad())
        
        
        
        
        4. Reassign the original global matrix to the object (obj->SetMg(oldMtx))
        
        
        
    

    Hope it helps...


Log in to reply