KrisLibrary  1.0.0
Segment3D.h
1 #ifndef MATH3D_SEGMENT3D_H
2 #define MATH3D_SEGMENT3D_H
3 
4 #include "Point.h"
5 
6 namespace Math3D {
7 
8 struct Line3D;
9 struct Plane3D;
10 struct AABB3D;
11 
12 struct Segment3D
13 {
14  void setTransformed(const Segment3D&, const Matrix4& xform);
15  void getLine(Line3D& l) const;
16  void getAABB(AABB3D& bb) const;
17  Real distance(const Point3D& p) const;
18  Real closestPointParameter(const Point3D& in) const;
19  Real closestPoint(const Point3D& in, Point3D& out) const; //returns the parameter value of the point
20  void closestPoint(const Segment3D&,Real& t,Real& u) const; //same comment as above
21  Real distance(const Segment3D&) const;
22  void eval(Real t, Point3D& out) const;
23  bool intersects(const AABB3D&) const;
24  bool intersects(const AABB3D&, Real& tmin, Real& tmax) const;
25  Real distance(const AABB3D& bb) const;
26  Real distance(const AABB3D& bb, Real& tclosest, Point3D& bbclosest) const;
27  bool Read(File& f);
28  bool Write(File& f) const;
29 
30  Point3D a,b;
31 };
32 
33 std::ostream& operator << (std::ostream& out,const Segment3D& s);
34 std::istream& operator >> (std::istream& in,Segment3D& s);
35 
36 } //namespace Math3D
37 
38 #endif
A 3D vector class.
Definition: math3d/primitives.h:136
A 3D axis-aligned bounding box.
Definition: AABB3D.h:13
A 4x4 matrix class.
Definition: math3d/primitives.h:626
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13
A 3D line class.
Definition: Line3D.h:18
A cross-platform class for reading/writing binary data.
Definition: File.h:47
Definition: Segment3D.h:12