A math challenge... Answered
Ok, so there's this coding language called FCML- a simple language built for a scripting engine in a game (Fantastic Contraption). I'm wanting to write a script that implements the graph of an equation in the form of axn+b to that gaming language. To clarify, this is to create a "level", or a series of bricks, and fitting them along the line of a user-specified equation. The coding language is very simple:
StaticRect (x1, y1), (x2, y2), z
Where x1 and y1 are coordinates on a Cartesian coordinate plane, x2 and y2 are lengths and widths of the rectangle, respectively, and z is the rotation of the brick. The brick is positioned with respect to it's center; i.e. it's center is positioned with x1 and y1. It's mathematically possible; it's just very confusing for a 7th grader. With a little calculus, trigonometry, and algebra I've come up with these formulas, and would just like to see what others come up with before implementing them.
90-tan-1(1/naxn-1) for z
10 for y2
root((axn-a(x-.5)n) + .25) for x2
axn+.5(axn-a(x-.5)n) for y1
x - .25 for x1
I'm aiming for an accuracy of 1/2.