Overflow check in Java?

Sharky Forums


Results 1 to 11 of 11

Thread: Overflow check in Java?

Threaded View

  1. #1
    Tiger Shark
    Join Date
    Oct 2000
    Location
    Erie, PA, USA
    Posts
    693

    Overflow check in Java?

    Is there a way to check for overflow of doubles in java? I'm working on a Raytracing application and I'm getting some anomolies with portions of infinite planes showing up where they shouldn't be. I've deduced that this is because the z value of the intersection of a ray and the plane x = constant, for instance, overflows for some rays. This causes the intersection distance to be less than it actually is, so the color of that plane shows up instead of the color of a different (correct) object.

    So I'd like to detect overflow and throw away that intersection value if possible. Any ideas?

    Here's a pic, so you see what I mean.
    The Green plane is z = 300.0
    The Blue plane is y = -50.0
    So they should meet at a horizontal line and the green one should go all the way to the top, but the blue one interferes.
    Image

    I can post code if you want, but I really think it's just the overflow thing that's the problem.
    Last edited by Malone; 09-30-2003 at 12:14 PM.
    AMD AthlonXP 2600+ Thoroughbred B @ 200x10.5
    Shuttle AN35N nForce2 Ultra 400
    2x512MB Kingston PC3200 (3-3-3)
    ATI Radeon 9600 Pro
    40GB WD ATA-100 8MB cache
    Creative 12X DVD Drive
    Memorex 52X CD-RW
    Running Windows XP Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •