Ignore:
Timestamp:
03/31/06 17:29:32 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBox2d.cpp

    r699 r721  
    11 
    2 #include "IMGBox2d.h" 
     2#include <IMGBox2d.h> 
    33 
    4 namespace IMG { 
     4namespace IMG  
     5{ 
    56 
    6 Box2d::~Box2d() { 
     7Box2d::Box2d() 
     8{ 
     9    mMinimum.x =  BOUNDINGBOX_MAXVALUE; 
     10    mMinimum.y =  BOUNDINGBOX_MAXVALUE; 
     11     
     12    mMaximum.x = -BOUNDINGBOX_MAXVALUE; 
     13    mMaximum.y = -BOUNDINGBOX_MAXVALUE;          
    714} 
    815 
     16Box2d::~Box2d()  
     17{ 
     18} 
     19 
     20Ogre::Vector2 Box2d::GetMinimum()  
     21{  
     22    return mMinimum; 
     23} 
     24 
     25Ogre::Vector2 Box2d::GetMaximum()  
     26{  
     27    return mMaximum;  
     28} 
     29 
     30void Box2d::SetBoundBox(float x, float y, float X, float Y)  
     31{ 
     32    mMinimum.x = x; 
     33    mMinimum.y = y; 
     34    mMaximum.x = X; 
     35    mMaximum.y = Y; 
     36} 
     37 
     38void Box2d::AddBoundingVector3(float x, float y) 
     39{ 
     40    if (x < mMinimum.x) 
     41        { 
     42                mMinimum.x = x;  
     43        } 
     44         
     45        if (x > mMaximum.x) 
     46        { 
     47                mMaximum.x = x; 
     48        } 
     49 
     50    if (y < mMinimum.y) 
     51        { 
     52                mMinimum.y = y; 
     53        } 
     54         
     55        if (y > mMaximum.y) 
     56        { 
     57                mMaximum.y = y; 
     58        } 
     59} 
     60 
     61void Box2d::Print() 
     62{ 
     63        Ogre::LogManager::getSingleton().logMessage("Valor de la Caixa: (" + Ogre::StringConverter::toString(Ogre::Vector3(mMinimum.x, mMinimum.y, 0)) + ") - (" + Ogre::StringConverter::toString(Ogre::Vector3(mMaximum.x, mMaximum.y, 0)) + ")"); 
     64} 
     65 
     66Ogre::Vector2 Box2d::GetCorner(int corner) const  
     67{ 
     68        Ogre::Vector2 vector; 
     69 
     70    switch (corner) 
     71    {            
     72        case BOX_CORNER_xy: vector = Ogre::Vector2(mMinimum.x, mMinimum.y ); break; 
     73        case BOX_CORNER_xY: vector = Ogre::Vector2(mMinimum.x, mMaximum.y ); break; 
     74        case BOX_CORNER_Xy: vector = Ogre::Vector2(mMaximum.x, mMinimum.y ); break; 
     75        case BOX_CORNER_XY: vector = Ogre::Vector2(mMaximum.x, mMaximum.y ); break;              
     76    } 
     77         
     78    return vector; 
     79} 
     80 
     81bool Box2d::In(int w, int h)  
     82{ 
     83    if (w <= (mMaximum.x - mMinimum.x) && h <= (mMaximum.y - mMinimum.y)) 
     84        { 
     85                return true; 
     86        } 
     87                 
     88    return false; 
     89} 
     90 
     91bool Box2d::FitPerfect(int w, int h) 
     92{        
     93    if (w == (mMaximum.x - mMinimum.x) && h == (mMaximum.y - mMinimum.y)) 
     94        { 
     95                return true; 
     96        } 
     97 
     98    return false; 
     99} 
    9100 
    10101} 
Note: See TracChangeset for help on using the changeset viewer.