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

PolygonVisibility.ComputeVisibility AccessViolationException #20

Open
szlq opened this issue Apr 29, 2024 · 1 comment
Open

PolygonVisibility.ComputeVisibility AccessViolationException #20

szlq opened this issue Apr 29, 2024 · 1 comment

Comments

@szlq
Copy link

szlq commented Apr 29, 2024

I tryed the method PolygonVisibility.ComputeVisibility , but encountered a AccessViolationException error bug.

Here is my code:

var points = new Point2d[]
{
  new Point2d(0, 0),
  new Point2d(5, 0),
  new Point2d(5, 5),
  new Point2d(0, 5),
};

var poly = new Polygon2<EEK>(points);
var pv = new PolygonVisibility<EEK>();

var pt = new Point2d(0, 0);
Polygon2<EEK> result;
pv.ComputeVisibility(pt, poly, out result);

The error is System.AccessViolationException:“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” which appeared at pv.ComputeVisibility(pt, poly, out result);

@szlq
Copy link
Author

szlq commented Apr 29, 2024

I found that the viewpoint must be located inside Polygon, not on its boundary.
I changed the pt from Point2d(0,0) to Point2d(1,1) and it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant