Re: Intersect Point of a 3D Parametric Line & B-Spline
- To: mathgroup at smc.vnet.net
- Subject: [mg132172] Re: Intersect Point of a 3D Parametric Line & B-Spline
- From: Itai Seggev <itais at wolfram.com>
- Date: Thu, 9 Jan 2014 03:51:04 -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
- References: <20140108035226.99D546A06@smc.vnet.net>
On Tue, Jan 07, 2014 at 10:52:26PM -0500, Bill wrote:
> Hi:
>
> I have the following Mathematica 8.0.4. code that plots a parametric 3D line and a surface using BSplineSurface.
>
> paraLine=ParametricPlot3D[{2+t,2+t 3,t 2}, {t,-1,1},PlotRange -> {{0, 5},{0, 5},{-1, 1}}, PlotStyle->{Red,Thickness[0.004]},ViewPoint->{4,2,1}, AxesLabel -> {"X", "Y", "Z"},Background->LightYellow,ImageSize->500];
> cpts={{{1,1,-0.5740579178735179`},{1,2,0.3902669640296943`},{1,3,0.6162142022057271`},{1,4,-0.11572153782589911`},{1,5,0.436662579150056`}},{{2,1,0.8096824307907462`},{2,2,-0.7419265507701529`},{2,3,-0.8659156744537175`},{2,4,-0.0998628811371658`},{2,5,-0.24185346526195106`}},{{3,1,-0.1969086942688163`},{3,2,0.7961076758026819`},{3,3,-0.060290070096196136`},{3,4,0.48665856202059254`},{3,5,-0.013419247141178037`}},{{4,1,0.6573342854316904`},{4,2,-0.9170657725998455`},{4,3,0.9830103505987027`},{4,4,-0.8759376369982923`},{4,5,-0.03030297194593956`}},{{5,1,-0.549653902873303`},{5,2,0.7865815336945703`},{5,3,-0.6672322036832838`},{5,4,0.5688838564868042`},{5,5,0.5541079809436917`}}};
> surf=Graphics3D[BSplineSurface[cpts]];
> Show[paraLine,surf]
>
>
> Question: How can the intersect point coordinates of the line and surface be found by using Mathematica?
>
> I think the Mathematica code maybe something like this:
>
> NSolve[x==2+t && y==2+t 3 && z==t 2 && (?),{x,y,z,t}]
>
> but I don't know how to enter the BSplineSurface.
>
> Bill W.
NSolve can't handle this, but if you use BSplineFunction to create a parametric
representation of your curve, you can do this with FindRoot (note that you must
use the secant method, as the Jacboian matrix can't be computed).
In[57]:= spline = BSplineFunction[cpts];
In[58]:= curve[t_] = {2 + t, 2 + t 3, t 2}
Out[58]= {2 + t, 2 + 3 t, 2 t}
In[71]:= FindRoot[curve[t] == spline[u, v], {{t, 0, 0.1}, {u, 0, 0.1}, {v, 0,
0.1}}]
Out[71]= {t -> -0.043517, u -> 0.191361, v -> 0.170743}
In[72]:= curve[t /. %]
Out[72]= {1.95648, 1.86945, -0.0870339}
In[73]:= spline[Sequence @@ ({u, v} /. %%)]
Out[73]= {1.95648, 1.86945, -0.0870339}
>
--
Itai Seggev
Mathematica Algorithms R&D
217-398-0700
- References:
- Intersect Point of a 3D Parametric Line & B-Spline Surface
- From: Bill <WDWNORWALK@aol.com>
- Intersect Point of a 3D Parametric Line & B-Spline Surface