Semi-circle-ish formula

Dois

New Member
Reaction score
1
Hi... Can anyone give me a formula I can use for something like...

JASS:
        loop
            set L2 = Location(GetLocationX(L1) + x, GetLocationY(L1) + y)
            call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl", L2))
            call RemoveLocation(L2)        
            exitwhen x == 300
            set x = x + 10
            set y = ?????
        endloop


A semi-circle that starts at X = -300 and ends at x = 0?

The sin curve would work too but I don't know how to change the "wavelength"

I mean like I need it to start at "X=-300" and end at "X=300" <<< for the sin curve... and "Absolute" as well... So itll form 2 semi-circles...

Edit: nvm i think ive figured it out
 
Circle:
x = Xcenter + radius * Cos(angle)
y = Ycenter + radius * Sin(angle),
where angle goes from 0 to 2PI.


The other way around:
Given the center and x as offset from there inside the circle:
y = Ycenter + SquareRoot(radius * radius - x * x)
or
y = Ycenter - SquareRoot(radius * radius - x * x), for the "other" side



No, I've no idea what you're trying here...
 
> Pow(Pow(150,2)-Pow(x+150,2),0.5)

= SquareRoot( 150 * 150 - (x + 150) * (x + 150) )

Hm... if (x + 150) * (x + 150) is larger then 150 * 150... you have a problem.
I.e. this only works if x is between -300 and 0.

Why do you add +150 to x?
 
oh

in the end it looks like this

JASS:
set x = -300
        set y = 0
        loop
            set L2 = Location(GetLocationX(L1) + x, GetLocationY(L1) + y)
            call DestroyEffect(AddSpecialEffectLoc(&quot;Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl&quot;, L2))
            call RemoveLocation(L2)        
            exitwhen x == 0
            set x = x + 10
            set y = SquareRoot(150*150-Pow(x+150,2))
        endloop
        loop
            set L2 = Location(GetLocationX(L1) + x, GetLocationY(L1) + y)
            call DestroyEffect(AddSpecialEffectLoc(&quot;Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl&quot;, L2))
            call RemoveLocation(L2)        
            exitwhen x == 300
            set x = x + 10
            set y = SquareRoot(150*150-Pow(x-150,2))
        endloop
        call TriggerSleepAction(0.2)


so it makes 2 semi circles...

one from -300 to 0 and another from 0 to 300


edit: this is actually the top of my heart that i was trying to make.... that heart equation was too... big... im not good enough to use that... so now i just have a triangle at the bottom and two semi circles at the top for a heart. the points dont connect right but.. oh well this is the best i can get so far...
 
JASS:
globals
    constant string HeartEffect = &quot;Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl&quot;
    constant real factor = 0.4  // size, sort of. don&#039;t go too big!
    constant real rad05 = 5.0 * bj_DEGTORAD
    constant real rad60 = 60.0 * bj_DEGTORAD
endglobals

function Trig_Heart_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real f = (GetUnitFacing(u) - 90.0) * bj_DEGTORAD
    local real cf = Cos(f)
    local real sf = Sin(f)
    local real xc = GetUnitX(u)
    local real yc = GetUnitY(u)
    local real x
    local real y
    local real t
    local real a = 0.0
    local real b = 0.0

    loop
        set a = a + rad05
        set b = b + 5.0
        exitwhen b &gt; 60.0
        set t = 1200 + 40 * b - b * b
        set x = t * Sin(a) * factor
        set y = t * Cos(a) * factor
        call DestroyEffect(AddSpecialEffect(HeartEffect, xc + x * cf - y * sf, yc + x * sf + y * cf))
        call DestroyEffect(AddSpecialEffect(HeartEffect, xc - x * cf - y * sf, yc - x * sf + y * cf))
    endloop

    set u = null
endfunction

//===========================================================================
function InitTrig_Heart takes nothing returns nothing
    set gg_trg_Heart = CreateTrigger(  )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Heart, Player(0), true )
    call TriggerAddAction( gg_trg_Heart, function Trig_Heart_Actions )
endfunction
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top