Skip to content

Commit d7c1c14

Browse files
Merge pull request #72 from vismaychuriwala/master
2 parents 913a7ed + 2f09f77 commit d7c1c14

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

gpu/opengjk_gpu.cu

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,10 @@ __device__ inline static int hff2(const gkFloat* p, const gkFloat* q,
280280

281281
__device__ inline static int hff3(const gkFloat* p, const gkFloat* q,
282282
const gkFloat* r) {
283-
gkFloat n[3], pq[3], pr[3];
283+
gkFloat n[3];
284+
crossProduct(q, r, n);
284285

285-
#pragma unroll
286-
for (int i = 0; i < 3; i++) {
287-
pq[i] = q[i] - p[i];
288-
}
289-
#pragma unroll
290-
for (int i = 0; i < 3; i++) {
291-
pr[i] = r[i] - p[i];
292-
}
293-
294-
crossProduct(pq, pr, n);
295-
return dotProduct(p, n) <= 0; // discard s if true
286+
return dotProduct(p, n) <= 0; // discard s if true
296287
}
297288

298289
__device__ inline static void S1D(gkSimplex* s, gkFloat* v) {

scalar/openGJK.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,9 @@ inline static int hff2(const gkFloat* restrict p, const gkFloat* restrict q,
267267

268268
inline static int hff3(const gkFloat* restrict p, const gkFloat* restrict q,
269269
const gkFloat* restrict r) {
270-
gkFloat n[3], pq[3], pr[3];
271-
272-
for (int i = 0; i < 3; i++) {
273-
pq[i] = q[i] - p[i];
274-
}
275-
for (int i = 0; i < 3; i++) {
276-
pr[i] = r[i] - p[i];
277-
}
278-
279-
crossProduct(pq, pr, n);
280-
return dotProduct(p, n) <= 0;
270+
gkFloat n[3];
271+
crossProduct(q, r, n);
272+
return dotProduct(p, n) <= 0; // discard s if true
281273
}
282274

283275
inline static void S1D(gkSimplex* s, gkFloat* v) {

0 commit comments

Comments
 (0)