Search code examples
javavectorgeometry2dvecmath

Any Java library for 2D vectors (geometry)? Stable/maintained/perspective?


I'm working on an SVG project, and I need to do some geometrical calculations that work with the 2d vectors. I wonder whether there is some stable, widely used, maintained library for that. I've found javax.vecmath and its class Vector2d, but the latest release is from 2015, and its homepage is dead. Any ideas or suggestions?


Solution

  • I would recommend Apache Commons Math (https://commons.apache.org/proper/commons-math/).

    Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang.

    It has Vector2D and many more useful math classes. (https://commons.apache.org/proper/commons-math/javadocs/api-3.6/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.html)