diff --git a/modules/viz/src/shape_widgets.cpp b/modules/viz/src/shape_widgets.cpp index 8dea213f9e..4dbfaee929 100644 --- a/modules/viz/src/shape_widgets.cpp +++ b/modules/viz/src/shape_widgets.cpp @@ -1166,7 +1166,8 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector &path, i { vtkSmartPointer appendFilter = vtkSmartPointer::New(); - if (display_mode & TrajectoryWidget::DISPLAY_PATH) + // Bitwise and with 3 in order to limit the domain to 2 bits + if ((~display_mode & 3) ^ TrajectoryWidget::DISPLAY_PATH) { // Create a poly line along the path vtkIdType nr_points = path.size(); @@ -1207,7 +1208,7 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector &path, i appendFilter->AddInputConnection(polyData->GetProducerPort()); } - if (display_mode & TrajectoryWidget::DISPLAY_FRAMES) + if ((~display_mode & 3) ^ TrajectoryWidget::DISPLAY_FRAMES) { // Create frames and transform along the path vtkSmartPointer axes = vtkSmartPointer::New();