| 863 | } |
| 864 | |
| 865 | void dispatch_planar_section_impl( |
| 866 | McContext context, |
| 867 | McFlags flags, |
| 868 | const McVoid* pSrcMeshVertices, |
| 869 | const uint32_t* pSrcMeshFaceIndices, |
| 870 | const uint32_t* pSrcMeshFaceSizes, |
| 871 | uint32_t numSrcMeshVertices, |
| 872 | uint32_t numSrcMeshFaces, |
| 873 | const McDouble* pNormalVector, |
| 874 | const McDouble sectionOffset, |
| 875 | uint32_t numEventsInWaitlist, |
| 876 | const McEvent* pEventWaitList, |
| 877 | McEvent* pEvent) noexcept(false) |
| 878 | { |
| 879 | std::shared_ptr<context_t> context_ptr = g_contexts.find_first_if([=](const std::shared_ptr<context_t> cptr) { return cptr->m_user_handle == context; }); |
| 880 | |
| 881 | if (context_ptr == nullptr) { |
| 882 | throw std::invalid_argument("invalid context"); |
| 883 | } |
| 884 | |
| 885 | std::weak_ptr<context_t> context_weak_ptr(context_ptr); |
| 886 | |
| 887 | // submit the dispatch call to be executed asynchronously and return the future |
| 888 | // object that will be waited on as an event |
| 889 | const McEvent event_handle = context_ptr->prepare_and_submit_API_task( |
| 890 | MC_COMMAND_DISPATCH, numEventsInWaitlist, pEventWaitList, |
| 891 | [=]() { |
| 892 | if (!context_weak_ptr.expired()) { |
| 893 | std::shared_ptr<context_t> context = context_weak_ptr.lock(); |
| 894 | if (context) { |
| 895 | std::vector<McChar> supertriangle_vertices; |
| 896 | std::vector<McIndex> supertriangle_indices; |
| 897 | |
| 898 | generate_supertriangle_from_mesh_vertices( |
| 899 | supertriangle_vertices, |
| 900 | supertriangle_indices, |
| 901 | flags, |
| 902 | pSrcMeshVertices, |
| 903 | numSrcMeshVertices, |
| 904 | pNormalVector, |
| 905 | sectionOffset, |
| 906 | context->get_general_position_enforcement_constant()); |
| 907 | |
| 908 | preproc( |
| 909 | context, |
| 910 | flags, |
| 911 | pSrcMeshVertices, |
| 912 | pSrcMeshFaceIndices, |
| 913 | pSrcMeshFaceSizes, |
| 914 | numSrcMeshVertices, |
| 915 | numSrcMeshFaces, |
| 916 | (McVoid*)supertriangle_vertices.data(), |
| 917 | (McIndex*)&supertriangle_indices[0], |
| 918 | nullptr, |
| 919 | 3, |
| 920 | 1); |
| 921 | } |
| 922 | } |
no test coverage detected