How to describe a surface with an inner hole?

Hi,
I tried to create .SCS file by following the sample code in “authoring_samples”, but in this sample project I didn’t find any example that shows how to create a surface with a inner hole.

Sample code is as below:

static void
AddSquareFace(
    SC::Store::Mesh& mesh,
    uint32_t const*  point_indices,
    uint32_t         normal_index,
    uint32_t         rgba_index)
{
    mesh.face_elements.emplace_back();
    SC::Store::MeshElement& face = mesh.face_elements.back();

    // Add first face triangle
    for (size_t i = 0; i < 3; ++i) {
        face.indices.push_back(point_indices[i]);
        face.indices.push_back(normal_index);
        face.indices.push_back(rgba_index);
    }

    // Add second face triangle
    for (size_t i = 0; i < 3; ++i) {
        face.indices.push_back(point_indices[(i + 2) % 4]);
        face.indices.push_back(normal_index);
        face.indices.push_back(rgba_index);
    }

    // Add face edges
    for (size_t i = 0; i < 4; ++i) {
        mesh.polyline_elements.emplace_back();
        SC::Store::MeshElement& edges = mesh.polyline_elements.back();
        edges.indices.push_back(point_indices[i % 4]);
        edges.indices.push_back(rgba_index);
        edges.indices.push_back(point_indices[(i + 1) % 4]);
        edges.indices.push_back(rgba_index);
        // Set bits on edges so that they are selectable for measurement
        mesh.polyline_elements_bits.push_back(SC::Store::SelectionBitsEdgeHasMeasurementData);
    }
    // Set bits on faces so that they are selectable for measurement
    mesh.face_elements_bits.push_back(
        SC::Store::SelectionBitsFaceHasMeasurementData | SC::Store::SelectionBitsFacePlanar);
}

If I want to add an inner hole into this square face, what should I do?

Thanks.

I found this:

does that mean if I want to create a surface with hole, I should triangulate the face by calling
SC::Store::Utils::TriangulateFace first.

Hello @820110017,

Yes, please review the section Faces with Holes in the referenced article.

Thanks,
Tino

Hi,

Thanks, it’s very helpful.

Further more, what if the surface is not a polygon but curved surface?

How is the non-polygonal surface defined? Is the surface a Bezier or NURBS?

Hi,
I recognized that I misunderstood the input params of SC::Store::Utils::TriangulateFace, the interface supports polygonal surface, even the surface is not planar.
Thanks for answering.