Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 x^2/a^2 + y^2/b^2 = 1
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cycro1234




PostPosted: Sat Oct 30, 2004 8:35 pm   Post subject: x^2/a^2 + y^2/b^2 = 1

What do I do with it though???
Sponsor
Sponsor
Sponsor
sponsor
bugzpodder




PostPosted: Sat Oct 30, 2004 8:46 pm   Post subject: (No subject)

what do you want to do with it?
cycro1234




PostPosted: Sat Oct 30, 2004 9:59 pm   Post subject: (No subject)

make a ball travel in an arc
AsianSensation




PostPosted: Sun Oct 31, 2004 5:36 pm   Post subject: (No subject)

well, you can substitute a value for x, and then it spits out a value for y, and then use the x and y values to draw your thingie, and it will follow an elliptical path.
bugzpodder




PostPosted: Sun Oct 31, 2004 7:38 pm   Post subject: (No subject)

the parametric equation for an ellipse is:
x=acos(t)
y=bsin(t)

just plug in your angle

(or if you want it the other way...
x=asin(t)
y=bcos(t)
)
wtd




PostPosted: Sun Oct 31, 2004 11:14 pm   Post subject: (No subject)

I would recommend breaking this down into a data structure and a number of associated functions and procedures.

code:
type Point : record
   x, y : int
end record

type Arc : record
   center : Point
   radius : int
end record

function makeArc(x, y, radius : int) : Arc
   var a : Arc
   a.center.x := x
   a.center.y := y
   a.radius := radius
   result a
end makeArc

function pointOnArcAtAngle(a : Arc; angle : int) : Point
   var p : Point
   p.x := a.radius * sin(angle) + a.center.x
   p.y := a.radius * cos(angle) + a.center.y
   result p
end pointOnArcAtAngle
cycro1234




PostPosted: Tue Nov 02, 2004 1:25 pm   Post subject: Un huh

AsianSensation, u mentione to substitute a value for x, nd it will spit out a valur for y. What about a and b??? Or will the answer be in terms of a and b?
bugzpodder




PostPosted: Tue Nov 02, 2004 1:44 pm   Post subject: (No subject)

of course the answer will be in terms of a and b
Sponsor
Sponsor
Sponsor
sponsor
cycro1234




PostPosted: Tue Nov 02, 2004 6:29 pm   Post subject: ok...

Alright, but then wat exactly are the variables a and b?? Are they the angle of the circle?
AsianSensation




PostPosted: Tue Nov 02, 2004 8:08 pm   Post subject: (No subject)

no, they are just some constant, where 2a is the length of the major axis, and the 2b is the length of the minor axis of an ellipse. I suggest searching some math sites, or you'll be learning about ellipses in Gr. 11 math.
templest




PostPosted: Wed Nov 03, 2004 1:41 pm   Post subject: (No subject)

Quote:
All girls take time and money
Girls = Time x Money
"Time is money" =>
Time = Money
Girls = Money x Money
Girls = Money^2
"Money is the root of all evil" = >
Evil = the square root of money
Girls = (Evil)^1/2 (Evil)^1/2 =>
Girls = Evil


ROFL You get hundred bits now! Posted Image, might have been reduced in size. Click Image to view fullscreen. Good stuff. Laughing
rizzix




PostPosted: Wed Nov 03, 2004 4:35 pm   Post subject: (No subject)

ah yea.. nice stuff.. Laughing
cycro1234




PostPosted: Wed Nov 03, 2004 7:27 pm   Post subject: hehehe

dam straight!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: