COMMUNITY : FORUMS : TECH

A math challenge...

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.
Input: y=axn
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.

sort by: active | newest | oldest
 1-10 of 12 Next »
lemonie7 years ago
Your parabolic equation is y = ax2 + bx + c if that helps? a, b, and c are constants that give you the different shapes.

L

TheBatchies7 years ago
Uhhhh...6? 6.5?
schetleft7 years ago
i remember my old algebra teacher, she would always draw parabolas and intend them to look like penises. any teenager would laugh at their math teacher drawing penises in algebra. haha thats the way i remembered the quadratic formula
7 years ago
lmfao.
Wow. That's a pretty freakin awesome algebra teacher.
PKM7 years ago
I get the groundwork of what you are trying to achieve, but I'm not sure how you want the bricks to be positioned. Do you want to make a smooth shape like the graph out of rotated bricks, or just position the bricks along the path as steps? The rotation part is harder, as it involves calculus, but fortunately some simple enough calculus that I can remember how to do :) Could you explain how you derived the last three equations? This sounds like quite an interesting problem. I think with a little messing around I could work out an "accurate" solution (ie fit top edges of bricks to a polygonal approximation of the graph). Where did I put my whiteboard...