Skip to content

Instantly share code, notes, and snippets.

@ahancock1
ahancock1 / MonotoneCubicInterpolation.cs
Created March 26, 2019 09:44
MonotoneCubicInterpolation
public class MonotoneCubicSpline
{
private readonly double[] _x;
private readonly double[] _y;
private readonly int _n;
private readonly double[] _m;
public MonotoneCubicSpline(IList<Point> points)
{
_x = points.OrderBy(p => p.X).Select(p => p.X).ToArray();
@ahancock1
ahancock1 / DouglasPeuckerReduction.cs
Last active June 1, 2023 09:00
Ramer–Douglas–Peucker algorithm is a line simplification algorithm for reducing the number of points used to define its shape. Implemented in C# 7
namespace Interpolation
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
/// <summary>
/// Douglas Peucker Reduction algorithm.
/// </summary>
@ahancock1
ahancock1 / ViewportControl.cs
Last active August 14, 2018 18:12
ViewportControl in WPF
// -----------------------------------------------------------------------
// Copyright (C) 2017 Adam Hancock
//
// Viewer.cs can not be copied and/or distributed without the express
// permission of Adam Hancock
// -----------------------------------------------------------------------
namespace Controls
{
using System;