Skip to content

Conversation

@romanarust
Copy link
Member

Added function create_offset_polygons_with_holes_2 along with some code refactorings on straight_skeleton_2.cpp.

@romanarust romanarust requested a review from tomvanmele October 1, 2024 11:24
return [Polygon(points.tolist()) for points in offset_polygons]


def create_offset_polygons_with_holes_2(points, holes, offset) -> list[Tuple[Polygon, list[Polygon]]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have asked this before, but i guess _2 means "2D"? perhaps this should be mentioned in the docstrings...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, i've added it to the docstrings. I've use "_2" as the cgal functions are named like that as well

Raises
------
ValueError
If the normal of the polygon is not [0, 0, 1].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be a unit normal, or vertical up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be vertical up, i've adjusted the docstrings

------
ValueError
If the normal of the polygon is not [0, 0, 1].
If the normal of a hole is not [0, 0, -1].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be a unit normal, or vertical down?


H = []
for i, hole in enumerate(holes):
points = list(hole)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the conversion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, not needed

hole = np.asarray(points, dtype=np.float64)
H.append(hole)

offset = float(offset)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the conversion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in any case, would do this at the beginning of the algorithm. process all input params (if necessary) at the start...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, it is not needed

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@romanarust romanarust merged commit 4d1eca6 into main Oct 3, 2024
5 checks passed
@romanarust romanarust deleted the feature/offset_with_holes branch October 3, 2024 06:30
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

Successfully merging this pull request may close these issues.

3 participants