Экран -> Комплекс
Конверсия:
screenPointX .. X coordinate on the screen
screenPointY .. Y coordinate on the screen
screenWidth .. width of the screen
screenHeight .. height of the screen
re .. real component of resulting complex
im .. imaginary component of resulting complex
re = 3 * screenPointX/screenWidth - 2
im = 1 - 2 * screenPointY/screenHeight
Пример C++
реализация:
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);
}
Просто переставить другой путь вокруг.
Это не вопрос программирования. Помните, вы уверены, что хотите «-2» в верхнем левом углу, а не '-1'? –
yeh im sure its -2, а не -1 – gmoney
Исследуйте определяемые пользователем литералы –