- B07_wf4_DesignDetail(8파일+openwebcad) -> B08_DesignDetail로 git mv (이력 보존) - B08_wf5_Quantity -> B07_Quantity (구 수량 백업 zip 보관 폴더) - 파생 문자열 일괄 전환: /b07-cad -> /b08-cad 정적 서빙, CAD 레이어 b07-* -> b08-*, postMessage aislo:b07:* -> aislo:b08:*, 패키지명 aislo-b08-cad, CSS .b08-*, 라우트 키/슬러그(B08_DESIGN_DETAIL/b08-design-detail, B07_QUANTITY/b07-quantity) - 상세설계 워크플로우 stage 4 -> 5 (확정/무효화 전이 3곳), 확정 완료 시 B09로 이동 - WORKFLOW_STEP_ROUTES 순서 재배열: index4=수량(B07), index5=상세설계(B08) - [임시] B08 이동 테스트 버튼 제거, openwebcad dist 재빌드 - 주석 의미 정렬: 수량 인계 주석 B08->B07, 도면 참조 B07->B08 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import {type Arc, Point} from '@flatten-js/core';
|
|
import {describe, expect, it} from 'vitest';
|
|
import {EPSILON} from "../App.consts.ts";
|
|
import {ArcEntity} from './ArcEntity.ts';
|
|
|
|
describe('ArcEntity.distanceTo', () => {
|
|
/**
|
|
* ---X---
|
|
* ----- -----
|
|
* -- --
|
|
*/
|
|
it('distance to point on arc', () => {
|
|
const arc = new ArcEntity('layer1', new Point(0, 0), 1, Math.PI / 4, (3 * Math.PI) / 4, true);
|
|
const point = (arc.getShape() as Arc).pointAtLength(
|
|
(arc.getShape() as Arc).length / 2
|
|
) as Point;
|
|
const distanceInfo = arc.distanceTo(point);
|
|
expect(distanceInfo).toBeDefined();
|
|
if (!distanceInfo) return;
|
|
expect(distanceInfo[0]).to.equal(0);
|
|
});
|
|
|
|
/**
|
|
* ------- X
|
|
* ----- -----
|
|
* -- --
|
|
*/
|
|
it('distance to point outside arc', () => {
|
|
const arc = new ArcEntity('layer1', new Point(0, 0), 1, Math.PI / 4, (3 * Math.PI) / 4, true);
|
|
const point = new Point(2, 2);
|
|
const distanceInfo = arc.distanceTo(point);
|
|
expect(distanceInfo).toBeDefined();
|
|
if (!distanceInfo) return;
|
|
expect(distanceInfo[0]).to.be.closeTo(Math.sqrt(2 * 2 + 2 * 2) - 1, EPSILON);
|
|
});
|
|
|
|
/**
|
|
* -------
|
|
* ----- -----
|
|
* -- --
|
|
* - X -
|
|
*/
|
|
it('distance to point inside arc', () => {
|
|
const arc = new ArcEntity('layer1', new Point(0, 0), 1, Math.PI / 4, (3 * Math.PI) / 4, true);
|
|
const point = new Point(0.5, 0.5);
|
|
const distanceInfo = arc.distanceTo(point);
|
|
expect(distanceInfo).toBeDefined();
|
|
if (!distanceInfo) return;
|
|
expect(distanceInfo[0]).to.be.closeTo(1 - Math.sqrt(0.5 * 0.5 + 0.5 * 0.5), EPSILON);
|
|
});
|
|
|
|
it('should return distance from a point to an arc', () => {
|
|
const arc = new ArcEntity('layer1', new Point(20, 20), 20, 0, 2 * Math.PI * 0.75, true);
|
|
const distanceInfo = arc.distanceTo(new Point(20 - 14.14, 20 + 14.14));
|
|
expect(distanceInfo).toBeDefined();
|
|
if (!distanceInfo) return;
|
|
expect(distanceInfo[0]).toBeLessThan(1);
|
|
});
|
|
});
|