Skip to content

Generate binary polygon data in debug layer #42

@kylebarron

Description

@kylebarron

We could easily generate binary polygon data here:

function reprojectorToTriangles(
reprojector: RasterReprojector,
): ParsedTriangle[] {
const positions = reprojector.exactOutputPositions;
const triangles = reprojector.triangles;
const trianglePolygons: ParsedTriangle[] = [];
for (let triangleIdx = 0; triangleIdx < triangles.length / 3; ++triangleIdx) {
const a = triangles[triangleIdx * 3]!;
const b = triangles[triangleIdx * 3 + 1]!;
const c = triangles[triangleIdx * 3 + 2]!;
const coords = [
[positions[a * 2]!, positions[a * 2 + 1]!],
[positions[b * 2]!, positions[b * 2 + 1]!],
[positions[c * 2]!, positions[c * 2 + 1]!],
[positions[a * 2]!, positions[a * 2 + 1]!],
];
trianglePolygons.push({
idx: triangleIdx,
geom: coords,
});
}
return trianglePolygons;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions