offset default 50으로 변경,

육각 안되는 모양 수정
This commit is contained in:
hyojun.choi 2024-08-02 17:05:15 +09:00
parent 912e433f6a
commit f20be4f0af
2 changed files with 85 additions and 46 deletions

View File

@ -1091,7 +1091,7 @@ export function useMode() {
/**
* 지붕 외곽선 생성 polygon을 입력받아 만들기
*/
const handleOuterlinesTest2 = (polygon, offset = 71) => {
const handleOuterlinesTest2 = (polygon, offset = 50) => {
const offsetPoints = offsetPolygon(polygon.points, offset)
const roof = makePolygon(

View File

@ -253,6 +253,10 @@ export const drawHelpLineInHexagon = (polygon, chon) => {
name: 'hip',
})
if (line.length === 0) {
return
}
line.startPoint = ridgePoint
line.endPoint = filteredCenterInterSectionPoints
@ -283,54 +287,74 @@ export const drawHelpLineInHexagon = (polygon, chon) => {
const startPoint = remainingPoints.shift()
const endPoint = remainingPoints.shift()
const line = new QLine([startPoint.x, startPoint.y, endPoint.x, endPoint.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'connectRidge',
})
if (!(startPoint.x === endPoint.x && startPoint.y === endPoint.y)) {
const line = new QLine([startPoint.x, startPoint.y, endPoint.x, endPoint.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'connectRidge',
})
line.startPoint = startPoint
line.endPoint = endPoint
line.startPoint = startPoint
line.endPoint = endPoint
polygon.connectRidges.push(line)
polygon.connectRidges.push(line)
polygon.points.forEach((point) => {
const degree = calculateAngle(startPoint, point)
polygon.points.forEach((point) => {
const degree = calculateAngle(startPoint, point)
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
const line = new QLine([startPoint.x, startPoint.y, point.x, point.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'hip',
})
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
const line = new QLine([startPoint.x, startPoint.y, point.x, point.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'hip',
})
line.startPoint = startPoint
line.endPoint = point
line.startPoint = startPoint
line.endPoint = point
polygon.hips.push(line)
polygon.canvas.add(line)
}
})
polygon.hips.push(line)
polygon.canvas.add(line)
}
})
polygon.points.forEach((point) => {
const degree = calculateAngle(endPoint, point)
polygon.points.forEach((point) => {
const degree = calculateAngle(endPoint, point)
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
const line = new QLine([endPoint.x, endPoint.y, point.x, point.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'hip',
})
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
const line = new QLine([endPoint.x, endPoint.y, point.x, point.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'hip',
})
line.startPoint = endPoint
line.endPoint = point
line.startPoint = endPoint
line.endPoint = point
polygon.hips.push(line)
polygon.canvas.add(line)
}
})
polygon.hips.push(line)
polygon.canvas.add(line)
}
})
polygon.canvas.add(line)
polygon.canvas.add(line)
} else {
polygon.points.forEach((point) => {
const degree = calculateAngle(startPoint, point)
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
const line = new QLine([startPoint.x, startPoint.y, point.x, point.y], {
stroke: 'purple',
fontSize: polygon.fontSize,
name: 'hip',
})
line.startPoint = startPoint
line.endPoint = point
polygon.hips.push(line)
polygon.canvas.add(line)
}
})
}
}
}
@ -485,9 +509,8 @@ export const dividePolygon = (polygon) => {
}
})
hips = [...hips, ...connectRidges]
polygon.setViewLengthText(false)
polygonLines.forEach((line) => {
polygonLines.forEach((line, index) => {
let ridge
const startPoint = line.startPoint
@ -522,15 +545,31 @@ export const dividePolygon = (polygon) => {
return
}
let connectedRidge = ridges.find(
(ridge) =>
(ridge.startPoint.x === startHip.endPoint.x && ridge.startPoint.y === startHip.endPoint.y) ||
(ridge.endPoint.x === startHip.endPoint.x && ridge.endPoint.y === startHip.endPoint.y),
)
let connectedRidge
const restRidgeConnection = connectRidges[0]
if (!restRidgeConnection || restRidgeConnection.length === 0) {
connectedRidge = ridges.find(
(ridge) =>
(ridge.startPoint.x === startHip.endPoint.x &&
ridge.startPoint.y === startHip.endPoint.y &&
ridge.endPoint.x === endHip.endPoint.x &&
ridge.endPoint.y === endHip.endPoint.y) ||
(ridge.startPoint.x === endHip.endPoint.x &&
ridge.startPoint.y === endHip.endPoint.y &&
ridge.endPoint.x === startHip.endPoint.x &&
ridge.endPoint.y === startHip.endPoint.y),
)
} else {
connectedRidge = ridges.find(
(ridge) =>
(ridge.startPoint.x === startHip.endPoint.x && ridge.startPoint.y === startHip.endPoint.y) ||
(ridge.endPoint.x === startHip.endPoint.x && ridge.endPoint.y === startHip.endPoint.y),
)
}
const hipStartPoint = startHip.endPoint
const hipEndPoint = endHip.endPoint
const restRidgeConnection = connectRidges[0]
if (connectedRidge.startPoint.x === hipStartPoint.x && connectedRidge.startPoint.y === hipStartPoint.y) {
if (connectedRidge.endPoint.x === hipEndPoint.x && connectedRidge.endPoint.y === hipEndPoint.y) {