Add Center Function on Holes

Calculates the center of the hole.
This commit is contained in:
2025-11-24 20:03:52 -05:00
parent 703285f555
commit 0a3919ce4c
2 changed files with 14 additions and 6 deletions

View File

@@ -149,18 +149,18 @@ func hit(position: Vector3):
# translate the cutter
var hole_vectors = Transform2D(0, hole_vector2_offset) * cutter
var rtree_search = []
for hv in hole_vectors:
rtree_search.append_array(inner_rtree.query(hv))
var draw = _add_hole(hole_vectors, rtree_search)
var draw = _add_hole(hole_vectors)
if draw:
_re_draw()
func _add_hole(new_hole: PackedVector2Array, holes_id: PackedInt32Array) -> bool:
func _add_hole(new_hole: PackedVector2Array) -> bool:
var ids_to_remove = []
var holes_id = []
for vector in new_hole:
holes_id.append_array(inner_rtree.query(vector))
# validate that the hole is valid
var boundary_polygon = Geometry2D.offset_polygon(outer_polygon, -edge_non_fracture)