ConnectionDrawer class

Handles the drawing of connection lines between nearby particles in a network

This class implements an optimized approach to:

  1. Find particle pairs within connection distance
  2. Calculate connection line opacity based on distance
  3. Render visually pleasing connections between particles

Optimization Features:

  • Uses spatial grid for O(1) neighbor lookups
  • Implements pair processing tracking to avoid duplicate draws
  • Caches distance calculations
  • Batched line drawing operations

Constructors

ConnectionDrawer({required List<Particle> particles, required int particleCount, required double lineDistance, required Color lineColor, required Paint linePaint, required DistanceCalculator distanceCalculator, required bool isComplex})

Properties

distanceCalculator DistanceCalculator
final
hashCode int
The hash code for this object.
no setterinherited
isComplex bool
final
lineColor Color
final
lineDistance double
final
linePaint Paint
final
particleCount int
final
particles List<Particle>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

drawConnections(Canvas canvas, Map<GridCell, List<int>> grid) → void
Draws connection lines between particles within the specified distance
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited