//:TODO: This will cause multiple traversals of the paths [perf]. Review. IHitResult GetClosestHit(Vector3 testPoint) { var closestMoveInstruction = _objectDetector.DetectMoveInstruction(testPoint); if (closestMoveInstruction != null) { return(closestMoveInstruction); } var closestPathSegment = _objectDetector.DetectPathSegment(testPoint); if (closestPathSegment != null) { return(closestPathSegment); } return(null); }
Tuple <ProjectObject, Vector3> GetHitObject(Vector3 point) { var sbHitResult = _detector.DetectSetBrushInstruction(point) as HitResult <RsActionInstruction>; if (sbHitResult != null) { return(Tuple.Create((ProjectObject)sbHitResult.HitObject, sbHitResult.HitPoint)); } var hitResult = _detector.DetectPathSegment(point) as HitResult <PathSegment>; if (hitResult != null && hitResult.HitObject.MoveInstruction != null) { return(Tuple.Create((ProjectObject)hitResult.HitObject.MoveInstruction, hitResult.HitPoint)); } return(null); }