00001 #ifndef PLANE_3D_HPP
00002 #define PLANE_3D_HPP
00003
00004 #include "jmath/jblas.hpp"
00005 #include <iostream>
00006 #include "model3d/point3D.hpp"
00007
00008 namespace jafar {
00010 namespace model3d {
00011
00019 class Plane3D
00020 {
00021 public:
00022 Plane3D();
00023 ~Plane3D();
00024
00025 Plane3D& operator= (const Plane3D& srcPlane);
00026
00034 void setPlane(Point3D& p1, Point3D& p2, Point3D& p3);
00035
00036 void info();
00037
00038 void clear();
00039 bool isBaseNormal(int& nType);
00040 void setBaseNormal(int nType);
00041 bool isVertical();
00042
00057 inline double calculateCosDihedralAngle(Plane3D& plane3D_2)
00058 {
00059 return (u[0]*plane3D_2.u[0] +
00060 u[1]*plane3D_2.u[1] +
00061 u[2]*plane3D_2.u[2]);
00062 }
00063
00064
00065
00066 inline double signedDistance(const Point3D& p) const
00067 {
00068 return (u[0]*p.x()+u[1]*p.y()+u[2]*p.z()+d0);
00069 }
00070
00071
00078 bool isCoplanar(Plane3D& plane3D_2, double dist, double cosDihedral);
00079
00080
00081 double u[3];
00082 double d0;
00083 };
00084
00085
00086
00087 }
00088 }
00089
00090 #endif //PLANE_3D_HPP