diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-02 21:45:44 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-02 21:45:44 -0400 |
| commit | e94e651d068c8318e1136495178577bf75dfea91 (patch) | |
| tree | 3f132fe5d7f832cd285ba0b7864524c1e1798035 | |
| parent | 995207c93e0af09bbb8243d9857095682c2a2713 (diff) | |
| download | balls-e94e651d068c8318e1136495178577bf75dfea91.zip | |
remove epsilon
| -rw-r--r-- | balls.cl | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -37,8 +37,8 @@ collideWalls(__global float2 *positions, __global float2 *velocities, __global f r = radii[id]; /* Set bounds. */ - min = -1.0f + r + FLT_EPSILON; - max = 1.0f - r - FLT_EPSILON; + min = -1.0f + r; + max = 1.0f - r; /* Check for collision with bounds. */ if (p.x <= min.x || p.x >= max.x) { @@ -114,7 +114,7 @@ isCollision(float2 p1, float r1, float2 p2, float r2) { float rhs; dist = p1 - p2; - rhs = r1 + r2 + FLT_EPSILON; + rhs = r1 + r2; return (dist.x*dist.x + dist.y*dist.y) <= rhs*rhs; } @@ -125,8 +125,8 @@ setPosition(float2 *p1, float r1, float2 *p2, float r2) { mid = (*p1 + *p2) / 2.0f; n = unitNorm(*p2 - *p1); - *p1 = mid - (n*r1 + FLT_EPSILON); - *p2 = mid + (n*r2 + FLT_EPSILON); + *p1 = mid - n*r1; + *p2 = mid + n*r2; } /* Set the velocities of two balls after collision. */ |