public class TangencyPack extends Object
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.
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
List<processing.core.PVector> |
pack()
Computes and returns a circle packing for the configuration of tangencies
given by the triangulation.
|
public TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double boundaryRadii)
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
triangulationpublic TangencyPack(org.tinfour.common.IIncrementalTin triangulation, List<Double> boundaryRadii)
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 listpublic TangencyPack(org.tinfour.common.IIncrementalTin triangulation, double[] boundaryRadii)
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 listpublic List<processing.core.PVector> pack()
Copyright © 2023. All rights reserved.