User:Wakebrdkid/Inscribed square problem

Article

Tests

BeginPackage["Wikicode`InscribedSquareProblem`"]

CreateExample::usage = "CreateExample[] returns a Graphic \
representing example squares inscribed in a spline."

Begin["`Private`"]

Wikicode`Load["Square"]
Wikicode`Load["Spline interpolation"]

CreateExample[] := 
 Module[{plg, allpoints, order, smooth}, 
  plg = Square`CreateRandomSquares[3];
  allpoints = Flatten[plg, 1];
  order = FindShortestTour[allpoints][[2]];
  allpoints = Part[allpoints, order];
  smooth = SplineInterpolation`Interpolate@allpoints;
  Graphics[{EdgeForm[{Darker@Blue, Thickness[0.003]}], FaceForm[None],
     Polygon[Most@plg], {EdgeForm[Thickness[0.005]], 
     Polygon[Last@plg]}, Black, PointSize[0.04], Point[allpoints], 
    Dashing[0.025], Thickness[0.008], smooth}]]

End[]
EndPackage[]