Class EuclideanUtils

java.lang.Object
org.apache.commons.geometry.euclidean.internal.EuclideanUtils

public final class EuclideanUtils extends Object
Class containing utilities and algorithms intended to be internal to the library. Absolutely no guarantees are made regarding the stability of this API.
  • Field Details

  • Method Details

    • convexPolygonToTriangleFan

      public static <T> List<T> convexPolygonToTriangleFan(List<Vector3D> vertices, Function<List<Vector3D>, T> fn)
      Convert a convex polygon defined by a list of vertices into a triangle fan. The vertex forming the largest interior angle in the polygon is selected as the base of the triangle fan. Callers are responsible for ensuring that the given list of vertices define a geometrically valid convex polygon; no validation (except for a check on the minimum number of vertices) is performed.
      Type Parameters:
      T - triangle result type
      Parameters:
      vertices - vertices defining a convex polygon
      fn - function accepting the vertices of each triangle as a list and returning the object used to represent that triangle in the result; each argument to this function is guaranteed to contain 3 vertices
      Returns:
      a list containing the return results of the function when passed the vertices for each triangle in order
      Throws:
      IllegalArgumentException - if fewer than 3 vertices are given