3D product to sum order

Basic and Machine Language

Moderator: Moderators

Post Reply
DrVeryEvil
Vic 20 Amateur
Posts: 69
Joined: Thu Jul 23, 2015 5:11 pm
Location: Lansing, MI, USA
Occupation: Data Analyst

3D product to sum order

Post by DrVeryEvil »

Here we go again. I am trying to figure out the right way to do a product to sum using three terms. Is there a specific order in which to apply the identities? For example: sin(x)sin(y)cos(z). Does it matter where you start applying the identity? Do I apply it to sin(x)sin(y) first, or sin(y)cos(z) first? Is this a distributive operation? Does it make a difference if I do sin(y)cos(z) or cos(z)sin(y)?

My second question is how to handle a negative trig function when applying identities? cos(x)(-sin(z)). Do you make (-sin(z)) = sin(-z)? If not, how is the minus sign handled before the sin function.

The reason I ask is in that C=Hacking #8, "A different Perspective..." they show element D of the rotation matrix as:
D = (sin(t3)-sin(t4))/2 + (cos(t6)-cos(t5)+cos(t8)-cos(t7) with t8 = sy+sz-sx. I am not able to come up with that anywhere in the whole matrix.
t3, t4, t5, t6, and t7 all match up, but not t8. When I get to D, I have:

cos(x)(-sin(z)) + sin(x)sin(y)cos(z) and when I apply the product to sum identities, I get:

(sin(x-z)-sin(x+z))/2 + (cos(x-y-z) - cos(x+y+z) + cos(x-y+z) - cos(x+y-z))/4
t4 t3 ??? t5 t6 t7

Here's a link to the issue in PDF and page 24 references the matrix.

http://commodore.software/downloads/dow ... g-issue-08

Any help would be appreciated with this obsolete process.
DrVeryEvil
Vic 20 Amateur
Posts: 69
Joined: Thu Jul 23, 2015 5:11 pm
Location: Lansing, MI, USA
Occupation: Data Analyst

Re: 3D product to sum order

Post by DrVeryEvil »

I think I found the problem with T8. A clue awaits in the next issue of C=Hacking with the second installment of "A Different Perspective...".
malcontent
Vic 20 Hobbyist
Posts: 129
Joined: Sun Dec 26, 2010 1:51 pm

Re: 3D product to sum order

Post by malcontent »

Honestly just skip to the last article in the series in C=Hacking #16:
These routines, not to mention this article, are the codification
of all those years of algorithms and derivations and everything else.
Those past efforts created working prototypes; this one is the
production model... ...So that's what I did, and that's what this article does. The
first section of the article summarizes the basics of 3D graphics:
projections and rotations. Since in my experience many people don't
remember their high school math, I've also covered the basic mathematical
tools needed, like trigonometry and linear algebra, and other related
issues.
http://www.ffd2.com/fridge/chacking/c=hacking16.txt
Post Reply