HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with math

01-27-2009, 09:12 PM#1
Gwypaas
This is what I'm trying to make but I have absolutely no idea of how I can do it. The should unit slide following the line starting counter clockwise and hitting the Far End point pretty much perfectly and then coming back to the start point also that pretty much perfectly. (All following the lines.)


(Keep in mind that I want the curve to be "good", not like my lines that I painted in paint but you should get the idea:P)
01-27-2009, 09:20 PM#2
Captain Griffen
We need more info...

Constant velocity? Constant movement along axis from start to end? What do you want the curve to be?
01-27-2009, 09:24 PM#3
Gwypaas
Yes, constant velocity, but what is the "constant movement"? The speed should be the same and it should have the same height through out the curve.
01-27-2009, 09:39 PM#4
Anitarf
A sqaure polynomial parabola in a polar coordinate system could give you that kind of projectile motion.
01-27-2009, 10:29 PM#5
Captain Griffen
Quote:
Originally Posted by Gwypaas
Yes, constant velocity, but what is the "constant movement"? The speed should be the same and it should have the same height through out the curve.

Mmm...let me rephrase this...

Constant velocity with variable sidewise velocity, or constant speed?
01-27-2009, 11:28 PM#6
Ammorth
maybe he wants a circle at the end, but instead of starting at one end and going around, he starts on the tangent with the circle and a point P away from the circle. So he follows up the tangent, then goes partially around the circle and comes back down the other tangent.
01-28-2009, 05:52 AM#7
Gwypaas
Quote:
maybe he wants a circle at the end, but instead of starting at one end and going around, he starts on the tangent with the circle and a point P away from the circle. So he follows up the tangent, then goes partially around the circle and comes back down the other tangent.

I couldn't say it better myself :)
01-28-2009, 03:05 PM#8
peq
Quote:
Originally Posted by Gwypaas
I couldn't say it better myself :)

So you would have something like this:

Zoom (requires log in)

Then the angle between r and s would be 90°.

d and r are known and so s = Sqrt(d*d - r*r)

Then you can use Atan2 to calculate the other angles.

alpha = Atan2(r,s)
beta = PI/2 - alpha.

I think you have all values you need now.
Attached Images
File type: jpggra.jpg (14.0 KB)
01-28-2009, 07:22 PM#9
Gwypaas
Yep, like that. :)


Now I just need to try to get it to work :D



Edit - I've tried a bit but I've got no where, could someone please show me some code displaying how to use this formula. I don't really understand how I should calculate the X/Y's and stuff.. Help is appreciated.
01-28-2009, 09:39 PM#10
Zerzax
Try this:
Find the coordinates of the center of the circle that you are eventually revolving around. So first project at the initial angle alpha and once you have reached s distance, begin following the circle by projecting at a constantly increasing angle in the circle's radius from its center. Once you have moved around 180 degrees (which you have kept track of) again project at the angle formed by the second tangent and the radius. Make sense?
01-29-2009, 12:49 PM#11
peq
Quote:
Originally Posted by Zerzax
Try this:
Find the coordinates of the center of the circle that you are eventually revolving around. So first project at the initial angle alpha and once you have reached s distance, begin following the circle by projecting at a constantly increasing angle in the circle's radius from its center. Once you have moved around 180 degrees (which you have kept track of) again project at the angle formed by the second tangent and the radius. Make sense?

The 180° degrees would just be an approximation, you would need 360 degrees -2*beta to be precise
01-29-2009, 01:43 PM#12
Vexorian
For actual constant velocity on curves I had to use integrals (or was it derivatives?) in Snow and Hazards. Huh?
01-30-2009, 03:38 AM#13
PipeDream
Any path parameterized in the form u(s) = <x(s),y(s),...> can be stepped at a given velocity by solving |u(s1) - u(s0)| = dl, for dl the desired step size and u(s0) the initial position. You can approximate this as

|u(s0) + (s1-s0) du/ds - u(s0)| = |(s1-s0) du/ds| = dl
and solve for s1
s1 = s0 + dl / |du/dt|
Which makes for a rather convenient algorithm compared to trying to solve the exact formula for whatever curve you come up with.