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
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import manifoldModule from "manifold-3d";
|
|
import { findSketchOutlineIntersection } from "@/lib/sketchProfileValidation";
|
|
|
|
describe("sketch profile validation", () => {
|
|
it("rejects a bow-tie profile whose non-adjacent edges cross", () => {
|
|
expect(findSketchOutlineIntersection([[
|
|
{ x: 0, y: 10 },
|
|
{ x: 37, y: 10 },
|
|
{ x: 3, y: 0 },
|
|
{ x: 34, y: 0 },
|
|
]])).toEqual({ outlineA: 0, edgeA: 1, outlineB: 0, edgeB: 3 });
|
|
});
|
|
|
|
it("accepts a normal simple profile", () => {
|
|
expect(findSketchOutlineIntersection([[
|
|
{ x: 0, y: 10 },
|
|
{ x: 37, y: 10 },
|
|
{ x: 34, y: 0 },
|
|
{ x: 3, y: 0 },
|
|
]])).toBeNull();
|
|
});
|
|
|
|
it("allows disjoint and nested profiles", () => {
|
|
expect(findSketchOutlineIntersection([
|
|
[{ x: 0, y: 0 }, { x: 20, y: 0 }, { x: 20, y: 20 }, { x: 0, y: 20 }],
|
|
[{ x: 5, y: 5 }, { x: 15, y: 5 }, { x: 15, y: 15 }, { x: 5, y: 15 }],
|
|
[{ x: 30, y: 0 }, { x: 40, y: 0 }, { x: 40, y: 10 }, { x: 30, y: 10 }],
|
|
])).toBeNull();
|
|
});
|
|
|
|
it("rejects closed profiles that cross or touch each other", () => {
|
|
expect(findSketchOutlineIntersection([
|
|
[{ x: 0, y: 0 }, { x: 10, y: 0 }, { x: 10, y: 10 }, { x: 0, y: 10 }],
|
|
[{ x: 5, y: -5 }, { x: 15, y: -5 }, { x: 15, y: 5 }, { x: 5, y: 5 }],
|
|
])).not.toBeNull();
|
|
});
|
|
|
|
it("resolves a bow-tie into valid even-odd regions that can be extruded", async () => {
|
|
const runtime = await manifoldModule();
|
|
runtime.setup();
|
|
const section = new runtime.CrossSection([[
|
|
[-18.5, -5],
|
|
[18.5, -5],
|
|
[-15.5, 5],
|
|
[15.5, 5],
|
|
]], "EvenOdd");
|
|
const solid = section.extrude(10);
|
|
try {
|
|
expect(section.toPolygons()).toHaveLength(2);
|
|
expect(solid.status()).toBe("NoError");
|
|
expect(solid.numTri()).toBeGreaterThan(0);
|
|
} finally {
|
|
solid.delete();
|
|
section.delete();
|
|
}
|
|
});
|
|
});
|