Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Transforming second order polynomials

Started by tscott1213 Nov 1, 2004 at 3:08 PM 0 replies 350+ views
Original Post
tscott1213
tscott1213
Hey, I am running into a problem on a ray tracing assignment where we transform second order polynomials. Specifically, we are using Blinn's matrix formation for transforming second order polynomials: a b c d 0 e f g 0 0 h i 0 0 0 j We can use the above matrix by premultiplying by [x,y,z,1] and post multiplying by [x,y,z,1] transposed to get the general equation for second order polynomials. Thus, if I use this coefficient matrix to define a sphere with center at the origin and 0.5 radius, I start with the following: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 -.25 If I then transform this matrix to move the sphere 10 units in the positive z direction I get the following matrix: 1 0 0 0 0 1 0 0 0 0 1 -10 0 0 -10 99.75 This appears to be correct because if I pre-multiply this matrix by [0,0,9.5,1] and post multiply that result by [0,0,9.5,1] transposed, the result is zero. This is as expected becase 0,0,9.5 is on the surface of the sphere. However, I am using the quadratic equation to ray trace to the sphere and the -10 in the fourth row of the matrix is not accounted for in the equation (as it needs to be) because it is not in one of the locations for the a-j coefficients. Has anyone seen this before that can help me understand what I am doing incorrectly. Thanks Todd
Charles B
Charles B
x^2 + y^2 + (z-10)^2 -0.25 = x^2 + y^2 + z^2 - 20*z + 99.75

so

1 0 0 0
0 1 0 0
0 0 1 -20
0 0 0 99.75

also works, right ? What's the problem now ? Just change the way you compute your translation to keep a triangular matrix.
"Coding math tricks in asm is more fun than Java"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.