Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __CXUTILS_MATH_SEGMENT_3D_H
00041 #define __CXUTILS_MATH_SEGMENT_3D_H
00042
00043 #include "cxutils/math/point3d.h"
00044
00045 namespace CxUtils
00046 {
00053 class CX_UTILS_DLL Segment3D
00054 {
00055 public:
00056 typedef std::vector<Segment3D> List;
00057
00058
00059
00060
00061
00062
00063 enum Axis
00064 {
00065 X = 0,
00066 Y,
00067 Z
00068 };
00069 Segment3D();
00070 Segment3D(const Segment3D& segment);
00071 Segment3D(const Point3D& p1,
00072 const Point3D& p2,
00073 const double width = 0.0);
00074 Segment3D Flip();
00075 void Clear();
00076 bool IsParallel(const Segment3D& segment) const;
00077 double GetDistanceX() const;
00078 double GetDistanceY() const;
00079 double GetDistanceZ() const;
00080 double GetDotProduct() const;
00081 double GetNorm() const;
00082 double GetMagnitude() const;
00083 double GetVolume() const;
00084 double GetAngleXY(const bool degrees = false) const;
00085 double GetAngleXZ(const bool degrees = false) const;
00086 double GetAngleYZ(const bool degrees = false) const;
00087 double GetDistanceToPoint(const Point3D& point) const;
00088 double GetDistanceToSegment(const Segment3D& segment) const;
00089 Point3D GetClosestPointOnSegment(const Point3D& point) const;
00090 Vector3D GetVector() const;
00091 Point3D GetMidpoint() const;
00092 Segment3D GetProjectionXY() const;
00093 Segment3D GetProjectionXZ() const;
00094 Segment3D GetProjectionYZ() const;
00095 Segment3D Rotate(const double angle,
00096 const unsigned int axis,
00097 const bool angleInDegrees = false) const;
00098 Segment3D Rotate(const Point3D& origin,
00099 const double angle,
00100 const unsigned int axis,
00101 const bool angleInDegrees = false) const;
00102 static bool DoesIntersect(const Segment3D& segment1,
00103 const Segment3D& segment2);
00104 static bool DoesIntersectXY(const Segment3D& segment1,
00105 const Segment3D& segment2);
00106 static bool DoesIntersect(const Segment3D& segment1,
00107 const Segment3D& segment2,
00108 Point3D& intersectionPoint);
00109 static bool DoesIntersectXY(const Segment3D& segment1,
00110 const Segment3D& segment2,
00111 Point3D& intersectionPoint);
00112 static bool DoesIntersect(const Segment3D& segment,
00113 const Point3D& p1,
00114 const Point3D& p2,
00115 const Point3D& p3);
00116 static bool IsParallel(const Segment3D& segment1,
00117 const Segment3D& segment2);
00118 static double GetDistanceToPoint(const Point3D& point,
00119 const Segment3D& segment);
00120 static double GetDistanceToSegment(const Segment3D& segment1,
00121 const Segment3D& segment2);
00122 static Point3D GetClosestPointOnSegment(const Point3D& point,
00123 const Segment3D& segment);
00124 Segment3D& operator=(const Segment3D& segment);
00125 Point3D mPoint1;
00126 Point3D mPoint2;
00127 double mWidth;
00128 };
00129 }
00130
00131 #endif
00132