Skip to content

tektosyne

Compare
Choose a tag to compare
@PixelBumper PixelBumper released this 19 Mar 22:51
· 26 commits to master since this release

Tektosyne is a partial Java port of my older .NET library. For those who have used the older version, here is a list of significant changes in functionality.

Removed Classes

Tektosyne for Java only contains functionality from the .NET library Tektosyne.Core. The second library in the .NET edition, Tektosyne.Windows, was entirely specific to Windows and WPF.
From Tektosyne.Core, the geometric and graph algorithms with related collections have been ported, along with some fundamental mathematical algorithms. All .NET-specific classes (e.g. Tektosyne.IO), general-purpose classes with existing Java ports (e.g. MersenneTwister), and various helper classes of dubious usefulness have been removed.

Changed Classes

As Java lacks a global flag or keyword for checked arithmetic, many methods were changed to either widen calculations from int to long or throw an ArithmeticException if the target type of a conversion overflows. This has been noted in the corresponding Javadoc entries.
The .NET version used to silently ignore negative comparison epsilons, which however could lead to nonsensical results in certain algorithms. The Java version throws an IllegalArgumentException whenever a negative epsilon is specified, except for methods that always raise epsilon to a fixed minimum value (see Javadoc).

Fortran:

  • Removed overloads for decimal and short.
  • Removed sign overloads as the Java method Math.copySign provides equivalent functionality.
  • Added knint overloads that round float and double values to long, equivalent to nint for int.
  • Changed integral modulo overloads to return Math.floorMod which Java conveniently defines for these types. modulo remains for the floating-point overloads which Java lacks.

MathUtility:

  • Renamed to MathUtils in conformance with standard Java usage.
  • Added toIntExact and toLongExact for checked conversions from double and float.
  • Removed overloads for decimal, short, and uint.

Collections:

  • Removed separate namespace (package) as the Java Collections Framework already provides most of the features that my own classed added to the .NET Framework collections.
  • Added NodeList which is the exact equivalent of Java’s LinkedList but publicly exposes its node structure, like .NET’s LinkedList.
  • Ported BraidedTree.FindRange as PointDComparator.findRange for Java’s NavigableMap and NavigableSet which proved sufficient replacements for BraidedTree.
  • Ported QuadTree but with massive API differences due to JCF conformity, e.g. attempting to add an existing entry will silently overwrite the existing value rather than throwing an exception.

Geometry:

  • Removed primitives with float coordinates (LineF, PointF, RectF, SizeF) as I had never used them in practice.
  • Removed ability to set comparison epsilon after construction from PointDComparatorX/Y and Subdivision. This was a testing convenience that would cause bugs when used on live objects.
  • GeoAlgorithms: Renamed to GeoUtils and made random number generation thread-safe via standard method Math.random.
  • LineIntersection.locateCollinear: Documentation claimed that this algorithm was identical to LineD.locateCollinear but the implementations differed, and the epsilon overload performed fewer epsilon checks. The LineD implementations were copied to LineIntersection, and LineD/I now simply forward to that class.
  • PointDComparator: Java’s List.sort throws an IllegalArgumentException for any Comparator that signals equality for objects with false equals or unequal hashCode results. This happens when the comparison epsilon overlaps PointD distances in both dimensions. I cannot influence this behavior but have documented it in setEpsilon.
  • PolygonGrid: Renamed …Display… methods to …World…, matching Graph usage and no longer implying display output.
  • RectI/D: Completely rewritten with minimum & maximum coordinates rather than location & size. RectI now also includes its greatest coordinates, like RectD. This greatly simplified the code, but all algorithms using these classes must be changed accordingly.
  • RectLocation: Simplified redesign as combination of two LineLocation values.

Graph:

  • Graph: Renamed Graph2D to Graph as there is only one, and all other classes assume that one class. Also added getNeighbors overload with steps parameter and a default implementation that works for all graphs.

Subdivision:

  • Moved Subdivision & all related classes to new package org.kynosarges.tektosyne.subdivision as there were a lot of related classes, and more in the Java port.
  • Subdivision: Collections no longer offer index access as Java does not provide collections that are both indexed and (quickly, automatically) sorted. In particular, vertices are now exclusively identified by their PointD coordinates rather than by collection indices. This simplified the API overall.