00001 #include "Tuple3.hpp" 00002 #include "../math/CoorT.hpp" 00003 #include "../math/Math.hpp" 00004 #include <cstdio> 00005 00006 namespace se_core { 00007 00008 bool Tuple3 00009 ::epsilonEquals(const Tuple3& t1, coor_t epsilon) const { 00010 return (CoorT::abs(t1.x_ - x_) <= epsilon) && 00011 (CoorT::abs(t1.y_ - y_) <= epsilon) && 00012 (CoorT::abs(t1.z_ - z_) <= epsilon); 00013 } 00014 00015 se_err::Log& operator<< (se_err::Log& log, const Tuple3& t) { 00016 log << "(" << t.x_ << ", " << t.y_ << ", " << t.z_ << ")"; 00017 return log; 00018 } 00019 00020 char* Tuple3 00021 ::toString(char* buffer) const { 00022 # ifdef SE_FIXED_POINT 00023 sprintf(buffer, "(%d,%d,%d)", x_, y_,z_); 00024 # else 00025 sprintf(buffer, "(%f,%f,%f)", x_, y_,z_); 00026 # endif 00027 return buffer; 00028 } 00029 00030 00031 void Tuple3 00032 ::scale(scale_t s, const Tuple3& t1) { 00033 x_ = CoorT::scale(s, t1.x_); 00034 y_ = CoorT::scale(s, t1.y_); 00035 z_ = CoorT::scale(s, t1.z_); 00036 } 00037 00038 00039 void Tuple3 00040 ::scale(scale_t s) { 00041 x_ = CoorT::scale(s, x_); 00042 y_ = CoorT::scale(s, y_); 00043 z_ = CoorT::scale(s, z_); 00044 } 00045 00046 00047 const char* Tuple3 00048 ::toLog() const { 00049 sprintf(log_msg(), "(%f, %f, %f)", x_, y_, z_); 00050 return log_msg(); 00051 } 00052 00053 00054 00055 bool Tuple3 00056 ::isNan() const { 00057 return x_ != x_ || y_ != y_ || z_ != z_; 00058 } 00059 }
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:13 2007 by Doxygen version 1.3.9.1.