Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12046 Posts in 1593 Topics- by 595 Members - Latest Member: KeelmHaxabefe

23. May 2013, 12:55:27 am
Xith3D CommunityXith3D InternalsDeveloper discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)Bug in FirstPersonInputHandler?
Pages: [1]
Print
Author Topic: Bug in FirstPersonInputHandler?  (Read 1604 times)
synopia
Just dropped in

Offline Offline

Posts: 3


View Profile
« on: 25. March 2008, 10:37:51 am »

Rev 1327, FPIHMovementConstraints.java, L128

If any value in viewEuler is Infinity, those while loops will never end.

have a nice day and thanks for xith ;-)
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 25. March 2008, 02:24:18 pm »

Rev 1327, FPIHMovementConstraints.java, L128

If any value in viewEuler is Infinity, those while loops will never end.

have a nice day and thanks for xith ;-)

Thanks for the hint. I will fix that soon.

Marvin
Logged
Pandaemonium
Enjoying the stay
*
Offline Offline

Posts: 85


If at first you don't succeed; call it version 1.0


View Profile
« Reply #2 on: 25. March 2008, 07:57:08 pm »

I've seen that code too and wondered about that. Shouldn't that logic simply use a mod with 2*pi to limit euler, instead of the while loop?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #3 on: 25. March 2008, 08:55:20 pm »

I've seen that code too and wondered about that. Shouldn't that logic simply use a mod with 2*pi to limit euler, instead of the while loop?

A "mod"? Do you mean a modulo?

Modulo is an integer operation. I am simulating the modulo operation with this while loop. In 99.99% of the cases the incoming values will be in range [-2.x*p, +2.x*p] (with a small x), so the loop won't have more than one iteration and therefore this is not a performance issue.

Marvin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #4 on: 25. March 2008, 09:15:57 pm »

Hmm... short question: Why should the values ever be inifinity??? What are you doing with the FPIH or its constraints? I don't see, how you could ever make it be infinity by a simple mouse movement - may it be as extreme as possible. And the digital rotation (e.g. initiated by a keyboard key press) should also not be able to make it infinity.

Of course there should be a check to avoid the endless loop. But I was just wondering.

Marvin
Logged
Pandaemonium
Enjoying the stay
*
Offline Offline

Posts: 85


If at first you don't succeed; call it version 1.0


View Profile
« Reply #5 on: 28. March 2008, 08:40:03 pm »

Quote
A "mod"? Do you mean a modulo?
Yep, that's what I meant.

Quote
Modulo is an integer operation.

Yep, that's right. Just ignore me. I wasn't thinking.  Lips sealed
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #6 on: 07. April 2008, 06:12:34 am »

>> mod is an integer operation
In theory, yep. But for example, on my TI-89, (AMS), it works with floating numbers, e.x. :

Code:
3 % 2 = 1
3.1 % 2 = 1.1
3 % 1.2 = 0.8

Haven't tested it in Java, though...
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic