[visionegg] Bugfix in Core.py
- From: Tony Arkles <tony@xxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 12 Jul 2005 12:32:36 -0600
Hi! I'm in the process of writing my own special viewport, and stumbled
onto this:
Core.py, line 1256:
# clamp n and f
n = max(1.0,min(0.0,n))
f = max(1.0,min(0.0,f))
I believe that these are backwards, and for clamping should be:
# clamp n and f
n = min(1.0,max(0.0,n))
f = min(1.0,max(0.0,f))
Here's my simple testing to show this:
>>> def clamp1(x):
return max(1.0, min(0.0, x))
>>> def clamp2(x):
return min(1.0, max(0.0, x))
>>> clamp1(0.2)
1.0
>>> clamp2(0.2)
0.20000000000000001
>>> clamp1(-0.1)
1.0
>>> clamp2(-0.1)
0.0
>>> clamp1(1.1)
1.0
>>> clamp2(1.1)
1.0
>>>
Tony
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: Bugfix in Core.py
- From: Andrew Straw
Other related posts:
- » [visionegg] Bugfix in Core.py
- » [visionegg] Re: Bugfix in Core.py
- [visionegg] Re: Bugfix in Core.py
- From: Andrew Straw