Little math problem :-/ (hopefully not big)

Blitz3D Forums/Blitz3D Programming/Little math problem :-/ (hopefully not big)

ChrML(Posted 2004) [#1]
I've got quite a lot of my car physics working fine, but there's a slight little problem, as most of my math sucks.

However, I got a little equation telling how much pressure a tire must be able to handle to not skid during a turn in R radius at V speed. The problem is that that equation requires me to know the radius I'm currently turning in (of the whole circle).



Lets say during last calculation (60 times a second) my car was at the green spot (Coords: ABC), this cycle, it is at the red spot (Coords: XYZ).

Out of those two positions, how can I figure out R?


PGF(Posted 2004) [#2]
Sorry but you cannot.

There are infinitely many circles that can pass through two points.

Thinking of another way ... Do you know the heading at both points ? If so and you consider the heading is at a tangent then you can find the point of intersection of the perpendiculars to the tangents to get R. Watch out for the special case where the perpendiculars are parallel and R is infinitely distant. In this case the vehicle is travelling in a straight line and there is no sideways force.

Do you really need R ? If you know the headings at both points then the change in heading is going to be an angle which is what you'll need to calculate the 'sideways' force due to circular acceleration.


_PJ_(Posted 2004) [#3]
_________________________________________________

Consider the circumference of a circle being PI*d
Radius (r) = d/2

The distance travelled (assuming it is an arc of a circle,) is : s

The Angle between the start of curve and the end of curve: Q


(PI*d)/(360/Q)=s


If you know the speed, v
The distance travelled, a is simply v/t (t=time)

(PI*d)/(360/Q)=(v/t)



We know

t=1/60seconds
_______________________________________________________


For the rest I'll need to see your diagram... that's a bad link.


ChrML(Posted 2004) [#4]
Thanks for help guys :).

@PGF: Yes, I know which way the car is turned to at both points. Yeah, I thought the sideways force also could be calculated out of the difference between the two angles, but I haven't been able to figure out a way to do so, as all my references tells me to use the radius of some reason :(.

@Malice: Ah, so that's the actual velocity as the way the circle is followed? Nice. That becomes handy. Yep, I know V. Oh, the link is bad (weird, worked for me).
_ttp://chrml.thefreebizhost.com/carphy.jpg
Switch _ with h, and past in browser, guess that works (also the host is down for 2 minutes from time to time).


_PJ_(Posted 2004) [#5]
Malice: Ah, so that's the actual velocity as the way the circle is followed?

No!!!

You've referred to speed (I assume angular velocity) not velocity. the velocity will be changing constantly with direction.

Also, Displacement is distance around the circumferencial arc, not straight line!


ChrML(Posted 2004) [#6]

The distance travelled, a is simply v/t (t=time)



Woops, I think I misread a bit, sorry.
The A you are talking about here, is that the sideway accelleration I'm looking for (which I just can compare to what the wheels can handle to find skid/or not skid)?

I studied the logic a bit now (I hope), if Q is the angle between the first angle (green), and the last angle (red) of the car, then this means that the answer (v/t) is A, meaning the sideway accelleration between these two calculation events (which happens at 60 Hz, meaning t=1/60), or have I completly misunderstood?

Lol, sorry if I sound a bit dumb, math isn't really my strongest side.


_PJ_(Posted 2004) [#7]
Sorry, not 'a' should be 's' as before.

Yes, Q should be that angle between start and finish locations, provided the arc is consistent. I think you have misunderstood a little, I have not dealt with any sideways movement, because there isn't enough info. I really cant see your diagram, otherwise I could use that to describe better.


ChrML(Posted 2004) [#8]
Ok, my pic is uploaded to an another location:
_ttp://chrml0606.tripod.com/carphy.jpg

Remember to switch _ with h before pasting into browser :).


eBusiness(Posted 2004) [#9]
The force is speed*delta-rotation/time*(some constant)


ChrML(Posted 2004) [#10]
Delta rotation, sorry, but what kind of rotation is that? :P
Is it the difference between first and last angle on my pic (as Malice explained me), or some other rotation? I guess time here is 1/60 second if game running in 60 hz (60 loops a second)?


eBusiness(Posted 2004) [#11]
It's the difference, so delta-rotation/time is just the speed of rotation.


ChrML(Posted 2004) [#12]
Ah, lol, ok. Last question, you got a faintest idea about what time is supposed to be multiplied with (the constant), or do I just have to try and see?


_PJ_(Posted 2004) [#13]
You might wish to convert everything to Delta-time (change-in-time)

Where anything involving 'time' is multiplied by the Millisecs() difference each loop.

This will help everything move by standard amounts and be the same regardless of computer speeds etc.


eBusiness(Posted 2004) [#14]
Just try, and by the way, if the logic rate is locked, time will probably be a constant too.


ChrML(Posted 2004) [#15]
Great thanks for help guys :D!

@Malice: Good idea, I'll reprogram most movement stuff/time calculations stuff to suit that. :)

@eBusiness: Yep, logic rate will be locked to 60 if the computer can handle it (otherwize it will autolock to something less).


Doggie(Posted 2004) [#16]
Not meaning to hijack this thread, but since there's some math majors here I got a little problem too.
This code was taken from the archives and the idea is it's supposed to aim and move your object towards a 3d point. It works most of the time but sometimes it doesn't, I think when it hits negative values or something. I suck at math so I'm not sure how to fix it to be 100% accurate.
For e=1 To 35
PointEntity enemy[e]\pivot,player
targetangle#=EntityYaw(cam,True)
currentangle#=EntityYaw(enemy[e]\pivot)

If Abs(currentangle#-targetangle#)<180 Then turn=2 Else turn=-2 
If currentangle#<targetangle# 
TurnEntity enemy[e]\pivot,0,turn,0 
Else
If currentangle>targetangle
TurnEntity enemy[e]\pivot,0,-turn,0
EndIf
EndIf
MoveEntity enemy[e]\pivot,0,-0.5,.5 
Next


Thanks


Stevie G(Posted 2004) [#17]
Try this doggie ( not tested but should work )

For e = 1 To 35
	ENTITYchase( enemy[e]\pivot , player , 2.0, .5 )
Next

;=============================
;=============================
;=============================

Function ENTITYchase( Entity, Target, TurnRate#, MoveSpeed# )

	Turn# = DeltaYaw( Entity , Target )
	If Turn < - TurnRate Turn = -TurnRate
	If Turn > TurnRate Turn = TurnRate
	TurnEntity entity, 0, Turn, 0
	MoveEntity entity,0,0, MoveSpeed
	
End Function	



Doggie(Posted 2004) [#18]
SO far so good. It works in all directions. Thank you.


ChrML(Posted 2004) [#19]
This should be the solution to use the popular formulas used to calculate sideway force during a turn (F = m*v^2/r, where m is the mass, v is the speed, and r is the radius of the circle (way to calculate described below), and F is ofcourse the result of the calculation, the sideway accelleration (which the tires must support to prevent the car from skidding out)):



When thinking about the XY line, it's a quite rough calculation, but it shouldn't play an important role as the change of position doesn't become that big in 1/60 seconds. That SHOULD (unless my logic really fails) be the way to get the radius out of two positions, where the rectangles is a car (supposed to be at the purple dots), and the lines through them are the way they drive. The angle the two car directions create (D2) are ofcourse the delta rotation (the change of rotation) between two calculations (usually not that big as on this drawing).

If you got problems with the picture, replace _ with h, and paste this URL into the browser:
_ttp://chrml.thefreebizhost.com/hmmm.jpg

Or try again later (the server seems to go down sometimes).