00001
00002
00003
00004
00005 #include "wall.h"
00006
00007 #include <eq/base/log.h>
00008
00009 using namespace eq::base;
00010 using namespace std;
00011
00012 namespace eq
00013 {
00014 Wall::Wall()
00015 : bottomLeft( -.8f, -.5f, -1.f ),
00016 bottomRight( .8f, -.5f, -1.f ),
00017 topLeft( -.8f, .5f, -1.f )
00018 {
00019 }
00020
00021 void Wall::resizeHorizontal( const float ratio )
00022 {
00023 if( ratio == 1.f || ratio < 0.f )
00024 return;
00025
00026 const vmml::Vector3f u_2 = (bottomRight - bottomLeft) * .5f;
00027 const vmml::Vector3f delta = u_2 * (ratio - 1.f);
00028 bottomLeft -= delta;
00029 bottomRight += delta;
00030 topLeft -= delta;
00031 }
00032
00033 void Wall::resizeVertical( const float ratio )
00034 {
00035 if( ratio == 1.f || ratio < 0.f )
00036 return;
00037
00038 const vmml::Vector3f v_2 = (topLeft - bottomLeft) * .5f;
00039 const vmml::Vector3f delta = v_2 * (ratio - 1.f);
00040 bottomLeft -= delta;
00041 bottomRight -= delta;
00042 topLeft += delta;
00043 }
00044
00045 bool Wall::operator == ( const Wall& rhs ) const
00046 {
00047 return ( bottomLeft == rhs.bottomLeft &&
00048 bottomRight == rhs.bottomRight &&
00049 topLeft == rhs.topLeft );
00050 }
00051
00052 bool Wall::operator != ( const Wall& rhs ) const
00053 {
00054 return ( bottomLeft != rhs.bottomLeft ||
00055 bottomRight != rhs.bottomRight ||
00056 topLeft != rhs.topLeft );
00057 }
00058
00059 ostream& operator << ( ostream& os, const Wall& wall )
00060 {
00061 os << "wall" << endl;
00062 os << "{" << endl << indent;
00063 os << "bottom_left " << wall.bottomLeft << endl;
00064 os << "bottom_right " << wall.bottomRight << endl;
00065 os << "top_left " << wall.topLeft << endl;
00066 os << exdent << "}";
00067 return os;
00068 }
00069
00070 }