lvector3_src.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Filename: lvector3_src.h
  2. // Created by: drose (24Sep99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Class : LVector3
  20. // Description : This is a three-component vector distance (as opposed
  21. // to a three-component point, which represents a
  22. // particular point in space). Some of the methods are
  23. // slightly different between LPoint3 and LVector3; in
  24. // particular, subtraction of two points yields a
  25. // vector, while addition of a vector and a point yields
  26. // a point.
  27. ////////////////////////////////////////////////////////////////////
  28. class EXPCL_PANDA FLOATNAME(LVector3) : public FLOATNAME(LVecBase3) {
  29. PUBLISHED:
  30. INLINE_LINMATH FLOATNAME(LVector3)();
  31. INLINE_LINMATH FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) &copy);
  32. INLINE_LINMATH FLOATNAME(LVector3) &operator = (const FLOATNAME(LVecBase3) &copy);
  33. INLINE_LINMATH FLOATNAME(LVector3) &operator = (FLOATTYPE fill_value);
  34. INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE fill_value);
  35. INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
  36. INLINE_LINMATH static const FLOATNAME(LVector3) &zero();
  37. INLINE_LINMATH static const FLOATNAME(LVector3) &unit_x();
  38. INLINE_LINMATH static const FLOATNAME(LVector3) &unit_y();
  39. INLINE_LINMATH static const FLOATNAME(LVector3) &unit_z();
  40. INLINE_LINMATH FLOATNAME(LVector3) operator - () const;
  41. INLINE_LINMATH FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const;
  42. INLINE_LINMATH FLOATNAME(LVector3) operator + (const FLOATNAME(LVector3) &other) const;
  43. INLINE_LINMATH FLOATNAME(LVecBase3) operator - (const FLOATNAME(LVecBase3) &other) const;
  44. INLINE_LINMATH FLOATNAME(LVector3) operator - (const FLOATNAME(LVector3) &other) const;
  45. INLINE_LINMATH FLOATTYPE length() const;
  46. INLINE_LINMATH FLOATTYPE length_squared() const;
  47. INLINE_LINMATH bool normalize();
  48. INLINE_LINMATH FLOATNAME(LVector3) cross(const FLOATNAME(LVecBase3) &other) const;
  49. INLINE_LINMATH FLOATNAME(LVector3) operator * (FLOATTYPE scalar) const;
  50. INLINE_LINMATH FLOATNAME(LVector3) operator / (FLOATTYPE scalar) const;
  51. // Some special named constructors for LVector3.
  52. INLINE_LINMATH static FLOATNAME(LVector3) up(CoordinateSystem cs = CS_default);
  53. INLINE_LINMATH static FLOATNAME(LVector3) right(CoordinateSystem cs = CS_default);
  54. INLINE_LINMATH static FLOATNAME(LVector3) forward(CoordinateSystem cs = CS_default);
  55. INLINE_LINMATH static FLOATNAME(LVector3) down(CoordinateSystem cs = CS_default);
  56. INLINE_LINMATH static FLOATNAME(LVector3) left(CoordinateSystem cs = CS_default);
  57. INLINE_LINMATH static FLOATNAME(LVector3) back(CoordinateSystem cs = CS_default);
  58. // INLINE_LINMATH static FLOATNAME(LVector3) & rfu(FLOATTYPE right,
  59. INLINE_LINMATH static FLOATNAME(LVector3) rfu(FLOATTYPE right,
  60. FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default);
  61. public:
  62. static TypeHandle get_class_type() {
  63. return _type_handle;
  64. }
  65. static void init_type();
  66. private:
  67. static TypeHandle _type_handle;
  68. };
  69. #include "lvector3_src.I"