testPoint function

void testPoint(
  1. Vector3 point,
  2. int index,
  3. double localThresholdSq,
  4. Matrix4 matrixWorld,
  5. Raycaster raycaster,
  6. List<Intersection> intersects,
  7. Object3D object,
)

Implementation

void testPoint(
  Vector3 point,
  int index,
  double localThresholdSq,
  Matrix4 matrixWorld,
  Raycaster raycaster,
  List<Intersection> intersects,
  Object3D object
) {
  final rayPointDistanceSq = _pointsray.distanceSqToPoint(point);

  if (rayPointDistanceSq < localThresholdSq) {
    final intersectPoint = Vector3.zero();

    _pointsray.closestPointToPoint(point, intersectPoint);
    intersectPoint.applyMatrix4(matrixWorld);

    final distance = raycaster.ray.origin.distanceTo(intersectPoint);

    if (distance < raycaster.near || distance > raycaster.far) return;

    intersects.add(Intersection(
      distance: distance,
      distanceToRay: math.sqrt(rayPointDistanceSq),
      point: intersectPoint,
      index: index,
      object: object
    ));
  }
}