16 #define TACHYON_INTERNAL 1 30 (
void (*)(
const void *,
const void *,
const void *,
void *))(
quadric_normal),
58 ro.x = ry->o.x - q->
ctr.x;
59 ro.y = ry->o.y - q->
ctr.y;
60 ro.z = ry->o.z - q->
ctr.z;
63 Aq = (q->
mat.
a*(rd.x * rd.x)) +
64 (2.0 * q->
mat.
b * rd.x * rd.y) +
65 (2.0 * q->
mat.
c * rd.x * rd.z) +
66 (q->
mat.
e * (rd.y * rd.y)) +
67 (2.0 * q->
mat.
f * rd.y * rd.z) +
68 (q->
mat.
h * (rd.z * rd.z));
71 (q->
mat.
a * ro.x * rd.x) +
72 (q->
mat.
b * ((ro.x * rd.y) + (rd.x * ro.y))) +
73 (q->
mat.
c * ((ro.x * rd.z) + (rd.x * ro.z))) +
75 (q->
mat.
e * ro.y * rd.y) +
76 (q->
mat.
f * ((ro.y * rd.z) + (rd.y * ro.z))) +
78 (q->
mat.
h * ro.z * rd.z) +
82 Cq = (q->
mat.
a * (ro.x * ro.x)) +
83 (2.0 * q->
mat.
b * ro.x * ro.y) +
84 (2.0 * q->
mat.
c * ro.x * ro.z) +
85 (2.0 * q->
mat.
d * ro.x) +
86 (q->
mat.
e * (ro.y * ro.y)) +
87 (2.0 * q->
mat.
f * ro.y * ro.z) +
88 (2.0 * q->
mat.
g * ro.y) +
89 (q->
mat.
h * (ro.z * ro.z)) +
90 (2.0 * q->
mat.
i * ro.z) +
95 ry->add_intersection(t1, (
object *) q, ry);
98 disc=(Bq*Bq - 4.0 * Aq * Cq);
101 t1 = (-Bq + disc) / (2.0 * Aq);
102 t2 = (-Bq - disc) / (2.0 * Aq);
103 ry->add_intersection(t1, (
object *) q, ry);
104 ry->add_intersection(t2, (
object *) q, ry);
112 N->x = (q->
mat.
a*(pnt->x - q->
ctr.x) +
116 N->y = (q->
mat.
b*(pnt->x - q->
ctr.x) +
120 N->z = (q->
mat.
c*(pnt->x - q->
ctr.x) +
124 invlen = 1.0 /
SQRT(N->x*N->x + N->y*N->y + N->z*N->z);
130 if (
VDot(N, &(incident->d)) > 0.0) {
void quadric_normal(const quadric *q, const vector *pnt, const ray *incident, vector *N)
quadric * newquadric(void)
static object_methods quadric_methods
flt VDot(apivector *a, apivector *b)
double flt
generic floating point number, using double
void quadric_intersect(const quadric *q, ray *ry)
RT_OBJECT_HEAD vector ctr
center of quadric object
Tachyon cross-platform timers, special math function wrappers, and RNGs.
quadmatrix mat
quadric function coefficient matrix
Tachyon public API function prototypes and declarations used to drive the ray tracing engine...
int quadric_bbox(void *obj, vector *min, vector *max)