Tag Info

New answers tagged

1

For anyone tired of holding their breath for the bug fix, here is how you construct a second order nurbs interpolation directly: b2[n_, k_, u_] := Piecewise@{ {(u - k[[n]])^2/((k[[n]] - k[[n + 1]]) (k[[n]] - k[[n + 2]])), k[[n]] <= u < k[[n + 1]]}, {Total[ ((u - k[[n + #]]) (u - k[[n + 2 + #]]))/ ...


0

My approach, since BSplineFunction evaluates to a pair of numbers only when t is numeric, would be wrap the difference in a function protected by ?NumericQ: rooteq[t_?NumericQ] := First[k[0]] - First[f[t]] FindRoot[rooteq[t], {t, .5, 0, 1}] (* {t -> 0.674177} *) f[t] /. % k[0] (* {-4.93131, 2.99958} {-4.93131, 2.99958} *) The problem with the ...


1

Here is an arc-length reparametrization in terms of a function tfn that maps the arclength to the parameter t. It's important to use AspectRatio -> Automatic to get the spacing even. There are two truncation-error issues with parametrizing the full length of the curve. One is that the stopping point is found by stepping past the end of the curve. ...


5

SeedRandom[4]; pts = Table[{x, y, 0.25 + UnitStep[30 - Abs[x] - 0.001] UnitStep[50 - Abs[y] - 0.001] (0.25/RandomReal[{0.1, 2}]^2)}, {x, -30, 30, 5}, {y, -50, 50, 5}]; ParametricPlot3D[ BSplineFunction[pts, SplineDegree -> 2][u, v], {u, 0, 1}, {v, 0, 1}, PlotRange -> All, Boxed -> False, Axes -> False, Mesh -> None, ...


1

Clear["Global`*"] pts = {{1, 1}, {2, 3}, {3, -1}, {4, 1}, {5, 0}}; f1 = Interpolation[pts, InterpolationOrder -> 1]; f2 = BSplineFunction[pts]; Show[Graphics[{Red, Point[pts], PointSize[0.02], Point[f2 /@ {0.2, 0.4}], Green, Line[pts]}, Axes -> True], ParametricPlot[f2[t], {t, 0, 1}]] First,determine approximate range of t, in my example ...



Top 50 recent answers are included