From b554b20c8d59d6046bdcec7c79fb61cd0e65811c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 3 Sep 2014 15:55:19 -0400 Subject: math: Make vectors have an array instead of different fields. --- libdimension/bench/geometry.c | 6 ------ libdimension/bench/prtree.c | 13 +++++-------- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'libdimension/bench') 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)); } -- cgit v1.2.3