Ok first I want to apoligize for my previous post ... the formulas are fscked up. Rather than try to fix them for the general case Ill give you a simple version that will work for your specific case.
for each point R,G,B contained in (0,1)x(0,1)x(0,1):
X=(R-0.5)/(B+1)*IMAGE_WIDTH + IMAGE_WIDTH/2
Y=(G-0.5)/(B+1)*IMAGE_HEIGHT + IMAGE_HEIGHT/2
You can change the 1 to 'dolly' the camera back and forth.
Just swap the variables to view along a different color axis.
To view not along a color axis you need to rotate the points before hand. eg
R'= R*cos(theta)+G*sin(theta)
G'=-R*sin(theta)+G*cos(theta)
B'= B
to rotate about the B axis
R'= R
G'= G*cos(theta)+B*sin(theta)
B'=-G*sin(theta)+B*cos(theta)
to rotate about the R axis, and
R'=R*cos(theta)-B*sin(theta)
G'=G
B'=R*sin(theta)+B*cos(theta)
to rotate about the G axis
Geez I can't get anything right...maybe this really isnt as simple as I said :). The formulas should now map the entire RGB space into the image ... if you rotate the space then the corners will not be visible ... fix this by increasing the value added to the denomiator.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.