summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-17 14:26:19 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-17 14:26:19 -0400
commitcd7cba285144211c5ea1f4573ad729555923dab1 (patch)
tree10f500a3c3fbbeba04778943fad36f97f6b2242f
parentbafe01580d1470f703a95a434b38998843440cd0 (diff)
downloaddimension-cd7cba285144211c5ea1f4573ad729555923dab1.tar.xz
Rename dmnsn_matrix_*_mul() to dmnsn_transform_*().
-rw-r--r--bench/libdimension/geometry.c12
-rw-r--r--dimension/parse.c8
-rw-r--r--dimension/realize.c26
-rw-r--r--doc/libdimension.texi14
-rw-r--r--libdimension/canvas_pigment.c2
-rw-r--r--libdimension/csg.c12
-rw-r--r--libdimension/cube.c6
-rw-r--r--libdimension/dimension/geometry.h12
-rw-r--r--libdimension/dimension/object.h2
-rw-r--r--libdimension/geometry.c20
-rw-r--r--libdimension/object.c8
-rw-r--r--libdimension/perspective.c2
-rw-r--r--libdimension/plane.c4
-rw-r--r--libdimension/sphere.c8
14 files changed, 68 insertions, 68 deletions
diff --git a/bench/libdimension/geometry.c b/bench/libdimension/geometry.c
index 282d3eb..d75b09e 100644
--- a/bench/libdimension/geometry.c
+++ b/bench/libdimension/geometry.c
@@ -152,17 +152,17 @@ main()
});
printf("dmnsn_matrix_mul(): %ld\n", sandglass.grains);
- /* dmnsn_matrix_vector_mul() */
+ /* dmnsn_transform_vector() */
sandglass_bench_fine(&sandglass, {
- vector = dmnsn_matrix_vector_mul(matrix, vector);
+ vector = dmnsn_transform_vector(matrix, vector);
});
- printf("dmnsn_matrix_vector_mul(): %ld\n", sandglass.grains);
+ printf("dmnsn_transform_vector(): %ld\n", sandglass.grains);
- /* dmnsn_matrix_line_mul() */
+ /* dmnsn_transform_line() */
sandglass_bench_fine(&sandglass, {
- line = dmnsn_matrix_line_mul(matrix, line);
+ line = dmnsn_transform_line(matrix, line);
});
- printf("dmnsn_matrix_line_mul(): %ld\n", sandglass.grains);
+ printf("dmnsn_transform_line(): %ld\n", sandglass.grains);
/* dmnsn_line_point() */
sandglass_bench_fine(&sandglass, {
diff --git a/dimension/parse.c b/dimension/parse.c
index 9b174db..4d27be6 100644
--- a/dimension/parse.c
+++ b/dimension/parse.c
@@ -1164,7 +1164,7 @@ dmnsn_eval_binary(dmnsn_astnode astnode, dmnsn_symbol_table *symtable)
);
axis = dmnsn_vector_mul(atan(1.0)/45.0, axis);
- r = dmnsn_matrix_vector_mul(dmnsn_rotation_matrix(axis), r);
+ r = dmnsn_transform_vector(dmnsn_rotation_matrix(axis), r);
ret = dmnsn_copy_astnode(astnode);
dmnsn_make_ast_vector(&ret, r.x, r.y, r.z, 0.0, 0.0);
@@ -1271,15 +1271,15 @@ dmnsn_eval_binary(dmnsn_astnode astnode, dmnsn_symbol_table *symtable)
axis = dmnsn_vector_mul(atan(1.0)/45.0, axis);
- r = dmnsn_matrix_vector_mul(
+ r = dmnsn_transform_vector(
dmnsn_rotation_matrix(dmnsn_new_vector(axis.x, 0.0, 0.0)),
r
);
- r = dmnsn_matrix_vector_mul(
+ r = dmnsn_transform_vector(
dmnsn_rotation_matrix(dmnsn_new_vector(0.0, axis.y, 0.0)),
r
);
- r = dmnsn_matrix_vector_mul(
+ r = dmnsn_transform_vector(
dmnsn_rotation_matrix(dmnsn_new_vector(0.0, 0.0, axis.z)),
r
);
diff --git a/dimension/realize.c b/dimension/realize.c
index a40095a..d0b8fa2 100644
--- a/dimension/realize.c
+++ b/dimension/realize.c
@@ -272,8 +272,8 @@ dmnsn_realize_camera(dmnsn_astnode astnode)
dmnsn_vector_normalize(direction)
)
);
- up = dmnsn_matrix_vector_mul(sky1, up);
- right = dmnsn_matrix_vector_mul(sky1, right);
+ up = dmnsn_transform_vector(sky1, up);
+ right = dmnsn_transform_vector(sky1, right);
dmnsn_matrix sky2 = dmnsn_rotation_matrix(
dmnsn_vector_mul(
@@ -281,8 +281,8 @@ dmnsn_realize_camera(dmnsn_astnode astnode)
dmnsn_vector_normalize(right)
)
);
- up = dmnsn_matrix_vector_mul(sky2, up);
- direction = dmnsn_matrix_vector_mul(sky2, direction);
+ up = dmnsn_transform_vector(sky2, up);
+ direction = dmnsn_transform_vector(sky2, direction);
/* Line up the camera with the look_at */
@@ -293,8 +293,8 @@ dmnsn_realize_camera(dmnsn_astnode astnode)
dmnsn_vector_normalize(up)
)
);
- right = dmnsn_matrix_vector_mul(look_at1, right);
- direction = dmnsn_matrix_vector_mul(look_at1, direction);
+ right = dmnsn_transform_vector(look_at1, right);
+ direction = dmnsn_transform_vector(look_at1, direction);
dmnsn_matrix look_at2 = dmnsn_rotation_matrix(
dmnsn_vector_mul(
@@ -302,8 +302,8 @@ dmnsn_realize_camera(dmnsn_astnode astnode)
dmnsn_vector_normalize(right)
)
);
- up = dmnsn_matrix_vector_mul(look_at2, up);
- direction = dmnsn_matrix_vector_mul(look_at2, direction);
+ up = dmnsn_transform_vector(look_at2, up);
+ direction = dmnsn_transform_vector(look_at2, direction);
break;
}
@@ -349,8 +349,8 @@ dmnsn_realize_camera(dmnsn_astnode astnode)
)
);
- dmnsn_vector x = dmnsn_matrix_vector_mul(align, dmnsn_x);
- dmnsn_vector y = dmnsn_matrix_vector_mul(align, dmnsn_y);
+ dmnsn_vector x = dmnsn_transform_vector(align, dmnsn_x);
+ dmnsn_vector y = dmnsn_transform_vector(align, dmnsn_y);
align = dmnsn_matrix_mul(
dmnsn_rotation_matrix(
@@ -736,19 +736,19 @@ dmnsn_realize_light_source_modifiers(dmnsn_astnode astnode, dmnsn_light *light)
switch (modifier.type) {
case DMNSN_AST_ROTATION:
- light->x0 = dmnsn_matrix_vector_mul(
+ light->x0 = dmnsn_transform_vector(
dmnsn_realize_rotation(modifier),
light->x0
);
break;
case DMNSN_AST_SCALE:
- light->x0 = dmnsn_matrix_vector_mul(
+ light->x0 = dmnsn_transform_vector(
dmnsn_realize_scale(modifier),
light->x0
);
break;
case DMNSN_AST_TRANSLATION:
- light->x0 = dmnsn_matrix_vector_mul(
+ light->x0 = dmnsn_transform_vector(
dmnsn_realize_translation(modifier),
light->x0
);
diff --git a/doc/libdimension.texi b/doc/libdimension.texi
index 2303c3b..33210bd 100644
--- a/doc/libdimension.texi
+++ b/doc/libdimension.texi
@@ -315,11 +315,11 @@ dmnsn_vector dmnsn_vector_normalize(dmnsn_vector n);
dmnsn_matrix dmnsn_matrix_inverse(dmnsn_matrix A);
@findex dmnsn_matrix_mul()
dmnsn_matrix dmnsn_matrix_mul(dmnsn_matrix lhs, dmnsn_matrix rhs);
-@findex dmnsn_matrix_vector_mul()
-dmnsn_vector dmnsn_matrix_vector_mul(dmnsn_matrix lhs,
- dmnsn_vector rhs);
-@findex dmnsn_matrix_line_mul()
-dmnsn_line dmnsn_matrix_line_mul(dmnsn_matrix lhs, dmnsn_line rhs);
+@findex dmnsn_transform_vector()
+dmnsn_vector dmnsn_transform_vector(dmnsn_matrix lhs,
+ dmnsn_vector rhs);
+@findex dmnsn_transform_line()
+dmnsn_line dmnsn_transform_line(dmnsn_matrix lhs, dmnsn_line rhs);
@findex dmnsn_line_point()
dmnsn_vector dmnsn_line_point(dmnsn_line l, double t);
@@ -341,7 +341,7 @@ They may be easily constructed by the self-explanatory @code{dmnsn_new_vector()}
@cindex normalization
@cindex dot product
@cindex cross product
-Vectors support addition and subtraction, multiplication and division by a scalar, the dot and cross products, the norm and normalization operations, and transformation by a matrix (@code{dmnsn_matrix_vector_mul()}).
+Vectors support addition and subtraction, multiplication and division by a scalar, the dot and cross products, the norm and normalization operations, and transformation by a matrix (@code{dmnsn_transform_vector()}).
@cindex matrix inversion
Matricies support matrix multiplication, and inversion.
@@ -352,7 +352,7 @@ As well, there are four special matrix constructors.
@code{dmnsn_translate_matrix(d)} returns a matrix which translates by @code{d}.
Finally, @code{dmnsn_rotation_matrix(theta)} returns a matrix which rotates by an angle of @code{dmnsn_vector_norm(theta)}, about the axis @code{dmnsn_vector_normalize(theta)}.
-Lines support transformation by a matrix (@code{dmnsn_matrix_line_mul(A, l) = dmnsn_new_line(A*l.x0, A*(l.x0 + l.n) - A*l.x0)}).
+Lines support transformation by a matrix (@code{dmnsn_transform_line(A, l) = dmnsn_new_line(A*l.x0, A*(l.x0 + l.n) - A*l.x0)}).
Also, @code{dmnsn_line_point(l, t) = l.x0 + t*l.n} gives the point @code{t} on the line, and @code{dmnsn_line_index(l, x)} gives the @code{t} value such that @code{dmnsn_line_point(l, t) == x}.
@node Color
diff --git a/libdimension/canvas_pigment.c b/libdimension/canvas_pigment.c
index 8667e4d..c86fc66 100644
--- a/libdimension/canvas_pigment.c
+++ b/libdimension/canvas_pigment.c
@@ -40,7 +40,7 @@ dmnsn_new_canvas_pigment(dmnsn_canvas *canvas)
static dmnsn_color
dmnsn_canvas_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v)
{
- v = dmnsn_matrix_vector_mul(pigment->trans_inv, v);
+ v = dmnsn_transform_vector(pigment->trans_inv, v);
dmnsn_canvas *canvas = pigment->ptr;
diff --git a/libdimension/csg.c b/libdimension/csg.c
index 14f2980..1c5f15a 100644
--- a/libdimension/csg.c
+++ b/libdimension/csg.c
@@ -36,7 +36,7 @@ dmnsn_csg_union_intersection_fn(const dmnsn_object *csg,
dmnsn_line line,
dmnsn_intersection *intersection)
{
- dmnsn_line line_trans = dmnsn_matrix_line_mul(csg->trans_inv, line);
+ dmnsn_line line_trans = dmnsn_transform_line(csg->trans_inv, line);
const dmnsn_object **params = csg->ptr;
@@ -71,8 +71,8 @@ dmnsn_csg_union_intersection_fn(const dmnsn_object *csg,
}
intersection->ray = line;
- intersection->normal = dmnsn_matrix_normal_mul(csg->trans,
- intersection->normal);
+ intersection->normal = dmnsn_transform_normal(csg->trans,
+ intersection->normal);
return true;
}
@@ -118,7 +118,7 @@ dmnsn_csg_intersection_fn(const dmnsn_object *csg, dmnsn_line line,
/* inside1 is whether the second object is allowed inside the first object;
respectively for inside2 */
- dmnsn_line line_trans = dmnsn_matrix_line_mul(csg->trans_inv, line);
+ dmnsn_line line_trans = dmnsn_transform_line(csg->trans_inv, line);
const dmnsn_object **params = csg->ptr;
@@ -183,8 +183,8 @@ dmnsn_csg_intersection_fn(const dmnsn_object *csg, dmnsn_line line,
}
intersection->ray = line;
- intersection->normal = dmnsn_matrix_normal_mul(csg->trans,
- intersection->normal);
+ intersection->normal = dmnsn_transform_normal(csg->trans,
+ intersection->normal);
return true;
}
diff --git a/libdimension/cube.c b/libdimension/cube.c
index dfd1757..396049d 100644
--- a/libdimension/cube.c
+++ b/libdimension/cube.c
@@ -49,7 +49,7 @@ static bool
dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line,
dmnsn_intersection *intersection)
{
- dmnsn_line line_trans = dmnsn_matrix_line_mul(cube->trans_inv, line);
+ dmnsn_line line_trans = dmnsn_transform_line(cube->trans_inv, line);
double t = -1.0, t_temp;
dmnsn_vector p, normal;
@@ -125,7 +125,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line,
if (t >= 0.0) {
intersection->ray = line;
intersection->t = t;
- intersection->normal = dmnsn_matrix_normal_mul(cube->trans, normal);
+ intersection->normal = dmnsn_transform_normal(cube->trans, normal);
intersection->texture = cube->texture;
intersection->interior = cube->interior;
return true;
@@ -138,7 +138,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line,
static bool
dmnsn_cube_inside_fn(const dmnsn_object *cube, dmnsn_vector point)
{
- point = dmnsn_matrix_vector_mul(cube->trans_inv, point);
+ point = dmnsn_transform_vector(cube->trans_inv, point);
return point.x > -1.0 && point.x < 1.0
&& point.y > -1.0 && point.y < 1.0
&& point.z > -1.0 && point.z < 1.0;
diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h
index 754e46d..a7ff32c 100644
--- a/libdimension/dimension/geometry.h
+++ b/libdimension/dimension/geometry.h
@@ -192,19 +192,19 @@ double dmnsn_vector_axis_angle(dmnsn_vector v1, dmnsn_vector v2,
dmnsn_matrix dmnsn_matrix_inverse(dmnsn_matrix A);
dmnsn_matrix dmnsn_matrix_mul(dmnsn_matrix lhs, dmnsn_matrix rhs);
-dmnsn_vector dmnsn_matrix_vector_mul(dmnsn_matrix lhs, dmnsn_vector rhs);
-dmnsn_bounding_box dmnsn_matrix_bounding_box_mul(dmnsn_matrix lhs,
- dmnsn_bounding_box rhs);
+dmnsn_vector dmnsn_transform_vector(dmnsn_matrix lhs, dmnsn_vector rhs);
+dmnsn_bounding_box dmnsn_transform_bounding_box(dmnsn_matrix lhs,
+ dmnsn_bounding_box rhs);
/* Affine line transformation; n = lhs*(x0 + n) - lhs*x0, x0 *= lhs */
DMNSN_INLINE dmnsn_line
-dmnsn_matrix_line_mul(dmnsn_matrix lhs, dmnsn_line rhs)
+dmnsn_transform_line(dmnsn_matrix lhs, dmnsn_line rhs)
{
/* 24 multiplications, 6 divisions, 30 additions */
dmnsn_line l;
- l.x0 = dmnsn_matrix_vector_mul(lhs, rhs.x0);
+ l.x0 = dmnsn_transform_vector(lhs, rhs.x0);
l.n = dmnsn_vector_sub(
- dmnsn_matrix_vector_mul(lhs, dmnsn_vector_add(rhs.x0, rhs.n)),
+ dmnsn_transform_vector(lhs, dmnsn_vector_add(rhs.x0, rhs.n)),
l.x0
);
return l;
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index 1d5f580..d0afa8a 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -41,7 +41,7 @@ typedef struct dmnsn_intersection {
const dmnsn_interior *interior;
} dmnsn_intersection;
-dmnsn_vector dmnsn_matrix_normal_mul(dmnsn_matrix trans, dmnsn_vector normal);
+dmnsn_vector dmnsn_transform_normal(dmnsn_matrix trans, dmnsn_vector normal);
/* Forward-declare dmnsn_object */
typedef struct dmnsn_object dmnsn_object;
diff --git a/libdimension/geometry.c b/libdimension/geometry.c
index 304f21d..faeb30b 100644
--- a/libdimension/geometry.c
+++ b/libdimension/geometry.c
@@ -345,7 +345,7 @@ dmnsn_matrix_mul(dmnsn_matrix lhs, dmnsn_matrix rhs)
/* Affine transformation; lhs*(x,y,z,1), normalized so the fourth element is
1 */
dmnsn_vector
-dmnsn_matrix_vector_mul(dmnsn_matrix lhs, dmnsn_vector rhs)
+dmnsn_transform_vector(dmnsn_matrix lhs, dmnsn_vector rhs)
{
/* 12 multiplications, 3 divisions, 12 additions */
dmnsn_vector r;
@@ -361,7 +361,7 @@ dmnsn_matrix_vector_mul(dmnsn_matrix lhs, dmnsn_vector rhs)
/* Give an axis-aligned box that contains the given box transformed by `lhs' */
dmnsn_bounding_box
-dmnsn_matrix_bounding_box_mul(dmnsn_matrix trans, dmnsn_bounding_box box)
+dmnsn_transform_bounding_box(dmnsn_matrix trans, dmnsn_bounding_box box)
{
/* Infinite bounding box support */
if (isinf(box.min.x) || isinf(box.min.y) || isinf(box.min.z)
@@ -374,41 +374,41 @@ dmnsn_matrix_bounding_box_mul(dmnsn_matrix trans, dmnsn_bounding_box box)
dmnsn_vector corner;
dmnsn_bounding_box ret;
- ret.min = dmnsn_matrix_vector_mul(trans, box.min);
+ ret.min = dmnsn_transform_vector(trans, box.min);
ret.max = ret.min;
corner = dmnsn_new_vector(box.min.x, box.min.y, box.max.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.min.x, box.max.y, box.min.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.min.x, box.max.y, box.max.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.max.x, box.min.y, box.min.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.max.x, box.min.y, box.max.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.max.x, box.max.y, box.min.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
corner = dmnsn_new_vector(box.max.x, box.max.y, box.max.z);
- corner = dmnsn_matrix_vector_mul(trans, corner);
+ corner = dmnsn_transform_vector(trans, corner);
ret.min = dmnsn_vector_min(ret.min, corner);
ret.max = dmnsn_vector_max(ret.max, corner);
diff --git a/libdimension/object.c b/libdimension/object.c
index 3cf68c7..981e535 100644
--- a/libdimension/object.c
+++ b/libdimension/object.c
@@ -21,12 +21,12 @@
#include "dimension.h"
dmnsn_vector
-dmnsn_matrix_normal_mul(dmnsn_matrix trans, dmnsn_vector normal)
+dmnsn_transform_normal(dmnsn_matrix trans, dmnsn_vector normal)
{
return dmnsn_vector_normalize(
dmnsn_vector_sub(
- dmnsn_matrix_vector_mul(trans, normal),
- dmnsn_matrix_vector_mul(trans, dmnsn_zero)
+ dmnsn_transform_vector(trans, normal),
+ dmnsn_transform_vector(trans, dmnsn_zero)
)
);
}
@@ -62,7 +62,7 @@ void
dmnsn_object_precompute(dmnsn_object *object)
{
object->bounding_box
- = dmnsn_matrix_bounding_box_mul(object->trans, object->bounding_box);
+ = dmnsn_transform_bounding_box(object->trans, object->bounding_box);
object->trans_inv = dmnsn_matrix_inverse(object->trans);
if (object->texture) {
object->texture->trans
diff --git a/libdimension/perspective.c b/libdimension/perspective.c
index 9c2f31d..017d215 100644
--- a/libdimension/perspective.c
+++ b/libdimension/perspective.c
@@ -76,5 +76,5 @@ dmnsn_perspective_camera_ray_fn(const dmnsn_camera *camera,
/* Aim at the z = 1 plane */
l.n = dmnsn_new_vector(x - 0.5, y - 0.5, 1.0);
- return dmnsn_matrix_line_mul(*trans, l);
+ return dmnsn_transform_line(*trans, l);
}
diff --git a/libdimension/plane.c b/libdimension/plane.c
index e475c46..1680aa0 100644
--- a/libdimension/plane.c
+++ b/libdimension/plane.c
@@ -58,14 +58,14 @@ dmnsn_plane_intersection_fn(const dmnsn_object *plane, dmnsn_line line,
{
dmnsn_vector *normal = plane->ptr;
- dmnsn_line line_trans = dmnsn_matrix_line_mul(plane->trans_inv, line);
+ dmnsn_line line_trans = dmnsn_transform_line(plane->trans_inv, line);
double den = dmnsn_vector_dot(line_trans.n, *normal);
if (den != 0.0) {
double t = -dmnsn_vector_dot(line_trans.x0, *normal)/den;
if (t >= 0.0) {
intersection->ray = line;
intersection->t = t;
- intersection->normal = dmnsn_matrix_normal_mul(plane->trans, *normal);
+ intersection->normal = dmnsn_transform_normal(plane->trans, *normal);
intersection->texture = plane->texture;
intersection->interior = plane->interior;
return true;
diff --git a/libdimension/sphere.c b/libdimension/sphere.c
index 94ae44e..d384e60 100644
--- a/libdimension/sphere.c
+++ b/libdimension/sphere.c
@@ -50,7 +50,7 @@ static bool
dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line line,
dmnsn_intersection *intersection)
{
- dmnsn_line l = dmnsn_matrix_line_mul(sphere->trans_inv, line);
+ dmnsn_line l = dmnsn_transform_line(sphere->trans_inv, line);
/* Solve (x0 + nx*t)^2 + (y0 + ny*t)^2 + (z0 + nz*t)^2 == 1 */
double a, b, c, t;
@@ -67,8 +67,8 @@ dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line line,
if (t >= 0.0) {
intersection->ray = line;
intersection->t = t;
- intersection->normal = dmnsn_matrix_normal_mul(sphere->trans,
- dmnsn_line_point(l, t));
+ intersection->normal = dmnsn_transform_normal(sphere->trans,
+ dmnsn_line_point(l, t));
intersection->texture = sphere->texture;
intersection->interior = sphere->interior;
return true;
@@ -82,6 +82,6 @@ dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line line,
static bool
dmnsn_sphere_inside_fn(const dmnsn_object *sphere, dmnsn_vector point)
{
- point = dmnsn_matrix_vector_mul(sphere->trans_inv, point);
+ point = dmnsn_transform_vector(sphere->trans_inv, point);
return point.x*point.x + point.y*point.y + point.z*point.z < 1.0;
}