Tag Info

New answers tagged

1

The definition of B-Spline curve $$\vec{C}(u)=\sum _{i=0}^n N_{i,p}(u) \vec{P}_i \qquad (a\leq u\leq b)$$ where, $P_i$ is the control point, the $N_ {i, p} (u)$ are the pth - degree Bspline basis functions defined on the nonperiodic (and nonuniform) knot vector. To speed up the visualization of B-Spline curve, I must simplify this equation. In ...


3

The plot is sped up substantially if you use Evaluate: ParametricPlot[ Evaluate[ Total@MapIndexed[NBSpline[First@#2 - 1, p, knots, u] #1 &, pts]] , {u, a, b}, opts] (I only looked a trial 1 , but I think your other try have the same issue ) It helps a little more if you remove the Simplify from NBSpline and simplify the whole ...


2

Re: your error BSplinePlot2[pts : {{_, _} ..}, knots_, opts : OptionsPattern[{Plot, BSplinePlot}]] := Module[{p = Length@First@Split[knots] - 1, a, b}, {a, b} = {First[knots], Last[knots]}; With[{a1 = a, b1 = b}, ParametricPlot[ Total@MapIndexed[NBSpline[First@#2 - 1, p, knots, u] #1 &, pts], {u, a1, b1}, Evaluate[Sequence @@ ...


2

It is easiest when each options controls something that is more or less independent of other options. If as in your example each combination of options results in (the need for) a different subroutine things do get complicated. A basic strategy is to look for repetitions segments of code an replace them with a single copy. For example in your ...



Top 50 recent answers are included