diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-05-18 11:58:18 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-05-18 21:05:41 -0600 |
commit | fe3bd7a078ac758792da7338d480b274e6aa4895 (patch) | |
tree | 2757c92940b80f9519e70ffbb727b9d65c9bf27b /libdimension | |
parent | 8a0acb317cf4870b3893849e6565833c611095bd (diff) | |
download | dimension-fe3bd7a078ac758792da7338d480b274e6aa4895.tar.xz |
Rename to dmnsn_vector_normalized().
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/bench/geometry.c | 6 | ||||
-rw-r--r-- | libdimension/cone.c | 2 | ||||
-rw-r--r-- | libdimension/dimension/geometry.h | 2 | ||||
-rw-r--r-- | libdimension/dimension/object.h | 2 | ||||
-rw-r--r-- | libdimension/geometry.c | 2 | ||||
-rw-r--r-- | libdimension/gradient.c | 2 | ||||
-rw-r--r-- | libdimension/raytrace.c | 8 | ||||
-rw-r--r-- | libdimension/torus.c | 4 |
8 files changed, 14 insertions, 14 deletions
diff --git a/libdimension/bench/geometry.c b/libdimension/bench/geometry.c index 4b77c9b..a952631 100644 --- a/libdimension/bench/geometry.c +++ b/libdimension/bench/geometry.c @@ -122,11 +122,11 @@ main(void) }); printf("dmnsn_vector_norm(): %ld\n", sandglass.grains); - /* dmnsn_vector_normalize() */ + /* dmnsn_vector_normalized() */ sandglass_bench_fine(&sandglass, { - vector = dmnsn_vector_normalize(vector); + vector = dmnsn_vector_normalized(vector); }); - printf("dmnsn_vector_normalize(): %ld\n", sandglass.grains); + printf("dmnsn_vector_normalized(): %ld\n", sandglass.grains); /* dmnsn_matrix_inverse() */ sandglass_bench_fine(&sandglass, { diff --git a/libdimension/cone.c b/libdimension/cone.c index 40e8f12..87f1fde 100644 --- a/libdimension/cone.c +++ b/libdimension/cone.c @@ -111,7 +111,7 @@ dmnsn_cone_intersection_fn(const dmnsn_object *cone, dmnsn_line l, } if (t >= 0.0 && p.y > -1.0 && p.y < 1.0) { - dmnsn_vector norm = dmnsn_vector_normalize( + dmnsn_vector norm = dmnsn_vector_normalized( dmnsn_new_vector(p.x, -(r2 - r1)*sqrt(p.x*p.x + p.z*p.z)/2.0, p.z) ); intersection->ray = l; diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h index 74807f7..ba8f531 100644 --- a/libdimension/dimension/geometry.h +++ b/libdimension/dimension/geometry.h @@ -331,7 +331,7 @@ dmnsn_vector_norm(dmnsn_vector n) /** Return the direction of a vector. */ DMNSN_INLINE dmnsn_vector -dmnsn_vector_normalize(dmnsn_vector n) +dmnsn_vector_normalized(dmnsn_vector n) { /* 1 sqrt, 3 divisions, 3 multiplications, 2 additions */ return dmnsn_vector_div(n, dmnsn_vector_norm(n)); diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index 1e10c3f..efe2323 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -123,7 +123,7 @@ void dmnsn_initialize_object(dmnsn_object *object); DMNSN_INLINE dmnsn_vector dmnsn_transform_normal(dmnsn_matrix trans, dmnsn_vector normal) { - return dmnsn_vector_normalize( + return dmnsn_vector_normalized( dmnsn_vector_sub( dmnsn_transform_vector(trans, normal), /* Optimized form of dmnsn_transform_vector(trans, dmnsn_zero) */ diff --git a/libdimension/geometry.c b/libdimension/geometry.c index 827e78a..b36b9c3 100644 --- a/libdimension/geometry.c +++ b/libdimension/geometry.c @@ -92,7 +92,7 @@ dmnsn_vector_axis_angle(dmnsn_vector v1, dmnsn_vector v2, dmnsn_vector axis) if (fabs(projn) < dmnsn_epsilon) return 0.0; - double c = dmnsn_vector_dot(dmnsn_vector_normalize(v1), + double c = dmnsn_vector_dot(dmnsn_vector_normalized(v1), dmnsn_vector_div(proj, projn)); double angle = acos(c); diff --git a/libdimension/gradient.c b/libdimension/gradient.c index ed20b63..aafc3b3 100644 --- a/libdimension/gradient.c +++ b/libdimension/gradient.c @@ -42,7 +42,7 @@ dmnsn_new_gradient_pattern(dmnsn_vector orientation) dmnsn_pattern *gradient = dmnsn_new_pattern(); dmnsn_vector *payload = dmnsn_malloc(sizeof(dmnsn_vector)); - *payload = dmnsn_vector_normalize(orientation); + *payload = dmnsn_vector_normalized(orientation); gradient->pattern_fn = dmnsn_gradient_pattern_fn; gradient->free_fn = dmnsn_free; diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index f5c68e6..87e0b8f 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -218,7 +218,7 @@ dmnsn_raytrace_background(dmnsn_raytrace_state *state, dmnsn_line ray) && (state->scene->quality & DMNSN_RENDER_PIGMENT)) { dmnsn_color sky = dmnsn_sky_sphere_color(state->scene->sky_sphere, - dmnsn_vector_normalize(ray.n)); + dmnsn_vector_normalized(ray.n)); color = dmnsn_apply_filter(color, sky); } @@ -310,7 +310,7 @@ dmnsn_raytrace_lighting(dmnsn_raytrace_state *state) dmnsn_color light_color = dmnsn_raytrace_light_ray(state, *light); if (!dmnsn_color_is_black(light_color)) { if (state->scene->quality & DMNSN_RENDER_FINISH) { - dmnsn_vector ray = dmnsn_vector_normalize( + dmnsn_vector ray = dmnsn_vector_normalized( dmnsn_vector_sub((*light)->x0, state->r) ); @@ -370,7 +370,7 @@ dmnsn_raytrace_translucency(dmnsn_raytrace_state *state) dmnsn_line trans_ray = dmnsn_new_line(state->r, state->intersection->ray.n); trans_ray = dmnsn_line_add_epsilon(trans_ray); - dmnsn_vector r = dmnsn_vector_normalize(trans_ray.n); + dmnsn_vector r = dmnsn_vector_normalized(trans_ray.n); dmnsn_vector n = state->intersection->normal; dmnsn_raytrace_state recursive_state = *state; @@ -439,7 +439,7 @@ dmnsn_raytrace_shoot(dmnsn_raytrace_state *state, dmnsn_line ray) state->intersection = &intersection; state->r = dmnsn_line_point(state->intersection->ray, state->intersection->t); - state->viewer = dmnsn_vector_normalize( + state->viewer = dmnsn_vector_normalized( dmnsn_vector_negate(state->intersection->ray.n) ); state->reflected = dmnsn_vector_sub( diff --git a/libdimension/torus.c b/libdimension/torus.c index 852102e..9eb2323 100644 --- a/libdimension/torus.c +++ b/libdimension/torus.c @@ -120,9 +120,9 @@ dmnsn_torus_intersection_fn(const dmnsn_object *torus, dmnsn_line l, dmnsn_vector p = dmnsn_line_point(l, t); dmnsn_vector center = dmnsn_vector_mul( payload->major, - dmnsn_vector_normalize(dmnsn_new_vector(p.x, 0.0, p.z)) + dmnsn_vector_normalized(dmnsn_new_vector(p.x, 0.0, p.z)) ); - dmnsn_vector normal = dmnsn_vector_normalize(dmnsn_vector_sub(p, center)); + dmnsn_vector normal = dmnsn_vector_normalized(dmnsn_vector_sub(p, center)); intersection->ray = l; intersection->t = t; intersection->normal = normal; |