Let me help you in this way: the range will have only three values.... -1, 0, and 1...
for:
<span>0≤x<<span>π2</span></span>, y=0
x = <span>π/2</span>, y = 1
<span><span>π/2</span><x<π</span>, y=0
Then what you need to do is to figure out the values for <span><span>π<x<2π</span></span>