Re: Confusion about splitting classes to allow sharing of resources



m.a.stijnman@xxxxxxxxxxxxxx wrote:

Hang Dog wrote:

m.a.stijnman@xxxxxxxxxxxxxx wrote:

probably should generate an error when the knot vectors are shared.

I

imagine further that any spline that share a knot vector that is

not

explicitly expanded (such as Splines for p and q) gets expanded

with a

default value - or it might be better to require all splines to be
given a new value explicitely
before more points can be added.


Share the KnotVector class via reference counted pointers. If the reference count is not one when adding a point to a curve then copy

the

KnotVector and replace the reference pointer in the curve with the

copy.

I think you are confusing Curves and Splines here, but beyond that, it
does sound like a good idea to provide the functionality of splines
being allowed to split off with a local copy of the knotvector. I think
in this context it doesn't really apply though - it will make adding
points to each of a linked set of splines highly efficient and loose
the coupling in the process.


Alternatively avoid all the complication and don't bother sharing.
Unless you can share vast numbers of KVs the amount of memory saving
will be fairly minimal.


It's not just the memory saving I'm after (although that would be very
nice indeed) but also so it would be easier to manipulate the knots of
the spline in unison - and hopefully more efficient too. It also
guarantees that the knot vectors stay in sync at all times. But I
agree, it might not be worth the trouble...


Ah right sorry, I'm conditioned to seeing Spline as a subclass of Curve, interpolate a method on Curve, and KnotVector an implementation detail.


.



Relevant Pages

  • Confusion about splitting classes to allow sharing of resources
    ... I'm using cubic splines to model two-dimensional parametric curves ... I use this in my current Curve class. ... the Spline class a reference to a external knot vector. ... Adding new interpolation variables in subclasses of Curve will then ...
    (comp.object)
  • Re: solving the equation [ spline way ]
    ... Information about the location of its endpoints ... Information about the slope of the fitted curve ... At the end Tis not a single cubic curve, ... the complications of cubic splines. ...
    (sci.math)
  • Re: Getting smooth Bezier curves in SVG
    ... open source library that can convert clothoid splines into bezier ... splines: libsprio. ... So you could calculate just a bunch of points on your curve (probably ... that into a bezier spline for output into SVG. ...
    (comp.graphics.algorithms)
  • Re: Confusion about splitting classes to allow sharing of resources
    ... >> probably should generate an error when the knot vectors are shared. ... >> default value - or it might be better to require all splines to be ... > Share the KnotVector class via reference counted pointers. ... > reference count is not one when adding a point to a curve then copy ...
    (comp.object)