From b1d61c67c28a9ba4a1de834e401d97cfc9e84764 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 21 Dec 2025 20:53:50 +0100 Subject: Reworking some structures. adding particle tests again --- lib/core/c++/particle/particle.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/core/c++') diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index b647ebe..3089378 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -51,7 +51,7 @@ constexpr auto verlet_step_lambda = [](saw::data>& particle, auto& pos = body.template get<"position">(); auto& pos_old = body.template get<"position_old">(); - // auto& rot = body.template get<"rotation">(); + auto& rot = body.template get<"rotation">(); auto& acc = body.template get<"acceleration">(); auto tsd_squared = time_step_delta * time_step_delta; @@ -70,7 +70,7 @@ constexpr auto verlet_step_lambda = [](saw::data>& particle, * * */ -template +template constexpr auto broadphase_collision_check = [](saw::data>& left, saw::data>& right){ auto rad_l = left.template get<"collision">().template get<"radius">(); auto rad_r = right.template get<"collision">().template get<"radius">(); @@ -80,7 +80,15 @@ constexpr auto broadphase_collision_check = [](saw::data>& le auto& pos_l = rb_l.template get<"position">(); auto& pos_r = rb_r.template get<"position">(); -} + + auto pos_dist = pos_l - pos_r; + + auto norm_2 = saw::math::dot(pos_dist,pos_dist); + + auto rad_ab_2 = rad_l * rad_l + rad_r * rad_r + rad_r * rad_l * static_cast::type>(2); + + return (norm_2.at({}).get() < rad_ab_2.get()); +}; template > class particle_system { -- cgit v1.2.3