When I run ellipse3.rendergeometry.IntersectionDetail(ellipse3.rendergeometry); always coming out ...

  1. Entry
  2. Entry
  3. Intersect
  4. Intersect
  5. Intersect
  6. Intersect
  7. Intersect

and so endlessly

What could be wrong? Structure

@Stack I’ve done on one piece, now it’s just Empty. Began to make a different shape, climbs error that "Can not set the property of the object" ", as it is in the" read only "state.". Here is the code:

 private void Ellipse_OnMouseMove(object sender, MouseEventArgs e) { var ellipse = sender as Ellipse foreach (Ellipse tb in FindVisualChildren<Ellipse>(canvas)) { var g = tb.RenderedGeometry; g.Transform = (Transform)tb.TransformToAncestor(canvas); var m = ellipse.RenderedGeometry;//Вот здесь вылазит ошибка m.Transform = (Transform)ellipse.TransformToAncestor(canvas); IntersectionDetail khg = m.FillContainsWithDetail(g); } } 
  • ellipse3.rendergeometry.IntersectionDetail(ellipse3.rendergeometry) is not a typo? It looks like you cross ellipse3 with yourself. - Pavel Mayorov
  • @PavelMayorov yes, typo))) - alex-rudenkiy
  • @Alex_Rudenkiy updated the answer. - Stack

1 answer 1

If the figures are located in the Canvas, the comparison should be carried out in the coordinates of the Canvas.

 var g = shape.RenderedGeometry; g.Transform = (Transform) shape.TransformToAncestor(canvas); 

You also need to do for another shape and then compare their Geometry.


UPDATE

A working example is here.

enter image description here