private void PointInternal(IToolContext context, double x, double y, Modifier modifier) { Filters?.Any(f => f.Process(context, ref x, ref y)); CurrentState = State.StartPoint; context.Renderer.SelectedShapes.Remove(_line.StartPoint); context.Renderer.SelectedShapes.Remove(_line.Point); context.WorkingContainer.Shapes.Remove(_line); _line.Point = context.GetNextPoint(x, y, Settings?.ConnectPoints ?? false, Settings?.HitTestRadius ?? 0.0); Intersections?.ForEach(i => i.Clear(context)); Intersections?.ForEach(i => i.Find(context, _line)); if ((Settings?.SplitIntersections ?? false) && (Intersections?.Any(i => i.Intersections.Count > 0) ?? false)) { LineHelper.SplitByIntersections(context, Intersections, _line); } else { context.CurrentContainer.Shapes.Add(_line); } _line = null; Intersections?.ForEach(i => i.Clear(context)); Filters?.ForEach(f => f.Clear(context)); context.Release?.Invoke(); context.Invalidate?.Invoke(); }
public override void IntersectLocal(ref Tuple origin, ref Tuple direction, Intersections intersections) { Intersections leftXs = new Intersections(); Left.Intersect(ref origin, ref direction, leftXs); var rightXs = new Intersections(); Right.Intersect(ref origin, ref direction, rightXs); Intersections result; if (leftXs.Any() || rightXs.Any()) { var xs = new Intersections(leftXs.Concat(rightXs)); result = Filter(xs); intersections.AddRange(result); } }
public override Intersections IntersectLocal(Ray ray) { Intersections leftXs = Left.Intersect(ray); var rightXs = Right.Intersect(ray); Intersections result; if (leftXs.Any() || rightXs.Any()) { var xs = new Intersections(leftXs.Concat(rightXs)); result = Filter(xs); } else { result = new Intersections(); } return(result); }