1

Consider the already well answered topic : Get x and z coordinate from an image and make a parametric surface of revolution.

wineGlassPoints = {{32.75, 283.75}, {37.75, 275.75}, {43.25, 267.25}, {49.25, 256.75},
               {53.75, 247.75}, {58.25, 236.25}, {61.75, 224.25}, {64.25, 211.75},
               {65.25, 198.75}, {64.25, 185.75}, {61.75, 174.25}, {58.25, 165.75},
               {53.25, 157.25}, {46.25, 149.25}, {38.75, 143.75}, {30.25, 139.75},
               {23.25, 137.25}, {17.75, 135.25}, {13.75, 134.75}, {13.75, 128.75},
               {10.25, 126.75}, {7.25, 122.25}, {5.75, 115.75}, {4.75, 109.25},
               {4.25, 101.25}, {3.75, 88.25}, {3.75, 70.25}, {3.75, 53.75},
               {4.75, 39.75}, {6.75, 25.75}, {8.25, 20.25}, {11.25, 16.75},
               {17.25, 14.25}, {25.25, 11.25}, {33.75, 9.25}, {41.25, 7.75},
               {48.25, 5.75}, {48.75, 0.25}};

parametrizeCurve[pts_List, a : (_?NumericQ) : 1/2] := FoldList[Plus, 0, Normalize[(Norm /@ Differences[pts])^a, Total]] /; MatrixQ[pts, NumericQ]

tvals = parametrizeCurve[wineGlassPoints] {0, 0.0274652, 0.0559174, 0.0870137, 0.115379, 0.146802, 0.178417, 0.210343, 0.242632, 0.27492, 0.305596, 0.332707, 0.360788, 0.389942, 0.417212, 0.44462, 0.468999, 0.490631, 0.508584, 0.530488, 0.548441, 0.569236, 0.592332, 0.615263, 0.64058, 0.672833, 0.71077, 0.747093, 0.780593, 0.814221, 0.835571, 0.85477, 0.877568, 0.903705, 0.930129, 0.954859, 0.978986, 1.}

wineGlassFunction = Interpolation[Transpose[{tvals, wineGlassPoints}]];

The function wineGlassFunction[t] allow for finding a coordinate {x,y} depending on a parameter t. Let consider only the first output x.

I would like to find the intersection(s) between this parametric interpolated curve and an infinite line given by the coordinate x=30.

What I've tried so far :

wineGlassFunction[0.2][[1]]
(*29.4744*)

Okay, so the solution I'm looking for is located around t=0.2. So now I've tried the following functions :

FindRoot[wineGlassFunction[t][[1]] == 30, {t, 0.2}]
NSolve[wineGlassFunction[t][[1]] == 30, t]
NMinimize[{wineGlassFunction[t][[1]] - 30, 0 <= t <= 1}, t]

I'd like a method which give me the t values corresponding to the intersections of a infinite vertical line. Thank for your advices.

Jocelyn Minini
  • 612
  • 3
  • 8

1 Answers1

1

I do not know why directly using wineGlassFunction[t][[1]]does not work. It looks like MNMA tries some erreneous symbolic simplifications. Because, if you define an auxiliary function "fun" with an numeric argument,it will works:

Clear[fun]
fun[t_?NumericQ] := wineGlassFunction[t][[1]]

FindRoot[fun[t] == 30, {t, 0.2}] (* {t -> 0.198429} *)

If you define the same function without requesting that the argument is numeric, you get the wrong result:

Clear[fun]
fun[t_] := wineGlassFunction[t][[1]]

FindRoot[fun[t] == 30, {t, 0.2}] (* {t -> 30.} *)

Daniel Huber
  • 51,463
  • 1
  • 23
  • 57