Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/linmath/lvecBase3_src.I

Go to the documentation of this file.
00001 // Filename: lvecBase3_src.I
00002 // Created by:  drose (08Mar00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //     Function: LVecBase3::Default Constructor
00021 //       Access: Public
00022 //  Description:
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE_LINMATH FLOATNAME(LVecBase3)::
00025 FLOATNAME(LVecBase3)() {
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: LVecBase3::Copy Constructor
00030 //       Access: Public
00031 //  Description:
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE_LINMATH FLOATNAME(LVecBase3)::
00034 FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) &copy) {
00035   _v.v._0 = copy._v.v._0;
00036   _v.v._1 = copy._v.v._1;
00037   _v.v._2 = copy._v.v._2;
00038 //  (*this) = copy;
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: LVecBase3::Copy Assignment Operator
00043 //       Access: Public
00044 //  Description:
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00047 operator = (const FLOATNAME(LVecBase3) &copy) {
00048   _v.v._0 = copy._v.v._0;
00049   _v.v._1 = copy._v.v._1;
00050   _v.v._2 = copy._v.v._2;
00051 //  set(copy[0], copy[1], copy[2]);
00052   return *this;
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: LVecBase3::Fill Assignment Operator
00057 //       Access: Public
00058 //  Description:
00059 ////////////////////////////////////////////////////////////////////
00060 INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00061 operator = (FLOATTYPE fill_value) {
00062   fill(fill_value);
00063   return *this;
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: LVecBase3::Constructor
00068 //       Access: Public
00069 //  Description:
00070 ////////////////////////////////////////////////////////////////////
00071 INLINE_LINMATH FLOATNAME(LVecBase3)::
00072 FLOATNAME(LVecBase3)(FLOATTYPE fill_value) {
00073   fill(fill_value);
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: LVecBase3::Constructor
00078 //       Access: Public
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 INLINE_LINMATH FLOATNAME(LVecBase3)::
00082 FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
00083   _v.v._0 = x;
00084   _v.v._1 = y;
00085   _v.v._2 = z;
00086 //  set(x, y, z);
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: LVecBase3::zero Named Constructor
00091 //       Access: Public
00092 //  Description: Returns a zero-length vector.
00093 ////////////////////////////////////////////////////////////////////
00094 INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00095 zero() {
00096   return _zero;
00097 }
00098 
00099 ////////////////////////////////////////////////////////////////////
00100 //     Function: LVecBase3::unit_x Named Constructor
00101 //       Access: Public
00102 //  Description: Returns a unit X vector.
00103 ////////////////////////////////////////////////////////////////////
00104 INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00105 unit_x() {
00106   return _unit_x;
00107 }
00108 
00109 ////////////////////////////////////////////////////////////////////
00110 //     Function: LVecBase3::unit_y Named Constructor
00111 //       Access: Public
00112 //  Description: Returns a unit Y vector.
00113 ////////////////////////////////////////////////////////////////////
00114 INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00115 unit_y() {
00116   return _unit_y;
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: LVecBase3::unit_z Named Constructor
00121 //       Access: Public
00122 //  Description: Returns a unit Z vector.
00123 ////////////////////////////////////////////////////////////////////
00124 INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
00125 unit_z() {
00126   return _unit_z;
00127 }
00128 
00129 ////////////////////////////////////////////////////////////////////
00130 //     Function: LVecBase3::Destructor
00131 //       Access: Public
00132 //  Description:
00133 ////////////////////////////////////////////////////////////////////
00134 INLINE_LINMATH FLOATNAME(LVecBase3)::
00135 ~FLOATNAME(LVecBase3)() {
00136 }
00137 
00138 ////////////////////////////////////////////////////////////////////
00139 //     Function: LVecBase3::Indexing Operator
00140 //       Access: Public
00141 //  Description:
00142 ////////////////////////////////////////////////////////////////////
00143 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00144 operator [](int i) const {
00145   nassertr(i >= 0 && i < 3, 0.0);
00146   return _v.data[i];
00147 }
00148 
00149 ////////////////////////////////////////////////////////////////////
00150 //     Function: LVecBase3::Indexing Operator
00151 //       Access: Public
00152 //  Description:
00153 ////////////////////////////////////////////////////////////////////
00154 INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase3)::
00155 operator [](int i) {
00156   nassertr(i >= 0 && i < 3, _v.data[0]);
00157   return _v.data[i];
00158 }
00159 
00160 ////////////////////////////////////////////////////////////////////
00161 //     Function: LVecBase3::is_nan
00162 //       Access: Public
00163 //  Description: Returns true if any component of the vector is
00164 //               not-a-number, false otherwise.
00165 ////////////////////////////////////////////////////////////////////
00166 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00167 is_nan() const {
00168   return cnan(_v.v._0) || cnan(_v.v._1) || cnan(_v.v._2);
00169 }
00170 
00171 ////////////////////////////////////////////////////////////////////
00172 //     Function: LVecBase3::get_cell
00173 //       Access: Public
00174 //  Description:
00175 ////////////////////////////////////////////////////////////////////
00176 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00177 get_cell(int i) const {
00178   nassertr(i >= 0 && i < 3, 0);
00179   return _v.data[i];
00180 }
00181 
00182 ////////////////////////////////////////////////////////////////////
00183 //     Function: LVecBase3::get_x
00184 //       Access: Public
00185 //  Description:
00186 ////////////////////////////////////////////////////////////////////
00187 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00188 get_x() const {
00189   return _v.v._0;
00190 }
00191 
00192 ////////////////////////////////////////////////////////////////////
00193 //     Function: LVecBase3::get_y
00194 //       Access: Public
00195 //  Description:
00196 ////////////////////////////////////////////////////////////////////
00197 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00198 get_y() const {
00199   return _v.v._1;
00200 }
00201 
00202 ////////////////////////////////////////////////////////////////////
00203 //     Function: LVecBase3::get_z
00204 //       Access: Public
00205 //  Description:
00206 ////////////////////////////////////////////////////////////////////
00207 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00208 get_z() const {
00209   return _v.v._2;
00210 }
00211 
00212 ////////////////////////////////////////////////////////////////////
00213 //     Function: LVecBase3::set_cell
00214 //       Access: Public
00215 //  Description:
00216 ////////////////////////////////////////////////////////////////////
00217 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00218 set_cell(int i, FLOATTYPE value) {
00219   nassertv(i >= 0 && i < 3);
00220   _v.data[i] = value;
00221 }
00222 
00223 ////////////////////////////////////////////////////////////////////
00224 //     Function: LVecBase3::set_x
00225 //       Access: Public
00226 //  Description:
00227 ////////////////////////////////////////////////////////////////////
00228 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00229 set_x(FLOATTYPE value) {
00230   _v.v._0 = value;
00231 }
00232 
00233 ////////////////////////////////////////////////////////////////////
00234 //     Function: LVecBase3::set_y
00235 //       Access: Public
00236 //  Description:
00237 ////////////////////////////////////////////////////////////////////
00238 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00239 set_y(FLOATTYPE value) {
00240   _v.v._1 = value;
00241 }
00242 
00243 ////////////////////////////////////////////////////////////////////
00244 //     Function: LVecBase3::set_z
00245 //       Access: Public
00246 //  Description:
00247 ////////////////////////////////////////////////////////////////////
00248 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00249 set_z(FLOATTYPE value) {
00250   _v.v._2 = value;
00251 }
00252 
00253 ////////////////////////////////////////////////////////////////////
00254 //     Function: LVecBase3::get_data
00255 //       Access: Public
00256 //  Description: Returns the address of the first of the three data
00257 //               elements in the vector.  The remaining elements
00258 //               occupy the next positions consecutively in memory.
00259 ////////////////////////////////////////////////////////////////////
00260 INLINE_LINMATH const FLOATTYPE *FLOATNAME(LVecBase3)::
00261 get_data() const {
00262   return _v.data;
00263 }
00264 
00265 ////////////////////////////////////////////////////////////////////
00266 //     Function: LVecBase3::get_num_components
00267 //       Access: Public
00268 //  Description: Returns the number of elements in the vector, three.
00269 ////////////////////////////////////////////////////////////////////
00270 INLINE_LINMATH int FLOATNAME(LVecBase3)::
00271 get_num_components() const {
00272   return 3;
00273 }
00274 
00275 ////////////////////////////////////////////////////////////////////
00276 //     Function: LVecBase3::begin
00277 //       Access: Public
00278 //  Description: Returns an iterator that may be used to traverse the
00279 //               elements of the matrix, STL-style.
00280 ////////////////////////////////////////////////////////////////////
00281 INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
00282 begin() {
00283   return _v.data;
00284 }
00285 
00286 ////////////////////////////////////////////////////////////////////
00287 //     Function: LVecBase3::end
00288 //       Access: Public
00289 //  Description: Returns an iterator that may be used to traverse the
00290 //               elements of the matrix, STL-style.
00291 ////////////////////////////////////////////////////////////////////
00292 INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
00293 end() {
00294   return begin() + get_num_components();
00295 }
00296 
00297 ////////////////////////////////////////////////////////////////////
00298 //     Function: LVecBase3::begin
00299 //       Access: Public
00300 //  Description: Returns an iterator that may be used to traverse the
00301 //               elements of the matrix, STL-style.
00302 ////////////////////////////////////////////////////////////////////
00303 INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
00304 begin() const {
00305   return _v.data;
00306 }
00307 
00308 ////////////////////////////////////////////////////////////////////
00309 //     Function: LVecBase3::end
00310 //       Access: Public
00311 //  Description: Returns an iterator that may be used to traverse the
00312 //               elements of the matrix, STL-style.
00313 ////////////////////////////////////////////////////////////////////
00314 INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
00315 end() const {
00316   return begin() + get_num_components();
00317 }
00318 
00319 ////////////////////////////////////////////////////////////////////
00320 //     Function: LVecBase3::fill
00321 //       Access: Public
00322 //  Description: Sets each element of the vector to the indicated
00323 //               fill_value.  This is particularly useful for
00324 //               initializing to zero.
00325 ////////////////////////////////////////////////////////////////////
00326 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00327 fill(FLOATTYPE fill_value) {
00328   _v.v._0 = fill_value;
00329   _v.v._1 = fill_value;
00330   _v.v._2 = fill_value;
00331 }
00332 
00333 ////////////////////////////////////////////////////////////////////
00334 //     Function: LVecBase3::set
00335 //       Access: Public
00336 //  Description:
00337 ////////////////////////////////////////////////////////////////////
00338 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00339 set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
00340   _v.v._0 = x;
00341   _v.v._1 = y;
00342   _v.v._2 = z;
00343 }
00344 
00345 ////////////////////////////////////////////////////////////////////
00346 //     Function: LVecBase3::dot
00347 //       Access: Public
00348 //  Description:
00349 ////////////////////////////////////////////////////////////////////
00350 INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
00351 dot(const FLOATNAME(LVecBase3) &other) const {
00352   return _v.v._0 * other._v.v._0 + _v.v._1 * other._v.v._1 + _v.v._2 * other._v.v._2;
00353 }
00354 
00355 ////////////////////////////////////////////////////////////////////
00356 //     Function: LVecBase3::cross
00357 //       Access: Public
00358 //  Description:
00359 ////////////////////////////////////////////////////////////////////
00360 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00361 cross(const FLOATNAME(LVecBase3) &other) const {
00362   return FLOATNAME(LVecBase3)(_v.v._1 * other._v.v._2 - other._v.v._1 * _v.v._2,
00363                               other._v.v._0 * _v.v._2 - _v.v._0 * other._v.v._2,
00364                               _v.v._0 * other._v.v._1 - other._v.v._0 * _v.v._1);
00365 }
00366 
00367 ////////////////////////////////////////////////////////////////////
00368 //     Function: LVecBase3::operator <
00369 //       Access: Public
00370 //  Description: This performs a lexicographical comparison.  It's of
00371 //               questionable mathematical meaning, but sometimes has
00372 //               a practical purpose for sorting unique vectors,
00373 //               especially in an STL container.  Also see
00374 //               compare_to().
00375 ////////////////////////////////////////////////////////////////////
00376 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00377 operator < (const FLOATNAME(LVecBase3) &other) const {
00378   return (compare_to(other) < 0);
00379 }
00380 
00381 ////////////////////////////////////////////////////////////////////
00382 //     Function: LVecBase3::operator ==
00383 //       Access: Public
00384 //  Description:
00385 ////////////////////////////////////////////////////////////////////
00386 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00387 operator == (const FLOATNAME(LVecBase3) &other) const {
00388   return (_v.v._0 == other._v.v._0 &&
00389           _v.v._1 == other._v.v._1 &&
00390           _v.v._2 == other._v.v._2);
00391 }
00392 
00393 ////////////////////////////////////////////////////////////////////
00394 //     Function: LVecBase3::operator !=
00395 //       Access: Public
00396 //  Description:
00397 ////////////////////////////////////////////////////////////////////
00398 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00399 operator != (const FLOATNAME(LVecBase3) &other) const {
00400   return !operator == (other);
00401 }
00402 
00403 ////////////////////////////////////////////////////////////////////
00404 //     Function: LVecBase3::compare_to
00405 //       Access: Public
00406 //  Description: This flavor of compare_to uses a default threshold
00407 //               value based on the numeric type.
00408 ////////////////////////////////////////////////////////////////////
00409 INLINE_LINMATH int FLOATNAME(LVecBase3)::
00410 compare_to(const FLOATNAME(LVecBase3) &other) const {
00411   return compare_to(other, NEARLY_ZERO(FLOATTYPE));
00412 }
00413 
00414 ////////////////////////////////////////////////////////////////////
00415 //     Function: LVecBase3::compare_to
00416 //       Access: Public
00417 //  Description: Sorts vectors lexicographically, componentwise.
00418 //               Returns a number less than 0 if this vector sorts
00419 //               before the other one, greater than zero if it sorts
00420 //               after, 0 if they are equivalent (within the indicated
00421 //               tolerance).
00422 ////////////////////////////////////////////////////////////////////
00423 INLINE_LINMATH int FLOATNAME(LVecBase3)::
00424 compare_to(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
00425   if (!IS_THRESHOLD_COMPEQ(_v.v._0, other._v.v._0, threshold)) {
00426     return (_v.v._0 < other._v.v._0) ? -1 : 1;
00427   }
00428   if (!IS_THRESHOLD_COMPEQ(_v.v._1, other._v.v._1, threshold)) {
00429     return (_v.v._1 < other._v.v._1) ? -1 : 1;
00430   }
00431   if (!IS_THRESHOLD_COMPEQ(_v.v._2, other._v.v._2, threshold)) {
00432     return (_v.v._2 < other._v.v._2) ? -1 : 1;
00433   }
00434   return 0;
00435 }
00436 
00437 ////////////////////////////////////////////////////////////////////
00438 //     Function: LVecBase3::unary -
00439 //       Access: Public
00440 //  Description:
00441 ////////////////////////////////////////////////////////////////////
00442 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00443 operator - () const {
00444   return FLOATNAME(LVecBase3)(-_v.v._0, -_v.v._1, -_v.v._2);
00445 }
00446 
00447 ////////////////////////////////////////////////////////////////////
00448 //     Function: LVecBase3::vector + vector
00449 //       Access: Public
00450 //  Description:
00451 ////////////////////////////////////////////////////////////////////
00452 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00453 operator + (const FLOATNAME(LVecBase3) &other) const {
00454   return FLOATNAME(LVecBase3)(_v.v._0 + other._v.v._0,
00455                               _v.v._1 + other._v.v._1,
00456                               _v.v._2 + other._v.v._2);
00457 }
00458 
00459 ////////////////////////////////////////////////////////////////////
00460 //     Function: LVecBase3::vector - vector
00461 //       Access: Public
00462 //  Description:
00463 ////////////////////////////////////////////////////////////////////
00464 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00465 operator - (const FLOATNAME(LVecBase3) &other) const {
00466   return FLOATNAME(LVecBase3)(_v.v._0 - other._v.v._0,
00467                               _v.v._1 - other._v.v._1,
00468                               _v.v._2 - other._v.v._2);
00469 }
00470 
00471 ////////////////////////////////////////////////////////////////////
00472 //     Function: LVecBase3::vector * scalar
00473 //       Access: Public
00474 //  Description:
00475 ////////////////////////////////////////////////////////////////////
00476 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00477 operator * (FLOATTYPE scalar) const {
00478   return FLOATNAME(LVecBase3)(_v.v._0 * scalar,
00479                               _v.v._1 * scalar,
00480                               _v.v._2 * scalar);
00481 }
00482 
00483 ////////////////////////////////////////////////////////////////////
00484 //     Function: LVecBase3::vector / scalar
00485 //       Access: Public
00486 //  Description:
00487 ////////////////////////////////////////////////////////////////////
00488 INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
00489 operator / (FLOATTYPE scalar) const {
00490   FLOATTYPE recip_scalar = 1.0f/scalar;
00491   return FLOATNAME(LVecBase3)(_v.v._0 * recip_scalar,
00492                               _v.v._1 * recip_scalar,
00493                               _v.v._2 * recip_scalar);
00494 }
00495 
00496 ////////////////////////////////////////////////////////////////////
00497 //     Function: LVecBase3::operator +=
00498 //       Access: Public
00499 //  Description:
00500 ////////////////////////////////////////////////////////////////////
00501 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00502 operator += (const FLOATNAME(LVecBase3) &other) {
00503   _v.v._0 += other._v.v._0;
00504   _v.v._1 += other._v.v._1;
00505   _v.v._2 += other._v.v._2;
00506 }
00507 
00508 ////////////////////////////////////////////////////////////////////
00509 //     Function: LVecBase3::operator -=
00510 //       Access: Public
00511 //  Description:
00512 ////////////////////////////////////////////////////////////////////
00513 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00514 operator -= (const FLOATNAME(LVecBase3) &other) {
00515   _v.v._0 -= other._v.v._0;
00516   _v.v._1 -= other._v.v._1;
00517   _v.v._2 -= other._v.v._2;
00518 }
00519 
00520 ////////////////////////////////////////////////////////////////////
00521 //     Function: LVecBase3::operator *=
00522 //       Access: Public
00523 //  Description:
00524 ////////////////////////////////////////////////////////////////////
00525 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00526 operator *= (FLOATTYPE scalar) {
00527   _v.v._0 *= scalar;
00528   _v.v._1 *= scalar;
00529   _v.v._2 *= scalar;
00530 }
00531 
00532 ////////////////////////////////////////////////////////////////////
00533 //     Function: LVecBase3::operator /=
00534 //       Access: Public
00535 //  Description:
00536 ////////////////////////////////////////////////////////////////////
00537 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00538 operator /= (FLOATTYPE scalar) {
00539   FLOATTYPE recip_scalar = 1.0f/scalar;
00540   _v.v._0 *= recip_scalar;
00541   _v.v._1 *= recip_scalar;
00542   _v.v._2 *= recip_scalar;
00543 }
00544 
00545 ////////////////////////////////////////////////////////////////////
00546 //     Function: LVecBase3::cross product (with assigment)
00547 //       Access: Public
00548 //  Description:
00549 ////////////////////////////////////////////////////////////////////
00550 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00551 cross_into(const FLOATNAME(LVecBase3) &other) {
00552   (*this) = cross(other);
00553 }
00554 
00555 ////////////////////////////////////////////////////////////////////
00556 //     Function: LVecBase3::almost_equal
00557 //       Access: Public
00558 //  Description: Returns true if two vectors are memberwise equal
00559 //               within a specified tolerance.
00560 ////////////////////////////////////////////////////////////////////
00561 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00562 almost_equal(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
00563   return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) &&
00564           IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) &&
00565           IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold));
00566 }
00567 
00568 ////////////////////////////////////////////////////////////////////
00569 //     Function: LVecBase3::almost_equal
00570 //       Access: Public
00571 //  Description: Returns true if two vectors are memberwise equal
00572 //               within a default tolerance based on the numeric type.
00573 ////////////////////////////////////////////////////////////////////
00574 INLINE_LINMATH bool FLOATNAME(LVecBase3)::
00575 almost_equal(const FLOATNAME(LVecBase3) &other) const {
00576   return almost_equal(other, NEARLY_ZERO(FLOATTYPE));
00577 }
00578 
00579 ////////////////////////////////////////////////////////////////////
00580 //     Function: LVecBase3::output
00581 //       Access: Public
00582 //  Description:
00583 ////////////////////////////////////////////////////////////////////
00584 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00585 output(ostream &out) const {
00586   out << MAYBE_ZERO(_v.v._0) << " "
00587       << MAYBE_ZERO(_v.v._1) << " "
00588       << MAYBE_ZERO(_v.v._2);
00589 }
00590 
00591 
00592 ////////////////////////////////////////////////////////////////////
00593 //     Function: LVecBase3::generate_hash
00594 //       Access: Public
00595 //  Description: Adds the vector to the indicated hash generator.
00596 ////////////////////////////////////////////////////////////////////
00597 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00598 generate_hash(ChecksumHashGenerator &hashgen) const {
00599   generate_hash(hashgen, NEARLY_ZERO(FLOATTYPE));
00600 }
00601 
00602 ////////////////////////////////////////////////////////////////////
00603 //     Function: LVecBase3::generate_hash
00604 //       Access: Public
00605 //  Description: Adds the vector to the indicated hash generator.
00606 ////////////////////////////////////////////////////////////////////
00607 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00608 generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const {
00609   hashgen.add_fp(_v.v._0, threshold);
00610   hashgen.add_fp(_v.v._1, threshold);
00611   hashgen.add_fp(_v.v._2, threshold);
00612 }
00613 
00614 ////////////////////////////////////////////////////////////////////
00615 //     Function: LVecBase3::write_datagram
00616 //       Access: Public
00617 //  Description: Function to write itself into a datagram
00618 ////////////////////////////////////////////////////////////////////
00619 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00620 write_datagram(Datagram &destination) const {
00621   destination.add_float32(_v.v._0);
00622   destination.add_float32(_v.v._1);
00623   destination.add_float32(_v.v._2);
00624 }
00625 
00626 ////////////////////////////////////////////////////////////////////
00627 //     Function: LVecBase3::read_datagram
00628 //       Access: Public
00629 //  Description: Function to read itself from a datagramIterator
00630 ////////////////////////////////////////////////////////////////////
00631 INLINE_LINMATH void FLOATNAME(LVecBase3)::
00632 read_datagram(DatagramIterator &source) {
00633   _v.v._0 = source.get_float32();
00634   _v.v._1 = source.get_float32();
00635   _v.v._2 = source.get_float32();
00636 }

Generated on Fri May 2 00:40:16 2003 for Panda by doxygen1.3