SRL Archive - SRL Suggestions

RotatePointEx


Awkwardsaw

2011-02-07 22:37:32

Camaro had me make this because the RotatePoint in simba doesnt really work perfectly(has to inverse the x coord)


function RotatePointEx(p, o:tPoint; d:Extended):TPoint ;
begin
p.x := p.x + (0 - o.x);
p.y := p.y + (0 - o.y);

Result.x := (round(p.x * cos(d * (PI / 180)) - (p.y * sin(d * (PI / 180))))) - o.x * -1;
Result.y := (round(sin(d * (PI / 180)) * p.x + cos(d * 1 * (PI / 180)) * p.y)) - o.y * -1;
end;

p: the origional point, make sure you get it at perfect north
o: the origin to spin at
d: the angle in degrees
so i thought it would be usefull in srl, so MouseMM() can work once again :)

Camaro'

2011-02-07 23:19:12

Thanks :D

Coh3n

2011-02-08 01:58:32

So this walks to a point (obtained when the minimap is at north) no matter the angle of the minimap?

i luffs yeww

2011-02-08 02:58:53

Won't walk to it, but it will find where you're supposed to click no matter the angle of the map.

I know that I used RotatePoint and it worked fine though, so I dunno why this is needed? Too lazy to test them both out, but if there's a point, looks fine. Just make it look prettier when it's committed.

Awkwardsaw

2011-02-08 08:13:41

From: i luffs yeww
Won't walk to it, but it will find where you're supposed to click no matter the angle of the map.

I know that I used RotatePoint and it worked fine though, so I dunno why this is needed? Too lazy to test them both out, but if there's a point, looks fine. Just make it look prettier when it's committed.


the other one has to inverse the x point(go on the other side of the origin), this one does it for you

Gu3st...

2011-02-08 08:28:03

RotatePoint has worked perfectly for me at all time I've used it… What's wrong about it?

E:
From: Awkwardsaw
the other one has to inverse the x point(go on the other side of the origin), this one does it for you

I have never had to do that

Wanted

2011-02-08 12:46:55

There's something in SRL that uses ToPolar to walk to a point given it's north and rotates it automatically. I don't see the point of adding RotatePointEx, instead just overwrite it in simba.simba if it's not working and go post this in simba bug section.

I Am Legend

2012-01-08 22:42:14

this assumes that you made the points originrally with compass set on North rite ?

jeffadkins51

2012-01-19 15:28:10

From: Wanted
There's something in SRL that uses ToPolar to walk to a point given it's north and rotates it automatically. I don't see the point of adding RotatePointEx, instead just overwrite it in simba.simba if it's not working and go post this in simba bug section.


Its a fix bro. If people are having issues, they can rely on this as opposed to waiting for a fix or whatever.

OP: Gj :spot::spot:
Haters: :duh::duh: BY :norris:

weequ

2012-01-19 15:31:50

Dunno about inversing x-coord but sometimes I have to use - angle while in some situations + angle. I guess it just depends what you are doing.

Coh3n

2012-01-20 01:07:05

If the RotatePoint in Simba doesn't work, why not fix it?

Kyle Undefined

2012-01-20 01:08:49

Almost a year gravedig…


Coh3n

2012-01-20 01:10:47

Still could be a bug.

Wizzup?

2012-01-20 16:58:16

From: Awkwardsaw
Camaro had me make this because the RotatePoint in simba doesnt really work perfectly(has to inverse the x coord)


function RotatePointEx(p, o:tPoint; d:Extended):TPoint ;
begin
p.x := p.x + (0 - o.x);
p.y := p.y + (0 - o.y);

Result.x := (round(p.x * cos(d * (PI / 180)) - (p.y * sin(d * (PI / 180))))) - o.x * -1;
Result.y := (round(sin(d * (PI / 180)) * p.x + cos(d * 1 * (PI / 180)) * p.y)) - o.y * -1;
end;

p: the origional point, make sure you get it at perfect north
o: the origin to spin at
d: the angle in degrees
so i thought it would be usefull in srl, so MouseMM() can work once again :)


Are you sure the one in Simba isn't working correctly? Aren't you just expecting the wrong result?

ZephyrsFury

2012-01-20 19:25:28

Is this the age old problem where in mathematics the 0 degree origin is at the positive x-axis and increases anticlockwise, opposed to with bearings (and the minimap) where the origin is at North and increases clockwise?