Commit 1bfd7ad1 authored by ozantonkal's avatar ozantonkal

arrow widget thickness parameter

parent dc348ff9
...@@ -81,7 +81,7 @@ namespace cv ...@@ -81,7 +81,7 @@ namespace cv
class CV_EXPORTS ArrowWidget : public Widget3D class CV_EXPORTS ArrowWidget : public Widget3D
{ {
public: public:
ArrowWidget(const Point3f& pt1, const Point3f& pt2, const Color &color = Color::white()); ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
}; };
class CV_EXPORTS CircleWidget : public Widget3D class CV_EXPORTS CircleWidget : public Widget3D
......
...@@ -128,9 +128,13 @@ template<> cv::viz::SphereWidget cv::viz::Widget::cast<cv::viz::SphereWidget>() ...@@ -128,9 +128,13 @@ template<> cv::viz::SphereWidget cv::viz::Widget::cast<cv::viz::SphereWidget>()
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
/// arrow widget implementation /// arrow widget implementation
cv::viz::ArrowWidget::ArrowWidget(const Point3f& pt1, const Point3f& pt2, const Color &color) cv::viz::ArrowWidget::ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness, const Color &color)
{ {
vtkSmartPointer<vtkArrowSource> arrowSource = vtkSmartPointer<vtkArrowSource>::New (); vtkSmartPointer<vtkArrowSource> arrowSource = vtkSmartPointer<vtkArrowSource>::New ();
arrowSource->SetShaftRadius(thickness);
// The thickness and radius of the tip are adjusted based on the thickness of the arrow
arrowSource->SetTipRadius(thickness * 3.0);
arrowSource->SetTipLength(thickness * 10.0);
float startPoint[3], endPoint[3]; float startPoint[3], endPoint[3];
startPoint[0] = pt1.x; startPoint[0] = pt1.x;
......
...@@ -90,7 +90,7 @@ TEST(Viz_viz3d, accuracy) ...@@ -90,7 +90,7 @@ TEST(Viz_viz3d, accuracy)
viz::LineWidget lw(Point3f(0, 0, 0), Point3f(4.f, 4.f,4.f), viz::Color::green()); viz::LineWidget lw(Point3f(0, 0, 0), Point3f(4.f, 4.f,4.f), viz::Color::green());
viz::PlaneWidget pw(Vec4f(0.0,1.0,2.0,3.0), 5.0); viz::PlaneWidget pw(Vec4f(0.0,1.0,2.0,3.0), 5.0);
viz::SphereWidget sw(Point3f(0, 0, 0), 0.5); viz::SphereWidget sw(Point3f(0, 0, 0), 0.5);
viz::ArrowWidget aw(Point3f(0, 0, 0), Point3f(1, 1, 1), viz::Color::red()); viz::ArrowWidget aw(Point3f(0, 0, 0), Point3f(1, 1, 1), 0.01, viz::Color::red());
viz::CircleWidget cw(Point3f(0, 0, 0), 0.5, 0.01, viz::Color::green()); viz::CircleWidget cw(Point3f(0, 0, 0), 0.5, 0.01, viz::Color::green());
viz::CylinderWidget cyw(Point3f(0, 0, 0), Point3f(-1, -1, -1), 0.5, 30, viz::Color::green()); viz::CylinderWidget cyw(Point3f(0, 0, 0), Point3f(-1, -1, -1), 0.5, 30, viz::Color::green());
viz::CubeWidget cuw(Point3f(-2, -2, -2), Point3f(-1, -1, -1)); viz::CubeWidget cuw(Point3f(-2, -2, -2), Point3f(-1, -1, -1));
......
Markdown is supported
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