00001 /* 00002 Copyright (C) 1997,1998,1999 00003 Kenji Hiranabe, Eiwa System Management, Inc. 00004 00005 This program is free software. 00006 Implemented by Kenji Hiranabe(hiranabe@esm.co.jp), 00007 conforming to the Java(TM) 3D API specification by Sun Microsystems. 00008 00009 Permission to use, copy, modify, distribute and sell this software 00010 and its documentation for any purpose is hereby granted without fee, 00011 provided that the above copyright notice appear in all copies and 00012 that both that copyright notice and this permission notice appear 00013 in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc. 00014 makes no representations about the suitability of this software for any 00015 purpose. It is provided "AS IS" with NO WARRANTY. 00016 00017 Copyright (C) 2004 00018 Rune Myrland, Skalden Studio AS 00019 SagaEngine adaptions, involving conversion from floating point values to fixed point values. 00020 Kenji Hiranabe's license apply. 00021 */ 00022 #ifndef base_vecmath_Point3_hpp 00023 #define base_vecmath_Point3_hpp 00024 00025 #include "util_vecmath.hpp" 00026 #include "Vector3.hpp" 00027 00028 namespace se_core { 00033 class _SeCoreExport Point3 : public Vector3 { 00034 public: 00041 Point3(coor_t x, coor_t y, coor_t z): Vector3(x, y, z) { } 00042 00047 Point3(const coor_t p[]): Vector3(p) { } 00048 00049 /* 00050 * Constructs and initializes a Point3 from the specified Tuple3d. 00051 * @param t1 the Tuple3d containing the initialization x y z data 00052 */ 00053 Point3(const Tuple3& t1): Vector3(t1) { } 00054 00058 Point3(): Vector3() { } 00059 00065 coor_double_t distanceSquared(const Point3& p1) const { 00066 coor_double_t dx = x_ - p1.x_; 00067 coor_double_t dy = y_ - p1.y_; 00068 coor_double_t dz = z_ - p1.z_; 00069 return dx*dx + dy*dy + dz*dz; 00070 } 00071 00077 coor_t distance(const Point3& p1) const; 00078 00084 coor_t distanceL1(const Point3& p1) const; 00085 00091 coor_t distanceLinf(const Point3& p1) const; 00092 00098 void project(const Point4& p1); 00099 00100 00109 inline coor_double_t xzDistanceSquared(const Point3& c) const { 00110 coor_double_t xDist = c.x_ - x_; 00111 coor_double_t zDist = c.z_ - z_; 00112 return ((xDist * xDist) + (zDist * zDist)); 00113 } 00114 00119 coor_t xzDistanceLinf(const Point3& c) const; 00120 00124 coor_t yDistance(const Point3& c) const; 00125 00132 inline coor_tile_t xTile() const { return CoorT::tile(x_); } 00133 00140 inline coor_tile_t zTile() const { return CoorT::tile(z_); } 00141 00151 coor_in_t xInsideTile() const { return CoorT::inTile(x_); } 00152 00162 coor_in_t zInsideTile() const { return CoorT::inTile(z_); } 00163 00164 00165 00171 bray_t yawTowards(const Point3& c) const; 00172 00173 void eulerTowards(const Point3& c, Euler3& dest) const; 00174 00175 void nearestPoint(const Point3& pt1, const Point3& pt2, const Point3& testPoint); 00176 00177 // copy constructor and operator = is made by complier 00178 00179 Point3& operator=(const Tuple3& t) { 00180 Tuple3::operator=(t); 00181 return *this; 00182 } 00183 }; 00184 00185 } // Namespace 00186 00187 /* 00188 inline 00189 se_core::Point3 operator*(scale_t s, const se_core::Point3& t1) { 00190 return operator*(s, (const se_core::Tuple3&)t1); 00191 } 00192 */ 00193 00194 00195 #endif /* POINT3_H */
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:13 2007 by Doxygen version 1.3.9.1.