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

Add Mesh2dInsertEdgeFromCoordinates #58

Merged
merged 5 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Deltares.MeshKernel" Version="4.1.0.3027" />
<PackageVersion Include="Deltares.MeshKernel" Version="4.1.0.3049" />
<PackageVersion Include="DHYDRO.SharedConfigurations" Version="1.0.0.27" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageVersion Include="NetTopologySuite" Version="1.15.0" />
Expand Down
20 changes: 20 additions & 0 deletions src/MeshKernelNET/Api/IMeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,26 @@ int Mesh2dInitializeOrthogonalization(int meshKernelId,
/// <returns>Error code</returns>
int Mesh2dInsertEdge(int meshKernelId, int startVertexIndex, int endVertexIndex, ref int edgeIndex);

/// @brief Insert a new mesh2d edge from 2 coordinates. If the coordinates do not match an existing node within a computed search radius, new ones will be created.
/// The search radius is computed internally based on the minimum mesh size and the distance between the two nodes.
/// <param name="meshKernelId"> The id of the mesh state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an explanation that if the coordinate does not (exactly? within some radius?) match a vertex, then a new one is created.

/// <param name="firstNodeX"> The index of the first node to connect
/// <param name="firstNodeY"> The index of the second node to connect
/// <param name="secondNodeX"> The index of the first node to connect
/// <param name="secondNodeY "> The index of the second node to connect
/// <param name="firstNodeIndex"> The index of the first node
/// <param name="secondNodeIndex"> The index of the second node
/// <param name="edgeIndex"> The index of the new generated edge
/// <returns>Error code</returns>
int Mesh2dInsertEdgeFromCoordinates(int meshKernelId,
double firstNodeX,
double firstNodeY,
double secondNodeX,
double secondNodeY,
ref int firstNodeIndex,
ref int secondNodeIndex,
ref int edgeIndex);

/// <summary>
/// Inserts a new vertex
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions src/MeshKernelNET/Api/MeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,26 @@ public int Mesh2dInsertEdge(int meshKernelId, int startVertexIndex, int endVerte
return MeshKernelDll.Mesh2dInsertEdge(meshKernelId, startVertexIndex, endVertexIndex, ref edgeIndex);
}

/// <inheritdoc/>
public int Mesh2dInsertEdgeFromCoordinates(int meshKernelId,
double firstNodeX,
double firstNodeY,
double secondNodeX,
double secondNodeY,
ref int firstNodeIndex,
ref int secondNodeIndex,
ref int edgeIndex)
{
return MeshKernelDll.Mesh2dInsertEdgeFromCoordinates(meshKernelId,
firstNodeX,
firstNodeY,
secondNodeX,
secondNodeY,
ref firstNodeIndex,
ref secondNodeIndex,
ref edgeIndex);
}

public int Mesh2dInsertNode(int meshKernelId, double xCoordinate, double yCoordinate, ref int vertexIndex)
{
return MeshKernelDll.Mesh2dInsertNode(meshKernelId, xCoordinate, yCoordinate, ref vertexIndex);
Expand Down
Loading