Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re: Re: Re: 3D Point Plotting by Merlin42
in thread 3D Point Plotting by Anonymous Monk

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found