Skip to content

Handle degenerate cases in circumcircle-raw, triangle-spec #90

@Hendekagon

Description

@Hendekagon

thi.ng.geom.triangle/circumcircle-raw returns nil for points that are the same:

(circumcircle-raw [0.5 0.5] [0.5 0.5] [0.5 0.5])
=> nil

causing a NPE in thi.ng.geom.utils.delaunay/triangle-spec :

(alter-meta! #'td/triangle-spec update :private not)

(td/triangle-spec [0.5 0.5] [0.5 0.5] [0.5 0.5])
Execution error (NullPointerException) at thi.ng.geom.utils.delaunay/triangle-spec (delaunay.cljc:40).
null

I can think of these options:

  • circumcircle-raw could return a zero-radius circle in this case - no errors but maybe undesirable
  • check for zero radius in triangle-spec and warn - slower but more friendly
  • add docstring warning in triangulate - at least users would be able to find out why

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions