|
-
Feb 13th, 2007, 02:00 PM
#1
Thread Starter
Lively Member
Forces, Speed,...
Im looking for formula for calc impact force from speed and mass of flying object.
This i need becouse soon i gona start writing 2d physical engine.
-
Feb 13th, 2007, 03:27 PM
#2
Re: Forces, Speed,...
the second law of newton should help you out in normal cases (no light speed involved)
you just need to invert it to get the force that's neccesary to stop the object
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Feb 13th, 2007, 04:57 PM
#3
Addicted Member
Re: Forces, Speed,...
why don't you use the momentum equations? You can either have a completely elastic collision or an inelastic collision. Of course, there are some that are in between, where it's just a coefficient that is a property of the two materials involved multiplied by the final velocity.
-
Feb 16th, 2007, 11:33 AM
#4
Thread Starter
Lively Member
Re: Forces, Speed,...
How to check if line is crossed by another line and on what coordinates.
-
Feb 21st, 2007, 03:31 PM
#5
Frenzied Member
Re: Forces, Speed,...
VB Code:
Type tPoint
X As Double
Y As Double
End Type
Type tLine
B As tPoint
E As tPoint
End Type
Function Intersect(L1 As tLine, L2 As tLine, Optional ByRef Pin As tPoint) As Boolean
'pin is used byref to return the point of intersection
Dim a1 As Double
Dim b1 As Double
Dim a2 As Double
Dim b2 As Double
Dim i As Boolean
Dim t As tPoint
'determine the formula y = a * x + b for each line
a1 = (L1.E.Y - L1.B.Y) / (L1.E.X - L1.B.X)
b1 = L1.B.Y - L1.B.X * a1
a2 = (L2.E.Y - L2.B.Y) / (L2.E.X - L2.B.X)
b2 = L2.B.Y - L2.B.X * a2
If a1 = a2 Then 'test if the lines are parallel
If (b1 = b2) Then 'test if the lines start from the same point on the y axis
If L1.E.X < L1.B.X Then
t = L1.B
L1.B = L1.E
L1.E = t
End If
If L2.E.X < L2.B.X Then
t = L2.B
L2.B = L2.E
L2.E = t
End If
If L2.B.X <= L1.B.X And L1.B.X <= L2.E.X Then 'pick the first point that is on both linesections
Pin = L1.B
i = True
ElseIf L1.B.X <= L2.B.X And L2.B.X <= L1.E.X Then
Pin = L2.B
i = True
Else 'the linesections do not match
Pin.X = 0
Pin.Y = b1
End If
Else 'no intersection at all
Pin = t
End If
Else 'intersection in one point
Pin.X = (b2 - b1) / (a1 - a2) 'calculate the intersection
Pin.Y = a1 * Pin.X + b1
i = (la.B.X <= Pin.X And Pin.X <= la.E.X) Or (la.E.X <= Pin.X And Pin.X <= la.B.X) 'test if the intersection is on one of the lines
End If
Intersect = i
End Function
Last edited by jeroen79; Feb 21st, 2007 at 06:50 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|