diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-09-03 15:55:19 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-10-25 11:03:56 -0400 |
commit | b554b20c8d59d6046bdcec7c79fb61cd0e65811c (patch) | |
tree | a6c6f257cfaffcec953be7c0cce180f7a8855c68 /libdimension/bench | |
parent | b2cf35c26d5263f3079480208429e3a1d7dd2373 (diff) | |
download | dimension-b554b20c8d59d6046bdcec7c79fb61cd0e65811c.tar.xz |
math: Make vectors have an array instead of different fields.
Diffstat (limited to 'libdimension/bench')
-rw-r--r-- | libdimension/bench/geometry.c | 6 | ||||
-rw-r--r-- | libdimension/bench/prtree.c | 13 |
2 files changed, 5 insertions, 14 deletions
diff --git a/libdimension/bench/geometry.c b/libdimension/bench/geometry.c index 59d27e3..ae30d17 100644 --- a/libdimension/bench/geometry.c +++ b/libdimension/bench/geometry.c @@ -107,12 +107,6 @@ main(void) }); printf("dmnsn_vector_mul(): %ld\n", sandglass.grains); - // dmnsn_vector_div() - sandglass_bench_fine(&sandglass, { - vector = dmnsn_vector_div(vector, 2.0); - }); - printf("dmnsn_vector_div(): %ld\n", sandglass.grains); - // dmnsn_vector_cross() sandglass_bench_fine(&sandglass, { vector = dmnsn_vector_cross(vector, vector2); diff --git a/libdimension/bench/prtree.c b/libdimension/bench/prtree.c index 6b5e7c1..aa29317 100644 --- a/libdimension/bench/prtree.c +++ b/libdimension/bench/prtree.c @@ -29,7 +29,7 @@ static bool dmnsn_fake_intersection_fn(const dmnsn_object *object, dmnsn_ray ray, dmnsn_intersection *intersection) { - intersection->t = (object->aabb.min.z - ray.x0.z)/ray.n.z; + intersection->t = (object->aabb.min.Z - ray.x0.Z)/ray.n.Z; intersection->normal = dmnsn_x; return true; } @@ -45,13 +45,10 @@ dmnsn_fake_bounding_fn(const dmnsn_object *object, dmnsn_matrix trans) { dmnsn_vector a, b; - a.x = 2.0*((double)rand())/RAND_MAX - 1.0; - a.y = 2.0*((double)rand())/RAND_MAX - 1.0; - a.z = 2.0*((double)rand())/RAND_MAX - 1.0; - - b.x = 2.0*((double)rand())/RAND_MAX - 1.0; - b.y = 2.0*((double)rand())/RAND_MAX - 1.0; - b.z = 2.0*((double)rand())/RAND_MAX - 1.0; + for (unsigned int i = 0; i < 3; ++i) { + a.n[i] = 2.0*((double)rand())/RAND_MAX - 1.0; + b.n[i] = 2.0*((double)rand())/RAND_MAX - 1.0; + } return dmnsn_new_aabb(dmnsn_vector_min(a, b), dmnsn_vector_max(a, b)); } |