HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Rotate question

08-27-2009, 03:25 PM#1
Flame_Phoenix
Hi guys, I am working on 2D3S and I would like some help to rotate a line.
I have the coordinates of the last point of the line, all I need is to simple move that point to the new position and then recalculate the line. However I am having problems rotating the last point of the line ... as usual, a code is worth a billion words, so here it is:

2D3S core
Expand JASS:

Line, this is where I need help in the rotate method.
Expand JASS:
08-27-2009, 04:39 PM#2
Anitarf
Basic trigonometry.
Collapse Note: all coordinates are relative to the center of rotation:
set newx=x*Cos(a)-y*Sin(a)
set newy=x*Sin(a)+y*Cos(a)
08-27-2009, 06:16 PM#3
Flame_Phoenix
basic !?
I would never get to the formula alone ... and I did try reading stuff on wikipedia ...
Thx !
08-27-2009, 06:58 PM#4
moyack
Please take this advice gently:

If you don't learn BASIC trigonometry and geometry, your system will not go far.
08-27-2009, 09:12 PM#5
Zerzax
What Anitarf referred to is called rotation of axes. It's obtained by using the sum and difference formulas for sin and cos. This stuff is covered usually with conic sections, and was included in my precalc textbook last year. Anitarf's example rotates about the origin - just add the rotation to your base x and y coordinates.
08-27-2009, 10:34 PM#6
Flame_Phoenix
Truth is I don't need much for my shape system. I only need to know how lines rotate, after that everything shall be done quite easily because the system will be quite modular.
Imagine a Cross shape with a rotate method:

Collapse JASS:
struct cross 
    Line l1
    Line l2
    stub method rotate takes real degs returns nothing
        call l1.rotate(degs)
        //same for l2
    endmethod
endstruct

Sure there may be some more calculus in the middle, but this the main skeleton idea I have.

I don't see how you people apply this stuff so easily. I also learned this a long time ago, however, in my teachings everything is always nice in theory - problem is, that's the only thing we ever learn, so technically when it comes to practice, I am the disaster you all see.
Further more I am a survivor on one of the universities with hardest maths on my country (2nd ftw ...), yet I can't do a simple calculus like this. I feel stupid ...
08-27-2009, 11:51 PM#7
Vexorian
Quote:
Originally Posted by Flame_Phoenix
basic !?
I would never get to the formula alone ... and I did try reading stuff on wikipedia ...
Thx !
What Anitarf posted is really basic...
08-28-2009, 06:24 AM#8
Mr_Saturn
Flame_Phoenix, before you copy and paste any script into your map, try to understand how that script works.

For instance, it may be easier to see how rotation works in this version:
Collapse JASS:
set newx = x*Cos(a) + y*Cos(a + bj_PI/2)
set newy = x*Sin(a) + y*Sin(a + bj_PI/2)
...Which was given to you as part of another solution three weeks ago. Had you understood it then, you never would have needed to make this thread.
08-28-2009, 06:53 AM#9
Vulcano
lol so there is a bj_PI and i was always using bj_DEGTORAD*180.
08-28-2009, 09:45 AM#10
Flame_Phoenix
It is hard for me to keep my persistence and good will in studying a subject when everyone says my I.Q. is lower than the I.Q. of a chair... it's simply frustrating.
But thanks, I will do my best now.
08-28-2009, 01:25 PM#11
Vulcano
To boost your self-confidence: i started learning trigonometry in the 4 grade of secondary school and i saw this 'basic' trigonometry in the first year physics at university.

Just some advice:
-When you need trigonometry, draw a trigonometric circle on a paper.
-Know the geometric definition of sin and cos.(see link above)

Combine this with your brain and you should be able to derive a lot of things from it.

Image is from http://nl.wikipedia.org/wiki/Sinus_en_cosinus
English page: http://en.wikipedia.org/wiki/Trigonometric_functions (less good images imo)

BTW: how is your spell make tutorial v2 going?
09-12-2009, 12:09 PM#12
Flame_Phoenix
It is currently on hold. I just want to finish my 2D3S system, my tutorial, and I will probably quit wc3 after.
Thx for asking though.

Updated the first post. Please give constructive criticism. I am open to ideas.
09-12-2009, 01:08 PM#13
Earth-Fury
http://www.ies.co.jp/math/java/trig/...sixtrigfn.html

The single most useful thing I have ever found in understanding trig. May be of use to you.

It shows the input angle, and the output of the various functions. It also shows you how the output of the functions relates to the unit circle and input angle, visually. Click'n'drag the red circle to change the angle.

Quote:
Originally Posted by Flame_Phoenix
It is hard for me to keep my persistence and good will in studying a subject when everyone says my I.Q. is lower than the I.Q. of a chair... it's simply frustrating.
Believe it or not, I've been there. Keep trying, and things will improve.

Now, to create an illusion of still being an ass: Go die in some god-forsaken hole, FP.

(Hey, I have a reputation to maintain! I can't just go around being nice to people. That would ruin me!)
09-12-2009, 02:34 PM#14
Flame_Phoenix
Well, there is something I wanted to say for a long time...

In case you haven't noticed yet (I believe most of you already did) I have no real skills. What I have is my dedication, determination and good will. When people help me around here, they get frustrated because they see my lack of skill and get angry for me, but thing is I can't do better. When someone helps me, all I can give is my determination, dedication and my good will into learning what they are trying to teach me, if this is not enough, if you want more, then it simply won't happen because I can't give what I don't have.

This is not to anyone in specific but to all people who feel frustrated because of me. I wanted to say this for a long time, however I never got the chance. To be honest I still think this is kinda off-topic but I just couldn't hold it any longer.
Quote:
Believe it or not, I've been there. Keep trying, and things will improve.
You are just being nice because I said I was going to leave wc3c and now you are happy xD

Thanks for the links btw.

Any suggestions on the code?
09-12-2009, 03:15 PM#15
Earth-Fury
Quote:
Originally Posted by Flame_Phoenix
Well, there is something I wanted to say for a long time...

In case you haven't noticed yet (I believe most of you already did) I have no real skills. What I have is my dedication, determination and good will. When people help me around here, they get frustrated because they see my lack of skill and get angry for me, but thing is I can't do better. When someone helps me, all I can give is my determination, dedication and my good will into learning what they are trying to teach me, if this is not enough, if you want more, then it simply won't happen because I can't give what I don't have.
FP, you are a fucking idiot. But I believe that your heart is in the right place, which makes you worth a hell of a lot more than a lot of the people who pass through these parts. Skills can be learned and information gained, but a useless asshole is a useless asshole for life. I believe that you are the opposite of a useless asshole.

Now, don't prove me wrong, otherwise I will have to castrate you.

Quote:
Originally Posted by Flame_Phoenix
You are just being nice because I said I was going to leave wc3c and now you are happy xD
Quite the opposite, actually.

Quote:
Originally Posted by Flame_Phoenix
Any suggestions on the code?
My brain is too fried from coding and lack of sleep to do extensive code review right now... Which means this entire post is off-topic. Sue me.