Skip to content

Commit

Permalink
Disable roof geometry validation
Browse files Browse the repository at this point in the history
  • Loading branch information
StrandedKitty committed Sep 3, 2023
1 parent 42faf05 commit 7ff4e94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/lib/math/AABB2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class AABB2D extends AABB<Vec2> {
if (this.isEmpty) {
this.min.set(aabb.min.x, aabb.min.y);
this.max.set(aabb.max.x, aabb.max.y);
this.isEmpty = false;
}

this.min.x = Math.min(this.min.x, aabb.min.x);
Expand Down Expand Up @@ -72,4 +73,4 @@ export default class AABB2D extends AABB<Vec2> {
(this.max.y + this.min.y) / 2
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export default class Tile3DExtrudedGeometryBuilder {
private buildRoofSafe(builder: RoofBuilder, params: RoofParams): RoofGeometry {
let roof = builder.build(params);

if (roof === null || !RoofGeometryValidator.validate(roof, params.multipolygon)) {
if (roof === null/* || !RoofGeometryValidator.validate(roof, params.multipolygon)*/) {
roof = new FlatRoofBuilder().build(params);
}

Expand Down Expand Up @@ -426,4 +426,4 @@ export default class Tile3DExtrudedGeometryBuilder {
positionBuffer: new Float32Array(this.terrainMaskPositions)
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import Vec2 from "~/lib/math/Vec2";

export default class RoofGeometryValidator {
public static validate(roof: RoofGeometry, multipolygon: Tile3DMultipolygon): boolean {
return true;
if (roof.canExtendOutsideFootprint) {
return true;
}

const aabb = multipolygon.getAABB();
const padding = new Vec2(0.01);
aabb.includePoint(Vec2.sub(aabb.min, padding));
aabb.includePoint(Vec2.add(aabb.max, padding));

for (let i = 0; i < roof.position.length; i += 3) {
const point = new Vec2(roof.position[i], roof.position[i + 2]);
Expand Down

0 comments on commit 7ff4e94

Please sign in to comment.