Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat: SnapCAD Studio'yu YakHub deposuna taşı
- DWG/DXF içe aktarma ve .skf yeniden açma düzeltmeleri - YakNet Bulut eşitlemede boş/eski kopya koruması ve yerel-only proje bildirimi - Panelden içe aktarma duyuruları ve erişilebilir Türkçe hata mesajları - AGPL-3.0 lisansı, README ve YakHub bağlantıları
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { offsetPolygon, polygonSignedArea, offsetSketchProfile, type Point2D } from "@/lib/offsetKernel";
|
||||
|
||||
describe("Offset Tool Kernel (Ofset Aracı & Duvar Kalınlığı)", () => {
|
||||
it("calculates signed area of a rectangle correctly", () => {
|
||||
// 100 x 50 rectangle (CCW)
|
||||
const rect: Point2D[] = [
|
||||
{ x: 0, z: 0 },
|
||||
{ x: 100, z: 0 },
|
||||
{ x: 100, z: 50 },
|
||||
{ x: 0, z: 50 },
|
||||
];
|
||||
const area = polygonSignedArea(rect);
|
||||
expect(area).toBe(5000);
|
||||
});
|
||||
|
||||
it("offsets a rectangle outward by 10mm", () => {
|
||||
const rect: Point2D[] = [
|
||||
{ x: 0, z: 0 },
|
||||
{ x: 100, z: 0 },
|
||||
{ x: 100, z: 50 },
|
||||
{ x: 0, z: 50 },
|
||||
];
|
||||
const outset = offsetPolygon(rect, 10);
|
||||
expect(outset.length).toBe(4);
|
||||
// Outward expands by 10 on all sides: width becomes 120, height becomes 70
|
||||
const minX = Math.min(...outset.map((p) => p.x));
|
||||
const maxX = Math.max(...outset.map((p) => p.x));
|
||||
const minZ = Math.min(...outset.map((p) => p.z));
|
||||
const maxZ = Math.max(...outset.map((p) => p.z));
|
||||
|
||||
expect(Math.round(maxX - minX)).toBe(120);
|
||||
expect(Math.round(maxZ - minZ)).toBe(70);
|
||||
});
|
||||
|
||||
it("offsets a room perimeter inward by 15mm to generate interior wall", () => {
|
||||
const room: Point2D[] = [
|
||||
{ x: 0, z: 0 },
|
||||
{ x: 200, z: 0 },
|
||||
{ x: 200, z: 150 },
|
||||
{ x: 0, z: 150 },
|
||||
];
|
||||
// Inset by -15mm
|
||||
const inset = offsetPolygon(room, -15);
|
||||
expect(inset.length).toBe(4);
|
||||
const minX = Math.min(...inset.map((p) => p.x));
|
||||
const maxX = Math.max(...inset.map((p) => p.x));
|
||||
const minZ = Math.min(...inset.map((p) => p.z));
|
||||
const maxZ = Math.max(...inset.map((p) => p.z));
|
||||
|
||||
expect(Math.round(maxX - minX)).toBe(170); // 200 - 30 = 170
|
||||
expect(Math.round(maxZ - minZ)).toBe(120); // 150 - 30 = 120
|
||||
});
|
||||
|
||||
it("offsets a SketchProfile into a dual-walled footprint", () => {
|
||||
const initialProfile = {
|
||||
points: [
|
||||
{ id: "p1", x: 0, z: 0 },
|
||||
{ id: "p2", x: 100, z: 0 },
|
||||
{ id: "p3", x: 100, z: 80 },
|
||||
{ id: "p4", x: 0, z: 80 },
|
||||
],
|
||||
segments: [
|
||||
{ id: "s1", startId: "p1", endId: "p2" },
|
||||
{ id: "s2", startId: "p2", endId: "p3" },
|
||||
{ id: "s3", startId: "p3", endId: "p4" },
|
||||
{ id: "s4", startId: "p4", endId: "p1" },
|
||||
],
|
||||
};
|
||||
const walledProfile = offsetSketchProfile(initialProfile, -10);
|
||||
expect(walledProfile.points.length).toBe(8); // 4 outer + 4 inner wall points
|
||||
expect(walledProfile.segments.length).toBe(8); // 4 outer + 4 inner segments
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user