Saturday, May 3, 2008

Script Kiddies

I have the following 6 scripts for the script project:

My Home Page
My home page actually serves double duty. It has both a script to manage the drop down menu and a script to manage the opening of a new window with the picture.

Poem Page
This page has a javascript that tells you when you accessed the page.

Super Secret
A php script for the Super Secret Society Login.

Links page php
A php script that builds a links page based on a flat file.

Script for Redesign proejct
This is a script that builds a gallery detail page for the Dale Helms site using the Drupal Content Management System. It's called by another page, but it does it's job. Pretty nifty.

Friday, May 2, 2008

Of Intersection Tests and Floating Point Error

XNA's Ray-Sphere Intersection test returns true with a distance of zero if the Ray originates inside the sphere.

This is great for games. Very fast. Avoids all the lengthy distance calculations and just kicks out an indication of collision.

This is not good for ray-tracers. The transmitted ray specifically looks at what happens when a ray travels through a translucent object. The requires us to spawn a ray within a spherical boundary and find the intersection on the other side.

I've tried writing a new sphere intersection test. There are a couple that I've found that I really like, and are very slick. The problem? C#'s floating point numbers aren't accurate enough to support them. Whatever XNA's BoundingSphere is doing, it's accurate enough for these calculations, whereas I can't figure out how to make mine accurate enough.

So I'm going to try to fake it. I'm going to use the XNA sphere test for external intersections, and my own for internal calculations. Once I know that I'm inside from the other one, hopefully I'll be accurate enough on my own.

Using XNA's vector class may have been a mistake here. Probably should've rolled our own using double precision numbers.