Package micycle.pgs.commons
Class TangencyPack
java.lang.Object
micycle.pgs.commons.TangencyPack
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
ConstructorsConstructorDescriptionTangencyPack
(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
-
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 packingboundaryRadii
- Radii of the circles (same for every circle) associated with the boundary/perimeter vertices of the triangulation
-
TangencyPack
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 packingboundaryRadii
- 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 packingboundaryRadii
- 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
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.
-