using System.Collections.Generic; using System.Drawing; namespace DALI.Segmentation { public class SegmentationDouglasPeucker { private int nombrePointsSegmentationMax = 3; public static List DouglasPeuckerReduction(Point point, Double Tolerance) { return [0]; } public static Double PerpendicularDistance(Point Point1, Point Point2, Point Point) { Double area = Math.Abs( .5 * ( Point1.X * Point2.Y + Point2.X * Point.Y + Point.X * Point1.Y - Point2.X * Point1.Y - Point.X * Point2.Y - Point1.X * Point.Y ) ); Double bottom = Math.Sqrt( Math.Pow(Point1.X - Point2.X, 2) + Math.Pow(Point1.Y - Point2.Y, 2) ); Double height = area / bottom * 2; return height; } public void Segmente() { } private double EuclideanDistance(Point point1, Point point2) { double longueur = Math.Sqrt( (point2.X - point1.X) * (point2.X - point1.X) + (point2.Y - point1.Y) * (point2.Y - point1.Y) ); return longueur; } private double angle(Point point1, Point point2) { double longueur = Math.Sqrt( (point2.X - point1.X) * (point2.X - point1.X) + (point2.Y - point1.Y) * (point2.Y - point1.Y) ); return longueur; } static double ComputeAngle180( Point intersectionCoordinates, Point firstSegmentEndCoordinates, Point secondSegmentEndCoordinates ) { double v1x = firstSegmentEndCoordinates.X - intersectionCoordinates.X; double v1y = firstSegmentEndCoordinates.Y - intersectionCoordinates.Y; double v2x = secondSegmentEndCoordinates.X - intersectionCoordinates.X; double v2y = secondSegmentEndCoordinates.Y - intersectionCoordinates.Y; double vectorMultiplied = (v1x * v2x) + (v1y * v2y); double angle = Math.Sqrt((v1x * v1x) + (v1y * v1y)) * (Math.Sqrt((v2x * v2x) + (v2y * v2y))); return Math.Acos(vectorMultiplied / angle) * 180 / Math.PI; } } }