-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Clarify Geometry.offset_polygon_2d
regarding vertices translation
#38390
Conversation
@@ -200,6 +200,13 @@ | |||
Inflates or deflates [code]polygon[/code] by [code]delta[/code] units (pixels). If [code]delta[/code] is positive, makes the polygon grow outward. If [code]delta[/code] is negative, shrinks the polygon inward. Returns an array of polygons because inflating/deflating may result in multiple discrete polygons. Returns an empty array if [code]delta[/code] is negative and the absolute value of it approximately exceeds the minimum bounding rectangle dimensions of the polygon. | |||
Each polygon's vertices will be rounded as determined by [code]join_type[/code], see [enum PolyJoinType]. | |||
The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distinguished by calling [method is_polygon_clockwise]. | |||
[b]Note:[/b] for translating the polygon's vertices specifically, use [method Transform2D.xform] method: | |||
[codeblock] | |||
var polygon = PackedVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackedVector2Array
→ PoolVector2Array
in 3.2.
Not sure why I marked this as WIP, likely because of godotengine/godot-proposals#913, but it's fine to merge as is. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a nitpick but marking as approved already to remember to merge it.
The method is used to either inflate or deflate a polygon. For translating/transforming a polygon, use `Transform2D.xform`.
Thanks! |
Cherry-picked for 3.2.3. |
Kind of closes godotengine/godot-proposals#777 (renaming is subject to discussion, but I think it's more about the confusion in the first place).
The method is used to either inflate or deflate a polygon.
For translating/transforming a polygon, use
Transform2D.xform
, as in #31761.