there,
I'm drawing a contour (in x
,z
plan) with opengl, then I want to know if a point is inside or outside of the contour. so I get the xmin
, xmax
, ymin
et ymax
values of that contour ( right now is just a circle) then I add -delta
to each min value, and +delta
to each max value.
then I doing this :
for(GLfloat x=getXmin()-getDelta();x<=getXmax()+getDelta();x+=getDelta())
for(GLfloat y=getYmin()-getDelta();y<=getYmax()+getDelta();y+=getDelta()){
...
}
I would like to get this :
but I got this :
I don't want to be close of the contour, because I fear a day to have the contour so close, than I'll get errors when I'll do some calculus. Since the problem comes from floating values. To solve this I can just do
for(GLfloat x=getXmin()-getDelta();x<=getXmax()+2.*getDelta();x+=getDelta())
for(GLfloat y=getYmin()-getDelta();y<=getYmax()+2.*getDelta();y+=getDelta()){
...
}
(dat's how I got the first picture)
So, I would like to know if it's the good way to just make the maximum value bigger... To be honnest, when I was writing this piece of code, I thought that adding +delta
will ensure to don't be close of the contour
for information :
getXmax()
return the value 1.2
,
getDelta()
return the value 0.1
getXmin()
return the value -0.699135