This site requires JavaScript, please enable it in your browser!
Greenfoot back
zog
zog wrote ...

2018/10/30

What does the code below do?

zog zog

2018/10/30

#
 private void updateCartesian() 
    {
        dx = length * Math.cos(Math.toRadians(direction));
        dy = length * Math.sin(Math.toRadians(direction));   
    }
danpost danpost

2018/10/30

#
zog wrote...
What does the code below do? << Code Omitted >>
It take a vector (a direction and a magnitude, "length"), and converts it to the distances they make along the x and y axes to get to the same end-point.
You need to login to post a reply.