Loading...
Loading...
You are given a list of doubles v of even length and a list of doubles theta. For each index i, the pair (v[2 * i], v[2 * i + 1]) is a point in the plane, and theta[i] is an angle in radians.
Rotate each point counter-clockwise around the origin by theta[i] radians. Return a list of doubles of length v.length with the rotated points in the same order, so the rotated point for index i occupies positions 2 * i and 2 * i + 1.
You can assume v.length is even and theta has exactly v.length / 2 elements. A returned value is accepted if it is within 1e-5 absolute or relative error of the expected value.
Input: v = [1,0], theta = [0]
Output: [1.0,0.0]
Explanation: A rotation angle of `0` leaves the point `(1, 0)` unchanged.
Input: v = [1,0], theta = [1.5707963267948966]
Output: [0.0,1.0]
Explanation: The point `(1, 0)` rotated counter-clockwise by `1.5707963267948966` radians is approximately `(0, 1)`.
Input: v = [0,0,10000,-10000], theta = [123.456,-10000]
Output: [0.0,0.0,-6465.409793707626,12577.697571472669]
Explanation: The first point is the origin, so it stays at `(0, 0)`. Rotating `(10000, -10000)` counter-clockwise by `-10000` radians gives approximately `(-6465.409793707626, 12577.697571472669)`.
theta.length ≤1500v.length =2⋅ theta.lengthv[i] ≤104theta[i] ≤104v and theta are finite doubles.