|
-
Apr 22nd, 2001, 09:47 PM
#1
Thread Starter
Member
OK this is a VERY basic question. A vector is a line on a graph representing something (Velocity, Displacement, ect...). Which is the best way to define a Vector:
1. Vector1 = (x1,y1,x2,y2) or
2. Vector1 = x1,y1, degree, magnitude
I working on a basic physics sim, so which would be easier? Or are both fine? Or are both wrong?
-
Apr 23rd, 2001, 04:18 AM
#2
Addicted Member
Both are fine from a design principle point of view, but neither are syntactically correct for VB.
How are you planning to do it in VB?
Shrog
VB6 Ent SP5
Win2000 
-
Apr 23rd, 2001, 04:47 AM
#3
transcendental analytic
not really, a vector is a one value per dimension measurement, therefore a line can either be a position vector and a offset vector or two position vectors. The second is more commonly used for lines, but since you use velocity, which is derived from displacement, you should use an offset vector.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 11:31 AM
#4
Thread Starter
Member
Kedamin- Using your example, say I had Rock at XY Location 0,16 (Y Being Verticle Axis). I want to find out the rocks location in Realtime using Gravity. At time 0 the rock is 16 meters high. So could I use the following 2 vectors to determine rocks position using a calculation based on time elapsed?:
Dim Rock as Vector
Rock.X=0
Rock.Y=16
Dim Gravity As Vector
Gravity.X = 0?
Gravity.Y = -9.8
Do those two vectors look right? I'm not so sure about the Gravity. THANKS!
-
Apr 23rd, 2001, 11:37 AM
#5
transcendental analytic
yes, if the first is suppose to be a displacement and the second, gravity. gravity though is acceleration and derived from velocity, so displacement is velocity*time+0.5*acceleration*time^2
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 11:50 AM
#6
Hyperactive Member
Just to throw in my two pennies, you could have a class Vectore which handled bot the 2 point vector and the 1 point, angle/magnitude.
Changing one set of parameters would automatically change the other.
e.g.
Vector1.x1=0
.y1=0
.x2=1
.y2=0
Reading the .angle for this would give 90 (if working in degrees) and .magnitude would give 1
Changing .angle to 0 would change .x2=0 and .y2=1 (assuming 0,0 is bottom left).
I don't know if this helps matters,
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Apr 23rd, 2001, 02:27 PM
#7
Thread Starter
Member
OK So I have:
Private Type Vector
x As Double
y As Double
End Type
Private Type xyObject
Displacement As Vector
Velocity As Vector
End Type
Dim Rock As xyObject
Rock.Displacement.x = 0
Rock.Displacement.y = 16
Rock.Velocity.x = 0
Rock.Velocity.y = 0
Dim Gravity As Double
Dim Time As Double
CurrentVel = Rock.Velocity.y + (Gravity * Time)
CurrentY = Rock.Displacement.y + ((CurrentVel + Rock.Velocity.y) / 2 * Time)
It works, but I'm not sure if it is right. Do these equations look right?
-
Apr 23rd, 2001, 02:32 PM
#8
transcendental analytic
Are you operating in 2 dimensions at all? because otherways drop the vector concept and work with scalars
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 02:40 PM
#9
Thread Starter
Member
LOL! Yes-eventually---I want to simulate an object falling straight down first, and then when I get that right I'm going to add an x direction, and then a Z. So do those look right?
-
Apr 23rd, 2001, 02:46 PM
#10
transcendental analytic
well not really, youre a bit incosistent, having scalar results, are you just doing an analysis or is this a simulation?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 02:48 PM
#11
Thread Starter
Member
-
Apr 23rd, 2001, 02:52 PM
#12
transcendental analytic
then you have a loop or a timer procedure in which you
1. add acceleration to velocity
2. add velocity to displacement
and vector addition is done by adding each component .x+.x and .y+.y and so on
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 03:10 PM
#13
Thread Starter
Member
Like so:
Do Until Rock.Displacement.y < -0.01
Time = modPhysics.GetTime(False) 'This tells how much time has passed since last loop.
Rock.Velocity.y = Rock.Velocity.y + (Gravity * Time)
Rock.Displacement.y = Rock.Displacement.y + ((2 * Rock.Velocity.y + Gravity * Time) / 2 * Time)
Loop
I got those EQ's out of a physics book and they seem to work. I just don't get why you have to add Gravity*Time to the Rocks Velocity in both EQ's. Is this what you mean?
-
Apr 23rd, 2001, 03:19 PM
#14
transcendental analytic
more like
Rock.Velocity.y = Rock.Velocity.y + Gravity
Rock.Displacement.y = Rock.Displacement.y + Rock.Velocity.y
assuming one time unit per loop, where time unit is the measurement for velocity mt^-1 and acceleration mt^-2
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 23rd, 2001, 03:56 PM
#15
Hyperactive Member
Originally posted by kedaman
Are you operating in 2 dimensions at all? because otherways drop the vector concept and work with scalars
Mmmmmmmm, yes, but wouldn't this be a contrarian approach?
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Apr 23rd, 2001, 03:59 PM
#16
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|