Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in PolygonSpatialObject::IsInsideInObjectSpace #1082

Open
maekclena opened this issue Jul 10, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@maekclena
Copy link
Contributor

commented Jul 10, 2019

Description

Polygon spatial objects have extra horizontal lines on some vertices. It is especially apparent when converted to binary image.

Steps to Reproduce

#include <itkImage.h>
#include <itkPolygonSpatialObject.h>

using ImageType = itk::Image<unsigned char, 2>;
using PolygonType = itk::PolygonSpatialObject<2>;

int main()
{
  PolygonType::Pointer polygon = PolygonType::New();

  // bottom left triangle
  float points[][2] = {
    {0.0, 0.0},
    {0.0, 10.0},
    {10.0, 10.0},
  };

  for (auto point : points)
  {
    PolygonType::SpatialObjectPointType so_point;
    so_point.SetPositionInObjectSpace(point);
    polygon->AddPoint(so_point);
  }

  polygon->Update();

  // top right corner
  ImageType::PointType test_point;
  test_point[0] = 10.0;
  test_point[1] = 0.0;

  // outputs "1"
  std::cout << polygon->IsInsideInObjectSpace(test_point, 0, "") << std::endl;

  return 0;
}

Expected behavior

test_point shouldn't be inside the polygon.

Actual behavior

test_point is inside the polygon.

Reproducibility

100%

Versions

The regression was introduced in b83454e.

Environment

MacOS Mojave

@maekclena maekclena added the type:Bug label Jul 10, 2019

@thewtex thewtex added the area:Core label Jul 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.