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

Implement a benchmark algorithm Delaunay3D #39

Merged
merged 1 commit into from
Apr 18, 2024
Merged
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
27 changes: 27 additions & 0 deletions benchmarks/math/delaunay_3d.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extends Benchmark

const NUM_POINTS := 1_000
const UPPER_LEFT_DOWN := Vector3(0.0, 0.0, 0.0)
const BOTTOM_RIGHT_UP := Vector3(10.0, 10.0, 10.0)

var rng := RandomNumberGenerator.new()

func scatter_points_3D(num_points: int,
upper_left_down: Vector3,
bottom_right_up: Vector3) -> PackedVector3Array:
rng.seed = hash("Delaunay3D")
var points := PackedVector3Array()

for i in range(num_points):
points.append(Vector3(
rng.randf_range(upper_left_down.x, bottom_right_up.x),
rng.randf_range(upper_left_down.y, bottom_right_up.y),
rng.randf_range(upper_left_down.z, bottom_right_up.z)
))

return points

var scattered_points := scatter_points_3D(NUM_POINTS, UPPER_LEFT_DOWN, BOTTOM_RIGHT_UP)

func benchmark_delaunay3D() -> void:
Geometry3D.tetrahedralize_delaunay(scattered_points)