@primestyleai/tryon 5.10.169 → 5.10.170
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.
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type { FitAreaInfo } from "../types";
|
|
2
2
|
import type { MeasurementLines } from "../pose-detect";
|
|
3
3
|
export type GranularFit = "good" | "tight" | "loose" | "a-bit-tight" | "a-bit-loose" | "too-tight" | "too-loose";
|
|
4
|
-
/** Compute granular fit label for a single measurement.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - "
|
|
9
|
-
* - "
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* reads as "tight". This also tightens the match-percent score, since
|
|
14
|
-
* fewer rows now fall in the good/a-bit buckets. */
|
|
4
|
+
/** Compute granular fit label for a single measurement. Mirrors the
|
|
5
|
+
* backend deterministic engine's edge-based thresholds so the FIT
|
|
6
|
+
* DIRECTIVES the SDK ships to /tryon match what the user reads in the
|
|
7
|
+
* table:
|
|
8
|
+
* - "good" : in chart range OR within ½" / 1.27 cm of nearest edge
|
|
9
|
+
* - "a-bit-X" : ½"–1" past the edge
|
|
10
|
+
* - "X" : 1"–2" past the edge
|
|
11
|
+
* - "too-X" : > 2" past the edge
|
|
12
|
+
* Where X is tight (over upper edge) or loose (under lower edge). */
|
|
15
13
|
export declare function computeFit(userValue: number, chartRange: string, unit?: "in" | "cm" | "mm"): GranularFit;
|
|
16
14
|
/**
|
|
17
15
|
* Build FitAreaInfo[] from matchDetails + optional pose coordinates.
|
|
@@ -10098,14 +10098,15 @@ function parseNum(s) {
|
|
|
10098
10098
|
function computeFit(userValue, chartRange, unit) {
|
|
10099
10099
|
const { min: rMin, max: rMax } = parseRange(chartRange);
|
|
10100
10100
|
if (rMin === 0 && rMax === 0) return "good";
|
|
10101
|
-
const perfectTol = unit === "cm" ?
|
|
10102
|
-
const aBitTol = unit === "cm" ?
|
|
10101
|
+
const perfectTol = unit === "cm" ? 1.27 : unit === "mm" ? 12.7 : 0.5;
|
|
10102
|
+
const aBitTol = unit === "cm" ? 2.54 : unit === "mm" ? 25.4 : 1;
|
|
10103
10103
|
const tooFarTol = unit === "cm" ? 5.08 : unit === "mm" ? 50.8 : 2;
|
|
10104
|
-
|
|
10104
|
+
const inRange = userValue >= rMin && userValue <= rMax;
|
|
10105
|
+
const overEdge = inRange ? 0 : userValue > rMax ? userValue - rMax : rMin - userValue;
|
|
10106
|
+
if (inRange || overEdge <= perfectTol) return "good";
|
|
10105
10107
|
const isUnder = userValue < rMin;
|
|
10106
|
-
|
|
10107
|
-
if (
|
|
10108
|
-
if (diff > aBitTol) return isUnder ? "loose" : "tight";
|
|
10108
|
+
if (overEdge > tooFarTol) return isUnder ? "too-loose" : "too-tight";
|
|
10109
|
+
if (overEdge > aBitTol) return isUnder ? "loose" : "tight";
|
|
10109
10110
|
return isUnder ? "a-bit-loose" : "a-bit-tight";
|
|
10110
10111
|
}
|
|
10111
10112
|
const AREA_TO_POSE_KEY = {
|