I am trying to draw a 3D tile grid that can be rotated and elevated.
The grid though, when rotated sometimes, does not show the graphics as it should, and mutilates them. The regular grid should look nothing like this.
The top half should not be present.

Can anyone help explain or give examples as to what may be causing this issue?
Just found something else: When you see the spike appear, on one side of your screen, on the opposite, that tile is missing. :

I found that if you set
azimuthto 133,elevationto 324,zmodto -0.9, leavexmodat 0 and change the grid to 7 × 7 instead of 10 × 10, then only one single point ‘misbehaves’. For this one misbehaving point, we have:i= 48,j= 3,x0= 7.0,y0= 0.0,z0= 6.1,x1= -0.31273127,y1= 5.4544506,z1= -7.5074077,near= 6.0 andnearToObj= 1.5,just before the following two lines:
The critical thing here is that
z1 + near + nearToObjhas crossed below zero. As it crossed below zero, it caused the sign of the values ofx1andy1calculated by the above two lines to change. This sign change is what causes the grid to appear wrong.I’m no expert in 3D graphics, but I believe this outcome suggests that you can’t plot the point in question because it has gone behind the camera. I’m afraid I’m not sure what the best way to solve this problem would be – that would require more knowledge of 3D graphics than I have.
As for my other answer, it was totally wrong, so I’ve deleted it. If I was going to claim that the Java 2D graphics API was any doing wrapping using 16-bit integers, I could at least have tried to verify that
and
produced the same output. They do not.