30 points around a circle

can some one please explain to me how this:

test2={}
for i = 1, 30 do
test2[i] = display.newRect(0,0,15,15)
test2[i]:setFillColor(0,0,255)
group:insert(test2[i])
test2[i]:setReferencePoint(display.CenterReferencePoint)
test2[i].x, test2[i].y = _W/2 + 100 * math.sin(i * 12), _H/2 + 100 * math.cos(i * 12)
end
test2[1]:setFillColor(245,12,134)

is generating 30 points around a circle yet not evenly spaced?

they clump 3 together then move to the next 3 around the circle and then the next

I figured out the radius to the circle is 100 thus making the circumference 628.32 which isn’t required for figuring out the cosines and sins of each x and y point but just letting everyone know the scenario [import]uid: 87730 topic_id: 36222 reply_id: 336222[/import]

try this

[code]
group = display.newGroup()
_W = display.contentWidth
_H = display.contentHeight

test2={}
for i = 1, 30 do
test2[i] = display.newRect(0,0,15,15)
test2[i]:setFillColor(0,0,255)
group:insert(test2[i])
test2[i]:setReferencePoint(display.CenterReferencePoint)
local angle = i * (2*math.pi/30)
test2[i].x = _W/2 + math.cos(angle)*100
test2[i].y = _H/2 + math.sin(angle)*100
end
test2[1]:setFillColor(245,12,134)
[/code] [import]uid: 58777 topic_id: 36222 reply_id: 143894[/import]

Seems to of done the trick there brightwave, thank you

My next dilemma is the first point starts at the bottom of the circle…
So in an anti clock wise direction the numbers for each pointing I’m using increments…

Anyway of starting the first point to mimicking a clock having 30 at the point of 12 o’clock [import]uid: 87730 topic_id: 36222 reply_id: 143993[/import]

change line 11

local angle = (i+21) \* (2\*math.pi/30)  

where 21 can be any point on the circle [import]uid: 58777 topic_id: 36222 reply_id: 143994[/import]

Alrighty there! looking promising just gotta test it out when I hit up corona, will keep you updated :smiley:
thanks for the work once again BrightWave [import]uid: 87730 topic_id: 36222 reply_id: 144004[/import]

try this

[code]
group = display.newGroup()
_W = display.contentWidth
_H = display.contentHeight

test2={}
for i = 1, 30 do
test2[i] = display.newRect(0,0,15,15)
test2[i]:setFillColor(0,0,255)
group:insert(test2[i])
test2[i]:setReferencePoint(display.CenterReferencePoint)
local angle = i * (2*math.pi/30)
test2[i].x = _W/2 + math.cos(angle)*100
test2[i].y = _H/2 + math.sin(angle)*100
end
test2[1]:setFillColor(245,12,134)
[/code] [import]uid: 58777 topic_id: 36222 reply_id: 143894[/import]

Seems to of done the trick there brightwave, thank you

My next dilemma is the first point starts at the bottom of the circle…
So in an anti clock wise direction the numbers for each pointing I’m using increments…

Anyway of starting the first point to mimicking a clock having 30 at the point of 12 o’clock [import]uid: 87730 topic_id: 36222 reply_id: 143993[/import]

change line 11

local angle = (i+21) \* (2\*math.pi/30)  

where 21 can be any point on the circle [import]uid: 58777 topic_id: 36222 reply_id: 143994[/import]

Alrighty there! looking promising just gotta test it out when I hit up corona, will keep you updated :smiley:
thanks for the work once again BrightWave [import]uid: 87730 topic_id: 36222 reply_id: 144004[/import]

try this

[code]
group = display.newGroup()
_W = display.contentWidth
_H = display.contentHeight

test2={}
for i = 1, 30 do
test2[i] = display.newRect(0,0,15,15)
test2[i]:setFillColor(0,0,255)
group:insert(test2[i])
test2[i]:setReferencePoint(display.CenterReferencePoint)
local angle = i * (2*math.pi/30)
test2[i].x = _W/2 + math.cos(angle)*100
test2[i].y = _H/2 + math.sin(angle)*100
end
test2[1]:setFillColor(245,12,134)
[/code] [import]uid: 58777 topic_id: 36222 reply_id: 143894[/import]

Seems to of done the trick there brightwave, thank you

My next dilemma is the first point starts at the bottom of the circle…
So in an anti clock wise direction the numbers for each pointing I’m using increments…

Anyway of starting the first point to mimicking a clock having 30 at the point of 12 o’clock [import]uid: 87730 topic_id: 36222 reply_id: 143993[/import]

change line 11

local angle = (i+21) \* (2\*math.pi/30)  

where 21 can be any point on the circle [import]uid: 58777 topic_id: 36222 reply_id: 143994[/import]

Alrighty there! looking promising just gotta test it out when I hit up corona, will keep you updated :smiley:
thanks for the work once again BrightWave [import]uid: 87730 topic_id: 36222 reply_id: 144004[/import]

try this

[code]
group = display.newGroup()
_W = display.contentWidth
_H = display.contentHeight

test2={}
for i = 1, 30 do
test2[i] = display.newRect(0,0,15,15)
test2[i]:setFillColor(0,0,255)
group:insert(test2[i])
test2[i]:setReferencePoint(display.CenterReferencePoint)
local angle = i * (2*math.pi/30)
test2[i].x = _W/2 + math.cos(angle)*100
test2[i].y = _H/2 + math.sin(angle)*100
end
test2[1]:setFillColor(245,12,134)
[/code] [import]uid: 58777 topic_id: 36222 reply_id: 143894[/import]

Seems to of done the trick there brightwave, thank you

My next dilemma is the first point starts at the bottom of the circle…
So in an anti clock wise direction the numbers for each pointing I’m using increments…

Anyway of starting the first point to mimicking a clock having 30 at the point of 12 o’clock [import]uid: 87730 topic_id: 36222 reply_id: 143993[/import]

change line 11

local angle = (i+21) \* (2\*math.pi/30)  

where 21 can be any point on the circle [import]uid: 58777 topic_id: 36222 reply_id: 143994[/import]

Alrighty there! looking promising just gotta test it out when I hit up corona, will keep you updated :smiley:
thanks for the work once again BrightWave [import]uid: 87730 topic_id: 36222 reply_id: 144004[/import]