Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Distance Between a B-Spline Surface & Point

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132235] Distance Between a B-Spline Surface & Point
  • From: Bill <WDWNORWALK at aol.com>
  • Date: Tue, 21 Jan 2014 03:02:48 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Hi:

My objective: Find the Distance Between a B-Spline Surface and a Point, {2,3,4}. 

(Note: The point {2,3,4}, is not on the B-spline surface.)


Below is the Mathematica 8.0.4. code I used to try and find the closest point on the B-spline surface to the point {2,3,4}:

cpts={{{1,1,-0.574058},{1,2,0.390267},{1,3,0.616214},{1,4,-0.115722},{1,5,0.436663}},{{2,1,0.809682},{2,2,-0.741927},{2,3,-0.865916},{2,4,-0.0998629},{2,5,-0.241853}},{{3,1,-0.196909},{3,2,0.796108},{3,3,-0.0602901},{3,4,0.486659},{3,5,-0.0134192}},{{4,1,0.657334},{4,2,-0.917066},{4,3,0.98301},{4,4,-0.875938},{4,5,-0.030303}},{{5,1,-0.549654},{5,2,0.786582},{5,3,-0.667232},{5,4,0.568884},{5,5,0.554108}}};

f=BSplineFunction[cpts];

gx[u_?NumericQ,v_?NumericQ]:=f[u,v][[1]]
gy[u_?NumericQ,v_?NumericQ]:=f[u,v][[2]]
gz[u_?NumericQ,v_?NumericQ]:=f[u,v][[3]]

NMinimize[{(x-2)^2 +(y-3)^2+(z-4)^2<=5 && x==gx && y==gy && z==gz},{x,y,z,u,v}]

Out(Error message.)


Questions: Can this be done using NMinimize? If so, how should this be coded? If not, how can this be done using Mathematica.


Thanks again,

Bill W.



  • Prev by Date: Re: How to show 1+2+3+ ... = -1/12 using Mathematica's symbols?
  • Next by Date: Re: Unnecessary parentheses around TagBox for MakeBoxes?
  • Previous by thread: Re: BSplineSurface & BSplineFunction_Extracting Data
  • Next by thread: Re: Distance Between a B-Spline Surface & Point