public static bool FindNearestPoint(IEnumerable <SceneObject> vSceneObjects, Vector3d point, double maxDist, out SORayHit nearest, CoordSpace eSpace = CoordSpace.WorldCoords) { nearest = null; foreach (var so in vSceneObjects) { if (so is SpatialQueryableSO) { SpatialQueryableSO spatialSO = so as SpatialQueryableSO; if (spatialSO.SupportsNearestQuery) { SORayHit soNearest; if (spatialSO.FindNearest(point, maxDist, out soNearest, eSpace)) { if (nearest == null || soNearest.fHitDist < nearest.fHitDist) { nearest = soNearest; } } } } } return(nearest != null); }
public SOProjectionTarget(SpatialQueryableSO so, CoordSpace eCoordSpace = CoordSpace.WorldCoords) { Target = so; eInCoords = eCoordSpace; }