|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const rotationParseNum = (num) => { | 
|---|
|  |  |  | const normalizedDegrees = num % 360; | 
|---|
|  |  |  | const normalizedDegrees = positiveAngle(num); | 
|---|
|  |  |  | return normalizedDegrees * Math.PI / 180; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return (targetTheta - originTheta > 180) ? targetTheta - 360 : targetTheta; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const positiveAngle = (angle) => { | 
|---|
|  |  |  | return ((angle % 360) + 360) % 360; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const normalizeAngle = (angle) => { | 
|---|
|  |  |  | let newAngle = angle % 360; | 
|---|
|  |  |  | if (newAngle < 0) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (newAngle < -180) { | 
|---|
|  |  |  | newAngle += 360; | 
|---|
|  |  |  | } else if (newAngle > 180) { | 
|---|
|  |  |  | newAngle -= 360; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return newAngle; | 
|---|
|  |  |  | } | 
|---|