@photivra/engine 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/CITATION.cff +1 -1
- package/README.md +6 -6
- package/SECURITY.md +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/core/version.js.map +1 -1
- package/dist/facade/simulate-capture.d.ts +5 -1
- package/dist/facade/simulate-capture.js +15 -2
- package/dist/facade/simulate-capture.js.map +1 -1
- package/dist/facade/subject-framing.d.ts +62 -0
- package/dist/facade/subject-framing.js +62 -19
- package/dist/facade/subject-framing.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/optics/diffraction-psf-profile.d.ts +51 -2
- package/dist/optics/diffraction-psf-profile.js +116 -3
- package/dist/optics/diffraction-psf-profile.js.map +1 -1
- package/docs/API_REFERENCE.md +4 -1
- package/docs/QUICK_START.md +90 -5
- package/docs/api/core-version.md +1 -1
- package/docs/api/exports.json +17 -2
- package/docs/api/facade-simulate-capture.md +5 -1
- package/docs/api/facade-subject-framing.md +67 -0
- package/docs/api/optics-diffraction-psf-profile.md +8 -1
- package/package.json +1 -1
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
The package and root API versions are recorded once in [Navigation](../API_REFERENCE.md) · [Developer guide](https://github.com/Photivra/photivra/blob/main/docs/DEVELOPERS.md). Generated signatures retain independent schema/model versions. Only the exports listed here are root-package contracts; module-local helpers are not supported deep imports.
|
|
4
4
|
|
|
5
|
+
## calculateChartFraming
|
|
6
|
+
|
|
7
|
+
How much of the frame a chart of a given physical size covers at any subject distance (2.5): magnification, framed plane size,
|
|
8
|
+
coverage fractions (above 1 when cropped), the chart's image size and the minimum-focus check. The same thin-lens framing as
|
|
9
|
+
`simulateCapture` (`scene.framing`, `result.scene.chart`) and `calculateSubjectDistanceForFraming`.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
export function calculateChartFraming(input: CalculateChartFramingInput): ChartFraming;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This call is synchronous; any supplied provider must follow its explicit synchronous contract.
|
|
16
|
+
|
|
17
|
+
## CalculateChartFramingInput
|
|
18
|
+
|
|
19
|
+
The exact contract is declared below; use the domain guide for assumptions and staged integration.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export interface CalculateChartFramingInput {
|
|
23
|
+
/** Active sensor (or simulated frame) size, mm: for `simulateCapture`, output width × height × pixel pitch. */
|
|
24
|
+
sensor: { widthMm: number; heightMm: number };
|
|
25
|
+
/** Physical focal length, mm. Give exactly one of this and `equivalentFocalLengthMm`. */
|
|
26
|
+
focalLengthMm?: number;
|
|
27
|
+
/** Full-frame-equivalent focal length (diagonal crop factor); a generic prime's value also reports that lens (as `lens.prime`). */
|
|
28
|
+
equivalentFocalLengthMm?: number;
|
|
29
|
+
/** Chart size as for `simulateCapture` `chartSize`: heightM defaults to widthM × the sensor aspect (height / width). */
|
|
30
|
+
chart: { widthM: number; heightM?: number };
|
|
31
|
+
/** Distance from the lens to the chart plane, metres; more than the focal length. */
|
|
32
|
+
subjectDistanceM: number;
|
|
33
|
+
/** Focus distance, metres (as `lens.focusDistanceM`); default the subject distance. More than the focal length. */
|
|
34
|
+
focusDistanceM?: number;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
5
38
|
## calculateSubjectDistanceForFraming
|
|
6
39
|
|
|
7
40
|
The subject distance that fits a chart of a given physical size to the frame, with magnification, coverage and the minimum-focus check (2.3).
|
|
@@ -30,6 +63,40 @@ export interface CalculateSubjectDistanceForFramingInput {
|
|
|
30
63
|
}
|
|
31
64
|
```
|
|
32
65
|
|
|
66
|
+
## ChartFraming
|
|
67
|
+
|
|
68
|
+
The exact contract is declared below; use the domain guide for assumptions and staged integration.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
export interface ChartFraming {
|
|
72
|
+
subjectDistanceM: number;
|
|
73
|
+
focusDistanceM: number;
|
|
74
|
+
/** Thin-lens image distance at the focus distance, f·s/(s − f), mm. */
|
|
75
|
+
imageDistanceMm: number;
|
|
76
|
+
/** Image size ÷ object size on the chart plane, v/d: f/(d − f) when focused on the chart. */
|
|
77
|
+
magnification: number;
|
|
78
|
+
focalLengthMm: number;
|
|
79
|
+
equivalentFocalLengthMm: number;
|
|
80
|
+
cropFactor35Mm: number;
|
|
81
|
+
chart: { widthM: number; heightM: number };
|
|
82
|
+
/** Plane area the frame covers at the subject distance, metres: sensor side ÷ magnification. */
|
|
83
|
+
framedWidthM: number;
|
|
84
|
+
framedHeightM: number;
|
|
85
|
+
/** Fraction of the frame width and height the chart covers; above 1 means the chart is larger than the frame and cropped. */
|
|
86
|
+
coverage: { frameWidthFraction: number; frameHeightFraction: number };
|
|
87
|
+
/** The chart's image on the sensor, mm. */
|
|
88
|
+
chartImageMm: { width: number; height: number };
|
|
89
|
+
/** The generic prime of this equivalent focal length, when there is one. */
|
|
90
|
+
prime: GenericPrimeLens | null;
|
|
91
|
+
/** The generic prime rule max(0.10 m, f·(1 + 1/0.15)) at this focal length (the prime's own value when there is one). */
|
|
92
|
+
minimumFocusDistanceM: number;
|
|
93
|
+
/** True when the subject or focus distance is closer than the minimum focus distance (`simulateCapture` with `lens.prime` rejects it). */
|
|
94
|
+
belowMinimumFocus: boolean;
|
|
95
|
+
scientificStatus: "approximation";
|
|
96
|
+
assumptions: readonly SimulateCaptureAssumption[];
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
33
100
|
## SubjectFraming
|
|
34
101
|
|
|
35
102
|
The exact contract is declared below; use the domain guide for assumptions and staged integration.
|
|
@@ -71,7 +71,14 @@ export interface DiffractionLimitedPsfProfile {
|
|
|
71
71
|
wavelengths: readonly DiffractionLimitedPsfWavelength[];
|
|
72
72
|
/** Largest truncated energy over the wavelengths. */
|
|
73
73
|
maximumTruncatedEnergyFraction: number;
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* How the cells were integrated. 2.5: wavelengths with β = p·f_c ≥ 192 (cells far larger than the pattern) use the real-space
|
|
76
|
+
* encircled-energy method; `realSpaceWavelengthsNm` lists them, and `method` is `"frequency-domain-and-real-space"` when both ran.
|
|
77
|
+
* `maximumRadialNodes` counts frequency-domain radial nodes (0 when only the real-space method ran); `maximumAngularNodes` the
|
|
78
|
+
* angular nodes of either method (for the real-space method, all θ nodes of one wavelength).
|
|
79
|
+
*/
|
|
80
|
+
quadrature: { method: "polar-frequency-domain-trapezoid-gauss-legendre" | "real-space-encircled-energy-gauss-legendre" | "frequency-domain-and-real-space";
|
|
81
|
+
maximumRadialNodes: number; maximumAngularNodes: number; realSpaceWavelengthsNm?: readonly number[] };
|
|
75
82
|
}
|
|
76
83
|
```
|
|
77
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photivra/engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Scientific TypeScript engine for camera optics, exposure, focus, motion, sensor sampling, diffraction, and digital imaging calculations.",
|
|
6
6
|
"type": "module",
|