Deltares / Deltares/MeshKernel
Trying to create a 2D Surface mesh using 2D Splines
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 31
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to generate a 2D mesh using 2D splines, but I get the following output:

I use the following code
splines->AddSpline(sp1, 0, sp1.size());
splines->AddSpline(sp2, 0, sp2.size());
splines->AddSpline(sp3, 0, sp3.size());
splines->AddSpline(sp4, 0, sp4.size());
splines->AddSpline(sp5, 0, sp5.size());
splines->AddSpline(sp6, 0, sp6.size());
splines->AddSpline(sp7, 0, sp7.size());
meshkernelapi::CurvilinearParameters curvilinearParameters;
meshkernelapi::SplinesToCurvilinearParameters splinesToCurvilinearParameters;
splinesToCurvilinearParameters.aspect_ratio = 0.1;
splinesToCurvilinearParameters.aspect_ratio_grow_factor = 1.1;
splinesToCurvilinearParameters.average_width = 10000.0;
splinesToCurvilinearParameters.nodes_on_top_of_each_other_tolerance = 1e-4;
splinesToCurvilinearParameters.min_cosine_crossing_angles = 0.95;
splinesToCurvilinearParameters.check_front_collisions = false;
splinesToCurvilinearParameters.curvature_adapted_grid_spacing = true;
splinesToCurvilinearParameters.remove_skinny_triangles = 0;
curvilinearParameters.m_refinement = 20;
curvilinearParameters.n_refinement = 40;
// create the algorithm
meshkernel::CurvilinearGridFromSplines curvilinearGridFromSplines(splines, curvilinearParameters, splinesToCurvilinearParameters);
// compute
const auto curviGrid = curvilinearGridFromSplines.Compute();
meshkernel::Mesh2D mesh(curviGrid.m_edges, curviGrid.m_nodes, meshkernel::Projection::cartesian);
points_voronoi = vtkSmartPointer<vtkPoints>::New();
for (auto& v : mesh.m_nodes)
{
points_mesh.push_back({ v.x, v.y });
}
for (int i = 0; i < mesh.m_facesNodes.size(); i++)
{
for (int j = 0; j < 4; j++)
{
indices_mesh.push_back(mesh.m_facesNodes[i][j]);
}
}
and the Splines are attached here:
L1.txt
L2.txt
L3.txt
L4.txt
L5.txt
L6.txt
L7.txt
L8.txt
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with meshkernel::CurvilinearGridFromSplines and its Compute() call, using the attached L1.txt through L8.txt spline inputs and the parameters shown in the issue. Reproduce the generated mesh and compare it with the intended 2D surface, then establish the expected output and identify whether the problem is in the spline inputs, parameters, or mesh conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100