Commit c42642cc authored by Emilie Harquel's avatar Emilie Harquel
Browse files

* fix plane comparison : compare normal and distance

 * update message event on PlaneListMsg and ResectionDNMsg

--HG--
branch : fw4spl_0.5
parent d2dd41a4
......@@ -33,6 +33,8 @@ public:
FWCOMED_API static std::string ADD_PLANE;
FWCOMED_API static std::string REMOVE_PLANE;
FWCOMED_API static std::string PLANELIST_VISIBILITY;
FWCOMED_API static std::string PLANELIST_MODIFIED;
FWCOMED_API static std::string DESELECT_ALL_PLANES;
/**
* @brief Constructor : does nothing.
......
......@@ -40,6 +40,7 @@ public:
FWCOMED_API static std::string NEW_RESECTION_SELECTED;
FWCOMED_API static std::string NEW_SAFE_PART_SELECTED;
FWCOMED_API static std::string ADD_RESECTION;
FWCOMED_API static std::string ADD_SAFE_PART;
FWCOMED_API static std::string MODIFIED;
FWCOMED_API static std::string RESECTIONDB_INVALIDATED;
/// @}
......
......@@ -14,7 +14,9 @@ namespace fwComEd
std::string PlaneListMsg::ADD_PLANE = "PLANE_IS_ADDED";
std::string PlaneListMsg::REMOVE_PLANE = "REMOVE_PLANE";
std::string PlaneListMsg::PLANELIST_VISIBILITY = "PLANELIST_VISIBILITY";
std::string PlaneListMsg::PLANELIST_VISIBILITY = "PLANELIST_VISIBILITY";
std::string PlaneListMsg::PLANELIST_MODIFIED = "PLANELIST_MODIFIED";
std::string PlaneListMsg::DESELECT_ALL_PLANES = "DESELECT_ALL_PLANES";
//-----------------------------------------------------------------------------
......
......@@ -24,6 +24,7 @@ std::string ResectionDBMsg::RESECTIONDB_SELECTED = "RESECTIONDB_SELECTED";
std::string ResectionDBMsg::NEW_RESECTION_SELECTED = "NEW_RESECTION_SELECTED";
std::string ResectionDBMsg::NEW_SAFE_PART_SELECTED = "NEW_SAFE_PART_SELECTED";
std::string ResectionDBMsg::ADD_RESECTION = "ADD_RESECTION";
std::string ResectionDBMsg::ADD_SAFE_PART = "ADD_SAFE_PART";
std::string ResectionDBMsg::MODIFIED = "MODIFIED";
std::string ResectionDBMsg::RESECTIONDB_INVALIDATED = "RESECTIONDB_INVALIDATED";
......
......@@ -51,7 +51,11 @@ public :
/// Copy method
FWDATA_API Plane &operator=( const Plane & _plane ) ;
/// Compare method
/*
* @brief Compare method
*
* Compare plane normal and distance from origin
*/
FWDATA_API bool operator==( const Plane & _plane ) ;
/// get the plane coordinate
......@@ -60,6 +64,7 @@ public :
/// Re-initialize the plane with 3 points
FWDATA_API void setValue(::fwData::Point::sptr _point1, ::fwData::Point::sptr _point2, ::fwData::Point::sptr _point3);
/// Compute plane normal and distance from points coordinates
FWDATA_API void computePlaneFromPoints();
/// Points container
......
......@@ -71,10 +71,16 @@ Plane & Plane::operator=( const Plane & _plane )
bool Plane::operator==( const Plane & _plane )
{
bool result = false;
if (fabs(float((m_vPoints[0]->getCoord())[0] - (_plane.m_vPoints[0]->getCoord())[0])) < EPSILON &&
fabs(float((m_vPoints[1]->getCoord())[1] - (_plane.m_vPoints[1]->getCoord())[1])) < EPSILON &&
fabs(float((m_vPoints[2]->getCoord())[2] - (_plane.m_vPoints[2]->getCoord())[2])) < EPSILON)
float dx = float(m_plane[0] - _plane.getPlane()[0] );
float dy = float(m_plane[1] - _plane.getPlane()[1] );
float dz = float(m_plane[2] - _plane.getPlane()[2] );
float dd = float(m_plane[3] - _plane.getPlane()[3] );
if (fabs(dx) < EPSILON && fabs(dy) < EPSILON && fabs(dz) < EPSILON && fabs(dd) < EPSILON)
{
result = true;
}
return result;
}
//------------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment