Skip to content

rasterizePolyhedron

This function generates discrete 3D grid points that approximate the surface of a polyhedron.

It returns a unique set of integer coordinates stored in a RowVector3iSet, including corner-based cell expansions around each voxel on the polyhedron’s surface.


Function Signatures

RowVector3iSet rasterizePolyhedron(
    const Eigen::MatrixX3d& polyhedronVertices
);
- Parameters: - polyhedronVertices (Eigen::MatrixX3d): A matrix containing the 3D coordinates of the polyhedron's vertices.

  • Returns: A RowVector3iSet that includes all surface voxels and their eight surrounding corner offsets.

Example Usage

#include "RasterizeTool.h"

int main() {
    Eigen::Matrix<double, 8, 3> polyhedronVertices; 
    polyhedronVertices << 748674.4539194419, 2564739.5306861168, 49,
           748694.4635618832, 2564739.3775614789, 49,
           748694.42507040221, 2564734.3476669602, 49,
           748674.41542796092, 2564734.5007915981, 49,
           748674.4539194419, 2564739.5306861168, 81,
           748694.4635618832, 2564739.3775614789, 81,
           748694.42507040221, 2564734.3476669602, 81,
           748674.41542796092, 2564734.5007915981, 81;

    RowVector3iSet polyhedronPointsSet = rasterizePolyhedron(polyhedronVertices);

    return 0;
}

Below is a visualization of the rasterized polyhedron surface: