import { placeInCircle } from './utils';
/**
 * Returns a point on a circle.
 * @example
 * ```ts
 * const coordData = getPointOnCircle(12, 0.25);
 * ```
 * 'Progress' is a value between 0 and 1. 0 Is in front of the camera, 0.5 is behind the camera.
 * The returned object has two properties: p and r.
 * p is the position of the point, r is the rotation of the point.
 * @example
 * ```ts
 const coordData = getPointOnCircle(7, 0.1);
  const item = getPrefab({
    p: coordData.p,
    r: coordData.r,
    id: 'rock_01_t1',
    s: [1.5, 0.75, 1.5],
  });
 * ```
 **/
export const getPointOnCircle = (radius, progress) => {
    progress += 0.25; // Offset the start of the circle s0 that o is in front of the camera.
    if (progress > 1)
        progress = progress - 1;
    const angleInDegrees = progress * 360;
    const rv = { p: [0, 0, 0], r: [0, 0, 0] };
    placeInCircle({
        radius: radius,
        numberOfItems: 1,
        offset: angleInDegrees,
        onEach: (data) => {
            rv.p = data.p;
            rv.r = data.r;
        },
    });
    return rv;
};
//# sourceMappingURL=getPointOnCircle.js.map