Class TangencyPack

java.lang.Object
micycle.pgs.commons.TangencyPack

public class TangencyPack extends Object
Implements a circle packing algorithm described by Collins and Stephenson (2003) to find an arrangement of circles which corresponds to a graph of desired circle tangencies.

The algorithm takes a graph (in triangulation form) which specifies a desired pattern of circle tangencies and searches for an arrangement of circle positions and sizes which satisfy that pattern.

Given any set of radii, it is possible to compute the angles of the triangles using the law of cosines. The final radii are those for which the angles at any vertex sum to exactly 2π. Thus, the algorithm searches for the radii of the disks by making small incremental updates to the radii, increasing the radius if the angle sum is more than 2π and decreasing the radius of the angle sum is less than 2π.

This implementation (specifically circle coordinate placement) is based on an implementation in the packcircles R package.

Author:
Michael Carleton
  • Constructor Summary

    Constructors
    Constructor
    Description
    TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double boundaryRadii)
    Creates a circle packing using tangancies specified by a triangulation.
    TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double[] boundaryRadii)
    Creates a circle packing using tangancies specified by a triangulation.
    TangencyPack(org.tinfour.common.IIncrementalTin triangulation, List<Double> boundaryRadii)
    Creates a circle packing using tangancies specified by a triangulation.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<processing.core.PVector>
    Computes and returns a circle packing for the configuration of tangencies given by the triangulation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TangencyPack

      public TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double boundaryRadii)
      Creates a circle packing using tangancies specified by a triangulation.
      Parameters:
      triangulation - Pattern of tangencies; vertices connected by an edge in the triangulation represent tangent circles in the packing
      boundaryRadii - Radii of the circles (same for every circle) associated with the boundary/perimeter vertices of the triangulation
    • TangencyPack

      public TangencyPack(org.tinfour.common.IIncrementalTin triangulation, List<Double> boundaryRadii)
      Creates a circle packing using tangancies specified by a triangulation.
      Parameters:
      triangulation - Pattern of tangencies; vertices connected by an edge in the triangulation represent tangent circles in the packing
      boundaryRadii - List of radii values of the circles associated with the boundary/perimeter vertices of the triangulation. The list may have fewer radii than the number of boundary vertices; in this case, boundary radii will wrap around the list
    • TangencyPack

      public TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double[] boundaryRadii)
      Creates a circle packing using tangancies specified by a triangulation.
      Parameters:
      triangulation - Pattern of tangencies; vertices connected by an edge in the triangulation represent tangent circles in the packing
      boundaryRadii - Array of radii values of the circles associated with the boundary/perimeter vertices of the triangulation. The list may have fewer radii than the number of boundary vertices; in this case, boundary radii will wrap around the list
  • Method Details

    • pack

      public List<processing.core.PVector> pack()
      Computes and returns a circle packing for the configuration of tangencies given by the triangulation.
      Returns:
      a list of PVectors, each representing one circle: (.x, .y) represent the center point and .z represents radius.