scax-engine 0.1.8 → 0.2.0-beta.2

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/README.md CHANGED
@@ -45,8 +45,8 @@ const engine = new SCAXEngine({
45
45
 
46
46
  const result = engine.simulate();
47
47
  console.log(result.traced_rays.length);
48
- console.log(result.info.astigmatism.combined);
49
- console.log(result.info.prism.combined);
48
+ console.log(engine.calculateMeridians([{ s: -2.0, c: -0.75, ax: 90 }]));
49
+ console.log(engine.calculateEyeRotationByPrism({ p: 1.0, p_ax: 90 }));
50
50
  ```
51
51
 
52
52
  UI(슬라이더, 애니메이션 등)에서 변경마다 `new SCAXEngine`을 다시 만들지 않고 하나의 엔진 인스턴스를 재사용하려면, 전체 `props` 객체로 `update`를 호출한 뒤 `simulate`를 다시 실행하세요. `update`에서 생략된 최상위 필드는 이전 상태와 병합되지 않으며 생성자 기본값으로 채워집니다.
@@ -95,9 +95,9 @@ const next = engine.simulate();
95
95
  - `eye.p` / `eye.p_ax`는 **교정량(처방값)** 입니다.
96
96
  - `lens.p` / `lens.p_ax`도 **교정량(처방값)** 입니다.
97
97
  - `p_ax`는 **임상 Base 방향**, **렌즈 쪽에서 각막을 바라보는 시점** 기준입니다.
98
- - `simulate().info.prism.eye` 계산에서 눈 프리즘 효과는 실제 안구 편위를 표현하기 위해 내부에서 역방향으로 변환됩니다.
98
+ - 눈 프리즘 효과는 실제 안구 편위를 표현하기 위해 내부 계산에서 효과 벡터 기준으로 해석됩니다.
99
99
  - 렌즈는 광선을 굴절시키는 물리 요소이므로, 광선 추적에는 입력 방향이 그대로 적용됩니다.
100
- - 교정이 맞으면 `lens prism`과 `eye prism`이 크기·축에서 대응하고, 이때 `net_prism`은 0에 가깝습니다.
100
+ - 프리즘 처방으로 인한 회전량은 `calculateEyeRotationByPrism({ p, p_ax })`로 계산할 있습니다.
101
101
 
102
102
  ### `engine.update(props?)`
103
103
 
@@ -119,36 +119,23 @@ const next = engine.simulate();
119
119
 
120
120
  - `simulate()`
121
121
  ```ts
122
- (): {
123
- traced_rays: Ray[];
124
- info: {
125
- astigmatism: {
126
- eye: Array<{ tabo: number; d: number }>;
127
- lens: Array<{ tabo: number; d: number }>;
128
- combined: Array<{ tabo: number; d: number }>;
129
- };
130
- prism: {
131
- eye: { p_x: number; p_y: number; prism_angle: number; magnitude: number | null };
132
- lens: { p_x: number; p_y: number; prism_angle: number; magnitude: number | null };
133
- combined: { p_x: number; p_y: number; prism_angle: number; magnitude: number | null };
134
- };
135
- };
136
- }
122
+ (): { traced_rays: Ray[] }
137
123
  ```
138
- - 광선 추적과 함께 난시/프리즘 요약 정보를 반환합니다.
139
- - `d`, `magnitude`는 0에 가까우면 `null`로 반환됩니다.
124
+ - 광선 추적과 Sturm 갱신을 수행하고 추적된 광선 배열만 반환합니다.
140
125
 
141
- - `getEyeRotation()`
126
+ - `calculateMeridians(scaxPowers)`
142
127
  ```ts
143
- (): {
144
- x_deg: number;
145
- y_deg: number;
146
- magnitude_deg: number;
147
- }
128
+ (scaxPowers: Array<{ s: number; c: number; ax: number }>): Array<{ tabo: number; d: number }>
148
129
  ```
149
- - 처방 프리즘·`eye.tilt`를 반영한 렌더용 회전량을 반환합니다.
130
+ - 입력한 S/C/AX 조합을 power vector 방식으로 합산해 주경선 2개를 반환합니다.
150
131
 
151
- - `rayTracing()` — 광선 추적만 수행해 추적된 `Ray[]`를 반환합니다. `simulate()`는 이를 포함해 Sturm·난시/프리즘 요약까지 한 번에 계산합니다.
132
+ - `calculateEyeRotationByPrism(prism)`
133
+ ```ts
134
+ (prism: { p: number; p_ax: number }): { x: number; y: number }
135
+ ```
136
+ - 프리즘 처방으로 인한 안구 회전량(도)을 `x`/`y` 축으로 계산합니다(tilt 제외).
137
+
138
+ - `rayTracing()` — 광선 추적만 수행해 추적된 `Ray[]`를 반환합니다. `simulate()`는 추적과 Sturm 갱신까지 수행합니다.
152
139
 
153
140
  - `sturmCalculation(rays?)` — 추적 광선(인자 생략 시 마지막 `rayTracing`/`simulate` 결과)으로 Sturm 슬라이스·스펙트럼선별 분석 객체를 계산해 반환합니다. `simulate()` 호출 시 내부에서 Sturm도 갱신됩니다.
154
141