@@ -1330,6 +1330,67 @@ bool is_neighbor_voxel(Cell* pCell, std::vector<double> my_voxel_center, std::ve
13301330 return true ;
13311331}
13321332
1333+ // bool is_neighbor_voxel_original(Cell* pCell, std::vector<double> my_voxel_center, std::vector<double> other_voxel_center, int other_voxel_index)
1334+ // bool is_neighbor_voxel_Claude(Cell* pCell, const std::vector<double>& my_voxel_center,
1335+ // const std::vector<double>& other_voxel_center, int other_voxel_index)
1336+ // {
1337+ // // Cache frequently used values
1338+ // const double max_interactive_distance = pCell->phenotype.mechanics.relative_maximum_adhesion_distance *
1339+ // pCell->phenotype.geometry.radius +
1340+ // pCell->get_container()->max_cell_interactive_distance_in_voxel[other_voxel_index];
1341+ // const double max_distance_squared = max_interactive_distance * max_interactive_distance;
1342+ // const auto& pos = pCell->position;
1343+
1344+ // // Helper lambda to compute squared distance
1345+ // auto squared_distance = [](double dx, double dy, double dz = 0.0) {
1346+ // return dx * dx + dy * dy + dz * dz;
1347+ // };
1348+
1349+ // // Count matching dimensions to determine neighbor type
1350+ // int matching_dims = 0;
1351+ // int differing_dim = -1;
1352+
1353+ // for (int i = 0; i < 3; ++i) {
1354+ // if (my_voxel_center[i] == other_voxel_center[i]) {
1355+ // matching_dims++;
1356+ // } else {
1357+ // differing_dim = i;
1358+ // }
1359+ // }
1360+
1361+ // // Case 1: Face neighbor (2 matching dimensions)
1362+ // if (matching_dims == 2) {
1363+ // const double surface_coord = 0.5 * (my_voxel_center[differing_dim] + other_voxel_center[differing_dim]);
1364+ // return std::fabs(pos[differing_dim] - surface_coord) <= max_interactive_distance;
1365+ // }
1366+
1367+ // // Case 2: Edge neighbor (1 matching dimension)
1368+ // if (matching_dims == 1) {
1369+ // int dim1 = -1, dim2 = -1;
1370+ // for (int i = 0, count = 0; i < 3; ++i) {
1371+ // if (my_voxel_center[i] != other_voxel_center[i]) {
1372+ // if (count == 0) dim1 = i;
1373+ // else dim2 = i;
1374+ // count++;
1375+ // }
1376+ // }
1377+
1378+ // const double line_coord1 = 0.5 * (my_voxel_center[dim1] + other_voxel_center[dim1]);
1379+ // const double line_coord2 = 0.5 * (my_voxel_center[dim2] + other_voxel_center[dim2]);
1380+ // const double dist_sq = squared_distance(pos[dim1] - line_coord1, pos[dim2] - line_coord2);
1381+
1382+ // return dist_sq <= max_distance_squared;
1383+ // }
1384+
1385+ // // Case 3: Corner neighbor (0 matching dimensions)
1386+ // const double corner_x = 0.5 * (my_voxel_center[0] + other_voxel_center[0]);
1387+ // const double corner_y = 0.5 * (my_voxel_center[1] + other_voxel_center[1]);
1388+ // const double corner_z = 0.5 * (my_voxel_center[2] + other_voxel_center[2]);
1389+ // const double dist_sq = squared_distance(pos[0] - corner_x, pos[1] - corner_y, pos[2] - corner_z);
1390+
1391+ // return dist_sq <= max_distance_squared;
1392+ // }
1393+
13331394std::vector<Cell*>& Cell::cells_in_my_container ( void )
13341395{
13351396 return get_container ()->agent_grid [get_current_mechanics_voxel_index ()];
0 commit comments