Saturday, January 21, 2017

3d graphics in excel 2013 xy scatter chart

So I figured that if I could put lines on an xy scatter chart, why not 3d graphical vectors.



I thought I'd try to make the scout from Stellar 7.

Boy, it's really hard to make a 3d object by hand that looks good. Things are much harder than they are conceptually.

Anyway, the points for the scout are in colums A-D, D being all ones.

We've got 4x4 matrices for Translation, Rotatation XY, Rotation XZ and Rotation YZ and Translation.

a bunch of MMULTs gives you a final matrix to multiply each row of the 3d points by.

then we use a very simple projection: xproj = F * X / Z and yproj = F * Y / Z where F is the focal plane distance.

The biggest problem is that Excel 2013 hates empty cells when you do matrix multiplication and just invalidates the entire operation, so I did separate MMULTs for each point, and then manually removed the error rows where there were blanks in the final calculation.

And for fun, why not use mousemove events to rotate the model.

You can find the excel file at http://ptouchman.weebly.com/blog where I'm putting my files now.

No comments:

Post a Comment