Advanced math help required. -
zaibaslr2 - 24.01.2015
Hello.
I have a picture here:
I have one dot already placed, and I need to place other dots on
the circle and know their coordinates.
I know the lenght of circle ©, radius®, number of dots needed
and the distance between points. I must place them all
in circle. Please notice that sizes C,r,distance may change.
I need a formula to find the coordinates of every point.
I have made a better drawing:

P.S. Coordinates can be a rational number (5.6,10.8 etc.)
Thanks for any help.
AW: Advanced math help required. -
Nero_3D - 24.01.2015
You only need to know the center of your circle and your first point
That function rotates that point by the given angle around the center
pawn Код:
stock GetNextPointOnCircle(Float: cX, Float: cY, & Float: X, & Float: Y, Float: angle, const amode = degrees) {
new
Float: cos = floatcos(angle, amode),
Float: sin = floatsin(angle, amode),
Float: tX = X - cX,
Float: tY = Y - cY
; // source - en.wikipedia.org/wiki/Rotation_matrix
X = tX * cos - tY * sin + cX;
Y = tX * sin + tY * cos + cY;
}
If you want 15 dots now you should use it like (same as your example)
pawn Код:
new
dots = 15,
Float: cX = 6.0, // center of circle
Float: cY = 4.0, // center of circle
Float: X = 6.0, // first point
Float: Y = 1.0, // first point
Float: angle = 360.0 / dots // split the circle in x (dots) pieces
;
while(dots--) { // crashes your server if dots < 0
GetNextPointOnCircle(cX, cY, X, Y, angle);
printf("%f %f", X, Y);
}
Re: Advanced math help required. -
codectile - 24.01.2015
Go through the source code of this include, you will find your answer,
Source Code
Objectometry - Include Thread
If you are trying to place objects in a circular path, this include lets you do that.
Re: Advanced math help required. -
Write - 24.01.2015
It dosen't move like that, it goes like;
Код:
{ strpack; '3x3x != 93c ab' 3x3x3 != 0 & != 12 }
You must find a destination to the size.
Re: Advanced math help required. -
zaibaslr2 - 24.01.2015
Thank you both for answers, I really appreciate your help, but I forgot to mention that I already done it