1 #include "manualContourModelRotationTool.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
7 manualContourModelRotationTool::manualContourModelRotationTool()
11 //----------------------------------------------------------------
13 manualContourModelRotationTool::~manualContourModelRotationTool()
18 // ----------------------------------------------------------------------------
19 manualContourModelRotationTool * manualContourModelRotationTool :: Clone() // virtual
21 manualContourModelRotationTool * clone = new manualContourModelRotationTool();
22 CopyAttributesTo(clone);
26 // ---------------------------------------------------------------------------
27 void manualContourModelRotationTool::CopyAttributesTo( manualContourModelRotationTool * cloneObject)
30 manualContourModelRotationTool::CopyAttributesTo(cloneObject);
33 //----------------------------------------------------------------
34 int manualContourModelRotationTool::GetTypeModel() //virtual
39 //----------------------------------------------------------------
40 void manualContourModelRotationTool::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
42 int nps = GetNumberOfPointsSpline();
43 //Spline points of the circle
46 double angle = _deltaAngle*i;
47 *x = _radio*cos(angle) + _centerX;
48 *y = _radio*sin(angle) + _centerY;
51 //Spline points of the reference line
58 //Spline points of the movable line
61 manualPoint *mpA= GetManualPoint(2);
69 // ---------------------------------------------------------------------------
70 void manualContourModelRotationTool:: UpdateSpline()
72 manualPoint *mpA,*mpB,*mpC;
75 int np = GetSizeLstPoints( );
76 int nps = GetNumberOfPointsSpline();
77 _deltaAngle=(3.14159265*2)/(nps-1-2);
81 mpA = GetManualPoint(0);
82 mpB = GetManualPoint(1);
83 mpC = GetManualPoint(2);
84 difX = mpA->GetX() - mpB->GetX();
85 difY = mpA->GetY() - mpB->GetY();
86 _radio = sqrt( difX*difX + difY*difY );
87 _centerX = mpA->GetX();
88 _centerY = mpA->GetY();
89 _centerZ = mpA->GetZ();
91 x= mpC->GetX() - mpA->GetX();
92 y= mpC->GetY() - mpA->GetY();
93 _angle= atan(y/x)*180/(3.14159265);
94 cout << "Scale" <<_radio <<endl;
95 cout << "Angle" <<_angle <<endl;
96 cout<< "Center"<<_centerX<<","<<_centerY<<endl;
108 //----------------------------------------------------------------
109 double manualContourModelRotationTool::getRadio()
114 //----------------------------------------------------------------
115 double manualContourModelRotationTool::getAngle()
121 std::vector<double> manualContourModelRotationTool::getCenter()
123 manualPoint *mpCenter = GetManualPoint(0);
124 std::vector<double> centro(2,0);
125 centro[0]=mpCenter->GetX();
126 centro[1]=mpCenter->GetY();