Added Algorithm Selection
This commit is contained in:
@@ -31,6 +31,11 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
[ObservableProperty] private bool _voronoiVisible = true;
|
||||
[ObservableProperty] private bool _trianglesVisible = true;
|
||||
|
||||
[ObservableProperty] private bool _doConnectPoints = false;
|
||||
[ObservableProperty] private bool _doNearestTriangle = false;
|
||||
[ObservableProperty] private bool _doDelaunayLib = false;
|
||||
[ObservableProperty] private bool _doBowyerWatson = true;
|
||||
|
||||
[ObservableProperty] private int? _generationDelay = 20;
|
||||
private CancellationTokenSource? _genCts;
|
||||
|
||||
@@ -541,10 +546,10 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
VoronoiDiagram.Clear();
|
||||
|
||||
await GenerateRandomPoints(PointCount ?? 20, ct);
|
||||
// await ConnectPoints(ct);
|
||||
// await Triangulate(ct);
|
||||
// await DelaunayTriangulateAsync(ct);
|
||||
await BowyerWatson(ct);
|
||||
if(DoConnectPoints) await ConnectPoints(ct);
|
||||
if(DoNearestTriangle) await Triangulate(ct);
|
||||
if(DoDelaunayLib) await DelaunayTriangulateAsync(ct);
|
||||
if(DoBowyerWatson) await BowyerWatson(ct);
|
||||
}
|
||||
|
||||
private bool CanGenerate() => true;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="20" Color="#aa000000" OffsetX="5" OffsetY="5"/>
|
||||
</Border.Effect>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Grid RowDefinitions="*, auto">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Border Classes="InnerCard">
|
||||
@@ -103,9 +104,23 @@
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Classes="InnerCard">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Used Algorithm:" Foreground="White"/>
|
||||
<Grid ColumnDefinitions="1*, 1*">
|
||||
<RadioButton GroupName="Algorithm" HorizontalAlignment="Left" Content="Connect Points" IsChecked="{Binding DoConnectPoints}" Foreground="White" Margin="10,0"/>
|
||||
<RadioButton Grid.Column="1" GroupName="Algorithm" HorizontalAlignment="Left" Content="Nearest Triangle" IsChecked="{Binding DoNearestTriangle}" Foreground="White" Margin="10,0"/>
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="1*, 1*">
|
||||
<RadioButton GroupName="Algorithm" HorizontalAlignment="Left" Content="BowyerWatson" IsChecked="{Binding DoBowyerWatson}" Foreground="White" Margin="10,0"/>
|
||||
<RadioButton Grid.Column="1" GroupName="Algorithm" HorizontalAlignment="Left" Content="Delaunay (Delaunator)" IsChecked="{Binding DoDelaunayLib}" Foreground="White" Margin="10,0"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Button Grid.Row="1" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="Generate" Command="{Binding GenerateCommand}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Canvas Grid.Row="0" Grid.RowSpan="2" x:Name="Scene" Background="#dd000000" ClipToBounds="True" PointerPressed="Scene_OnPointerPressed" PointerMoved="Scene_OnPointerMoved" PointerReleased="Scene_OnPointerReleased" PointerWheelChanged="Scene_OnWheel">
|
||||
|
||||
Reference in New Issue
Block a user