fix holes null
This commit is contained in:
@@ -468,7 +468,8 @@ export class SpatialGridManager {
|
|||||||
if (slab.polygon.length >= 3 && pointInPolygon(x, z, slab.polygon)) {
|
if (slab.polygon.length >= 3 && pointInPolygon(x, z, slab.polygon)) {
|
||||||
// Check if point is in any hole
|
// Check if point is in any hole
|
||||||
let inHole = false
|
let inHole = false
|
||||||
for (const hole of slab.holes) {
|
const holes = slab.holes || []
|
||||||
|
for (const hole of holes) {
|
||||||
if (hole.length >= 3 && pointInPolygon(x, z, hole)) {
|
if (hole.length >= 3 && pointInPolygon(x, z, hole)) {
|
||||||
inHole = true
|
inHole = true
|
||||||
break
|
break
|
||||||
@@ -507,7 +508,8 @@ export class SpatialGridManager {
|
|||||||
// We consider it entirely in a hole if the item center is in the hole
|
// We consider it entirely in a hole if the item center is in the hole
|
||||||
let inHole = false
|
let inHole = false
|
||||||
const [cx, , cz] = position
|
const [cx, , cz] = position
|
||||||
for (const hole of slab.holes) {
|
const holes = slab.holes || []
|
||||||
|
for (const hole of holes) {
|
||||||
if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) {
|
if (hole.length >= 3 && pointInPolygon(cx, cz, hole)) {
|
||||||
inHole = true
|
inHole = true
|
||||||
break
|
break
|
||||||
@@ -546,7 +548,8 @@ export class SpatialGridManager {
|
|||||||
let inHole = false
|
let inHole = false
|
||||||
const midX = (start[0] + end[0]) / 2
|
const midX = (start[0] + end[0]) / 2
|
||||||
const midZ = (start[1] + end[1]) / 2
|
const midZ = (start[1] + end[1]) / 2
|
||||||
for (const hole of slab.holes) {
|
const holes = slab.holes || []
|
||||||
|
for (const hole of holes) {
|
||||||
if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) {
|
if (hole.length >= 3 && pointInPolygon(midX, midZ, hole)) {
|
||||||
inHole = true
|
inHole = true
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ export function generateSlabGeometry(slabNode: SlabNode): THREE.BufferGeometry {
|
|||||||
shape.closePath()
|
shape.closePath()
|
||||||
|
|
||||||
// Add holes to the shape
|
// Add holes to the shape
|
||||||
for (const holePolygon of slabNode.holes) {
|
const holes = slabNode.holes || []
|
||||||
|
for (const holePolygon of holes) {
|
||||||
if (holePolygon.length < 3) continue
|
if (holePolygon.length < 3) continue
|
||||||
|
|
||||||
const holePath = new THREE.Path()
|
const holePath = new THREE.Path()
|
||||||
|
|||||||
Reference in New Issue
Block a user