offset default 50으로 변경,
육각 안되는 모양 수정
This commit is contained in:
parent
912e433f6a
commit
f20be4f0af
@ -1091,7 +1091,7 @@ export function useMode() {
|
|||||||
/**
|
/**
|
||||||
*벽 지붕 외곽선 생성 polygon을 입력받아 만들기
|
*벽 지붕 외곽선 생성 polygon을 입력받아 만들기
|
||||||
*/
|
*/
|
||||||
const handleOuterlinesTest2 = (polygon, offset = 71) => {
|
const handleOuterlinesTest2 = (polygon, offset = 50) => {
|
||||||
const offsetPoints = offsetPolygon(polygon.points, offset)
|
const offsetPoints = offsetPolygon(polygon.points, offset)
|
||||||
|
|
||||||
const roof = makePolygon(
|
const roof = makePolygon(
|
||||||
|
|||||||
@ -253,6 +253,10 @@ export const drawHelpLineInHexagon = (polygon, chon) => {
|
|||||||
name: 'hip',
|
name: 'hip',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (line.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
line.startPoint = ridgePoint
|
line.startPoint = ridgePoint
|
||||||
line.endPoint = filteredCenterInterSectionPoints
|
line.endPoint = filteredCenterInterSectionPoints
|
||||||
|
|
||||||
@ -283,54 +287,74 @@ export const drawHelpLineInHexagon = (polygon, chon) => {
|
|||||||
const startPoint = remainingPoints.shift()
|
const startPoint = remainingPoints.shift()
|
||||||
const endPoint = remainingPoints.shift()
|
const endPoint = remainingPoints.shift()
|
||||||
|
|
||||||
const line = new QLine([startPoint.x, startPoint.y, endPoint.x, endPoint.y], {
|
if (!(startPoint.x === endPoint.x && startPoint.y === endPoint.y)) {
|
||||||
stroke: 'purple',
|
const line = new QLine([startPoint.x, startPoint.y, endPoint.x, endPoint.y], {
|
||||||
fontSize: polygon.fontSize,
|
stroke: 'purple',
|
||||||
name: 'connectRidge',
|
fontSize: polygon.fontSize,
|
||||||
})
|
name: 'connectRidge',
|
||||||
|
})
|
||||||
|
|
||||||
line.startPoint = startPoint
|
line.startPoint = startPoint
|
||||||
line.endPoint = endPoint
|
line.endPoint = endPoint
|
||||||
|
|
||||||
polygon.connectRidges.push(line)
|
polygon.connectRidges.push(line)
|
||||||
|
|
||||||
polygon.points.forEach((point) => {
|
polygon.points.forEach((point) => {
|
||||||
const degree = calculateAngle(startPoint, point)
|
const degree = calculateAngle(startPoint, point)
|
||||||
|
|
||||||
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
|
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
|
||||||
const line = new QLine([startPoint.x, startPoint.y, point.x, point.y], {
|
const line = new QLine([startPoint.x, startPoint.y, point.x, point.y], {
|
||||||
stroke: 'purple',
|
stroke: 'purple',
|
||||||
fontSize: polygon.fontSize,
|
fontSize: polygon.fontSize,
|
||||||
name: 'hip',
|
name: 'hip',
|
||||||
})
|
})
|
||||||
|
|
||||||
line.startPoint = startPoint
|
line.startPoint = startPoint
|
||||||
line.endPoint = point
|
line.endPoint = point
|
||||||
|
|
||||||
polygon.hips.push(line)
|
polygon.hips.push(line)
|
||||||
polygon.canvas.add(line)
|
polygon.canvas.add(line)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
polygon.points.forEach((point) => {
|
polygon.points.forEach((point) => {
|
||||||
const degree = calculateAngle(endPoint, point)
|
const degree = calculateAngle(endPoint, point)
|
||||||
|
|
||||||
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
|
if (Math.abs(degree) === 45 || Math.abs(degree) === 135) {
|
||||||
const line = new QLine([endPoint.x, endPoint.y, point.x, point.y], {
|
const line = new QLine([endPoint.x, endPoint.y, point.x, point.y], {
|
||||||
stroke: 'purple',
|
stroke: 'purple',
|
||||||
fontSize: polygon.fontSize,
|
fontSize: polygon.fontSize,
|
||||||
name: 'hip',
|
name: 'hip',
|
||||||
})
|
})
|
||||||
|
|
||||||
line.startPoint = endPoint
|
line.startPoint = endPoint
|
||||||
line.endPoint = point
|
line.endPoint = point
|
||||||
|
|
||||||
polygon.hips.push(line)
|
polygon.hips.push(line)
|
||||||
polygon.canvas.add(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]
|
hips = [...hips, ...connectRidges]
|
||||||
polygon.setViewLengthText(false)
|
|
||||||
|
|
||||||
polygonLines.forEach((line) => {
|
polygonLines.forEach((line, index) => {
|
||||||
let ridge
|
let ridge
|
||||||
|
|
||||||
const startPoint = line.startPoint
|
const startPoint = line.startPoint
|
||||||
@ -522,15 +545,31 @@ export const dividePolygon = (polygon) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let connectedRidge = ridges.find(
|
let connectedRidge
|
||||||
(ridge) =>
|
const restRidgeConnection = connectRidges[0]
|
||||||
(ridge.startPoint.x === startHip.endPoint.x && ridge.startPoint.y === startHip.endPoint.y) ||
|
|
||||||
(ridge.endPoint.x === startHip.endPoint.x && ridge.endPoint.y === startHip.endPoint.y),
|
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 hipStartPoint = startHip.endPoint
|
||||||
const hipEndPoint = endHip.endPoint
|
const hipEndPoint = endHip.endPoint
|
||||||
const restRidgeConnection = connectRidges[0]
|
|
||||||
|
|
||||||
if (connectedRidge.startPoint.x === hipStartPoint.x && connectedRidge.startPoint.y === hipStartPoint.y) {
|
if (connectedRidge.startPoint.x === hipStartPoint.x && connectedRidge.startPoint.y === hipStartPoint.y) {
|
||||||
if (connectedRidge.endPoint.x === hipEndPoint.x && connectedRidge.endPoint.y === hipEndPoint.y) {
|
if (connectedRidge.endPoint.x === hipEndPoint.x && connectedRidge.endPoint.y === hipEndPoint.y) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user