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

Prism 2d correct center calculation #2188

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions python/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,13 @@ def __init__(
centroid = sum(vertices, Vector3(0)) * (
1.0 / len(vertices)
) # centroid of floor polygon
original_center = (
centroid + (0.5 * height) * axis
) # center as computed from vertices, height, axis
if height == mp.inf:
original_center = centroid # center as computed only from vertices if height is infinite (2d case)
else:
original_center = (
centroid + (0.5 * height) * axis
) # center as computed from vertices, height, axis

if center is not None and len(vertices):
center = Vector3(*center)
# translate vertices to center prism at requested center
Expand Down