After going round and around trying to get tan()/tanh() to do what I wanted, I ended up with using (relatively) simple exponentiation:

sub myCurve { my( $x, $p ) = ( @_, 5 ); my $sgn = $x <=> 0; $sgn * abs( $x )**$p; }

The jiggery pokery with the sign is so that I can supply input in the range -1 .. 1 and get the rotational symmetry I wanted.

Its effect is demonstrated in this image. You'll probably need to zoom in to read the text and see the effect clearly.

The top 10 pixel band, labelled "X->Y", is a simple linear path through the relevant hsv space; and the second band ("X**1") is identical but with the coordinates passed through my mapping algorithm with the exponent set to 1 to check it follows the same path.

The third band "x**2" is the input coordinates passed through the mapping with the exponent set to 2. This shows the effect I was after, that of reducing the near black and near white ~3rds at either end and stretching the middle 3rd to fill the space.

The other bands are higher exponents showing that the effect is configurable to a high degree. It looses some of the black and white at either end due to truncation to integer pixels which I can probably live with, or I could just replace the highest and lowest values in the gradient with black and white.

This is only curving the gradient in 2D at the moment; I've still to get the mapping right for the third dimension (hsv-V), but I'll get there.

Thanks for your input.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: A data selection problem(in3D).(Dammit! New requirement.) by BrowserUk
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.