Class StraightSkeleton

java.lang.Object
org.apache.sedona.common.approximate.StraightSkeleton

public class StraightSkeleton extends Object
Straight skeleton computation for polygons using the campskeleton library.

The straight skeleton is a method of representing a polygon by a topological skeleton. It is defined by a continuous shrinking process in which each edge of the polygon is moved inward in a parallel manner. This implementation uses the campskeleton library which implements the weighted straight skeleton algorithm based on Felkel's approach.

References: - Tom Kelly and Peter Wonka (2011). Interactive Architectural Modeling with Procedural Extrusions - Felkel, P., & Obdržálek, Š. (1998). Straight skeleton implementation

  • Constructor Details

    • StraightSkeleton

      public StraightSkeleton()
  • Method Details

    • computeSkeleton

      public org.locationtech.jts.geom.Geometry computeSkeleton(org.locationtech.jts.geom.Polygon polygon, int maxVertices)
      Compute the straight skeleton for a polygon.

      The campskeleton library has numerical stability issues with certain geometries. To improve robustness, we preprocess the polygon by: 1. Centering it at the origin (0,0) 2. Scaling it to a reasonable size 3. Ensuring counter-clockwise orientation 4. Optionally reducing vertex count by merging shortest edges

      After computing the skeleton, we transform it back to the original coordinate system.

      Parameters:
      polygon - Input polygon (must be simple, non-self-intersecting)
      maxVertices - Maximum number of vertices to keep (0 to disable simplification). If the polygon has more vertices than this limit, the shortest edges will be merged until the vertex count is reduced. Recommended: 100-500 for performance
      Returns:
      MultiLineString representing the straight skeleton edges