Advanced math help required.
#1

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.
Reply
#2

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);
}
Reply
#3

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.
Reply
#4

It dosen't move like that, it goes like;

Код:
{ strpack; '3x3x != 93c ab' 3x3x3 != 0 & != 12 }
You must find a destination to the size.
Reply
#5

Thank you both for answers, I really appreciate your help, but I forgot to mention that I already done it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)