AlphaShapes

org.appliedtopology.tda4j.AlphaShapes
See theAlphaShapes companion class

Alpha complexes of point clouds: AlphaShapes(points), or Persistence(points, complex = AlphaShapes).

Attributes

Companion
class
Experimental
true
Source
AlphaShapes.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object Point

Attributes

Source
AlphaShapes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Point.type

Types

Attributes

Source
AlphaShapes.scala

Value members

Concrete methods

def apply(points: PointCloud, backend: AlphaBackend = ..., requireValidTriangulation: Boolean = ..., maxRadius: Optional[Double] = ..., maxDimension: Optional[Int] = ...)(using factor: EpsilonFactor): AlphaShapes

The alpha complex of points, built by backend (see AlphaBackend).

The alpha complex of points, built by backend (see AlphaBackend).

  • BowyerWatson triangulates the whole point set (Delaunay, exact predicates: valid on grids and other degenerate input, and the same whatever the point order) and reads the alpha values off the triangulation. Points spanning at most 4 dimensions only; the fastest in 2-D and 3-D by far.
  • Helix triangulates the whole point set too, in any dimension, with floating-point predicates.
  • DQP decides each simplex on its own, dimension by dimension, among points within 2 maxRadius of each other: it never builds the whole triangulation, so a small maxRadius (or a low maxDimension in high ambient dimension) makes it much cheaper, while without a radius it is far slower than a triangulation.
  • Default picks: without a maxRadius, BowyerWatson for points in at most 4 dimensions and Helix above; with one, DQP instead when it is expected to be faster for this radius, from the average number of points within 2 maxRadius of a point (AlphaShapes.prefersDQP). (upToEnclosingRadius, which the verb runs on, picks DQP without a radius when the degree cap is low in high dimension.)

In general position every backend gives the same complex: the simplices whose alpha value (radius) is at most maxRadius, with the same values. On cospherical points DQP keeps the higher-dimensional simplex they span where BowyerWatson and Helix triangulate it (each its own way); the barcode is the same up to zero-length bars.

Value parameters

maxDimension

the highest homological degree needed: DQP builds simplices up to dimension maxDimension + 1 only. Default: all dimensions. (BowyerWatson and Helix always build every dimension; truncate the stream with Truncated.)

maxRadius

keep only simplices with alpha value (radius) at most this. Default: no limit.

requireValidTriangulation

Helix only: raise an error rather than return a triangulation it could not repair (see HelixDelaunay).

Attributes

Source
AlphaShapes.scala
def dqpNeighbourThreshold(n: Int, d: Int): Double

The average neighbour count (within 2r) up to which DQP is expected to be faster than the triangulation Default would use, for n points in ambient dimension d. Per point, DQP took about c_d k^1.6 ms (c_d = 0.004 * 2.35^(d-2), the constant from 1000-point clouds, the more expensive ones); BowyerWatson about b_d (n/1000)^0.2 ms, b_d = 0.03, 0.1, 1.1 for d = 2..4; Helix in 5-D about 150 (n/1000)^0.4 ms (uniform clouds of 1000-10000 points, this library's own measurements). In dimension 6 and up Helix's triangulation grows so fast that DQP is preferred whenever a radius is given.

The average neighbour count (within 2r) up to which DQP is expected to be faster than the triangulation Default would use, for n points in ambient dimension d. Per point, DQP took about c_d k^1.6 ms (c_d = 0.004 * 2.35^(d-2), the constant from 1000-point clouds, the more expensive ones); BowyerWatson about b_d (n/1000)^0.2 ms, b_d = 0.03, 0.1, 1.1 for d = 2..4; Helix in 5-D about 150 (n/1000)^0.4 ms (uniform clouds of 1000-10000 points, this library's own measurements). In dimension 6 and up Helix's triangulation grows so fast that DQP is preferred whenever a radius is given.

Attributes

Source
AlphaShapes.scala
def fromPoints(points: PointCloud, maxDimension: Int, maxFiltrationValue: Option[Double]): LevelwiseSimplexStream[Int, Double]

The alpha complex up to the alpha value maxFiltrationValue. Without one, up to the points' minimum enclosing radius (see upToEnclosingRadius).

The alpha complex up to the alpha value maxFiltrationValue. Without one, up to the points' minimum enclosing radius (see upToEnclosingRadius).

Attributes

Source
AlphaShapes.scala
def meanNeighbourCost(pts: Array[Array[Double]], distance: Double): Double

The average of k^1.6 over up to 64 evenly spaced sample points, k a point's number of other points within distance.

The average of k^1.6 over up to 64 evenly spaced sample points, k a point's number of other points within distance.

Attributes

Source
AlphaShapes.scala
def prefersDQP(points: PointCloud, r: Double): Boolean

Whether DQP is expected to build the alpha complex truncated at radius r faster than a triangulation (BowyerWatson up to 4 dimensions, Helix above) builds the whole one. DQP's cost grows with the number of points within 2r of each point (its neighbour graph); a triangulation's with the point count and the ambient dimension. The thresholds are measured (.claude/WORKLOG-helix-construction-speed.md): the largest average neighbour count at which DQP was still faster, by point count and ambient dimension.

Whether DQP is expected to build the alpha complex truncated at radius r faster than a triangulation (BowyerWatson up to 4 dimensions, Helix above) builds the whole one. DQP's cost grows with the number of points within 2r of each point (its neighbour graph); a triangulation's with the point count and the ambient dimension. The thresholds are measured (.claude/WORKLOG-helix-construction-speed.md): the largest average neighbour count at which DQP was still faster, by point count and ambient dimension.

Attributes

Source
AlphaShapes.scala
def prefersDQPAtEnclosingRadius(points: PointCloud, maxDimension: Optional[Int]): Boolean

Whether DQP is expected to build the alpha complex up to the enclosing radius, and homological degree maxDimension, faster than a triangulation (Helix above 4 dimensions) builds the whole one: in at least dqpMinAmbientDimension dimensions, and with maxDimension at most 2 below the ambient dimension (the top degree d - 1 stays on the triangulation: DQP's memory is 1.5 to 2.5 times Helix's there from 10 dimensions). DQP builds only the candidates up to dimension maxDimension + 1, a triangulation every dimension: at 40 points with maxDimension = 4 DQP was 3 times faster in 8 dimensions, 8 times in 10 and 28 times in 12 (with a fifth of the memory), and the only backend to finish in 15; at 5 dimensions it was slightly slower and at 6 a tie. Measured for 40 and 60 uniform points, maxDimension 4 and d - 1; the caps in between are interpolated.

Whether DQP is expected to build the alpha complex up to the enclosing radius, and homological degree maxDimension, faster than a triangulation (Helix above 4 dimensions) builds the whole one: in at least dqpMinAmbientDimension dimensions, and with maxDimension at most 2 below the ambient dimension (the top degree d - 1 stays on the triangulation: DQP's memory is 1.5 to 2.5 times Helix's there from 10 dimensions). DQP builds only the candidates up to dimension maxDimension + 1, a triangulation every dimension: at 40 points with maxDimension = 4 DQP was 3 times faster in 8 dimensions, 8 times in 10 and 28 times in 12 (with a fifth of the memory), and the only backend to finish in 15; at 5 dimensions it was slightly slower and at 6 a tie. Measured for 40 and 60 uniform points, maxDimension 4 and d - 1; the caps in between are interpolated.

Attributes

Source
AlphaShapes.scala

The backend that triangulates all the points: BowyerWatson up to 4 dimensions, Helix above.

The backend that triangulates all the points: BowyerWatson up to 4 dimensions, Helix above.

Attributes

Source
AlphaShapes.scala
def upToEnclosingRadius(points: PointCloud, backend: AlphaBackend = ..., requireValidTriangulation: Boolean = ..., maxRadius: Optional[Double] = ..., maxDimension: Optional[Int] = ...)(using factor: EpsilonFactor): AlphaShapes

apply, except that without a maxRadius the complex is cut at the points' minimum enclosing radius (FiniteMetricSpace.minimumEnclosingRadius) rather than left whole: past it the union of balls is contractible, so the barcode is the same, and the simplices of large circumradius that a triangulation has along its hull are never built. This is what Persistence(points, complex = AlphaShapes) runs on.

apply, except that without a maxRadius the complex is cut at the points' minimum enclosing radius (FiniteMetricSpace.minimumEnclosingRadius) rather than left whole: past it the union of balls is contractible, so the barcode is the same, and the simplices of large circumradius that a triangulation has along its hull are never built. This is what Persistence(points, complex = AlphaShapes) runs on.

AlphaBackend.Default picks the backend by the degree cap instead of the radius, which here leaves every point in every neighbourhood: DQP when maxDimension is given and low in high ambient dimension (prefersDQPAtEnclosingRadius), else the triangulation apply builds without a radius.

Attributes

Source
AlphaShapes.scala

Concrete fields

The lowest ambient dimension in which prefersDQPAtEnclosingRadius says DQP.

The lowest ambient dimension in which prefersDQPAtEnclosingRadius says DQP.

Attributes

Source
AlphaShapes.scala