private static void TestDistortion(string testObject, SWA_Ariadne_Outlines_DistortedOutlineShape_DistortionAccessor target, double x, double y, double xExpected, double yExpected) { double xActual = x, yActual = y; target(ref xActual, ref yActual); Assert.AreEqual(xExpected, xActual, 1e-6, string.Format("{0}({1:0.00},{2:0.00}).x", testObject, x, y)); Assert.AreEqual(yExpected, yActual, 1e-6, string.Format("{0}({1:0.00},{2:0.00}).y", testObject, x, y)); }
public static MazeTestForm.MazeConfiguratorDelegate DistortedPolygonConfiguratorDelegate(int corners, int windings, double slant, double centerX, double centerY, double shapeSize, double distortionWinding) { MazeTestForm.MazeConfiguratorDelegate mazeConfigurator = delegate(Maze maze) { int xSize = maze.XSize, ySize = maze.YSize; OutlineShape baseShape = SWA_Ariadne_Outlines_PolygonOutlineShapeAccessor.CreatePrivate(corners, windings, slant, xSize, ySize, centerX, centerY, shapeSize); SWA_Ariadne_Outlines_SmoothOutlineShapeAccessor baseShapeAccessor = new SWA_Ariadne_Outlines_SmoothOutlineShapeAccessor(baseShape); double xCenter, yCenter, size; SWA_Ariadne_Outlines_OutlineShapeAccessor.ConvertParameters(xSize, ySize, centerX, centerY, shapeSize, out xCenter, out yCenter, out size); SWA_Ariadne_Outlines_DistortedOutlineShape_DistortionAccessor distortion = SWA_Ariadne_Outlines_DistortedOutlineShapeAccessor.SpiralDistortion(xCenter, yCenter, size, distortionWinding); OutlineShape targetShape = SWA_Ariadne_Outlines_DistortedOutlineShapeAccessor.CreatePrivate(xSize, ySize, baseShapeAccessor, distortion); maze.OutlineShape = targetShape; }; return(mazeConfigurator); }
private static void TestDistortionFixpoint(string testObject, SWA_Ariadne_Outlines_DistortedOutlineShape_DistortionAccessor target, double x, double y) { TestDistortion(testObject + "_Fixpoint", target, x, y, x, y); }