| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- // Filename: lvecBase3_src.I
- // Created by: drose (08Mar00)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Default Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::
- FLOATNAME(LVecBase3)() {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::
- FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©) {
- _v.v._0 = copy._v.v._0;
- _v.v._1 = copy._v.v._1;
- _v.v._2 = copy._v.v._2;
- // (*this) = copy;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Copy Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- operator = (const FLOATNAME(LVecBase3) ©) {
- _v.v._0 = copy._v.v._0;
- _v.v._1 = copy._v.v._1;
- _v.v._2 = copy._v.v._2;
- // set(copy[0], copy[1], copy[2]);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Fill Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- operator = (FLOATTYPE fill_value) {
- fill(fill_value);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::
- FLOATNAME(LVecBase3)(FLOATTYPE fill_value) {
- fill(fill_value);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::
- FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
- _v.v._0 = x;
- _v.v._1 = y;
- _v.v._2 = z;
- // set(x, y, z);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::zero Named Constructor
- // Access: Public
- // Description: Returns a zero-length vector.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- zero() {
- return _zero;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::unit_x Named Constructor
- // Access: Public
- // Description: Returns a unit X vector.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- unit_x() {
- return _unit_x;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::unit_y Named Constructor
- // Access: Public
- // Description: Returns a unit Y vector.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- unit_y() {
- return _unit_y;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::unit_z Named Constructor
- // Access: Public
- // Description: Returns a unit Z vector.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
- unit_z() {
- return _unit_z;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Destructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::
- ~FLOATNAME(LVecBase3)() {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Indexing Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- operator [](int i) const {
- //nassertr(i >= 0 && i < 3, 0);
- return _v.data[i];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::Indexing Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase3)::
- operator [](int i) {
- //nassertr(i >= 0 && i < 3, _v.v._0);
- return _v.data[i];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::is_nan
- // Access: Public
- // Description: Returns true if any component of the vector is
- // not-a-number, false otherwise.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- is_nan() const {
- return cnan(_v.v._0) || cnan(_v.v._1) || cnan(_v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_cell
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- get_cell(int i) const {
- // nassertr(i >= 0 && i < 3, 0);
- return _v.data[i];
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_x
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- get_x() const {
- return _v.v._0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_y
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- get_y() const {
- return _v.v._1;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_z
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- get_z() const {
- return _v.v._2;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::set_cell
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- set_cell(int i, FLOATTYPE value) {
- // nassertv(i >= 0 && i < 3);
- _v.data[i] = value;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::set_x
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- set_x(FLOATTYPE value) {
- _v.v._0 = value;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::set_y
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- set_y(FLOATTYPE value) {
- _v.v._1 = value;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::set_z
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- set_z(FLOATTYPE value) {
- _v.v._2 = value;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_data
- // Access: Public
- // Description: Returns the address of the first of the three data
- // elements in the vector. The remaining elements
- // occupy the next positions consecutively in memory.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH const FLOATTYPE *FLOATNAME(LVecBase3)::
- get_data() const {
- return _v.data;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::get_num_components
- // Access: Public
- // Description: Returns the number of elements in the vector, three.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH int FLOATNAME(LVecBase3)::
- get_num_components() const {
- return 3;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::begin
- // Access: Public
- // Description: Returns an iterator that may be used to traverse the
- // elements of the matrix, STL-style.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
- begin() {
- return _v.data;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::end
- // Access: Public
- // Description: Returns an iterator that may be used to traverse the
- // elements of the matrix, STL-style.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
- end() {
- return begin() + get_num_components();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::begin
- // Access: Public
- // Description: Returns an iterator that may be used to traverse the
- // elements of the matrix, STL-style.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
- begin() const {
- return _v.data;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::end
- // Access: Public
- // Description: Returns an iterator that may be used to traverse the
- // elements of the matrix, STL-style.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
- end() const {
- return begin() + get_num_components();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::fill
- // Access: Public
- // Description: Sets each element of the vector to the indicated
- // fill_value. This is particularly useful for
- // initializing to zero.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- fill(FLOATTYPE fill_value) {
- _v.v._0 = fill_value;
- _v.v._1 = fill_value;
- _v.v._2 = fill_value;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::set
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
- _v.v._0 = x;
- _v.v._1 = y;
- _v.v._2 = z;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::dot
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
- dot(const FLOATNAME(LVecBase3) &other) const {
- return _v.v._0 * other._v.v._0 + _v.v._1 * other._v.v._1 + _v.v._2 * other._v.v._2;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::cross
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- cross(const FLOATNAME(LVecBase3) &other) const {
- return FLOATNAME(LVecBase3)(_v.v._1 * other._v.v._2 - other._v.v._1 * _v.v._2,
- other._v.v._0 * _v.v._2 - _v.v._0 * other._v.v._2,
- _v.v._0 * other._v.v._1 - other._v.v._0 * _v.v._1);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator <
- // Access: Public
- // Description: This performs a lexicographical comparison. It's of
- // questionable mathematical meaning, but sometimes has
- // a practical purpose for sorting unique vectors,
- // especially in an STL container. Also see
- // compare_to().
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- operator < (const FLOATNAME(LVecBase3) &other) const {
- return (compare_to(other) < 0);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator ==
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- operator == (const FLOATNAME(LVecBase3) &other) const {
- return (_v.v._0 == other._v.v._0 &&
- _v.v._1 == other._v.v._1 &&
- _v.v._2 == other._v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator !=
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- operator != (const FLOATNAME(LVecBase3) &other) const {
- return !operator == (other);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::compare_to
- // Access: Public
- // Description: This flavor of compare_to uses a default threshold
- // value based on the numeric type.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH int FLOATNAME(LVecBase3)::
- compare_to(const FLOATNAME(LVecBase3) &other) const {
- return compare_to(other, NEARLY_ZERO(FLOATTYPE));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::compare_to
- // Access: Public
- // Description: Sorts vectors lexicographically, componentwise.
- // Returns a number less than 0 if this vector sorts
- // before the other one, greater than zero if it sorts
- // after, 0 if they are equivalent (within the indicated
- // tolerance).
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH int FLOATNAME(LVecBase3)::
- compare_to(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
- if (!IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold)) {
- return (_v.v._0 < other._v.v._0) ? -1 : 1;
- }
- if (!IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)) {
- return (_v.v._1 < other._v.v._1) ? -1 : 1;
- }
- if (!IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold)) {
- return (_v.v._2 < other._v.v._2) ? -1 : 1;
- }
- return 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::unary -
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- operator - () const {
- return FLOATNAME(LVecBase3)(-_v.v._0, -_v.v._1, -_v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::vector + vector
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- operator + (const FLOATNAME(LVecBase3) &other) const {
- return FLOATNAME(LVecBase3)(_v.v._0 + other._v.v._0,
- _v.v._1 + other._v.v._1,
- _v.v._2 + other._v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::vector - vector
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- operator - (const FLOATNAME(LVecBase3) &other) const {
- return FLOATNAME(LVecBase3)(_v.v._0 - other._v.v._0,
- _v.v._1 - other._v.v._1,
- _v.v._2 - other._v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::vector * scalar
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- operator * (FLOATTYPE scalar) const {
- return FLOATNAME(LVecBase3)(_v.v._0 * scalar,
- _v.v._1 * scalar,
- _v.v._2 * scalar);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::vector / scalar
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
- operator / (FLOATTYPE scalar) const {
- FLOATTYPE recip_scalar = 1.0f/scalar;
- return FLOATNAME(LVecBase3)(_v.v._0 * recip_scalar,
- _v.v._1 * recip_scalar,
- _v.v._2 * recip_scalar);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator +=
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- operator += (const FLOATNAME(LVecBase3) &other) {
- _v.v._0 += other._v.v._0;
- _v.v._1 += other._v.v._1;
- _v.v._2 += other._v.v._2;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator -=
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- operator -= (const FLOATNAME(LVecBase3) &other) {
- _v.v._0 -= other._v.v._0;
- _v.v._1 -= other._v.v._1;
- _v.v._2 -= other._v.v._2;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator *=
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- operator *= (FLOATTYPE scalar) {
- _v.v._0 *= scalar;
- _v.v._1 *= scalar;
- _v.v._2 *= scalar;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::operator /=
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- operator /= (FLOATTYPE scalar) {
- FLOATTYPE recip_scalar = 1.0f/scalar;
- _v.v._0 *= recip_scalar;
- _v.v._1 *= recip_scalar;
- _v.v._2 *= recip_scalar;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::cross product (with assigment)
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- cross_into(const FLOATNAME(LVecBase3) &other) {
- (*this) = cross(other);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::almost_equal
- // Access: Public
- // Description: Returns true if two vectors are memberwise equal
- // within a specified tolerance.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- almost_equal(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
- return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) &&
- IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) &&
- IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::almost_equal
- // Access: Public
- // Description: Returns true if two vectors are memberwise equal
- // within a default tolerance based on the numeric type.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH bool FLOATNAME(LVecBase3)::
- almost_equal(const FLOATNAME(LVecBase3) &other) const {
- return almost_equal(other, NEARLY_ZERO(FLOATTYPE));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::output
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- output(ostream &out) const {
- out << MAYBE_ZERO(_v.v._0) << " "
- << MAYBE_ZERO(_v.v._1) << " "
- << MAYBE_ZERO(_v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::generate_hash
- // Access: Public
- // Description: Adds the vector to the indicated hash generator.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- generate_hash(ChecksumHashGenerator &hash) const {
- generate_hash(hash, NEARLY_ZERO(FLOATTYPE));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::generate_hash
- // Access: Public
- // Description: Adds the vector to the indicated hash generator.
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- generate_hash(ChecksumHashGenerator &hash, FLOATTYPE threshold) const {
- hash.add_fp(_v.v._0, threshold);
- hash.add_fp(_v.v._1, threshold);
- hash.add_fp(_v.v._2, threshold);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::write_datagram
- // Access: Public
- // Description: Function to write itself into a datagram
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- write_datagram(Datagram &destination) const {
- destination.add_float32(_v.v._0);
- destination.add_float32(_v.v._1);
- destination.add_float32(_v.v._2);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: LVecBase3::read_datagram
- // Access: Public
- // Description: Function to read itself from a datagramIterator
- ////////////////////////////////////////////////////////////////////
- INLINE_LINMATH void FLOATNAME(LVecBase3)::
- read_datagram(DatagramIterator &source) {
- _v.v._0 = source.get_float32();
- _v.v._1 = source.get_float32();
- _v.v._2 = source.get_float32();
- }
|