Math/Programming Time! (with questions!)

Jul 17, 2009 18:36

Okay, here's a mat puzzle for you, folks. I'm trying to create a 3d angled sloped wedge. With for loops, on a 3d X,Y,H grid ( Read more... )

school, programming, math

Leave a comment

Comments 3

(The comment has been removed)

forsythferret July 18 2009, 03:06:04 UTC
The step distances are already set by the external grid, which is one of the things that makes this difficult. I'm trying to model a surfing reef on an ocean floor, right now it's a basic theoretical plane, but the program should be general enough to deal with any layout.

Reply


alun_clewe July 19 2009, 08:20:52 UTC
>Next, to find where the hypotenuse is, to count along the X axis. Since tangent is opposite/adjacent, and my X axis is adjacent to the angle I know, I'm trying to find Z by doing 1/[tan(theta)*j (the opposite)] That should get me 1/1/adjacent, which should come out to adjacent.

No, that won't give you 1/1/adjacent. What that gives you is 1/[(opposite/adjacent)*opposite]... that doesn't come out to 1/1/adjacent; it comes out to adjacent/opposite^2, which isn't what you want. What you want is j/tan(theta).

That doesn't explain the divide by zero error, though. Not sure what's going on with that... (Unless j1 is zero?)

Reply

forsythferret July 21 2009, 23:21:50 UTC
Hmm, I think you're right. It's always the stupid tiny things that cause the trip-ups. I'd gotten in to work by changing it to sin, but I knew the angles were wrong. That does seem to have fixed it. Thanks!

Reply


Leave a comment

Up