∴2θ=2kπ+π/2 (k∈Z)
∴θ=kπ+π/4
When k is odd, cosθ=-√2/2.
Do not meet the second condition, give up.
When k is an even number, cosθ=√2/2.
The second condition is met,
Therefore,
θ=2mπ+π/4 (m∈Z)