Border Curves

Pick off some points along the US/Mexico border. You do not need to hold the "apple" button down constantly; just click on some points along the border.

In[107]:=

  points={{0.105085, 0.311864}, {0.125424, 0.308475}, 
  {0.142373, 0.305085}, {0.147458, 0.301695}, 
  {0.154237, 0.29661}, {0.166102, 0.289831}, 
  {0.177966, 0.283051}, {0.189831, 0.276271}, 
  {0.201695, 0.269492}, {0.210169, 0.264407}, 
  {0.222034, 0.262712}, {0.237288, 0.259322}, 
  {0.250847, 0.255932}, {0.264407, 0.254237}, 
  {0.267797, 0.259322}, {0.271186, 0.264407}, 
  {0.281356, 0.261017}, {0.291525, 0.261017}, 
  {0.30339, 0.259322}, {0.310169, 0.250847}, 
  {0.316949, 0.240678}, {0.327119, 0.233898}, 
  {0.332203, 0.222034}, {0.337288, 0.208475}, 
  {0.345763, 0.2}, {0.354237, 0.194915}, 
  {0.362712, 0.189831}, {0.366102, 0.2}, 
  {0.376271, 0.208475}, {0.386441, 0.208475}, 
  {0.39661, 0.205085}, {0.40339, 0.19661}, 
  {0.410169, 0.186441}, {0.416949, 0.172881}, 
  {0.425424, 0.162712}, {0.428814, 0.150847}, 
  {0.432203, 0.140678}, {0.438983, 0.130508}, 
  {0.450847, 0.125424}, {0.462712, 0.122034}, 
  {0.471186, 0.118644}};

In[108]:=

  ListPlot[points, AspectRatio->Automatic];

In[109]:=

  usmexborder=SplineFit[points,Cubic]

Out[109]=

  SplineFunction[Cubic,{0., 40.},<>]

In[110]:=

  ParametricPlot[usmexborder[x],{x,0,14},PlotRange->All,Compiled->False];

You can evaluate the function usmexborder at any point along the border. Remember that the spline curve is a parametric curve; you you enter a parameter within the range of the parametrization and the output is the (x,y) pair at that parameter.

In[111]:=

  usmexborder[0]
  usmexborder[14]

Out[111]=

  {0.105085, 0.311864}

Out[112]=

  {0.267797, 0.259322}

The following command gives the type of spline (Cubic), the points used, and the coefficients of the polynomials that make up the spline (if you really want to know the function). See the next example.

In[113]:=

  InputForm[usmexborder]

Out[113]=

  SplineFunction[Cubic, {0., 40.}, 
    {{0.105085, 0.311864}, {0.125424, 0.308475}, 
     {0.142373, 0.305085}, {0.147458, 0.301695}, 
     {0.154237, 0.29661}, {0.166102, 0.289831}, 
     {0.177966, 0.283051}, {0.189831, 0.276271}, 
     {0.201695, 0.269492}, {0.210169, 0.264407}, 
     {0.222034, 0.262712}, {0.237288, 0.259322}, 
     {0.250847, 0.255932}, {0.264407, 0.254237}, 
     {0.267797, 0.259322}, {0.271186, 0.264407}, 
     {0.281356, 0.261017}, {0.291525, 0.261017}, 
     {0.30339, 0.259322}, {0.310169, 0.250847}, 
     {0.316949, 0.240678}, {0.327119, 0.233898}, 
     {0.332203, 0.222034}, {0.337288, 0.208475}, 
     {0.345763, 0.2}, {0.354237, 0.194915}, 
     {0.362712, 0.189831}, {0.366102, 0.2}, 
     {0.376271, 0.208475}, {0.386441, 0.208475}, 
     {0.39661, 0.205085}, {0.40339, 0.19661}, 
     {0.410169, 0.186441}, {0.416949, 0.172881}, 
     {0.425424, 0.162712}, {0.428814, 0.150847}, 
     {0.432203, 0.140678}, {0.438983, 0.130508}, 
     {0.450847, 0.125424}, {0.462712, 0.122034}, 
     {0.471186, 0.118644}}, 
    {{{0.105085, 0.02038907441381466968, 0., 
       -0.00005007441381466968189}, 
      {0.311864, -0.003364837091438011499, 0., 
       -0.0000241629085619885052}}, 
     {{0.125424, 0.02023885117237066064, 
       -0.0001502232414440090406, -0.003139627930926651602}\
       , {0.308475, -0.003437325817123977015, 
       -0.00007248872568596551645, 0.0001198145428099425567}
       }, {{0.142373, 0.01051952089670268775, 
       -0.009569107034223963847, 0.004134586137521276099}, 
      {0.305085, -0.003222859640066080377, 
       0.0002869549027438621538, -0.000454095262677781778}}, 
     {{0.147458, 0.003785065240818588354, 
       0.002834651378339864452, 0.0001592833808415471856}, 
      {0.301695, -0.004011235622611701403, 
       -0.00107533088528948318, 1.566507901184580257*10^-6}}\
      , {{0.154237, 0.009932218140022958815, 
       0.00331250152086450601, -0.001379719660887464821}, 
      {0.29661, -0.00615719786948711402, 
       -0.001070631361585929435, 0.0004488292310730434494}}, 
     {{0.166102, 0.01241806219908957637, 
       -0.0008266574617978884527, 0.0002725952627083120887}\
       , {0.289831, -0.006951972899439842541, 
       0.0002758563316332009146, -0.0001038834321933583753}}\
      , {{0.177966, 0.01158253306361873573, 
       -(8.871673672952190723*10^-6), 
       0.0002913386100542164513}, 
      {0.283051, -0.006711910532753515839, 
       -0.0000357939649468742163, 
       -0.00003229550229960994776}}, 
     {{0.189831, 0.0124388055464354807, 
       0.0008651441564896971631, -0.001439949702925177859}, 
      {0.276271, -0.006880384969546094113, 
       -0.0001326804718457040554, 0.0002340654413917981627}}\
      , {{0.201695, 0.009849244750639341453, 
       -0.003454704952285836412, 0.002079460201646494952}, 
      {0.269492, -0.006443549589062107735, 
       0.0005695158523296904336, 0.0007890337367324172998}}, 
     {{0.210169, 0.009178215451007153484, 
       0.002783675652653648439, -0.00009689110366080192068}\
       , {0.264407, -0.002937416674205474969, 
       0.002936617062526942332, -0.001694200388321467363}}, 
     {{0.222034, 0.0144548934453320446, 
       0.002493002341671242678, -0.001693895787003287289}, 
      {0.262712, -0.002146783714115992395, 
       -0.002145984102437459758, 0.0009027678165534521514}}, 
     {{0.237288, 0.0143592107676646681, 
       -0.002588685019338619183, 0.001788474251673951082}, 
      {0.259322, -0.003730448469330555456, 
       0.0005623193472228966979, -0.0002218708778923412435}}\
      , {{0.250847, 0.01454726348400928297, 
       0.00277673773568323406, -0.00376400121969251703}, 
      {0.255932, -0.00327142240856178579, 
       -0.0001032932864541270323, 0.001679715695015912822}}, 
     {{0.264407, 0.008808735296298200008, 
       -0.008515265923394317025, 0.003096530627096117017}, 
      {0.254237, 0.001561138103577698612, 
       0.004935853798593611434, -0.001411991902171310044}}, 
     {{0.267797, 0.001067795330797917011, 
       0.000774325957894034027, 0.001546878711308048966}, 
      {0.259322, 0.007196869994250991348, 
       0.0006998780920796813014, -0.002811748086330672648}}, 
     {{0.271186, 0.007257083380510131963, 
       0.005414962091818180927, -0.002502045472328312885}, 
      {0.264407, 0.0001613819194183360074, 
       -0.007735366166912336643, 0.004183984247494000633}}, 
     {{0.281356, 0.01058087114716155516, 
       -0.002091174325166757726, 0.001679303178005202574}, 
      {0.261017, -0.002757397671924335376, 
       0.004816586575569665259, -0.002059188903645329883}}, 
     {{0.291525, 0.01143643203084364743, 
       0.002946735208848849997, -0.00251816723969249742}, 
      {0.261017, 0.0006982087682790054928, 
       -0.001360980135366324391, -0.001032228632912681103}}, 
     {{0.30339, 0.00977540072946385516, 
       -0.00460776651022864226, 0.001611365780764787078}, 
      {0.259322, -0.005120437401191686597, 
       -0.004457666034104367697, 0.001103103435296054291}}, 
     {{0.310169, 0.005393965051300931873, 
       0.0002263308320657189747, 0.001159704116633349155}, 
      {0.250847, -0.01072645916351225912, 
       -0.001148355728216204823, 0.001705814891728463949}}, 
     {{0.316949, 0.009325739065332417287, 
       0.003705443181965766439, -0.002861182247298183723}, 
      {0.240678, -0.00790572594475927692, 
       0.003969088946969187023, -0.002843363002209910091}}, 
     {{0.327119, 0.008153078687369398998, 
       -0.004878103559928784728, 0.001809024872559385736}, 
      {0.233898, -0.00849763705745063315, 
       -0.004561000059660543256, 0.001194637117111176399}}, 
     {{0.332203, 0.003823946185189986747, 
       0.0005489710577493724781, 0.0007120827570606407761}, 
      {0.222034, -0.01403572582543819047, 
       -0.000977088708327014051, 0.001453814533765204522}}, 
     {{0.337288, 0.007058136571870654032, 
       0.002685219328931294807, -0.001268355900801948836}, 
      {0.208475, -0.011628459640796605, 
       0.003384354892968599514, -0.0002308952521719945159}}, 
     {{0.345763, 0.008623507527327397138, 
       -0.001119848373474551702, 0.0009703408461471545714}, 
      {0.2, -0.005552435611375389522, 
       0.002691669136452615966, -0.002224233525077226445}}, 
     {{0.354237, 0.009294833318819757446, 
       0.00179117416496691201, -0.002611007483786669478}, 
      {0.194915, -0.006841797913701836927, 
       -0.003981031438779063368, 0.00573882935248090029}}, 
     {{0.362712, 0.005044159197393573028, 
       -0.006041848286393096425, 0.0043876890889995234}, 
      {0.189831, 0.002412627266182737208, 
       0.01323545661866363751, -0.005479083884846374706}}, 
     {{0.366102, 0.006123529891605950374, 
       0.007121218980605473768, -0.003075748872211424137}, 
      {0.2, 0.0124462888489708881, 
       -0.003201795035875486612, -0.000769493813095401484}}, 
     {{0.376271, 0.0111387212361826255, 
       -0.00210602763602879864, 0.001137306399846173144}, 
      {0.208475, 0.003734217337933710423, 
       -0.005510276475161691063, 0.00177605913722798064}}, 
     {{0.386441, 0.01033858516366354765, 
       0.00130589156350972079, -0.001475476727173268433}, 
      {0.208475, -0.001958158200705729784, 
       -0.0001820990634777491446, -0.001249742735816521074}}\
      , {{0.39661, 0.008523938109163183931, 
       -0.003120538618010084511, 0.001376600508846900583}, 
      {0.205085, -0.006071584535110791292, 
       -0.003931327270927312362, 0.001527911806038103652}}, 
     {{0.40339, 0.006412662399683716657, 
       0.001009262908530617239, -0.0006429253082143338915}, 
      {0.19661, -0.009350503658851105063, 
       0.0006524081471869985887, -0.001470904488335893533}}, 
     {{0.410169, 0.006502412292101949462, 
       -0.0009195130161123844337, 0.001197100724010434947}, 
      {0.186441, -0.01245840082948478848, 
       -0.003760305317820682007, 0.002658706147305470499}}, 
     {{0.416949, 0.008254688431908485436, 
       0.002671789155918920413, -0.002451477587827405846}, 
      {0.172881, -0.012002893023209741, 
       0.004215813124095729493, -0.002381920100885988499}}, 
     {{0.425424, 0.006243833980264108724, 
       -0.004682643607563297124, 0.001828809627299188401}, 
      {0.162712, -0.01071702707767624751, 
       -0.002929947178562236005, 0.001781974256238483512}}, 
     {{0.428814, 0.002364975647035079679, 
       0.0008037852743342680788, 0.0002202390786306522462}, 
      {0.150847, -0.01123099866608526898, 
       0.002415975590153214531, -0.001353976924067945539}}, 
     {{0.432203, 0.004633263431595572575, 
       0.001464502510226224819, 0.0006822340581782026075}, 
      {0.140678, -0.01046097825798267654, 
       -0.001645955182050622089, 0.001936933440033298626}}, 
     {{0.438983, 0.009608970626582630037, 
       0.00351120468476083264, -0.001256175311343462669}, 
      {0.130508, -0.007942088301984024842, 
       0.004164845138049273787, -0.001306756836065248937}}, 
     {{0.450847, 0.01286285406207390731, 
       -0.0002573212492695553668, 
       -0.0007405328128043519372}, 
      {0.125424, -0.003532668534081224078, 
       0.000244574629853526974, -0.0001019060957723029044}}, 
     {{0.462712, 0.01012661312512174076, 
       -0.002478919687682611176, 0.0008263065625608703914}, 
      {0.122034, -0.003349237561691078843, 
       -0.0000611436574633817378, 0.00002038121915446057926}}
      }]

Up to Example