skeleton - 모든 선분과의 기하학적 교차점을 탐색하여 가장 가까운 유효한 점을 찾는3 로그추가
This commit is contained in:
parent
633f417548
commit
c8421d1253
@ -149,7 +149,6 @@ const createInnerLinesFromSkeleton = (skeleton, baseLines, roof, canvas, textMod
|
|||||||
|
|
||||||
|
|
||||||
// 3. 최종적으로 정리된 스켈레톤 선들을 QLine 객체로 변환하여 캔버스에 추가합니다.
|
// 3. 최종적으로 정리된 스켈레톤 선들을 QLine 객체로 변환하여 캔버스에 추가합니다.
|
||||||
const innerLines = [];
|
|
||||||
skeletonLines.forEach(line => {
|
skeletonLines.forEach(line => {
|
||||||
const { p1, p2, attributes, lineStyle } = line;
|
const { p1, p2, attributes, lineStyle } = line;
|
||||||
const innerLine = new QLine([p1.x, p1.y, p2.x, p2.y], {
|
const innerLine = new QLine([p1.x, p1.y, p2.x, p2.y], {
|
||||||
@ -560,6 +559,7 @@ export const findDisconnectedSkeletonLines = (skeletonLines, baseLines) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 연장된 스켈레톤 라인들이 서로 교차하는 경우, 교차점에서 잘라냅니다.
|
* 연장된 스켈레톤 라인들이 서로 교차하는 경우, 교차점에서 잘라냅니다.
|
||||||
|
* 이 함수는 skeletonLines 배열의 요소를 직접 수정하여 접점에서 선이 멈추도록 합니다.
|
||||||
* @param {Array} skeletonLines - (수정될) 전체 스켈레톤 라인 배열
|
* @param {Array} skeletonLines - (수정될) 전체 스켈레톤 라인 배열
|
||||||
* @param {Array} disconnectedLines - 연장 정보가 담긴 배열
|
* @param {Array} disconnectedLines - 연장 정보가 담긴 배열
|
||||||
*/
|
*/
|
||||||
@ -570,7 +570,8 @@ const trimIntersectingExtendedLines = (skeletonLines, disconnectedLines) => {
|
|||||||
const dLine1 = disconnectedLines[i];
|
const dLine1 = disconnectedLines[i];
|
||||||
const dLine2 = disconnectedLines[j];
|
const dLine2 = disconnectedLines[j];
|
||||||
|
|
||||||
// 연장된 후의 선분 객체를 가져옴
|
// skeletonLines 배열에서 직접 참조를 가져오므로, 여기서 line1, line2를 수정하면
|
||||||
|
// 원본 skeletonLines 배열의 내용이 변경됩니다.
|
||||||
const line1 = skeletonLines[dLine1.index];
|
const line1 = skeletonLines[dLine1.index];
|
||||||
const line2 = skeletonLines[dLine2.index];
|
const line2 = skeletonLines[dLine2.index];
|
||||||
|
|
||||||
@ -580,7 +581,8 @@ const trimIntersectingExtendedLines = (skeletonLines, disconnectedLines) => {
|
|||||||
const intersection = getLineIntersection(line1.p1, line1.p2, line2.p1, line2.p2);
|
const intersection = getLineIntersection(line1.p1, line1.p2, line2.p1, line2.p2);
|
||||||
|
|
||||||
if (intersection) {
|
if (intersection) {
|
||||||
// 교차점이 있다면, 각 선의 연장된 끝점을 교차점으로 업데이트
|
// 교차점이 있다면, 각 선의 연장된 끝점을 교차점으로 업데이트합니다.
|
||||||
|
// 이 변경 사항은 skeletonLines 배열에 바로 반영됩니다.
|
||||||
if (!dLine1.p1Connected) { // p1이 연장된 점이었으면
|
if (!dLine1.p1Connected) { // p1이 연장된 점이었으면
|
||||||
line1.p1 = intersection;
|
line1.p1 = intersection;
|
||||||
} else { // p2가 연장된 점이었으면
|
} else { // p2가 연장된 점이었으면
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user