I'm working with Infinity to use in my Sweep AABB collision detection. How I implemented infinity was simple:
Problem is, is that I can multiply regular numbers to INFINITY, but if I multiply a variable to it, I get an overflow. So for example, since there is no movement, Collision_Time equals -INFINITY, as in negative infinity:
The line that has Result = Velocity.X * Collision_Time got the overflow. Which doesnt make sense because Infinity * 0 = 0. I do not wanna use error checking as it will slow down this sub, and I plan on using 100s of objects to check for collision, so that slowdown will add up. Is there any way I can work with a variable that has Infinity for simple multiplication? Thanks in advance.
vb Code:
Public INFINITY As Double Public Sub Initialize_Infinity() On Error Resume Next INFINITY = 1 / 0 End Sub
Problem is, is that I can multiply regular numbers to INFINITY, but if I multiply a variable to it, I get an overflow. So for example, since there is no movement, Collision_Time equals -INFINITY, as in negative infinity:
vb Code:
Public Sub Collision_Response() Dim Velocity As D3DVECTOR2 Dim Result As Single Dim Collision_Time As Single Collision_Time = Sweep_Collision_Detection(P1, Puck) Velocity = Vector_Subtract(P1.Position, P1.Old_Position) Result = Velocity.X * Collision_Time End Sub
The line that has Result = Velocity.X * Collision_Time got the overflow. Which doesnt make sense because Infinity * 0 = 0. I do not wanna use error checking as it will slow down this sub, and I plan on using 100s of objects to check for collision, so that slowdown will add up. Is there any way I can work with a variable that has Infinity for simple multiplication? Thanks in advance.