three-slicer 0.1.1 → 0.1.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.
@@ -1,23 +1,23 @@
1
- // three-slicer/viewer/loaders — 커널 무관 순수 로더.
1
+ // three-slicer/viewer/loaders — pure loaders, independent of the kernel.
2
2
 
3
- /** 내장 5종 + `registerLoader()` 로 등록된 확장자. 등록 시 이 배열에 push 된다. */
3
+ /** The 5 built-ins plus any extension registered via `registerLoader()`, which pushes onto this array. */
4
4
  export const SUPPORTED_EXT: string[]
5
5
 
6
- /** 소문자 확장자. 점이 없으면 빈 문자열. */
6
+ /** Lowercased extension. Empty string when there is no dot. */
7
7
  export function fileExt(name: string): string
8
8
 
9
9
  export interface LoadedObject {
10
10
  name: string
11
- /** 삼각형 정점 좌표 (N*9, model z-up) */
11
+ /** Triangle vertex coordinates (N*9, model z-up) */
12
12
  modelPos: Float32Array
13
13
  }
14
14
 
15
- /** 파일 1개에 여러 오브젝트가 들어있을 수 있다(3mf/amf/step) → 항상 배열. */
15
+ /** A single file may contain several objects (3mf/amf/step) -> always an array. */
16
16
  export function loadModel(name: string, buffer: ArrayBuffer): Promise<LoadedObject[]>
17
17
 
18
18
  /**
19
- * 확장 포맷 등록. 무거운 의존성이 필요한 포맷(STEP=OCCT WASM 등)은 패키지에 넣지 않으므로
20
- * 앱에서 직접 붙인다. `<Viewport/>` 의 파일 대화상자·드래그앤드롭 필터에 자동 반영된다.
19
+ * Registers an extra format. Formats needing heavy dependencies (STEP=OCCT WASM, etc.) are not bundled here,
20
+ * so the app wires them up itself. The `<Viewport/>` file dialog and drag-and-drop filters pick them up automatically.
21
21
  *
22
22
  * ```js
23
23
  * import { registerLoader } from 'three-slicer/viewer/loaders'
@@ -29,5 +29,5 @@ export function registerLoader(
29
29
  fn: (buffer: ArrayBuffer, name: string) => LoadedObject[] | Promise<LoadedObject[]>,
30
30
  ): void
31
31
 
32
- /** 연결 성분 분리. 성분이 1개뿐이면 `null`(분리 불가) — 빈 배열이 아니다. */
32
+ /** Connected-component split. Returns `null` when there is only one component (cannot split) — not an empty array. */
33
33
  export function splitConnectedComponents(localPos: Float32Array): Float32Array[] | null
@@ -1,26 +1,26 @@
1
- // three-slicer/viewer/toolpath — 커널 레이어 → GPU 인스턴싱 툴패스.
2
- // three 를 import 하지 않는다: makeToolpath 가 THREE 네임스페이스를 인자로 받는다(단일 인스턴스 보장).
1
+ // three-slicer/viewer/toolpath — kernel layers -> GPU-instanced toolpath.
2
+ // Does not import three: makeToolpath takes the THREE namespace as an argument (guaranteeing a single instance).
3
3
 
4
- /** 8정점 다이아몬드 단면의 24 삼각형 인덱스 (SegmentTemplate.cpp:18 원본) */
4
+ /** The 24 triangle indices of the 8-vertex diamond cross-section (from SegmentTemplate.cpp:18) */
5
5
  export const VERTEX_DATA: number[]
6
6
 
7
- /** 툴패스 타입 → 색. 0=travel, 1=wall … 11=prime */
7
+ /** Toolpath type -> color. 0=travel, 1=wall … 11=prime */
8
8
  export const TYPE_COLOR: Record<number, number[]>
9
9
  export const TYPE_LABEL: Record<number, string>
10
10
 
11
- /** 파랑→빨강 11색 히트맵 (libvgcode ColorRange.hpp:14) */
11
+ /** Blue-to-red 11-color heatmap (libvgcode ColorRange.hpp:14) */
12
12
  export const DEFAULT_RANGES_COLORS: number[][]
13
13
 
14
14
  export interface ViewTypeDef {
15
15
  key: 'feature' | 'speed' | 'height' | 'width' | 'fan' | 'temp'
16
16
  label: string
17
- /** 연속값(히트맵)인가. false 면 고정색. */
17
+ /** Whether values are continuous (heatmap). False means a fixed color. */
18
18
  cont: boolean
19
19
  unit: string
20
20
  }
21
21
  export const VIEW_TYPES: ViewTypeDef[]
22
22
 
23
- /** per-vertex 부가 정보 */
23
+ /** Per-vertex extra data */
24
24
  export interface SegmentMeta {
25
25
  vType: Uint8Array
26
26
  vWidth: Float32Array
@@ -42,16 +42,16 @@ export interface SegmentData {
42
42
  maxAbs: number
43
43
  hasNaN: boolean
44
44
  meta: SegmentMeta
45
- /** 타입별 총 압출 길이 (index = 툴패스 타입, 길이 16) */
45
+ /** Total extruded length per type (index = toolpath type, length 16) */
46
46
  typeLengths: Float64Array
47
- /** 정점이 하나도 없으면 null */
47
+ /** Null when there is not a single vertex */
48
48
  bbox: { min: [number, number, number]; max: [number, number, number] } | null
49
49
  }
50
50
 
51
- /** 커널 layers[{z, paths(stride8), widths[]}] → GPU 스트림. */
51
+ /** Kernel layers[{z, paths(stride8), widths[]}] -> GPU stream. */
52
52
  export function buildSegmentData(layers: unknown[], defaultLineWidth: number): SegmentData
53
53
 
54
- /** 타입별 길이 비율(%), pct 내림차순. 시간은 커널이 role 별로 노출하지 않아 길이로 근사한다. */
54
+ /** Length share per type (%), descending by pct. The kernel does not expose time per role, so length is used as an approximation. */
55
55
  export function roleRatios(typeLengths: Float64Array | number[]): Array<{
56
56
  type: number
57
57
  label: string
@@ -60,7 +60,7 @@ export function roleRatios(typeLengths: Float64Array | number[]): Array<{
60
60
  }>
61
61
 
62
62
  /**
63
- * speed/fan/temp 는 커널 툴패스에 없어 설정값에서 유도한다 — 그 유도에 쓰는 값들.
63
+ * speed/fan/temp are absent from the kernel toolpath and derived from settings — these are the values used for that.
64
64
  */
65
65
  export interface ColorContext {
66
66
  speedByType?: Record<number, number>
@@ -73,26 +73,26 @@ export interface ColorContext {
73
73
  }
74
74
 
75
75
  export interface ColorResult {
76
- /** per-vertex RGBA (nV*4). `.r` 에 색이 packed 돼 있다. */
76
+ /** Per-vertex RGBA (nV*4). The color is packed into `.r`. */
77
77
  color: Float32Array
78
78
  min: number
79
79
  max: number
80
80
  viewType: ViewTypeDef['key']
81
81
  label: string
82
82
  unit: string
83
- /** false 면 고정색 — min/max 는 0 이고 범례를 그리면 안 된다. */
83
+ /** False means fixed colors — min/max are 0 and no legend should be drawn. */
84
84
  cont: boolean
85
85
  }
86
86
 
87
87
  export function computeColors(data: SegmentData, viewType: ViewTypeDef['key'], ctx: ColorContext): ColorResult
88
88
 
89
89
  export interface ToolpathHandle {
90
- /** THREE.Mesh — 인자로 넘긴 THREE 네임스페이스의 타입 */
90
+ /** THREE.Mesh — typed by the THREE namespace passed in */
91
91
  mesh: any
92
92
  /** THREE.LineSegments (travel) */
93
93
  travLines: any
94
94
  setLayerRange(lo: number, hi: number): void
95
- /** 하위호환 — setLayerRange(0, n-1) 과 같다. */
95
+ /** Backwards compatible — same as setLayerRange(0, n-1). */
96
96
  setVisibleLayers(n: number): void
97
97
  setTravelVisible(visible: boolean): void
98
98
  setColors(color: Float32Array): void
@@ -101,5 +101,5 @@ export interface ToolpathHandle {
101
101
  layerCount: number
102
102
  }
103
103
 
104
- /** @param THREE - `import * as THREE from 'three'` 네임스페이스. 소비자 인스턴스를 그대로 쓴다. */
104
+ /** @param THREE - the `import * as THREE from 'three'` namespace. The consumer's instance is used as-is. */
105
105
  export function makeToolpath(THREE: any, data: SegmentData): ToolpathHandle
package/types/viewer.d.ts CHANGED
@@ -3,11 +3,11 @@ import type * as React from 'react'
3
3
  import type { SlicerSettings } from './settings-keys.d.ts'
4
4
 
5
5
  export interface ViewportProps {
6
- /** sparse 설정 맵. 기본 `{}`. */
6
+ /** Sparse settings map. Defaults to `{}`. */
7
7
  settings?: SlicerSettings
8
- /** React setState 형태. 기본 no-op. */
8
+ /** React setState shape. Defaults to a no-op. */
9
9
  setSettings?: React.Dispatch<React.SetStateAction<SlicerSettings>>
10
- /** 좌측 프로세스 패널 슬롯 — 보통 `<SettingsPanel embedded/>`. 기본 null. */
10
+ /** Left process-panel slot — usually `<SettingsPanel embedded/>`. Defaults to null. */
11
11
  processPanel?: React.ReactNode
12
12
  }
13
13
 
package/types/wasm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- // three-slicer/wasm, three-slicer/wasm-mt — emscripten 글루(생성물, 3.5MB+).
2
- // ponytail: 여기에 정확한 타입을 쓰지 않는다. 글루는 재빌드 때마다 바뀌고, 공개 API 는
3
- // three-slicer 의 createSlicer() 다. 직접 쓰는 쪽은 이미 커널 내부를 아는 쪽.
1
+ // three-slicer/wasm, three-slicer/wasm-mt — emscripten glue (generated, 3.5MB+).
2
+ // ponytail: no precise types here. The glue changes on every rebuild, and the public API is
3
+ // createSlicer() from three-slicer. Anyone using this directly already knows the kernel internals.
4
4
  declare const factory: (opts?: Record<string, unknown>) => Promise<any>
5
5
  export default factory
package/types/worker.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- // three-slicer/worker — 슬라이스 워커 스크립트. import 해서 쓰는 모듈이 아니라
2
- // `new Worker(new URL('three-slicer/worker', import.meta.url), { type: 'module' })` 의 대상.
1
+ // three-slicer/worker — the slice worker script. Not a module you import, but the target of
2
+ // `new Worker(new URL('three-slicer/worker', import.meta.url), { type: 'module' })`.
3
3
  export {}