plane_src.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file plane_src.h
  10. * @author mike
  11. * @date 1997-01-09
  12. */
  13. /**
  14. * An abstract mathematical description of a plane. A plane is defined by the
  15. * equation Ax + By + Cz + D = 0.
  16. */
  17. class EXPCL_PANDA_MATHUTIL FLOATNAME(LPlane) : public FLOATNAME(LVecBase4) {
  18. PUBLISHED:
  19. INLINE_MATHUTIL FLOATNAME(LPlane)();
  20. INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LVecBase4) &copy);
  21. INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LPoint3) &a,
  22. const FLOATNAME(LPoint3) &b,
  23. const FLOATNAME(LPoint3) &c);
  24. INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LVector3) &normal,
  25. const FLOATNAME(LPoint3) &point);
  26. INLINE_MATHUTIL FLOATNAME(LPlane)(FLOATTYPE a, FLOATTYPE b,
  27. FLOATTYPE c, FLOATTYPE d);
  28. INLINE_MATHUTIL FLOATNAME(LPlane) operator * (const FLOATNAME(LMatrix3) &mat) const;
  29. INLINE_MATHUTIL FLOATNAME(LPlane) operator * (const FLOATNAME(LMatrix4) &mat) const;
  30. INLINE_MATHUTIL void operator *= (const FLOATNAME(LMatrix4) &mat);
  31. INLINE_MATHUTIL void xform(const FLOATNAME(LMatrix4) &mat);
  32. INLINE_MATHUTIL FLOATNAME(LPlane) operator - () const;
  33. FLOATNAME(LMatrix4) get_reflection_mat() const;
  34. INLINE_MATHUTIL FLOATNAME(LVector3) get_normal() const;
  35. FLOATNAME(LPoint3) get_point() const;
  36. INLINE_MATHUTIL FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const;
  37. INLINE_MATHUTIL bool normalize();
  38. INLINE_MATHUTIL FLOATNAME(LPlane) normalized() const;
  39. INLINE_MATHUTIL FLOATNAME(LPoint3) project(const FLOATNAME(LPoint3) &point) const;
  40. INLINE_MATHUTIL void flip();
  41. INLINE_MATHUTIL bool intersects_line(FLOATNAME(LPoint3) &intersection_point,
  42. const FLOATNAME(LPoint3) &p1,
  43. const FLOATNAME(LPoint3) &p2) const;
  44. INLINE_MATHUTIL bool intersects_line(FLOATTYPE &t,
  45. const FLOATNAME(LPoint3) &from,
  46. const FLOATNAME(LVector3) &delta) const;
  47. bool intersects_plane(FLOATNAME(LPoint3) &from,
  48. FLOATNAME(LVector3) &delta,
  49. const FLOATNAME(LPlane) &other) const;
  50. bool intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2,
  51. const FLOATNAME(LParabola) &parabola) const;
  52. void output(std::ostream &out) const;
  53. void write(std::ostream &out, int indent_level = 0) const;
  54. std::string __repr__() const;
  55. };
  56. INLINE_MATHUTIL std::ostream &
  57. operator << (std::ostream &out, const FLOATNAME(LPlane) &p);
  58. #include "plane_src.I"