15,797,984 members
1.00/5 (1 vote)
See more:
I want to move a circle along a circular path(circumference of another circle). How can i do it?Any help will be appreciated but not links from google. Because i searched for it but couldnot find any help about my task. Article explaining it will be more appreciated.and i think there is no need of source.

What I have tried:

i tried moving x and y co-ordinates of object but it always moves in horizontal or vertical line
Posted
Updated 26-Dec-17 2:31am
What objects? What framework are you using?

## Solution 1

Circular movement isn't complicated, provided you change the x and y coordinates correctly: for a straight line, xn+1 = xn + c1 and yn+1 = yn + c2 where c1 and c2 are constant values.
For a circle, they aren't constants - they need to be recalculated for each step:
xn = r * cos(a) and yn = r * sin(a) where r is the radius and a in the angle in radians. For each step, you change a slightly (how much depends on you and how accurate you need your circle: the bigger the increment, the less circular and the more polygonal it looks). Try 0.1, and check it's value against pi * 2 to see if you have reached the end of the circle.

[no name] 26-Dec-17 7:36am
OriginalGriff 26-Dec-17 7:39am
You are kidding, right?
You can't convert
x = r * cos(a)
into VB yourself?
[no name] 26-Dec-17 7:41am
I am confusing in defining variables
OriginalGriff 26-Dec-17 7:54am
You can;t define a variable on your own? :OMG:

Dim nameOfMyVariable As typeOfMyVariable = initialValueForMyVariable

E.g.:

Dim i As Integer = 666

You need to go back to basics and ready through your first few classes again...
[no name] 26-Dec-17 8:34am
i mean can you tell me values for angle and radius(as sample) and then tell new coordinates of object