#include <manualContourModelLine.h>
Public Member Functions | |
manualContourModelLine () | |
virtual | ~manualContourModelLine () |
virtual manualContourModelLine * | Clone () |
void | CopyAttributesTo (manualContourModelLine *cloneObject) |
void | CopyAttributesTo (manualContourModel *cloneObject) |
virtual void | Open (FILE *ff) |
virtual void | Save (FILE *ff) |
int | AddPoint (double x, double y, double z) |
int | InsertPoint (double x, double y, double z) |
void | InsertPoint_id (int id, double x, double y, double z) |
void | AddManualPoint (manualPoint *theManualPoint) |
void | Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By) |
void | DeletePoint (int i) |
void | DeleteAllPoints () |
void | MovePoint (int i, double dx, double dy, double dz) |
void | MoveLstPoints (double dx, double dy, double dz) |
void | MoveAllPoints (double dx, double dy, double dz) |
int | GetIdPoint (double x, double y, double z, int i_range, int type) |
manualPoint * | GetManualPoint (int id) |
int | GetSizeLstPoints () |
int | GetNumberOfPointsSpline () |
void | SetNumberOfPointsSpline (int size) |
virtual void | UpdateSpline () |
void | SetCloseContour (bool closeContour) |
bool | IfCloseContour () |
double | GetPathSize () |
double | GetPathArea () |
void | GetNearestPointAndNormal (double *p, double *rp, double *rn) |
virtual void | GetSpline_i_Point (int i, double *x, double *y, double *z) |
void | GetSpline_t_Point (double t, double *x, double *y, double *z) |
virtual std::vector < manualContourModel * > | ExploseModel () |
Private Member Functions | |
virtual int | GetTypeModel () |
Definition at line 8 of file manualContourModelLine.h.
manualContourModelLine::manualContourModelLine | ( | ) |
Definition at line 9 of file manualContourModelLine.cpp.
References manualContourModel::SetCloseContour(), and manualContourModel::SetNumberOfPointsSpline().
Referenced by Clone().
00010 : manualContourModel() 00011 { 00012 SetNumberOfPointsSpline(20); 00013 this->SetCloseContour(false); 00014 }
manualContourModelLine::~manualContourModelLine | ( | ) | [virtual] |
manualContourModelLine * manualContourModelLine::Clone | ( | ) | [virtual] |
Reimplemented from manualContourModel.
Definition at line 22 of file manualContourModelLine.cpp.
References CopyAttributesTo(), and manualContourModelLine().
00023 { 00024 manualContourModelLine * clone = new manualContourModelLine(); 00025 CopyAttributesTo(clone); 00026 return clone; 00027 }
void manualContourModelLine::CopyAttributesTo | ( | manualContourModelLine * | cloneObject | ) |
Definition at line 31 of file manualContourModelLine.cpp.
References manualContourModel::CopyAttributesTo().
Referenced by Clone().
00032 { 00033 manualContourModel::CopyAttributesTo(cloneObject); 00034 }
int manualContourModelLine::GetTypeModel | ( | ) | [private, virtual] |
void manualContourModel::CopyAttributesTo | ( | manualContourModel * | cloneObject | ) | [inherited] |
Definition at line 652 of file manualContourModel.cpp.
References manualContourModel::_closeContour, manualContourModel::AddManualPoint(), manualContourModel::Clone(), manualContourModel::GetManualPoint(), manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSizeLstPoints(), manualContourModel::SetCloseContour(), manualContourModel::SetNumberOfPointsSpline(), and manualContourModel::UpdateSpline().
Referenced by manualContourModel::Clone(), manualContourModelRoi::CopyAttributesTo(), CopyAttributesTo(), manualContourModelCircle::CopyAttributesTo(), manualContourModelBullEyeSector::CopyAttributesTo(), and manualContourModelBullEye::CopyAttributesTo().
00653 { 00654 // Fathers object 00655 //XXXX::CopyAttributesTo(cloneObject); 00656 00657 cloneObject->SetCloseContour( this->IfCloseContour() ); 00658 int i, size = GetSizeLstPoints(); 00659 for( i=0; i<size; i++ ) 00660 { 00661 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() ); 00662 } 00663 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () ); 00664 cloneObject->SetCloseContour( _closeContour ); 00665 cloneObject->UpdateSpline(); 00666 }
void manualContourModel::Open | ( | FILE * | ff | ) | [virtual, inherited] |
Reimplemented in manualContourModelBullEye, and manualContourModelBullEyeSector.
Definition at line 601 of file manualContourModel.cpp.
References manualContourModel::AddPoint().
Referenced by manualContourModelBullEyeSector::Open(), and manualContourModelBullEye::Open().
00602 { 00603 char tmp[255]; 00604 int i; 00605 int numberOfControlPoints; 00606 double x,y,z; 00607 00608 fscanf(ff,"%s",tmp); // NumberOfControlPoints 00609 fscanf(ff,"%s",tmp); // ## 00610 numberOfControlPoints = atoi(tmp); 00611 for (i=0;i<numberOfControlPoints;i++) 00612 { 00613 fscanf(ff,"%s",tmp); // X 00614 x = atof(tmp); 00615 fscanf(ff,"%s",tmp); // Y 00616 y = atof(tmp); 00617 fscanf(ff,"%s",tmp); // Z 00618 z = atof(tmp); 00619 AddPoint(x,y,z); 00620 } 00621 }
void manualContourModel::Save | ( | FILE * | ff | ) | [virtual, inherited] |
Reimplemented in manualContourModelBullEye, and manualContourModelBullEyeSector.
Definition at line 637 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualContourModel::GetTypeModel(), manualPoint::GetX(), manualPoint::GetY(), and manualPoint::GetZ().
Referenced by manualContourModelBullEyeSector::Save(), and manualContourModelBullEye::Save().
00638 { 00639 int i,size=_lstPoints.size(); 00640 fprintf(ff,"TypeModel %d\n", GetTypeModel() ); 00641 fprintf(ff,"NumberOfControlPoints %d\n",size); 00642 for (i=0;i<size;i++) 00643 { 00644 manualPoint *mp=_lstPoints[i]; 00645 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() ); 00646 } 00647 }
int manualContourModel::AddPoint | ( | double | x, | |
double | y, | |||
double | z | |||
) | [inherited] |
Definition at line 54 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualContourModel::AddManualPoint(), and manualPoint::SetPoint().
Referenced by manualContourBaseControler::AddPoint(), manualContour3VControler::AddPoint(), AutoControlPoints::ChargeSpline(), manualViewContour::InitMove(), manualContourBaseControler::InsertPoint(), PropContour::method_Spline(), manualContourModel::Open(), manualContourContainer::refreshLumen(), manualContourContainer::refreshWall(), and wxMaracasCoutourTool::SetControlPoints().
00055 { 00056 manualPoint *mp = new manualPoint(); 00057 mp->SetPoint(x,y,z); 00058 AddManualPoint(mp); 00059 //UpdateSpline(); 00060 00061 return _lstPoints.size()-1; 00062 }
int manualContourModel::InsertPoint | ( | double | x, | |
double | y, | |||
double | z | |||
) | [inherited] |
Definition at line 64 of file manualContourModel.cpp.
References manualContourModel::_closeContour, manualContourModel::_lstPoints, and manualContourModel::InsertPoint_id().
Referenced by manualContourBaseControler::InsertPoint(), and manualContour3VControler::InsertPoint().
00065 { 00066 double dd,ddmin=9999999; 00067 int ibak=0; 00068 double xx,x1,x2; 00069 double yy,y1,y2; 00070 double zz,z1,z2; 00071 int i,ii,iii,size=_lstPoints.size(); 00072 double j,MaxDivisions=20,porcentage; 00073 int sizeB=size; 00074 00075 if (_closeContour==false) 00076 { 00077 size=size-1; 00078 } 00079 00080 double jbak; 00081 00082 for ( i=0 ; i<size ; i++ ) 00083 { 00084 ii=i % sizeB ; 00085 iii=(i+1) % sizeB; 00086 x1=_lstPoints[ii]->GetX(); 00087 y1=_lstPoints[ii]->GetY(); 00088 z1=_lstPoints[ii]->GetZ(); 00089 x2=_lstPoints[iii]->GetX(); 00090 y2=_lstPoints[iii]->GetY(); 00091 z2=_lstPoints[iii]->GetZ(); 00092 for (j=0; j<=MaxDivisions; j++) 00093 { 00094 porcentage=(j/MaxDivisions); 00095 xx=(x2-x1)*porcentage+x1; 00096 yy=(y2-y1)*porcentage+y1; 00097 zz=(z2-z1)*porcentage+z1; 00098 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) ); 00099 if ( dd<ddmin ) 00100 { 00101 ddmin=dd; 00102 ibak=iii; 00103 jbak=j; 00104 } 00105 } 00106 } 00107 00108 if (_closeContour==false) 00109 { 00110 if ( (ibak==1) && (jbak==0) ) 00111 { 00112 ibak=0; 00113 } 00114 if ( ( ibak==size ) && ( jbak==MaxDivisions ) ) 00115 { 00116 ibak=sizeB; 00117 } 00118 } 00119 00120 00121 //JSTG - 25-04-08 ---------------------------------------------------------- 00122 //manualPoint *mp = new manualPoint(); 00123 //mp->SetPoint(x,y,z); 00124 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak; 00125 //_lstPoints.insert(itNum,mp); 00126 InsertPoint_id(ibak,x,y,z); 00127 //---------------------------------------------------------------------------- 00128 00129 return ibak; 00130 }
void manualContourModel::InsertPoint_id | ( | int | id, | |
double | x, | |||
double | y, | |||
double | z | |||
) | [inherited] |
Definition at line 132 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, and manualPoint::SetPoint().
Referenced by manualContourModel::InsertPoint().
00133 { 00134 manualPoint *mp = new manualPoint(); 00135 mp->SetPoint(x,y,z); 00136 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id; 00137 _lstPoints.insert(itNum,mp); 00138 }
void manualContourModel::AddManualPoint | ( | manualPoint * | theManualPoint | ) | [inherited] |
Definition at line 670 of file manualContourModel.cpp.
References manualContourModel::_lstPoints.
Referenced by manualContourModel::AddPoint(), and manualContourModel::CopyAttributesTo().
00671 { 00672 _lstPoints.push_back( theManualPoint ); 00673 }
void manualContourModel::Transform_Ax_Plus_B | ( | double | Ax, | |
double | Bx, | |||
double | Ay, | |||
double | By | |||
) | [inherited] |
Definition at line 684 of file manualContourModel.cpp.
References manualContourModel::GetManualPoint(), manualContourModel::GetSizeLstPoints(), manualPoint::GetX(), manualPoint::GetY(), manualPoint::SetPointX(), and manualPoint::SetPointY().
00685 { 00686 manualPoint * mp; 00687 00688 int i, size = GetSizeLstPoints(); 00689 00690 for( i=0; i<size; i++ ) 00691 { 00692 mp = GetManualPoint( i ); 00693 00694 mp->SetPointX( mp->GetX()*Ax + Bx ); 00695 mp->SetPointY( mp->GetY()*Ay + By ); 00696 } 00697 }
void manualContourModel::DeletePoint | ( | int | i | ) | [inherited] |
Definition at line 141 of file manualContourModel.cpp.
References manualContourModel::_lstPoints.
Referenced by manualContourBaseControler::DeleteActualMousePoint().
00142 { 00143 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i; 00144 _lstPoints.erase(itNum); 00145 }
void manualContourModel::DeleteAllPoints | ( | ) | [inherited] |
Definition at line 147 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, and manualContourModel::UpdateSpline().
Referenced by AutoControlPoints::ChargeSpline(), manualContourBaseControler::DeleteContour(), manualViewContour::InitMove(), PropContour::method_Spline(), manualContourContainer::refreshLumen(), manualContourContainer::refreshWall(), and wxMaracasCoutourTool::SetControlPoints().
00148 { 00149 int i,size=_lstPoints.size(); 00150 for (i=0;i<size;i++){ 00151 _lstPoints.erase( _lstPoints.begin() ); 00152 } 00153 this->UpdateSpline(); 00154 }
void manualContourModel::MovePoint | ( | int | i, | |
double | dx, | |||
double | dy, | |||
double | dz | |||
) | [inherited] |
Definition at line 157 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualPoint::GetX(), manualPoint::GetY(), manualPoint::GetZ(), and manualPoint::SetPoint().
Referenced by manualContourModel::MoveAllPoints().
00158 { 00159 manualPoint *mp=_lstPoints[i]; 00160 double x=mp->GetX()+dx; 00161 double y=mp->GetY()+dy; 00162 double z=mp->GetZ()+dz; 00163 mp->SetPoint(x,y,z); 00164 }
void manualContourModel::MoveLstPoints | ( | double | dx, | |
double | dy, | |||
double | dz | |||
) | [inherited] |
void manualContourModel::MoveAllPoints | ( | double | dx, | |
double | dy, | |||
double | dz | |||
) | [inherited] |
Definition at line 171 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, and manualContourModel::MovePoint().
00172 { 00173 int i,size=_lstPoints.size(); 00174 for (i=0;i<size;i++){ 00175 MovePoint(i,dx,dy,dz); 00176 } 00177 }
int manualContourModel::GetIdPoint | ( | double | x, | |
double | y, | |||
double | z, | |||
int | i_range, | |||
int | type | |||
) | [inherited] |
Definition at line 186 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualPoint::GetX(), manualPoint::GetY(), and manualPoint::GetZ().
Referenced by manualViewBaseContour::GetIdPoint(), manualView3VContour::GetIdPoint(), and manualContourBaseControler::Magnet().
00187 { 00188 double range = i_range+1; 00189 00190 double xx,yy,zz,dd,ddmin=9999999; 00191 int ibak=-1; 00192 int i,size=_lstPoints.size(); 00193 for (i=0;i<size;i++){ 00194 manualPoint *mp=_lstPoints[i]; 00195 xx=mp->GetX(); 00196 yy=mp->GetY(); 00197 zz=mp->GetZ(); 00198 00199 if (type==-1) 00200 { 00201 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) { 00202 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) ); 00203 if (dd<ddmin){ 00204 ddmin=dd; 00205 ibak=i; 00206 } 00207 } 00208 } 00209 if (type==0) 00210 { 00211 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) { 00212 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) ); 00213 if (dd<ddmin){ 00214 ddmin=dd; 00215 ibak=i; 00216 } 00217 } 00218 } 00219 if (type==1) 00220 { 00221 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) { 00222 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) ); 00223 if (dd<ddmin){ 00224 ddmin=dd; 00225 ibak=i; 00226 } 00227 } 00228 } 00229 if (type==2) 00230 { 00231 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) { 00232 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) ); 00233 if (dd<ddmin){ 00234 ddmin=dd; 00235 ibak=i; 00236 } 00237 } 00238 } 00239 } 00240 return ibak; 00241 }
manualPoint * manualContourModel::GetManualPoint | ( | int | id | ) | [inherited] |
Definition at line 243 of file manualContourModel.cpp.
References manualContourModel::_lstPoints.
Referenced by manualContourModel::CopyAttributesTo(), manualView3DContour::GetIdPoint2(), manualViewRoi::GetMinMax(), manualViewCircle::GetMinMax(), manualViewBaseContour::GetMinMax(), manualContourModel::GetSpline_t_Point(), manualViewRoi::InitMove(), manualViewLine::InitMove(), manualViewContour::InitMove(), manualViewCircle::InitMove(), manualRoiControler::InitRoi(), manualLineControler::InitRoi(), manualCircleControler::InitRoi(), manualContourBaseControler::Magnet(), manualContour3DControler::MouseClickLeft(), manualViewRoi::MoveContour(), manualViewLine::MoveContour(), manualViewContour::MoveContour(), manualViewCircle::MoveContour(), wxMaracasCoutourTool::OnSaveControlPoints(), manualViewRoi::RefreshContour(), manualContourContainer::refreshLumen(), manualViewContour::RefreshText(), manualContourContainer::refreshWall(), manualContourBaseControler::SetPoint(), manualContour3VControler::SetPoint(), manualContourBaseControler::SetPointX(), manualContourBaseControler::SetPointY(), manualContourBaseControler::SetPointZ(), manualRoiControler::SetRoi(), manualContourModel::Transform_Ax_Plus_B(), manualContourModelCircle::UpdateSpline(), manualContourModelBullEye::UpdateSpline(), manualContourModel::UpdateSpline(), manualViewPerpPlaneContour::UpdateViewPoint(), manualViewBaseContour::UpdateViewPoint(), and manualView3VContour::UpdateViewPoint().
00244 { 00245 return _lstPoints[id]; 00246 }
int manualContourModel::GetSizeLstPoints | ( | ) | [inherited] |
Definition at line 248 of file manualContourModel.cpp.
References manualContourModel::_lstPoints.
Referenced by manualContourModel::CopyAttributesTo(), manualContourBaseControler::DeleteActualMousePoint(), wxMaracas_ManualTree_MPRDlg::ExportPoints(), manualView3DContour::GetIdPoint2(), manualViewRoi::GetMinMax(), manualViewBaseContour::GetMinMax(), manualViewRoi::InitMove(), manualViewLine::InitMove(), manualViewContour::InitMove(), manualViewCircle::InitMove(), manualViewContour::MoveContour(), wxMaracasCoutourTool::OnSaveControlPoints(), manualContourContainer::refreshLumen(), manualContourContainer::refreshWall(), manualContourModel::Transform_Ax_Plus_B(), and manualContourModelCircle::UpdateSpline().
00249 { 00250 return _lstPoints.size(); 00251 }
int manualContourModel::GetNumberOfPointsSpline | ( | ) | [inherited] |
Definition at line 253 of file manualContourModel.cpp.
References manualContourModel::_sizePointsContour.
Referenced by wxMaracasCoutourTool::AnalisisContourInside(), AutoControlPoints::ChargeSpline(), manualViewBaseContour::ConstructVTKObjects(), manualContourModel::CopyAttributesTo(), ContourExtractData::Fill_lstlstlstVecXY(), ContourExtractData::GetMinMaxPoint(), wxMaracasCoutourTool::GetMinMaxPoint(), manualContourModel::GetNearestPointAndNormal(), manualContourBaseControler::GetNumberOfPointsSplineManualContour(), manualContourModel::GetPathArea(), manualContourModel::GetPathSize(), manualContourModelBullEyeSector::GetSpline_i_Point(), wxMaracasCoutourTool::GetSplinePoints(), PropContour::method_Spline(), wxMaracasCoutourTool::OnSaveContour(), manualViewPerpPlaneContour::RefreshContour(), manualViewContour::RefreshContour(), manualViewBullEyeSector::RefreshContour(), manualView3VContour::RefreshContour(), and manualContourModelCircle::UpdateSpline().
00254 { 00255 return _sizePointsContour; 00256 }
void manualContourModel::SetNumberOfPointsSpline | ( | int | size | ) | [inherited] |
Definition at line 258 of file manualContourModel.cpp.
References manualContourModel::_sizePointsContour.
Referenced by manualContourModelBullEye::AddSector(), AutoControlPoints::ChargeSpline(), manualRoiControler::Configure(), wxMaracasCoutourTool::ConfigureVTK(), manualContourModel::CopyAttributesTo(), manualContourModelLine(), manualContourModelRoi::manualContourModelRoi(), and PropContour::method_Spline().
00259 { 00260 _sizePointsContour = size; 00261 }
void manualContourModel::UpdateSpline | ( | ) | [virtual, inherited] |
Reimplemented in manualContourModelBullEye, and manualContourModelCircle.
Definition at line 289 of file manualContourModel.cpp.
References manualContourModel::_cntSplineX, manualContourModel::_cntSplineY, manualContourModel::_cntSplineZ, manualContourModel::_delta_JSTG, manualContourModel::_lstPoints, manualContourModel::_sizePointsContour, manualContourModel::GetManualPoint(), manualPoint::GetX(), manualPoint::GetY(), and manualPoint::GetZ().
Referenced by wxMaracasCoutourTool::AnalisisContourInside(), AutoControlPoints::ChargeSpline(), manualContourModel::CopyAttributesTo(), manualContourModel::DeleteAllPoints(), wxMaracas_ManualTree_MPRDlg::ExportPoints(), ContourExtractData::Fill_lstlstlstVecXY(), ContourExtractData::GetMinMaxPoint(), wxMaracasCoutourTool::GetMinMaxPoint(), manualContourModel::GetNearestPointAndNormal(), manualContourModel::GetPathArea(), manualContourModel::GetPathSize(), wxMaracasCoutourTool::GetSplinePoints(), PropContour::method_Spline(), manualViewPerpPlaneContour::RefreshContour(), manualViewContour::RefreshContour(), manualViewBullEyeSector::RefreshContour(), manualViewBullEye::RefreshContour(), wxMaracasCoutourTool::SetControlPoints(), and manualContourModelBullEye::UpdateSpline().
00290 { 00291 int i, np; 00292 np = _lstPoints.size(); 00293 manualPoint *mp; 00294 _cntSplineX->RemoveAllPoints(); 00295 _cntSplineY->RemoveAllPoints(); 00296 _cntSplineZ->RemoveAllPoints(); 00297 for( i = 0; i < np; i++ ) { 00298 mp = GetManualPoint(i); 00299 _cntSplineX->AddPoint( i, mp->GetX() ); 00300 _cntSplineY->AddPoint( i, mp->GetY() ); 00301 _cntSplineZ->AddPoint( i, mp->GetZ() ); 00302 } // rof 00303 00304 //JSTG 25-02-08 --------------------------------------------------------------------------------------------- 00305 if (this->_closeContour==true) 00306 { 00307 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close 00308 } else { 00309 // _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close 00310 _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close 00311 } 00312 //----------------------------------------------------------------------------------------------------------- 00313 }
void manualContourModel::SetCloseContour | ( | bool | closeContour | ) | [inherited] |
Definition at line 266 of file manualContourModel.cpp.
References manualContourModel::_closeContour, manualContourModel::_cntSplineX, manualContourModel::_cntSplineY, and manualContourModel::_cntSplineZ.
Referenced by AutoControlPoints::ChargeSpline(), wxManualTree_MPRWidget::ConfigureContour(), manualContourModel::CopyAttributesTo(), manualContourModel::manualContourModel(), manualContourModelLine(), PropContour::method_Spline(), manualContourControler::MouseClickLeft(), wxWidgetMesure2D::OnCloseContour(), and manualContourBaseControler::OnRightButtonDown().
00267 { 00268 _closeContour = closeContour; 00269 if (_closeContour==true) 00270 { 00271 _cntSplineX->ClosedOn(); 00272 _cntSplineY->ClosedOn(); 00273 _cntSplineZ->ClosedOn(); 00274 } else { 00275 _cntSplineX->ClosedOff(); 00276 _cntSplineY->ClosedOff(); 00277 _cntSplineZ->ClosedOff(); 00278 } 00279 }
bool manualContourModel::IfCloseContour | ( | ) | [inherited] |
Definition at line 282 of file manualContourModel.cpp.
References manualContourModel::_closeContour.
Referenced by manualContourModel::GetPathArea(), and manualViewContour::RefreshText().
00283 { 00284 return _closeContour; 00285 }
double manualContourModel::GetPathSize | ( | ) | [inherited] |
Definition at line 386 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), and manualContourModel::UpdateSpline().
Referenced by AutoControlPoints::ChargeSpline().
00387 { 00388 double result = 0; 00389 double x1,y1,z1; 00390 double x2,y2,z2; 00391 00392 // JSTG 25-02-08 ----------------------------- 00393 //double t,delta; 00394 //int i,np,nps; 00395 int i; 00396 //-------------------------------------------- 00397 00398 if (_lstPoints.size()==2) 00399 { 00400 x1=_lstPoints[0]->GetX(); 00401 y1=_lstPoints[0]->GetY(); 00402 z1=_lstPoints[0]->GetZ(); 00403 x2=_lstPoints[1]->GetX(); 00404 y2=_lstPoints[1]->GetY(); 00405 z2=_lstPoints[1]->GetZ(); 00406 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) ); 00407 } 00408 if (_lstPoints.size()>2) 00409 { 00410 00411 // JSTG 25-02-08 ------------------------------------------ 00412 //np = _lstPoints.size( ); 00413 //nps = 200; 00414 //delta=( double ) ( np ) / ( double ) ( nps ); 00415 UpdateSpline(); 00416 //GetSplinePoint(0,x1,y1,z1); 00417 GetSpline_i_Point(0,&x1,&y1,&z1); 00418 00419 //for( i = 1; i < nps; i++ ) 00420 for( i = 1; i < GetNumberOfPointsSpline(); i++ ) 00421 { 00422 //t = delta * (double)i; 00423 //GetSplinePoint(t,x2,y2,z2); 00424 GetSpline_i_Point(i,&x2,&y2,&z2); 00425 //--------------------------------------------------------- 00426 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) ); 00427 x1=x2; 00428 y1=y2; 00429 z1=z2; 00430 }// for 00431 } 00432 00433 return result; 00434 }
double manualContourModel::GetPathArea | ( | ) | [inherited] |
Definition at line 436 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), manualContourModel::IfCloseContour(), and manualContourModel::UpdateSpline().
00437 { 00438 double result = 555; 00439 if ((_lstPoints.size()>=3) && IfCloseContour()==true ) 00440 { 00441 double area; 00442 //JSTG 25-02-08 --------------------------------------------- 00443 //double ti,tj; 00444 //----------------------------------------------------------- 00445 double x1,y1,z1; 00446 double x2,y2,z2; 00447 bool okArea=true; 00448 int i, j; 00449 00450 // This uses Green's theorem: 00451 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN 00452 // A < 0 -> A = |A| (a negative value could raise because points are 00453 // given in clockwise order). 00454 00455 //JSTG 25-02-08 ------------------------------------------------- 00456 //int np = _lstPoints.size( ); 00457 //int nps = 200; 00458 int nps = GetNumberOfPointsSpline(); 00459 //double delta=( double ) ( np ) / ( double ) ( nps ); 00460 UpdateSpline(); 00461 for( i = 0, area = 0.0; i < nps; i++ ) 00462 { 00463 j = ( i + 1 ) % nps; 00464 //ti = delta * (double)i; 00465 //tj = delta * (double)j; 00466 //GetSplinePoint(ti,x1,y1,z1); 00467 //GetSplinePoint(tj,x2,y2,z2); 00468 GetSpline_i_Point(i,&x1,&y1,&z1); 00469 GetSpline_i_Point(j,&x2,&y2,&z2); 00470 //---------------------------------------------------------------- 00471 area += 00472 (x1 * y2 ) - 00473 ( x2 * y1 ); 00474 if (z1!=z2) 00475 { 00476 okArea=false; 00477 } 00478 }// for 00479 area /= 2.0; 00480 area = fabs( area ); 00481 00482 /* 00483 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ ) 00484 { 00485 j = ( i + 1 ) % _lstPoints.size(); 00486 // Area 00487 area += 00488 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) - 00489 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() ); 00490 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ()) 00491 { 00492 okArea=false; 00493 } 00494 } // rof 00495 area /= 2.0; 00496 area = fabs( area ); 00497 */ 00498 00499 if (okArea==true) 00500 { 00501 result = area; 00502 } else { 00503 result = -1; 00504 } 00505 00506 } else { 00507 result = 0; 00508 } 00509 return result; 00510 }
void manualContourModel::GetNearestPointAndNormal | ( | double * | p, | |
double * | rp, | |||
double * | rn | |||
) | [inherited] |
Definition at line 517 of file manualContourModel.cpp.
References manualContourModel::_lstPoints, manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), and manualContourModel::UpdateSpline().
Referenced by manualContourPerpPlaneControler::ResetOrientationPlane(), and manualContour3DControler::ResetOrientationPlane().
00518 { 00519 double distMin=999999999; 00520 double dist,dx,dy,dz; 00521 double x1,y1,z1; 00522 double x2,y2,z2; 00523 int i,np,nps; 00524 00525 //JSTG 25-02-08 ------------------- 00526 //double tback; 00527 int iback; 00528 //double t,delta; 00529 //--------------------------------- 00530 00531 np = _lstPoints.size( ); 00532 if (np>=2) 00533 { 00534 // JSTG 25-02-08 ------------------------------------------ 00535 //nps = 200; 00536 nps = GetNumberOfPointsSpline(); 00537 //delta = ( double ) ( np ) / ( double ) ( nps ); 00538 UpdateSpline(); 00539 //GetSplinePoint(0,x1,y1,z1); 00540 GetSpline_i_Point(0,&x1,&y1,&z1); 00541 for( i = 0; i < nps; i++ ) 00542 { 00543 //t = delta * (double)i; 00544 //GetSplinePoint(t,x1,y1,z1); 00545 GetSpline_i_Point(i,&x1,&y1,&z1); 00546 //---------------------------------------------------------- 00547 dx= x1-p[0]; 00548 dy= y1-p[1]; 00549 dz= z1-p[2]; 00550 dist = sqrt( dx*dx + dy*dy + dz*dz ); 00551 if (dist<distMin) 00552 { 00553 distMin = dist; 00554 //JSTG tback = t; 00555 iback = i; 00556 rp[0] = x1; 00557 rp[1] = y1; 00558 rp[2] = z1; 00559 rn[0] = x2-x1; 00560 rn[1] = y2-y1; 00561 rn[2] = z2-z1; 00562 } 00563 x2=x1; 00564 y2=y1; 00565 z2=z1; 00566 }// for 00567 00568 // JSTG 25-02-08 ------------------------------------------ 00569 //if (tback==0) 00570 if (iback==0) 00571 { 00572 //t = delta * (double)1.0; 00573 //GetSplinePoint(t,x1,y1,z1); 00574 GetSpline_i_Point(i,&x1,&y1,&z1); 00575 //---------------------------------------------------------- 00576 rn[0]=rp[0]-x1; 00577 rn[1]=rp[1]-y1; 00578 rn[2]=rp[2]-z1; 00579 } 00580 } 00581 else 00582 { 00583 rp[0] = 0; 00584 rp[1] = 0; 00585 rp[2] = 0; 00586 rn[0] = -1; 00587 rn[1] = 0; 00588 rn[2] = 0; 00589 } 00590 }
void manualContourModel::GetSpline_i_Point | ( | int | i, | |
double * | x, | |||
double * | y, | |||
double * | z | |||
) | [virtual, inherited] |
Reimplemented in manualContourModelBullEyeSector, and manualContourModelCircle.
Definition at line 327 of file manualContourModel.cpp.
References manualContourModel::_delta_JSTG, and manualContourModel::GetSpline_t_Point().
Referenced by wxMaracasCoutourTool::AnalisisContourInside(), AutoControlPoints::ChargeSpline(), wxMaracas_ManualTree_MPRDlg::ExportPoints(), ContourExtractData::Fill_lstlstlstVecXY(), ContourExtractData::GetMinMaxPoint(), wxMaracasCoutourTool::GetMinMaxPoint(), manualContourModel::GetNearestPointAndNormal(), manualContourModel::GetPathArea(), manualContourModel::GetPathSize(), wxMaracasCoutourTool::GetSplinePoints(), PropContour::method_Spline(), wxMaracasCoutourTool::OnSaveContour(), manualViewPerpPlaneContour::RefreshContour(), manualViewContour::RefreshContour(), and manualViewBullEyeSector::RefreshContour().
00328 { 00329 GetSpline_t_Point(i*_delta_JSTG,x,y,z); 00330 }
void manualContourModel::GetSpline_t_Point | ( | double | t, | |
double * | x, | |||
double * | y, | |||
double * | z | |||
) | [inherited] |
Definition at line 335 of file manualContourModel.cpp.
References manualContourModel::_cntSplineX, manualContourModel::_cntSplineY, manualContourModel::_cntSplineZ, manualContourModel::_lstPoints, manualContourModel::GetManualPoint(), manualPoint::GetX(), manualPoint::GetY(), and manualPoint::GetZ().
Referenced by manualContourModel::GetSpline_i_Point().
00336 { 00337 if (_lstPoints.size()==0) 00338 { 00339 *x = 0; 00340 *y = 0; 00341 *z = 0; 00342 } 00343 if (_lstPoints.size()==1) 00344 { 00345 manualPoint *mp; 00346 mp = GetManualPoint(0); 00347 *x = mp->GetX(); 00348 *y = mp->GetY(); 00349 *z = mp->GetZ(); 00350 } 00351 if (_lstPoints.size()>=2) 00352 { 00353 *x = _cntSplineX->Evaluate(t); 00354 *y = _cntSplineY->Evaluate(t); 00355 *z = _cntSplineZ->Evaluate(t); 00356 } 00357 }
std::vector< manualContourModel * > manualContourModel::ExploseModel | ( | ) | [virtual, inherited] |
Reimplemented in manualContourModelBullEye.
Definition at line 675 of file manualContourModel.cpp.
00676 { 00677 std::vector<manualContourModel*> lstTmp; 00678 lstTmp.push_back(this); 00679 return lstTmp; 00680 }