Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue with polygon hole rendering #11577

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/engine/Source/Core/PolygonGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ function createGeometryFromPositionsExtruded(
}

let outerRing = hierarchy.outerRing;
let tangentPlane = EllipsoidTangentPlane.fromPoints(outerRing, ellipsoid);
const tangentPlane = EllipsoidTangentPlane.fromPoints(outerRing, ellipsoid);
let positions2D = tangentPlane.projectPointsOntoPlane(
outerRing,
createGeometryFromPositionsExtrudedPositions
Expand Down Expand Up @@ -664,8 +664,6 @@ function createGeometryFromPositionsExtruded(
const holes = hierarchy.holes;
for (i = 0; i < holes.length; i++) {
let hole = holes[i];

tangentPlane = EllipsoidTangentPlane.fromPoints(hole, ellipsoid);
positions2D = tangentPlane.projectPointsOntoPlane(
hole,
createGeometryFromPositionsExtrudedPositions
Expand Down Expand Up @@ -1331,7 +1329,7 @@ function getTangentPlane(rectangle, positions, ellipsoid) {
}

const scratchCartographicCyllindrical = new Cartographic();
function createProjectTo2d(rectangle, ellipsoid) {
function createProjectTo2d(rectangle, outerPositions, ellipsoid) {
return (positions, results) => {
// If the polygon positions span a large enough extent, use a specialized projection
if (rectangle.height >= CesiumMath.PI || rectangle.width >= CesiumMath.PI) {
Expand Down Expand Up @@ -1360,7 +1358,10 @@ function createProjectTo2d(rectangle, ellipsoid) {
}

// Use a local tangent plane for smaller extents
const tangentPlane = EllipsoidTangentPlane.fromPoints(positions, ellipsoid);
const tangentPlane = EllipsoidTangentPlane.fromPoints(
outerPositions,
ellipsoid
);
return tangentPlane.projectPointsOntoPlane(positions, results);
};
}
Expand Down Expand Up @@ -1466,7 +1467,7 @@ PolygonGeometry.createGeometry = function (polygonGeometry) {
const results = PolygonGeometryLibrary.polygonsFromHierarchy(
polygonHierarchy,
hasTextureCoordinates,
createProjectTo2d(rectangle, ellipsoid),
createProjectTo2d(rectangle, outerPositions, ellipsoid),
!perPositionHeight,
ellipsoid,
createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight)
Expand Down