Suggestion 1: given a parameter p that goes from -1 to 1, non-inclusive, you could do f(p) = tan(p*pi/2), but that doesn't give much control of the slopes. Given the logistic(p,L,K) = L / (1 + exp(-k*p)), you could do something like f(p) = tan( (2*logistic(p,L,K)-1)*pi/2 ), which allows some tuning... but I'm still not sure it's really tunable enough

Even before this additional wrinkle, I was cogitating that maybe going the route of a Bezier curve would be the right way to go: given a set of k coordinates P_i for i=(0..k-1), where each coordinate is in n-dimensional space, you could use a (k-1)th-order Bezier to "get near" each of those k points (exactly hitting the two endpoints). For example, if your k=5 coordinates were the (H,S,V) for white, yellow, bright gold, dark gold, black -- then you could do a quartic Bezier (the wp article goes to cubic, but quartic would just be f(t) = (1-t)**4 * P0 + 4*(1-t)**3 * t * P1 + 6*(1-t)**2 * t**2 * P2 + 4*(1-t) * t**3 * P3 + 1*t**4 * P4. Or it might be easier to do a piecewise quadratic or cubic Bezier. The benefits of various Bezier is you can plop those points anywhere (you can make a circle out of four piecewise Beziers) to make highly arbitrary points... and you can tune them to get wonderfully sharp slopes.


In reply to Re^3: A data selection problem(in3D).(Dammit! New requirement.) by pryrt
in thread A data selection problem(in3D). by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.