# FikoYT 3D CAD Selection System Upgrade Plan
**Tarih:** 2026-03-13
**Durum:** Taslak
**Kapsam:** `FikoSecililer.ts` (7451 satir) + `fiko-performance/` altyapisi

---

## 1. Mevcut Sistem Analizi

### 1.1 Dosya Boyutlari (Toplam ~20K+ satir)

| Dosya | Satir | Sorumluluk |
|-------|-------|------------|
| `FikoSecililer.ts` | 7451 | Ana orkestrator - HER SEY burada |
| `FikoGPUSelection.ts` | 2996 | GPU edge/point selection (WASM + WebGPU compute) |
| `FikoWasmBridge.ts` | 2931 | WASM entegrasyonu (raycast, edge detect, closest point) |
| `FikoGPUPicker.ts` | 1049 | GPU color-ID picking (async fence + PBO) |
| `FikoMemoryPooling.ts` | 991 | Nesne havuzu sistemi |
| `FikoEdgeSpatialIndex.ts` | 884 | O(1) edge lookup spatial hash |
| `FikoGPUHighlight.ts` | 825 | GPU highlight rendering |
| `FikoPredictiveRaycast.ts` | 629 | Mouse tahmin ve onceden hesaplama |
| `FikoDeferredSelection.ts` | 634 | Async secim kuyrugu |
| `FikoHierarchicalSelection.ts` | 589 | Coarse-to-fine secim boru hatti |
| `FikoWebGPURaycast.ts` | 565 | WebGPU native BVH raycast |
| `FikoRaycastBVH.ts` | 447 | BVH hizlandirma |
| `FikoRaycastCPUYardimci.ts` | 274 | CPU fallback yardimci |

### 1.2 FikoSecililer.ts Fonksiyon Gruplari

**A. Yapilandirma & Durum (satir 1-500, ~500 satir)**
- 30+ pre-allocated static buffer (Vector3, Matrix4, Float32Array)
- 15+ cache sistemi (geometry, ray, highlight, face, edge coherence, spatial)
- 20+ konfigürasyon property'si (threshold, toggle, renk, opacity)
- Performans istatistikleri, billion edge modu, visibility cache

**B. Agac Senkronizasyonu & Isbirligi (satir 470-700, ~230 satir)**
- `updateTreeSelectionFrom3D()`, `updateTreeHoverFrom3D()`, `selectFromTree()`, `hoverFromTree()`
- Real-time collaboration broadcast (Socket.IO isim tabanli sync)
- `highlightObjectAsHover()`, `highlightObject()` - agac kaynakli highlight

**C. Filtre & Highlight Kontrolü (satir 500-1400, ~900 satir)**
- `canHighlight()` - 4 katmanli filtre (gorunurluk, custom filtre, tip, isim, userData)
- `guncelleSecimAyarlari()` - 50+ ayar property'si, material pool reset
- Hover highlight tip ayarlari (mesh/line/point/edge ayri toggle)
- localStorage persistance

**D. Yasam Dongusu & Olay Baglama (satir 1400-2420, ~1020 satir)**
- `baslat()` / `bitir()` - event listener register/unregister
- `pointerDown()`, `pointerUp()`, `pointerMove()`, `dblClick()`, `contextMenu()`
- Touch gesture handling (touchstart/move/end, long press, 2-parmak context menu)
- Sag menu acma/kapama (CDK overlay, z-index yonetimi)
- RAF batching (`processRafRaycast`)
- Velocity-based throttling, mouse prediction, prefetch

**E. Raycast Boru Hatti (satir 3244-3900, ~656 satir)**
- `odaktakiler()` - ana giris noktasi (throttle + normalize + raycast)
- `performRaycast()` - strateji secimi (WebGPU > GPU > WASM > BVH > Standard)
- `performRaycastQueryWasm()` / `performRaycastQueryWasmSync()` - WASM raycast
- `performRaycastQueryBVH()` - BVH fallback
- `filterIntersections()`, `enrichIntersections()` - sonuc isleme
- Clipping plane filtresi

**F. Edge Secim Sistemi (satir 4245-5060, ~815 satir)**
- `screenSpaceEdgePickingWithThreshold()` - ana giris (temporal coherence)
- `_screenSpaceEdgePickingInternal()` - 3 katmanli: Spatial Index > WebGPU > CPU
- `collectEdgeObjects()` - BFS ile edge objesi toplama
- `findClosestEdgeInObject()` - GPU/CPU edge mesafe hesabi
- `triggerWebGPUEdgeSelection()` - async WebGPU batch edge isleme
- `projectToScreen()`, `pointToLineSegmentDistance2D()`, `getScreenDistance()`
- Frustum culling, uzaklik filtresi, zaman butcesi (8ms), erken cikis

**G. Nokta Secim Sistemi (satir 5084-5300, ~216 satir)**
- `screenSpacePointPickingWithThreshold()`, `collectPointObjects()`, `findClosestPointInObject()`

**H. Temizlik & Dispose (satir 5421-5920, ~500 satir)**
- cleanup* metodlari (BVH, GPU Picker, GPU Highlight, GPU Selection, WebGPU)
- `dispose()` - kapsamli kaynak serbest birakma
- Event emitter/listener temizligi

**I. Highlight Olusturma (satir 5645-7451, ~1806 satir)**
- `kesisimCozumle()` - orkestrator (filtre > hedef grup > highlight olustur)
- `kesistiYuzey()` - yuzey highlight (FikoCizimYalin ozel + normal mesh)
- `kesistiCizgi()` / `kesistiRegularLineSegments()` - cizgi highlight (Line2 + fallback)
- `kesistiNokta()` / `kesistiNoktaKoy()` - nokta highlight
- `kesistiEksen()` - eksen highlight
- `createNormalMeshHighlight()` - mesh clone/pool, material pool, clipping
- `createCizimYalinHighlight()` - BREP grup tabanli yuzey highlight
- `getGeometryBuffers()`, `getFaceGroupInfo()`, `buildGeometryFromGroup()` - geometri islemleri
- Mesh pool (hover icin zero-allocation), geometry instance pool, LRU cache

### 1.3 Mevcut Secim Strateji Hiyerarsisi

```
RAYCAST (mesh picking):
  WebGPU Native BVH  →  GPU Color-ID Picker  →  WASM Batch  →  BVH (three-mesh-bvh)  →  Standard

EDGE SELECTION (screen-space):
  Spatial Index O(1)  →  WebGPU Compute Batch  →  GPU/WASM Hybrid  →  CPU Iterative

POINT SELECTION:
  WASM closestPoint  →  CPU Iterative

HOVER PIPELINE:
  RAF Batch  →  Velocity Throttle  →  Mouse Prediction  →  Temporal Coherence  →  Raycast  →  Edge/Point Picking  →  Highlight
```

### 1.4 Darbogaz ve Sorun Tespitleri

**D1. God Object Anti-Pattern (KRITIK)**
- `FikoSecililer.ts` 7451 satir, 80+ metod, 60+ property
- Tek sinif icinde: raycast, edge picking, point picking, highlight, UI event handling, context menu, touch gesture, tree sync, collaboration, dispose, animation, GPU init, WASM init, BVH init
- Degisiklik yapma riski cok yüksek - herhangi bir modülde degisiklik diger tüm modülleri etkileyebilir

**D2. Kod Tekrari**
- `highlightObjectAsHover()` ve `highlightObject()` neredeyse ayni (satir 807-990, 180 satir x2)
- `sagMenuAc()` ve `showContextMenuForTouch()` buyük oranda tekrar (overlay/z-index logic)
- `kesistiRegularLineSegments()` icinde LineSegments2 ve normal LineSegments icin çifte highlight olusturma (Line2 + fallback) tekrari
- `collectEdgeObjects()` ve `collectPointObjects()` benzer BFS mantigi

**D3. FikoDeferredSelection ve FikoHierarchicalSelection KULLANILMIYOR**
- Bu siniflar yazilmis ama `FikoSecililer.ts` icinden referans edilmiyor
- Import bile yok - olasi "gelecek plani" olarak birakılmis

**D4. Highlight Olusturma Performans Sorunu**
- `kesistiRegularLineSegments()` her secimde `new LineGeometry()`, `new LineMaterial()`, `new Line2()`, `new THREE.BufferGeometry()`, `new THREE.LineBasicMaterial()`, `new THREE.LineSegments()`, `new THREE.Group()` olusturuyor
- Material pool sadece mesh icin var, cizgi/nokta material'leri havuzlanmiyor
- Her hover degisikliginde geometry allocation var (hover mesh pool sadece Mesh tipi icin)

**D5. Billion Edge Mode Karmasikligi**
- 4 farkli yerde `billionEdgeMode` kontrolü yapiliyor (processRafRaycast, pointerUp, uzunBasildi, screenSpaceEdgePickingWithThreshold)
- Her yerde benzer "gecici aktive et → islemi yap → geri al" pattern'i tekrarlaniyor

**D6. Cache Tutarsizligi**
- 8+ bagimsiz cache sistemi, farkli TTL'ler, farkli invalidation mekanizmalari
- Bazi cache'ler timestamp-based, bazilari frame-based, bazilari event-based
- Cache invalidation koordinasyonu yok

**D7. GPU Picker ID Encoding**
- 24-bit RGB encoding (16M obje limiti) - yeterli ama sub-pixel accuracy yok
- Multi-sample destegi yok - kenar piksellerinde yanlis ID dönebilir

**D8. Box/Lasso Selection Eksik**
- WebGPU batch picking shader'i var (FikoGPUPicker.ts icinde) ama FikoSecililer'dan cagrilmiyor
- Kullanicinin dikdörtgen/lasso ile toplu secim yapma imkani yok

**D9. BVH Rebuild Stratejisi**
- BVH tam rebuild yapiyor (senkron, main thread bloklar)
- Incremental update yok - sahneye yeni obje eklendiginde tüm BVH yeniden olusturuluyor
- WebGPU BVH rebuild'i `enableWebGPURaycast()` ile manual tetikleniyor

**D10. Accessibility Eksikligi**
- Klavye ile secim yok (Tab ile gezinme, Enter ile secim)
- Screen reader desteği yok (ARIA etiketleri, secim durumu bildirimi)
- Focus management yok

---

## 2. Faz Bazli Upgrade Plani

### FAZ 1: Modülerizasyon (Kisa Vadeli - 1-2 Hafta)

**Amac:** 7451 satirlik God Object'i mantiksal modüllere ayirmak. Zero breaking change.

**1.1 Dosya Yapisi**
```
fiko-selection/
  index.ts                          // Public API (FikoSecililer re-export)
  FikoSecililer.ts                  // Orkestrator (sadece koordinasyon, ~800 satir)

  core/
    selection-state.ts              // Tüm state ve property'ler
    selection-config.ts             // Konfigürasyon yonetimi (ayarlar, localStorage)
    selection-strategy.ts           // Strateji secimi (WebGPU/GPU/WASM/BVH/Standard)

  raycast/
    raycast-pipeline.ts             // performRaycast, filterIntersections, enrichIntersections
    raycast-wasm.ts                 // WASM raycast (sync + async)
    raycast-bvh.ts                  // BVH raycast (mevcut FikoRaycastBVH wrapper)
    raycast-webgpu.ts               // WebGPU native raycast

  picking/
    edge-picker.ts                  // Tüm edge secim mantigi (spatial, GPU, CPU)
    point-picker.ts                 // Tüm nokta secim mantigi
    surface-picker.ts               // Yuzey secim ve BREP grup hesabi

  highlight/
    highlight-manager.ts            // Highlight orkestrasyon
    highlight-mesh.ts               // Mesh highlight olusturma + pool
    highlight-line.ts               // Cizgi highlight olusturma (Line2 + fallback)
    highlight-point.ts              // Nokta highlight olusturma
    highlight-material-pool.ts      // Material havuzu (mesh + cizgi + nokta)

  events/
    mouse-handler.ts                // pointerDown, pointerUp, pointerMove, dblClick
    touch-handler.ts                // Touch gesture handling
    context-menu-handler.ts         // Sag menu acma/kapama (overlay)
    keyboard-handler.ts             // [YENİ] Klavye secim (Faz 3)

  sync/
    tree-sync.ts                    // Agac senkronizasyonu
    collab-sync.ts                  // Real-time collaboration

  optimization/
    hover-optimizer.ts              // RAF batch, velocity throttle, mouse prediction
    temporal-coherence.ts           // Edge coherence cache
    cache-manager.ts                // Merkezi cache koordinasyonu
```

**1.2 Uygulama Stratejisi**
- `FikoSecililer` sinifini extend etme yerine **composition** kullan
- Her modül bagimsiz test edilebilir
- Mevcut public API'yi koru - disaridaki `FikoSecililer` referanslari degismemeli
- Asama asama: once `highlight/` cikart, sonra `picking/`, sonra `events/`, en son `raycast/`

**1.3 Oncelik Sirasi**
1. `highlight/` (en cok tekrar, en az bagimlilik)
2. `picking/` (edge/point/surface ayirma)
3. `events/` (UI event handling ayirma)
4. `sync/` (tree + collab)
5. `raycast/` (en cok bagimlilik, en son)
6. `core/` (state, config, strategy - orkestrator ile birlikte)

**Tahmini Is:** 5-7 gün aktif kodlama + 2-3 gün test

---

### FAZ 2: GPU Picking Iyilestirmesi + Edge Optimizasyonu (Kisa-Orta Vadeli - 2-3 Hafta)

**2.1 GPU Picker ID Encoding Upgrade**
- **Mevcut:** 24-bit RGB (R<<16 | G<<8 | B) = 16M obje
- **Hedef:** 32-bit RGBA encoding (A kanali ile sub-object ID)
  - R,G,B = obje ID (24-bit, 16M obje)
  - A = sub-face/edge ID (8-bit, 256 alt eleman)
- **Multi-sample:** 3x3 piksel örnekleme ile kenar piksellerinde dogru ID
- **Sub-pixel accuracy:** Fractional piksel offset ile 0.5px hassasiyet

```typescript
// Yeni encoding:
encodeId(objectId: number, subId: number = 0): THREE.Color {
    return new THREE.Color(
        ((objectId >> 16) & 0xFF) / 255,
        ((objectId >> 8) & 0xFF) / 255,
        (objectId & 0xFF) / 255
    );
    // Alpha: subId / 255 (ayri render target'da)
}

// Multi-sample picking:
pickAtPosition(x: number, y: number): PickResult {
    const samples = [
        this.readPixel(x, y),         // Merkez
        this.readPixel(x-1, y),       // Sol
        this.readPixel(x+1, y),       // Sag
        this.readPixel(x, y-1),       // Üst
        this.readPixel(x, y+1),       // Alt
    ];
    // En sik tekrarlanan ID'yi döndür (majority voting)
    return this.majorityVote(samples);
}
```

**2.2 GPU-Based Edge Proximity**
- Mevcut CPU edge picking'i (findClosestEdgeInObject) GPU compute shader'a tasima
- Edge pozisyonlarini GPU buffer'a yükle, screen-space mesafe hesabini shader'da yap
- Sonucu async okuma (1-frame latency kabul edilebilir)
- **Kazanim:** 500K+ edge'de 10-50x hiz artisi

**2.3 Edge Selection Pipeline Birlestirme**
- Mevcut 3 katmanli sistem (Spatial > WebGPU > CPU) cok karmasik
- Spatial Index her zaman yeterli - diger katmanlar gereksiz karmasiklik
- **Basitlestirme:** Spatial Index + WASM fallback (2 katman yeterli)

**Tahmini Is:** 8-10 gün

---

### FAZ 3: Box/Lasso Selection + BVH Stratejisi (Orta Vadeli - 1 Ay)

**3.1 Box Selection (Dikdörtgen Secim)**
- Canvas üzerinde dikdörtgen cizme UI'i (mouse drag ile)
- WebGPU batch picking shader'i kullan (zaten FikoGPUPicker.ts icinde var!)
- GPU render target'tan bolge icindeki tüm obje ID'lerini cikart
- Unique ID extraction (mevcut WGSL shader)

```typescript
interface BoxSelection {
    startPoint: THREE.Vector2;
    endPoint: THREE.Vector2;
    mode: 'window' | 'crossing';  // AutoCAD benzeri
    // window: tamamen icindekiler, crossing: degendekiler
}
```

**3.2 Lasso Selection (Serbest Cizgi Secim)**
- Canvas üzerinde serbest cizgi cizme
- Poligon icinde/disinda testi (GPU shader ile)
- Point-in-polygon compute shader (even-odd rule)

**3.3 BVH Incremental Update**
- Mevcut: Tam rebuild (blokleyici)
- Hedef: Incremental insert/remove/update
- **Strateji:**
  1. Ilk olusturma: Web Worker'da async BVH build
  2. Obje ekleme: Leaf node insert (O(log n))
  3. Obje silme: Lazy mark-as-deleted + periodic rebalance
  4. Obje transform degisiklik: Subtree refit (AABB update)
  5. Tam rebuild: Sadece sahne %30+ degistiginde, Worker'da

```typescript
class IncrementalBVH {
    insertObject(obj: THREE.Object3D): void;
    removeObject(obj: THREE.Object3D): void;
    updateTransform(obj: THREE.Object3D): void;
    refit(): void;  // AABB'leri güncelle (transform degisikligi sonrasi)
    rebuild(): Promise<void>;  // Worker'da async tam rebuild
}
```

**3.4 Selection Cache & Invalidation**
- Merkezi cache yonetimi (tüm 8+ cache'i koordine et)
- Event-driven invalidation:
  - Sahne degisikligi → BVH refit + spatial index update + geometry cache clear
  - Kamera degisikligi → spatial index update + screen bounds dirty
  - Obje visibility → visibility cache clear + spatial index update
- Cache hit ratio izleme ve otomatik TTL ayarlama

**Tahmini Is:** 15-20 gün

---

### FAZ 4: Multi-Body Selection + Hover Preview (Orta-Uzun Vadeli - 1-2 Ay)

**4.1 Multi-Body Selection (Assembly vs Part)**

CAD assembly'lerinde secim hiyerarsisi:
```
Assembly (tüm montaj)
  └─ Sub-Assembly (alt montaj)
      └─ Part (parca)
          └─ Face (yuzey)
              └─ Edge (kenar)
                  └─ Vertex (nokta)
```

- **Secim Modu Enum:** `Assembly | SubAssembly | Part | Face | Edge | Vertex`
- Secim modu toggle: Kullanici arabiriminde dropdown veya kisa yol tuslari
- Mevcut `FikoGrup` hiyerarşisini kullan (zaten parent chain var)
- Smart auto-detection: Ctrl+tikla = parcaya, tikla = aktif moda göre

```typescript
enum SecimDuzeyi {
    MONTAJ = 'assembly',
    ALT_MONTAJ = 'sub-assembly',
    PARCA = 'part',
    YUZEY = 'face',
    KENAR = 'edge',
    NOKTA = 'vertex'
}

// Mevcut FikoCizimYalin hiyerarsisi ile uyumlu:
// FikoGrup (montaj) → FikoGrup (alt montaj) → FikoCizimYalin (parca) → Mesh/LineSegments (yuzey/kenar)
```

**4.2 Hover Preview Optimizasyonu**
- **Mevcut sorun:** Her hover degisikliginde geometry clone + material create
- **Cozum 1:** Outline post-processing shader (clone yerine)
  - Secili objeyi ayri render target'a ciz
  - Sobel edge detection shader ile disaridan anahat ciz
  - Mesh clone'a GEREK YOK → zero allocation hover
- **Cozum 2:** Stencil buffer highlight
  - Secili objeyi stencil buffer'a yaz
  - Stencil test ile sadece kenar bolgelerini renklendir
- **Predictive hover:** Mouse yönü + hiz tahmini ile sonraki hedefi onceden hesapla
  - Mevcut `_mousePredictionHistory` altyapisi var ama tam entegre degil
  - `FikoPredictiveRaycast` sinifi var ama kullanilmiyor - entegre et

**4.3 Hover Throttling Iyilestirmesi**
- Mevcut: Sabit 16ms throttle + velocity threshold
- Hedef: Adaptif throttle
  - Sahne karmasikligina göre: basit sahne = 8ms, karmasik = 32ms
  - GPU yüküne göre: FPS < 30 → throttle artir
  - Mouse hizina göre: yavas = 8ms (hassas), hizli = 32ms (performans)

**Tahmini Is:** 20-25 gün

---

### FAZ 5: WASM Genisletmesi + Accessibility (Uzun Vadeli - 3+ Ay)

**5.1 WASM'a Tasinacak Algoritmalar**

| Algoritma | Mevcut | Hedef | Kazanim |
|-----------|--------|-------|---------|
| Edge-edge mesafe | CPU (JS) | WASM (Rust) | 20-50x |
| Point-in-polygon | CPU | WASM | 10-30x |
| Frustum culling batch | CPU loop | WASM SIMD | 5-10x |
| BVH traversal | CPU (JS) | WASM | 10-20x |
| Screen-space projection batch | CPU | WASM SIMD | 20-50x |
| Closest point on surface | CPU | WASM | 10-30x |

**Yeni WASM API'ler:**
```rust
// fikoyt-wasm/src/selection/
pub fn batch_frustum_cull(
    bboxes: &[f32],        // N * 6 (min_x, min_y, min_z, max_x, max_y, max_z)
    frustum: &[f32; 24],   // 6 duzlem * 4 katsayi
) -> Vec<u32>;             // Gorunen obje indeksleri

pub fn batch_screen_project(
    positions: &[f32],     // N * 3 world positions
    mvp: &[f32; 16],       // Model-View-Projection matrix
    screen_w: f32,
    screen_h: f32,
) -> Vec<f32>;             // N * 2 screen positions

pub fn point_in_polygon_batch(
    points: &[f32],        // N * 2 screen positions
    polygon: &[f32],       // M * 2 polygon vertices
) -> Vec<u8>;              // 0/1 icinde/disinda

pub fn closest_point_on_surface(
    query: &[f32; 3],
    vertices: &[f32],
    indices: &[u32],
) -> (usize, [f32; 3], f32); // (face_index, closest_point, distance)
```

**5.2 Accessibility**

**5.2.1 Klavye Secim**
- `Tab` / `Shift+Tab`: Sahnedeki objeler arasinda gezinme (BVH sirasiyla)
- `Enter` / `Space`: Aktif objeyi sec
- `Escape`: Secimi temizle
- `Arrow keys`: Komshu yuzey/kenar'a gecis (topological adjacency)
- `Home` / `End`: Ilk/son obje
- `Ctrl+A`: Tümünü sec
- `Delete`: Secili objeyi sil (kullanici izni ile)

**5.2.2 Screen Reader Desteği**
```html
<canvas
  role="application"
  aria-label="3D CAD Goruntüleyici"
  aria-describedby="secim-durumu">
</canvas>

<div id="secim-durumu" aria-live="polite" class="sr-only">
  <!-- Dinamik olarak güncellenir -->
  "Parca seçildi: M8 Civata, Yüzey 3, Silindirik"
</div>
```

**5.2.3 Focus Ring**
- Seçili obje etrafinda yüksek kontrastli focus halkasi
- `prefers-reduced-motion` media query'ye saygi
- Renk körlügü dostu palet (mavi/turuncu yerine desen farki)

**Tahmini Is:** 30-40 gün

---

## 3. Breaking Change Risk Analizi

### Dusuk Risk (Faz 1 - Modülerizasyon)
- **Dis API degismiyor** - `FikoSecililer` sinifi ayni public API'yi sunmaya devam eder
- **Import path'leri korunur** - `FikoSecililer` ayni dosyadan export edilir
- **Ic implementasyon degisikligi** - sadece private metodlar ayri dosyalara tasinir
- **Risk:** Circular dependency olusabilir (dikkatli import yonetimi gerekir)

### Orta Risk (Faz 2-3)
- GPU Picker encoding degisikligi mevcut picking sonuclarini etkileyebilir
- BVH stratejisi degisikligi raycast sirasini etkileyebilir
- Box/lasso selection yeni event handler'lar gerektirir (mevcut pointer handler'larla catisma riski)

### Yüksek Risk (Faz 4-5)
- Multi-body selection mevcut secim davranisini degistirir
- Hover pipeline degisikligi (outline shader) rendering pipeline'i etkiler
- WASM API degisikligi build pipeline'i etkiler (Rust toolchain bagimlilik)
- Accessibility klavye handler'lari mevcut kisa yollarla catisabilir

---

## 4. Performans Hedefleri

| Metrik | Mevcut | Faz 1 | Faz 2 | Faz 3 | Faz 4 | Faz 5 |
|--------|--------|-------|-------|-------|-------|-------|
| Edge hover (100K edge) | ~2-5ms | ~2-5ms | ~0.5-1ms | ~0.5ms | ~0.3ms | ~0.2ms |
| Edge hover (1M edge) | ~8-15ms | ~8-15ms | ~2-4ms | ~1-2ms | ~0.5-1ms | ~0.3ms |
| Click secim | ~1-3ms | ~1-3ms | ~0.5-1ms | ~0.5ms | ~0.3ms | ~0.2ms |
| Box selection (1K obje) | N/A | N/A | N/A | ~2-5ms | ~1-2ms | ~0.5ms |
| Hover allocation/frame | ~3-5 obj | ~1-2 obj | ~0-1 obj | ~0 obj | ~0 obj | ~0 obj |
| Frame budget impact | ~4-8ms | ~3-6ms | ~1-3ms | ~0.5-2ms | ~0.3-1ms | ~0.2-0.5ms |

---

## 5. Bagimliliklarin Etkisi

### Mevcut Bagimliliklar (degismiyor)
- Three.js 0.177.0
- three-mesh-bvh (BVH icin)
- fikoyt-wasm (Rust WASM modülü)
- Angular CDK (overlay, portal)

### Yeni Bagimliliklar (Faz bazli)
- **Faz 2:** Yok (mevcut WebGPU altyapisi yeterli)
- **Faz 3:** Yok (mevcut altyapi)
- **Faz 4:** Yok (Three.js post-processing zaten var)
- **Faz 5:** fikoyt-wasm genisletmesi (Rust tarafinda yeni fonksiyonlar)

---

## 6. Test Stratejisi

### Birim Testleri
- Her yeni modül icin bagimsiz test dosyasi
- Mock Three.js sahneleri ile raycast/picking testi
- Cache invalidation testleri

### Entegrasyon Testleri
- Mevcut secim davranisinin korunmasi (regression)
- Farkli sahne boyutlarinda performans testi (100, 1K, 10K, 100K, 1M obje)
- Multi-browser test (WebGPU, WebGL2, fallback)

### Performans Benchmark
- Otomatik benchmark suite (her faz sonrasi calistir)
- FPS tracking ile hover performansi izleme
- Memory allocation profiling (Chrome DevTools Allocation Timeline)

---

## 7. Oneri ve Sonuc

**Acil baslanmali:** Faz 1 (Modülerizasyon) - diger tüm fazlarin temelidir. 7451 satirlik tek dosya ile ilerlemek sürdürülebilir degil.

**En büyük kazanim:** Faz 2 (GPU Edge Proximity) - CAD kullanicilari icin en sik kullanilan ve en cok performans gerektiren özellik.

**En yüksek ROI:** Faz 3.1 (Box Selection) - temel CAD islevi eksik, kullanici beklentisi yüksek, altyapi zaten var (WebGPU shader hazir).

**Ertelenebilir:** Faz 5.2 (Accessibility) - önemli ama kullanici kitlesi göz önüne alindiginda diger fazlardan sonra yapilabilir.

**FikoDeferredSelection ve FikoHierarchicalSelection** siniflarini Faz 1'de entegre etmeli veya silmeli - kullanilmayan kod bakim yükü olusturuyor.
