Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to create a 2D Surface mesh using 2D Splines #126

Open
AndreAhmed opened this issue Dec 9, 2022 · 0 comments
Open

Trying to create a 2D Surface mesh using 2D Splines #126

AndreAhmed opened this issue Dec 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@AndreAhmed
Copy link

I'm trying to generate a 2D mesh using 2D splines, but I get the following output:

image

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

@AndreAhmed AndreAhmed added the bug Something isn't working label Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant