Other

DelaunayTriangulation.distance_to_polygonFunction
distance_to_polygon(q, points, boundary_nodes) -> Number

Given a query point q and a polygon defined by (points, boundary_nodes), returns the signed distance from q to the polygon. The boundary_nodes must match the specification in the documentation and in check_args.

See also dist.

source
DelaunayTriangulation.number_typeFunction
number_type(x) -> DataType

Given a container x, returns the number type used for storing coordinates.

Examples

julia> using DelaunayTriangulation

julia> DelaunayTriangulation.number_type([1, 2, 3])
Int64

julia> DelaunayTriangulation.number_type((1, 2, 3))
Int64

julia> DelaunayTriangulation.number_type([1.0 2.0 3.0; 4.0 5.0 6.0])
Float64

julia> DelaunayTriangulation.number_type([[[1, 2, 3, 4, 5, 1]], [[6, 8, 9], [9, 10, 11], [11, 12, 6]]])
Int64

julia> DelaunayTriangulation.number_type((1.0f0, 2.0f0))
Float32

julia> DelaunayTriangulation.number_type(Vector{Float64})
Float64

julia> DelaunayTriangulation.number_type(Vector{Vector{Float64}})
Float64

julia> DelaunayTriangulation.number_type(NTuple{2, Float64})
Float64
source
DelaunayTriangulation.pole_of_inaccessibilityFunction
pole_of_inaccessibility(points, boundary_nodes; precision = one(number_type(points)))

Finds the pole of inaccessibility for the polygon defined by points and boundary_nodes. The boundary_nodes must match the specification given in the documentation. See also check_args for this specification.

Arguments

  • points: The points defining the polygon.
  • boundary_nodes: The boundary nodes defining the polygon.

Keyword Arguments

  • precision=one(number_type(points)): The precision of the returned pole. The default is one(number_type(points)).

Outputs

  • x: The x-coordinate of the pole.
  • y: The y-coordinate of the pole.

Extended help

The pole of inaccessibility is the point within a polygon that is furthest from an edge. For DelaunayTriangulation.jl, this is useful as it is a representative point for ghost edges that is guaranteed to be inside the polygon, in contrast to for example a centroid which is not always inside the polygon. Some useful links are this blog post and the the original repo. Our implementation is partially based on on the python implementation and this other Julia implementation.

source
DelaunayTriangulation.clip_polygonFunction
clip_polygon(vertices, points, clip_vertices, clip_points; predicates::AbstractPredicateKernel=AdaptiveKernel()) -> Vector

Clip a polygon defined by (vertices, points) to a convex clip polygon defined by (clip_vertices, clip_points) with the Sutherland-Hodgman algorithm. The polygons should be defined in counter-clockwise order.

Arguments

  • vertices: The vertices of the polygon to be clipped.
  • points: The underlying point set that the vertices are defined over.
  • clip_vertices: The vertices of the clipping polygon.
  • clip_points: The underlying point set that the clipping vertices are defined over.

Keyword Arguments

  • predicates::AbstractPredicateKernel=AdaptiveKernel(): Method to use for computing predicates. Can be one of FastKernel, ExactKernel, and AdaptiveKernel. See the documentation for a further discussion of these methods.

Output

  • clipped_polygon: The coordinates of the clipped polygon, given in counter-clockwise order and clipped_polygon[begin] == clipped_polygon[end].
source
DelaunayTriangulation.construct_polygon_hierarchyFunction
construct_polygon_hierarchy(points; IntegerType=Int) -> PolygonHierarchy{IntegerType}

Returns a PolygonHierarchy defining the polygon hierarchy for a given set of points. This defines a hierarchy with a single polygon.

source
construct_polygon_hierarchy(points, boundary_nodes; IntegerType=Int) -> PolygonHierarchy{IntegerType}

Returns a PolygonHierarchy defining the polygon hierarchy for a given set of boundary_nodes that define a set of piecewise linear curves.

source
construct_polygon_hierarchy(points, boundary_nodes, boundary_curves; IntegerType=Int, n=4096) -> PolygonHierarchy{IntegerType}

Returns a PolygonHierarchy defining the polygon hierarchy for a given set of boundary_nodes that define a curve-bounded domain from the curves in boundary_curves. Uses polygonise to fill in the boundary curves.

Arguments

Keyword Arguments

  • IntegerType=Int: The integer type to use for indexing the polygons.
  • n=4096: The number of points to use for filling in the boundary curves in polygonise.
source