c# - Converting Screen Coordinates to Complex Coordinates -
can please show me how convert screen coordinates complex? picture shows specific details conversion 
providing steps of how relationship between 2 appreciated.
thanks
screen -> complex
conversion:
screenpointx .. x coordinate on screen screenpointy .. y coordinate on screen screenwidth .. width of screen screenheight .. height of screen re .. real component of resulting complex im .. imaginary component of resulting complex re = 3 * screenpointx / screenwidth - 2 im = 1 - 2 * screenpointy / screenheight example c++ implementation:
template<class t> std::complex<t> screentocomplex( t screenpointx, t screenpointy, t screenwidth, t screenheight) { t re = 3 * screenpointx / screenwidth - 2; t im = 1 - 2 * screenpointy / screenheight; return std::complex<t>(re, im); } just rearrange other way around.
Comments
Post a Comment