Awkwardsaw
2009-07-16 00:19:44
i had fun making these, although they may not be usefull for rs scripts.
[minitut]
vectors! you may not know what they are, but this what this tut is for :)
a vector, is literally the distance of a direct path, caused by a transition. lets say your mouse is at coord (100, 100) and you move your mouse to (150, 300). your mouse had a vector or <50, 200> because your mouse moved 50 points on the x axis, and 200 points on the y axis. makes sence?
[/minitut]
how you would use MMVector:
that example shows, that your mouse will move 100 points down and over, and 100 points up and over. then 200 points down and over, ect ect. NOT to cord 100, 100, then go to coord -100, 100 (unless your mouse pos was at 0, 0 of course)
enjoy :D
{*******************************************************************************
function TriAngType(a, b, c: extended): string;
By: akwardsaw
Description: it checks what type of triangle it is. based off of the SIDE MEASURES
*******************************************************************************}
function TriAngType(a, b, c: extended): string;
begin
if a + b <= c then
begin
writeln('Wrong Triangle side measures');
exit;
end;
if Sqr(a) + sqr(b) < sqr(c) then result:= 'acute';
if Sqr(a) + sqr(b) = sqr(c) then result:= 'right';
if Sqr(a) + sqr(b) > sqr(c) then result:= 'acute';
end;
{*******************************************************************************
function RightTriSideMeasure(a, b, c: extended; sidetosolve: string): extended;
By: akwardsaw
Description: it solves for a side of a right triangle. leave the side you dont know to what ever
you want. showword = true if you want to show the work.
*******************************************************************************}
function RightTriSideMeasure(a, b, c: extended; sidetosolve: string; showwork: boolean): extended;
begin
case lowercase(sidetosolve) of
'a': begin
if showwork then
begin
writeln(floattostr(c) + '^2 = ' + floattostr(b) + '^2 + a^2');
writeln(floattostr(Sqr(c)) + ' = ' + floattostr(Sqr(b)) + ' + a^2');
writeln(floattostr(Sqr(c) - Sqr(b)) + ' = a^2');
writeln(floattostr(sqrt((Sqr(c)) - (sqr(b)))) + ' = a');
end;
result:= sqrt((Sqr(c)) - (sqr(b)));
end;
'b': begin
if showwork then
begin
writeln(floattostr(c) + '^2 = b^2 + ' + floattostr(a) + '^2');
writeln(floattostr(Sqr(c)) + ' = b^2 + ' + floattostr(Sqr(a)));
writeln(floattostr(Sqr(c) - Sqr(a)) + ' = b^2');
writeln(floattostr(sqrt((Sqr(c)) - (sqr(a)))) + ' = b');
end;
result:= sqrt((Sqr(c)) - (sqr(a)));
end;
'c': begin
if showwork then
begin
writeln('c^2 = ' + floattostr(b) + '^2 + ' + floattostr(a) + '^2');
writeln('c^2 = ' + floattostr(sqr(b)) + ' + ' + floattostr(sqr(a)));
writeln('c^2 = ' + floattostr(sqr(b) + sqr(a)));
writeln('c = ' + floattostr(sqrt(Sqr(a) + sqr(b))));
end;
result:= sqrt(Sqr(a) + sqr(b));
end;
end;
end;
{*******************************************************************************
procedure GetVector(x1, y1, x2, y2: integer; var rise, run: integer);
By: akwardsaw
Description: it simply finds the vector for 2 points. stores the x as run, y as rise
*******************************************************************************}
procedure GetVector(x1, y1, x2, y2: integer; var rise, run: integer);
begin
rise:= x2-x1;
run:= y2-y1;
end;
{*******************************************************************************
function Issimilier(av1, av2, bv1, bv2: extended; var ratio: extended):boolean;
By: akwardsaw
Description: it finds out if two sets of ratios are similer. if true ratio returns
the ratio.
*******************************************************************************}
function Issimilier(av1, av2, bv1, bv2: extended; var ratio: extended):boolean;
var val1, val2: extended;
begin
val1:= av1 / av2;
val2:= bv1 / bv2;
if val1 = val2 then
begin
ratio:= val1;
result:= true;
end;
end;{*******************************************************************************
procedure MMVector(vector : tpointarray; rx, ry: integer);
By: akwardsaw
Description: it moves the mouse using a set vector, in a Tpoint array
*******************************************************************************}
procedure MMVector(vector : tpointarray; rx, ry: integer);
var v, x, y: integer;
begin
for v:= 0 to high(vector) do
begin
getmousepos(x, y);
mmouse(x + vector[v].x, y + vector[v].y, rx, ry);
end;
end;[minitut]
vectors! you may not know what they are, but this what this tut is for :)
a vector, is literally the distance of a direct path, caused by a transition. lets say your mouse is at coord (100, 100) and you move your mouse to (150, 300). your mouse had a vector or <50, 200> because your mouse moved 50 points on the x axis, and 200 points on the y axis. makes sence?
[/minitut]
how you would use MMVector:
vector:= [point(100, 100), point(-100, -100), point(200, 200), point(-200, -200)];
MMVector(vector, 5, 5);
that example shows, that your mouse will move 100 points down and over, and 100 points up and over. then 200 points down and over, ect ect. NOT to cord 100, 100, then go to coord -100, 100 (unless your mouse pos was at 0, 0 of course)
enjoy :D