00001
00002
00003
00004
00005
00007
00012 #ifndef HGELINE__
00013 #define HGELINE__
00014
00015 #include <hgevector.h>
00016 #include <hgerect.h>
00017
00018 #include "hgeShape.h"
00019 #include "hgeIntersect.h"
00020 #include "hgeCircle.h"
00021
00022
00024
00025
00032 class hgeLine : public hgeShape
00033 {
00034 public:
00035
00036 hgeVector p1;
00037 hgeVector p2;
00038
00039
00040 hgeVector hgeLine::NearestPoint(hgeVector point);
00041
00042
00043 hgeIntersect Intersects(hgeLine *line);
00044 hgeIntersect Intersects(hgeLine line);
00045
00046
00047 hgeIntersect Intersects(hgeVector pos1, hgeVector pos2);
00048
00049
00050 hgeIntersect Intersects(hgeCircle *circle);
00051 hgeIntersect Intersects(hgeCircle circle);
00052
00053
00054 hgeRect Rect();
00055
00056
00057 float Length()
00058 {
00059 return hgeVector(p2 - p1).Length();
00060 }
00061
00062
00063 float Angle()
00064 {
00065 return hgeVector(p2 - p1).Angle();
00066 }
00067
00068
00069 hgeLine() : hgeShape(HGESHAPE_LINE) { }
00070 hgeLine(hgeVector m_p1, hgeVector m_p2) : hgeShape(HGESHAPE_LINE)
00071 {
00072 p1 = m_p1;
00073 p2 = m_p2;
00074 }
00075 hgeLine(float m_p1x, float m_p1y, float m_p2x, float m_p2y) : hgeShape(HGESHAPE_LINE)
00076 {
00077 p1 = hgeVector(m_p1x, m_p1y);
00078 p2 = hgeVector(m_p2x, m_p2y);
00079 }
00080 };
00081
00082 #endif