I have this
And lets keep the middle point at 10,10. How would I find all the cords around the circle.
Thanks.
(I'll rep!, then I can rep frement!)
I have this
And lets keep the middle point at 10,10. How would I find all the cords around the circle.
Thanks.
(I'll rep!, then I can rep frement!)
I do visit every 2-6 months
Get the radius of the circle, then use trig to work the rest out.
lol
Hmmh, get the white points to TPA then use ReturnPointsNotInTPA to get the points not in TPA and then get the closest ones near the middle point
EDIT: Oh this was in math
Last edited by Frement; 04-17-2010 at 07:50 PM.
There used to be something meaningful here.
Thanks i guess quick, and I still cant rep frem
I do visit every 2-6 months
If this was purely for maths, I would use trig ratios.
Make a loop and assign each point to an array of points around the circumference.
EDIT:
Actually Coded it:
SCAR Code:program New;
{.Include SRL/SRL.Scar}
{.Include SRL/SRL/Misc/Debug.Scar}
{.Include SRL/SRL/Misc/Users.Scar}
Var X, Y, I: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
TB : TBox;
Function GenerateCircumferencePoints(MidX, MidY : Integer; SDeg, EDeg, Radius : Integer) : TPointArray;
Var I, II : Integer;
Begin
For I := SDeg To EDeg Do
Begin
Inc(II);
SetLength(Result, II);
Result[II - 1] := Point(Round(Sin(Radians(I)) * Radius + MidX), Round(Cos(Radians(I)) * Radius + MidY));
End;
End;
Begin
SetupSRL;
SRLPlayerForm(False, [], [], [], []);
DebugTPA(GenerateCircumferencePoints(10, 10, 0, 360, 7), '');
End.
Last edited by Naum; 04-18-2010 at 11:59 AM.
Now that the circle is so small this should suffice:
SCAR Code:for x:= 0 to 19 do
for y := 0 to 19 do
if InCircle(x, y, 10, 10, 10) then
begin
inc(L);
SetLength(Result, L);
Result[L - 1] := Point(x, y);
end;
Marpis, that gets the same size circle drawn, as there is nothing to use radius and such.
And naum, I was about to scratch the circle part of the project until yours worked! Thank you! Rep!
I do visit every 2-6 months
Nice to see it worked.
If it was just for that smiley, then a faster way would be to do a 'FindColors' on the white part of his face. Then use GetTPAEdges and store the points ; instead of using mine which lags by loops.
I just need the output points once, as the smiley will be moving from the center point around, so the points will be moving with it using offsets.
I do visit every 2-6 months
Would be faster and simpilier (coding and runtime) to use Wizzyplugin.
SCAR Code:program Circle;
{.Include SRL\SRL.SCAR}
{.Include SRL\SRL\Misc\DeBug.SCAR}
var
TPA: TPointArray;
begin
{TPA := TPAFromBox(IntToBox(X1, Y1, X2, Y2));
FilterPointsPie(TPA, 0, 360, Radius, Radius + 1, OriginX, OriginY);}
TPA := TPAFromBox(IntToBox(50, 50, 100, 100));
FilterPointsPie(TPA, 0, 360, 25, 26, 75, 75);
DeBugTPA(TPA, '');
end.
And lol... why not just use distance anyways?
SCAR Code:program Circle;
{.Include SRL\SRL.SCAR}
{.Include SRL\SRL\Misc\DeBug.SCAR}
var
OldTPA, NewTPA: TPointArray;
I, C: LongInt;
begin
OldTPA := TPAFromBox(IntToBox(50, 50, 100, 100));
for I := 0 to High(OldTPA) do
if (Distance(OldTPA[I].X, OldTPA[I].Y, 75, 75) = 25) then
begin
SetLength(NewTPA, C + 1);
NewTPA[C] := OldTPA[I];
Inc(C);
end;
DeBugTPA(NewTPA, '');
end.
There are currently 1 users browsing this thread. (0 members and 1 guests)