Fixed Point plotting -> TODO: fix plotting of circles and edges

TODO: Generate Points distinct from eachother
This commit is contained in:
ti_mo
2025-10-21 00:05:06 +02:00
parent eece186bf3
commit 4f5530c87e
3 changed files with 65 additions and 39 deletions
@@ -8,26 +8,43 @@ namespace DelauneyTriangulation.ViewModels;
public partial class MainWindowViewModel : ViewModelBase
{
[ObservableProperty] private int _pointCount = 20;
private int _pointCount = 20;
[ObservableProperty] private double _panX;
[ObservableProperty] private double _panY;
[ObservableProperty] private double _zoom = 1.0;
public double Width { get; set; } = 1280;
public double Height { get; set; } = 720;
public ObservableCollection<Geometries.GeomPoint> Points { get; } = new();
public ObservableCollection<Geometries.GeomEdge> Edges { get; } = new();
public ObservableCollection<Geometries.GeomCircle> Circles { get; } = new();
public MainWindowViewModel()
public int PointCount
{
var rand = new Random();
for (int i = 0; i < PointCount; i++)
get => _pointCount;
set
{
double x = rand.NextDouble() * Width;
double y = rand.NextDouble() * Height;
Points.Add(new Geometries.GeomPoint(x, y));
_pointCount = value;
OnPropertyChanged(nameof(PointCount));
GenerateRandomPoints(value);
}
}
public ObservableCollection<Geometries.Point> Points { get; } = new();
public ObservableCollection<Geometries.Edge> Edges { get; } = new();
public ObservableCollection<Geometries.Circle> Circles { get; } = new();
void GenerateRandomPoints(int count)
{
Points.Clear();
var rand = new Random();
for (var i = 0; i < PointCount; i++)
{
var x = rand.NextDouble() * Width;
var y = rand.NextDouble() * Height;
Points.Add(new Geometries.Point(x, y));
}
}
public MainWindowViewModel()
{
GenerateRandomPoints(_pointCount);
}
}