actureSize

This commit is contained in:
yscha 2026-01-25 23:39:52 +09:00
parent 30f29113f6
commit d70e2f7346
2 changed files with 17 additions and 4 deletions

View File

@ -5992,6 +5992,19 @@ export const calcLineActualSize = (points, degree = 0) => {
return Big(planeSize).div(theta).round().toNumber() return Big(planeSize).div(theta).round().toNumber()
} }
export const calcLineActualSize2 = (points, degree = 0) => {
const planeSize = calcLinePlaneSize(points)
const xLength = Math.abs(points.x2 - points.x1) * 10
const yLength = Math.abs(points.y2 - points.y1) * 10
const hx = xLength * Math.tan(degree * (Math.PI / 180))
const hy = yLength * Math.tan(degree * (Math.PI / 180))
const actualSize = Math.sqrt(hx ** 2 + planeSize ** 2)
const actualSize2 = Math.sqrt(hy ** 2 + planeSize ** 2)
return actualSize
}
/** /**
* 포인트와 기울기를 기준으로 선의 길이를 구한다. * 포인트와 기울기를 기준으로 선의 길이를 구한다.
* @param lineLength * @param lineLength

View File

@ -1,6 +1,6 @@
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common' import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
import { SkeletonBuilder } from '@/lib/skeletons' import { SkeletonBuilder } from '@/lib/skeletons'
import { calcLineActualSize, calcLinePlaneSize, toGeoJSON } from '@/util/qpolygon-utils' import { calcLineActualSize, calcLineActualSize2, calcLinePlaneSize, toGeoJSON } from '@/util/qpolygon-utils'
import { QLine } from '@/components/fabric/QLine' import { QLine } from '@/components/fabric/QLine'
import { getDegreeByChon } from '@/util/canvas-util' import { getDegreeByChon } from '@/util/canvas-util'
import Big from 'big.js' import Big from 'big.js'
@ -1805,7 +1805,7 @@ function processGableEdge(edgeResult, baseLines, skeletonLines, selectBaseLine,
function isOuterEdge(p1, p2, edges) { function isOuterEdge(p1, p2, edges) {
const tolerance = 0.1; const tolerance = 0.1;
return edges.some(edge => { return edges.some(edge => {
const lineStart = { x: edge.Begin.X, y: edge.Begin.Y }; const lineStart = { x: edge.Begin.X, y: edge.Begin.Y }
const lineEnd = { x: edge.End.X, y: edge.End.Y }; const lineEnd = { x: edge.End.X, y: edge.End.Y };
const forwardMatch = Math.abs(lineStart.x - p1.x) < tolerance && Math.abs(lineStart.y - p1.y) < tolerance && Math.abs(lineEnd.x - p2.x) < tolerance && Math.abs(lineEnd.y - p2.y) < tolerance; const forwardMatch = Math.abs(lineStart.x - p1.x) < tolerance && Math.abs(lineStart.y - p1.y) < tolerance && Math.abs(lineEnd.x - p2.x) < tolerance && Math.abs(lineEnd.y - p2.y) < tolerance;
const backwardMatch = Math.abs(lineStart.x - p2.x) < tolerance && Math.abs(lineStart.y - p2.y) < tolerance && Math.abs(lineEnd.x - p1.x) < tolerance && Math.abs(lineEnd.y - p1.y) < tolerance; const backwardMatch = Math.abs(lineStart.x - p2.x) < tolerance && Math.abs(lineStart.y - p2.y) < tolerance && Math.abs(lineEnd.x - p1.x) < tolerance && Math.abs(lineEnd.y - p1.y) < tolerance;
@ -1848,7 +1848,7 @@ function addRawLine(id, skeletonLines, p1, p2, lineType, color, width, pitch, is
p2, p2,
attributes: { attributes: {
roofId: id, roofId: id,
actualSize: (isDiagonal) ? calcLineActualSize( actualSize: (isDiagonal) ? calcLineActualSize2(
{ {
x1: p1.x, x1: p1.x,
y1: p1.y, y1: p1.y,
@ -1869,7 +1869,7 @@ function addRawLine(id, skeletonLines, p1, p2, lineType, color, width, pitch, is
}; };
skeletonLines.push(newLine); skeletonLines.push(newLine);
//console.log('skeletonLines', skeletonLines); console.log('skeletonLines', skeletonLines);
} }
/** /**