
I am sad. Yesterday's algorithm was incorrect. I have a moral dilemma about the post, but that will have to wait. I want to inform the reader of the problem, explain how it was found, and propose possible fixes to the algorithm.
The problem is that dt1 depends on a0.a0 and v0.a0 which is unknown. Full knowledge of a0 would be needed for this to work. So that means the algorithm is not useful as it stands.
I found this error when my gcc compiler told me that a0 was defined twice: once to get the value and once to set the value. It took me a second or two to realize, but I was devastated when I looked at it clearly. I tried to see if there was a good solution, but to no avail. Below, I list my possible solutions.
Combined with my earlier smooth Path algorithm, the a0 can be found for a fraudulent pa which is close to the "correct" pa to achieve a pseudo-correct result. However, this is not optimal.
The unknown variable which I use a0 to find is dt1, so a person could give dt1 and the algorithm would be solved. However, dt1 is more knowledge than a person is likely to know. dt2 is also given (a concession I made to solve the algorithm), but dt2 is fairly arbitrary being that it only sets a constant of deceleration. I would not call setting dt1 an optimal solution.
If a person had |a0| and Θ (Θ (Theta) is the angle between a0 and v0), it could be solved by using: v0.a0 = |v0|*|a0|*cos(Θ). Having |a0| as a constant would simplify the problem more than it should, but it usually is within a fairly small range (large or small values are usually errors). Knowing or finding theta is not as simple. Theta can really be anything. Considering the position of p1, it could be 0 (straight ahead), Π (directly behind), ±Π/2 (to either side) or anything. This is not an optimal solution.
Another solution came to mind. Follow this set of equations.
va = v0 + a0 * dt1 a0 = (va - v0) / dt1 pa = p0 + v0 * dt1 + a0 * dt1 * dt1 / 2 pa - p0 = v0 * dt1 + (va - v0) * dt1 / 2 pa - p0 = (va + v0) * dt1 / 2 p1 - pa = va * dt2 / 2 pa = p1 - va * dt2 / 2 p1 - va * dt2 / 2 - p0 = (va + v0) * dt1 / 2 p1 - p0 = va * (dt2 + dt1) / 2 + v0 * dt1 / 2 p1, p0, dt2, |va|, and v0 are known dt1 and va are unknown. dt1 + dt2 = dt |p1 - p0|^2 = |va * (dt2 + dt1) / 2 + v0 * dt1 / 2|^2 = va.va*dt*dt/4 + va.v0 * dt*dt1 + v0.v0*dt1*dt1/4 In this equation, unknowns are dt1 and va.v0. va.v0 = |va|*|v0|*cos(Φ)
So the only unknowns are dt1 and Φ (where Φ (phi) is the angle between va and v0). Once phi is given, dt1 can be solved using the quadratic equation. However, Φ like Θ before it is not knowable without superior knowledge of the problem. As you can see in the visual aide, Φ could be any number of things. However, it allows an interesting alternate solution: we can reach point p1 coming from any direction that could possibly be made. While the original problem did not address this, this is a major problem: how does the computer know whether you wish to go straight to the destination or a roundabout way? The solution is Φ, but the problem is: how can I make a user interface for phi? I cannot.
The best possible solution would simply take p0, v0, and p1 and produce a perfect path. In Mathematical Methods of Physics, we students were introduced to Newton's Pachristachron problem. The question was: what is the fasted path for a particle to travel under gravity from (x1, y1) to (x2, y2)? The answer is definately not a straight line. The physical property that the physicists wish to exploit is that if a particle has a larger slope at first, it will have speed to carry it through the lesser slope later. A demo shows this. Except that the demo we saw was slightly silly and didn't work 100% due to friction and sticking. But the theory is sound. The problem is the solution. The more curved downward the path is, the longer the path is, so there is a balance somewhere between far curved and straight line. Newton anonymously published the answer and the scientific field was amazed. What do you expect from the physicist who compiled Kepler's Planetary Laws into a natural law of motion and gravity? The Pachristachron system is what I wish to apply to my problem: minimize dt1 and |a0| by manipulating the equations (requiring excessive a0 would be inefficient).
Sadly, today is not the right day to do this problem. Until an undefined future date, full stop is broken.
I have thought much about giving the AltSci3D Path System its own program with complete user control over t0, p0, v0, a0, and angular equivalents. However, this system would be very unfriendly to the unexperienced user. I have attempted to allow the user to drag and drop while the program does the math and just smooth path everything. With the addition of full stop, rigid partices, keys are assigned to switch to these systems. Instead of making an user-unfriendly program to handle advanced functions, I have made Anime Director slightly user-unfriendly. It is a necessary evil for now and will likely be changed before anyone decides to use the product except myself.
My mother suggests that I start selling Javantea's Fate t-shirts. Since certain websites sell these shirts for free, no risk is involved. I could sell and give these away to advertise my website which I put so much work in. Could I put the AS3D Smooth Path Algorithm on a t-shirt and sell it as a geek shirt? Sure... What about a super-hi-res of the Javantea's Fate logo? Fine. AltSci Goggles? Yup. Jav vs WHG1? Yup. What about a Warehouse Grunt pic? Ok. What about a futuristic Javantea tag logo? *nod* The top three boxes of Scene 5, Page 5* High Res? Why not? Headless body busts a cap? Err, maybe. A vector graphic of The Weasel?** Err, maybe not.
* Scene 2-5 need to be updated with the new Jav Model. Scene 1 has the new model which I am very happy with. When I wrote JF the first time, it was supposed to be very easy to upgrade models. That's why I went so recklessly into development. But I've gone so many versions past the AS3D that I used that I am using a totally different file format and it would be easier to redo all the scenes by hand than to convert the data. It is possible to copy over the positions, but it likely will be more work than it's worth. Considering how much work I've done on the engine,
** The Weasel is an actual character in JF, but I can't say much or I'll spoil the plot. Maybe I'll make a 3d version of The Weasel and make that a t-shirt. That would be pretty nifty. I won't be making a Weasel t-shirt from a vector graphic of The Weasel pic. It's just kinda crude even if it is well-drawn.


Permalink
-
Leave a Reply
Comments: 0
Leave a reply »