# `cameraViewFromStored`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Function · `import { cameraViewFromStored } from '@holostep-configurators/runtime-client';` · labs, `@experimental` · since 2.0.0 · section 22. Pure helpers (root of the package; run in Node and the fake)

A stored `defaultView` ([`IConfigurator.defaultView`](IConfigurator.defaultView.md), [`SceneModel.defaultView`](SceneModel.defaultView.md): degrees, named
`azimuth`, `polar`, `radius`) as the [`CameraView`](CameraView.md) [`camera.set`](Camera.set.md) takes (`azimuthDeg`, `polarDeg`,
`distance`). A stored `position` wins, as 1.4's view helper let it: with d = position − target,
`azimuthDeg` = atan2(d.x, d.z), `polarDeg` = atan2(hypot(d.x, d.z), d.y) and `distance` =
hypot(d.x, d.y, d.z), in degrees. `focalOffset` is kept. Points are copied as `{ x, y, z }`, so a
stored subdocument `_id` never reaches the camera write. Sync, pure. Errors: throws TypeError
when a field the conversion reads is missing or not finite.

## Declaration

```ts
export declare function cameraViewFromStored(view: DeepReadonly<IDefaultView>): CameraView;
```

## Example

Imports: values (`has`, `validate`, the `Holo*Error` classes, the pure helpers) from `@holostep-configurators/runtime-client`, types from `@holostep-configurators/runtime-client/contract`, `/math` and `/testing` names from those entries; `boot` from the runtime module the root's `loadRuntimeAtFloor` resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (`examples/declaration/22-cameraViewFromStored.ts`):

```ts
import { cameraViewFromStored } from '@holostep-configurators/runtime-client';
import type { IConfigurator, Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const stored: IConfigurator;                  // read by your server with its API key
// after setSceneModel: a scene write never moves the camera
await session.camera.set(cameraViewFromStored(stored.defaultView), { durationMs: 0 });
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `cameraViewFromStored` names no product |
| 2. A precedent | not recorded: no ledger row (coverage.json) names this member or its owner |
| 3. Two apps, or labs | labs (`@experimental` at a stable path, reached through `has()` or `supports()`): it graduates when a second app uses it |
| 4. The cheaper fix first | not recorded per member (Appendix B decides it per need) |
