Discussion Sin/Cos?

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
I just found Warcraft 3's Sin and Cos function are weird.
cosoa.jpg

Correct :
sincostan.gif

Tested Sin/Cos, both resulted same look.
Literate through 0->1440 for x and 300*scale for y-axis.
Any idea? :nuts:
 

tooltiperror

Super Moderator
Reaction score
231
Speaking of Radians, could someone please explain them to me?
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Radians are just another unit of measurement for angle.

Degrees break a full rotation up into 360 divisions, whereas 2(pi) radians complete a rotation. This is handy because circular measurements naturally depend on pi. For example, the length along the edge of a circular sector is simply radius*angle (in radians).
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Perhaps I post the script for you all to test it. :p
JASS:
library GraphViewer

    function interface GetY takes real x returns real
    
    globals
        private constant string Model = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
        private constant string AxisModel = "Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl"
        private GetY equation
        private timer t = CreateTimer()
        private real xD = 0.
        private real x = 0.
        private real s
    endglobals
    
    private function GenerateGraph takes nothing returns nothing
        if xD > 0. then
            set xD = xD - .07
            set x = x + .07
            call AddSpecialEffect(Model,x * s,equation.evaluate(x) * s)
        else
            call PauseTimer(t)
        endif
    endfunction
    
    function ShowGraph takes GetY y, real times, real scale returns nothing
        set equation = y
        set xD = times * 2
        set s = scale
        set x = -times
        call TimerStart(t,0.0,true,function GenerateGraph)
    endfunction
    
    private struct Initializer extends array
        private static method onInit takes nothing returns nothing
            set xD = -2000.
            loop
            exitwhen xD >= 2000.
                call AddSpecialEffect(AxisModel,xD,0.)
                call AddSpecialEffect(AxisModel,0.,xD)
                set xD = xD + 100.
            endloop
        endmethod
    endstruct
endlibrary

JASS:
library MapInit initializer Init requires GraphViewer
    private function Equation takes real x returns real
        return 3 - x - (4 * x * x) //Equation of line
    endfunction
    //don't touch any thing below here.
    private function Init takes nothing returns nothing
        call FogEnable(false )
        call FogMaskEnable(false)
        call SetCameraField(CAMERA_FIELD_ZOFFSET,3000.,0.)
        call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,270.,0.)
        call PanCameraTo(0.,0.)
        call ShowGraph(Equation,6.284,300.)
    endfunction
endlibrary
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
HEY!

I put in the symbol for pi in my post, but the forum thingy made it into a question mark, wtf!

Lemme' try again..

???????????????
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Well, what're ya gonna do. :p

The worst part is that it (pi ? ?) displays correctly when hitting "Preview Post" but not in the post itself.
 

saw792

Is known to say things. That is all.
Reaction score
280
180 degree = 1 rad
1 degree = ~0.175rad or (pi / 180)

Let me bring it back!

180 degrees = pi radians, not 1 radian. 1 radian is defined as the angle formed from a sector of a circle where the radius of the circle = the arc length.
 

Bribe

vJass errors are legion
Reaction score
67
My favorite is when I see noobs using the inlined versions of AngleBetweenPoints and PolarProjectionBJ, because you've got bj_RADTODEG to get the angle, and then a bj_DEGTORAD to utilize the angle :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top