I'm writing a program to draw a three-dimensional cube (with a corner cut off) without using any 3D graphics APIs. The only API call I make is win32's SetPixel()
Everything is going great. I've drawn lines, faces, and even the entire cube. Then rotation came along.
For some reason, when I rotate my cube, it begins to shrink. I became confused, then I realised something. Floating point numbers are truncated.
Here's some code that is fired everytime the user presses 'X' on the keyboard.
Code:
p->setY( p->getY() * cos(5.0/180.0*PI) - p->getZ() * sin(5.0/180.0*PI));
p->setZ( p->getY() * sin(5.0/180.0*PI) + p->getZ() * cos(5.0/180.0*PI));
p is a Point object that I created. Here the Y value and the Z value of the Point are being set. The problem is everytime X is pressed, and this code is fired, a small amount of precision is lost. As a result, the cube shrinks.
I'm really completely stumped. I remember when studying assembler that floating point numbers can be truncated or rounded. I think rounding would solve my problem. Since 50% of the time the value would round up, and 50% of the time the value would round down.
Whereas with truncation values are always lost, and never gained.
If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and the second one is for a sub navigation (which is a small box). I am trying to write an IF statement so
Error in write byte array into document in SM58
Hi Gurus,
Redirecting Admin
In my members table, I have a field called "perm" and it's set to zero for all members. However, I have two administrators, and theirs are set to 1.I want my members page that shows up on
Automatic Webpage ??
I have a page www.mysite.com/test.php with a <form> <textarea name="data" cols="100" rows="20"></textarea> //to enter the
Using Curl_multi for processing multiple URLs
Hi,I am at a loss as to how to implement this. I would like to be able to automatically assign a number of urls taken from a file to x amount of curl_multi handles determined by the user on the form,
help with Get_
ok some how this is not working i am not sure what i am doing wrong here but what this does is when the user goes to Secret-Codes.php they get a menu and when they pick the phone they want to view it
Simpler method of getting variables from mysql
Hi Guys,I'm trying to streamline my CMS's code and as I was writing a new page it occured to me that there might be an easier way to get variables from a mysql query and that if anyone knew how to do
Forms Authentication and Refresh at Login page
Hello,
Retrieving Data from Two Different Databases
Hello All, Ran into another problem and would appreciate some help! I have two databases, publications_db (pub_id, title, author, yr, journal, num_pages) and
Php Mysql Page Loading Notice
Hi all,I was wondering if there is a way (Sure there is) of showing a message or an image while a page is loading.The issue is that I have a big table and I'm running some queries against it.Obviously