KrisLibrary  1.0.0
Plane2D.h
1 #ifndef MATH3D_PLANE2D_H
2 #define MATH3D_PLANE2D_H
3 
4 #include "Point.h"
5 
6 namespace Math3D {
7 
8 struct Line2D;
9 struct Plane2D;
10 struct Segment2D;
11 typedef Line2D Ray2D;
12 struct AABB2D;
13 
20 struct Plane2D
21 {
22  void setPointNormal(const Point2D& a, const Vector2& n);
23  void setLine(const Line2D& l);
24  void setPoints(const Point2D& a, const Point2D& b);
25  void setTransformed(const Plane2D& pin, const Matrix3& xform);
26 
27  Real distance(const Point2D& v) const;
28  void project(const Point2D& in, Point2D& out) const;
29  void getBasis(Vector2& xb) const;
30 
31  bool intersectsSegment(const Segment2D&, Real* t);
32  bool intersectsLine(const Line2D&, Real* t);
33  bool intersectsRay(const Ray2D&, Real* t);
34  bool intersects(const AABB2D&) const;
35 
40  int allIntersections(const Plane2D& p,Vector2& pt) const;
41 
42  bool Read(File& f);
43  bool Write(File& f) const;
44 
45  Vector2 normal;
46  Real offset;
47 };
48 
49 } //namespace Math3D
50 
51 #endif
A 2D line class.
Definition: Line2D.h:19
A 2D segment class.
Definition: Segment2D.h:17
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13
A 2D plane classRepresents plane with a normal and offset such that x on the plane satisfy dot(normal...
Definition: Plane2D.h:20
A 3x3 matrix class.
Definition: math3d/primitives.h:469
void getBasis(Vector2 &xb) const
returns a plane basis vector
Definition: geometry2d.cpp:262
A 2D vector class.
Definition: math3d/primitives.h:41
A 2D axis-aligned bounding box.
Definition: AABB2D.h:13
void project(const Point2D &in, Point2D &out) const
projects onto the plane
Definition: geometry2d.cpp:257
A cross-platform class for reading/writing binary data.
Definition: File.h:47
int allIntersections(const Plane2D &p, Vector2 &pt) const
Definition: geometry2d.cpp:355