• 0

Math problem... C#


Question

As a testament to my suckiness at math, I'm stumped at how to derive a heading for a circle travelling in a circular orbit counterclockwise.

The beginning state of the disk is to have a heading of 90 deg, starting in the first quadrant. I have the disk updating its heading every 1/30th of a second, along with doing collision detection. What I can't figure is what info I need to update the heading.

I've tried taking the delta V, and taking the atan of dx/dy, as well as a few thousand different permutations to no avail... :cry: I haven't taken trig in many years, so I'm lost... completely.

According to my instructors bidding, I have a tick method that is called when ever the arena that is managing the disks ticks, and it passes a disk state object to the method. I am supposed to treat the disk state as read only, and I can only update the disk heading based on the state.

Here's the assignment if you want to see exactly what I have to do. http://www.opticverve.us/bins/lab4a.pdf

Link to comment
https://www.neowin.net/forum/topic/110983-math-problem-c/
Share on other sites

4 answers to this question

Recommended Posts

  • 0

If it is an elastic collision, The total momemtum will be conserved.

m1*u1 + m2*u2 = m1*v1 + m2*v2

& total kinetic energy will also be conserved

m1*u1^2 + m2*u2^2 = m1*v1^2 + m2*v2^2

m1, m2, u1, u2 are known values, Therfore you can find out v1 & v2

Do this calculations seperately for the x & y components of velocity.

Each disk's heading angle can be calculated from its final Vx & Vy (x component of velocity & y component of velocity).

_____________________

v1 = (m1 - m2) / (m1 + m2) * u1

v2 = (m2 - m1) / (m1 + m2) * u2

Heading angle = atan (Vy / Vx)

Edited by figgy
Link to comment
https://www.neowin.net/forum/topic/110983-math-problem-c/#findComment-1302543
Share on other sites

  • 0

I must be doing something completely wrong in my code, because that is exactly what I was doing mathematically. The collision stuff I have finished, the headings were giving me crap... but I'll get it figured out. Thanks for the reply.

Edited by weenur
Link to comment
https://www.neowin.net/forum/topic/110983-math-problem-c/#findComment-1302656
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.