geos icon indicating copy to clipboard operation
geos copied to clipboard

Support arcs in GeometryNoder / GEOSNode

Open dbaston opened this issue 1 week ago • 0 comments

This PR:

  • Reworks the CircularArc class to hold a reference to a CoordinateSequence and position, rather than holding coordinates as values. This makes it easier for the CircularArcIntersetor to access the Z and M values of arc points, without CircularArc having to store everything as CoordinateXYZM. The CircularArc may also own its own CoordinateSequence, though this is mostly used for tests and should maybe be removed.

  • Updates the CircularArcIntersector class to perform Z/M interpolation, with behavior modeled on that of LineIntersector. In particular, the Z/M values of intersection points are interopalted unless they match an arc endpoint, in which case they are taken from the endpoint with preference to the first arc. (This means that, like LineIntersector, the intersection of A and B may be different from the intersection of B and A.) Z/M interpolation on intersection points is performed between arc end points (p0, p2) and the arc control point (p1). Control points are not preserved in the the output; output arcs will have a control point generated at the angle midway between arc endpoints.

  • Adds a hierarchy of curve-capable noding classes. The idea here was to leave SegmentString / Noder / IntersectionAdder unchanged, so the following classes are added:

    • ArcString: equivalent of SegmentString, but for arcs
    • PathString : a parent of SegmentString and ArcString
    • ArcNoder : a derivative of Noder, who can also node not only a vector of SegmentStrings, but also a vector of PathStrings
    • NodablePath: a PathString to which intersection points can be added (interface)
    • NodableArcString: like it sounds. Captures the functionality of NodedSegmentString, SegmentNode, and SegmentNodeList.
    • ArcIntersector: An interface like SegmentIntersector that requires handling of the four possibleSegmentString / ArcString combinations
    • ArcIntersectionAdder: Analog of IntersectionAdder that implements ArcIntersector.
  • "Upgrades" the brute-force SimpleNoder from a Noder to an ArcNoder.

  • Makes GeometryNoder fall back to a SimpleNoder if it receives curved inputs. Otherwise, it sticks with the default MCIndexNoder.

There are a few FIXME / TODO items remaining that I would address before merging.

dbaston avatar Dec 18 '25 19:12 dbaston