CombineGeometry always closes the path, even if one of the two paths isn't closed.
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
Not sure if this is intentional or not, but I hope it isn't, as I'm not sure what the workaround would be for open paths in general.
As the title says, when I make two paths, in my case one that is closed and the other not, then the unclosed path always closes when the geometries are combined. I've only tested this for intersections, which is the main combination relevant for my case.
### Reproduction Steps
[Here's a repository containing a minimal example](https://github.com/osamakawish/CombineGeometryTest).
Here's the relevant code in MainWindow.cs, for easier reference:
```c#
public MainWindow()
{
InitializeComponent();
var path1 = new Path {
Stroke = Brushes.Orange,
StrokeThickness = 1,
Data = Geometry.Parse("M0,0 L80,80 L0,80")
};
var path2 = new Path {
Stroke = Brushes.IndianRed,
StrokeThickness = 1.2,
Data = new EllipseGeometry(new Point(0, 0), 60, 60)
};
// Uncomment below to see result.
//path1.Data = new CombinedGeometry(GeometryCombineMode.Intersect, path1.Data, path2.Data);
Canvas.Children.Add(path1); Canvas.Children.Add(path2);
}
```
I did nothing but set the main child of the Window to a Canvas that is centered horizontally and vertically in the xaml file.
Here's the result with the commented line commented:

Here's what happens when I uncomment the line:

### Expected behavior
No closing line should be visible, as there were none in the original path.
### Actual behavior
A closing line is visible, despite none existing in the original path.
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
Basically a major impact for my needs. The intersect just does not work as you would expect it to. And nothing in documentation is clear about this bug for it to appear intentional.
### Configuration
.Net 7.0.
Windows 11 Home 22H2
64-bit OS, x64 based processor
Don't know if it's specific to the configuration. But if I had to guess, I don't think it would be.
### Other information
Well, to start with, I'm guessing the first place to look would be in the constructor of the `CombinedGeometry`. In particular, for the intersection case. And somewhere where a path might end up closed even if it wasn't originally.
Contributor guide
Assessment
This issue has not been assessed yet.