testPoint function

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

Implementation

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

  if (rayPointDistanceSq < localThresholdSq) {
    var intersectPoint = Vector3();

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

    var 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,
      "face": null,
      "object": object
    }));
  }
}