# Quincunx Sampling

Hello, i am an spanish architect very interested in realistic simulations. You can see my work in www.chroma-e.com . Until now i have been working with Lightscape but now i would like to go deep in the code to adequate this kind of programs to my work. I dont know if it´s going to be impossible for me to understand the code because i am not a proggrammer but i am trying it. I have started with oconv, and now i am with rpict but i am a bit stop up with the quincunx sampling:
hstep=(psample*140+49)/99
ystep=(psample*99+70)/140
why this numbers??, can you help me??
thanks and sorry for my English,

Ignacio Munárriz
Escuela de Arquitectura, Universidad de Navarra

Hi Ignacio,

I'm not sure it's worthwhile to attempt to understand the code at this level of detail, but the numbers are just an integer approximation of the following quincunx (diamond) step size formulas:

horizontal_step = sample_spacing*sqrt(2)
vertical_step = sample_spacing*sqrt(2)/2

There's no reason, really, not to do this calculation in floating point as it's only done once at the beginning, but I chose to do it using integer math all the same.

-Greg

From: "etsaweb" <etsaweb@unav.es>
Date: December 4, 2003 3:49:29 AM PST

Hello, i am an spanish architect very interested in realistic simulations. You can see my work inwww.chroma-e.com.�Until now�i have been working with Lightscape but now i would like to go deep in the code to adequate this kind of programs to my work. I dont know if it�s going to be impossible for me to understand the code because i am not a proggrammer but i am trying it. I have started with oconv, and now i am with rpict but i am a bit stop up with the quincunx sampling:
hstep=(psample*140+49)/99
ystep=(psample*99+70)/140
why this numbers??, can you help me??
thanks and sorry for my English,

Ignacio Mun�rriz
Escuela de Arquitectura, Universidad de Navarra