VectorMath::VectorMath()
{
- //_math = vtkMath::new();
+
}
VectorMath::~VectorMath()
{
- if (_math != NULL ) { _math->Delete(); }
+
}
void VectorMath::SetData(std::vector<int> pointsX1, std::vector<int> pointsX2, std::vector<int> pointsY1, std::vector<int> pointsY2, std::vector<int> pointsZ1, std::vector<int> pointsZ2)
_pointz2a = pointsZ2[0];
_pointz2b = pointsZ2[1];
}
-/*
-int[3]* VectorMath::GetPoints()
+void VectorMath::Run()
{
+ _origin.clear();
+ _origin.push_back(_pointx2a);
+ _origin.push_back(_pointy2a);
+ _origin.push_back(_pointz2a);
+ _originReslicer.clear();
+ _originReslicer.push_back(_pointx1a);
+ _originReslicer.push_back(_pointy1a);
+ _originReslicer.push_back(_pointz1a);
+
+ double _vectorA[3];
+ _vectorA[0] =(double)(_pointx1b - _pointx1a);
+ _vectorA[1] =(double)(_pointy1b - _pointy1a);
+ _vectorA[2] =(double)(_pointz1b - _pointz1a);
+
+ double normA = vtkMath::Norm(_vectorA);
+
+ _vectorA[0] = _vectorA[0]/normA;
+ _vectorA[1] = _vectorA[1]/normA;
+ _vectorA[2] = _vectorA[2]/normA;
+
+ double _vectorB[3];
+ _vectorB[0] =(double)(_pointx2b - _pointx2a - _pointx1a);
+ _vectorB[1] =(double)(_pointy2b - _pointy2a - _pointy1a);
+ _vectorB[2] =(double)(_pointz2b - _pointz2a - _pointz1a);
+
+ double normB = vtkMath::Norm(_vectorB);
+
+ _vectorB[0] = _vectorB[0]/normB;
+ _vectorB[1] = _vectorB[1]/normB;
+ _vectorB[2] = _vectorB[2]/normB;
+
+ vtkMath::Cross(_vectorA, _vectorB, _result);
+
+ std::cout << "Data from vector A: X: " << _vectorA[0] << " Y: " << _vectorA[1] << " Z: " << _vectorA[2] << std::endl;
+ std::cout << "Data from vector B: X: " << _vectorB[0] << " Y: " << _vectorB[1] << " Z: " << _vectorB[2] << std::endl;
+ std::cout << "Data from result: X: " << _result[0] << " Y: " << _result[1] << " Z: " << _result[2] << std::endl;
+
+ double _vectorOrigin[3] = {0,0,0};
+
+ double distanceA = vtkMath::Distance2BetweenPoints(_vectorOrigin, _vectorA);
+ double distanceB = vtkMath::Distance2BetweenPoints(_vectorOrigin, _vectorA);
+
+ double proportion = distanceA/distanceB;
+
+ _scaleX = proportion;
+ _scaleY = proportion;
+ _scaleZ = proportion;
+
+ _angle = acos(vtkMath::Dot(_vectorA, _vectorB));
+
+ _angle = vtkMath::DegreesFromRadians(_angle);
+
+ std::cout << "Dot " << vtkMath::Dot(_vectorA, _vectorB) << std::endl;
+ std::cout << "Angle " << (double)_angle << std::endl;
+}
+
+
+std::vector<int> VectorMath::GetOrigin()
+{
+ return _origin;
}
-double[3]* VectorMath::GetScales()
+std::vector<int> VectorMath::GetOriginReslicer()
{
+ return _originReslicer;
+}
+void VectorMath::GetResult(double result[3])
+{
+ result = _result;
}
-double VectorMath::GetAngle()
+double VectorMath::GetScaleX()
+{
+ return _scaleX;
+}
+
+double VectorMath::GetScaleY()
+{
+ return _scaleY;
+}
+
+double VectorMath::GetScaleZ()
{
+ return _scaleZ;
+}
-}*/
+double VectorMath::GetAngle()
+{
+ return _angle;
+}