[brlcad-commits] SF.net SVN: brlcad:[41402] brlcad/trunk/src/libbn/ulp.c

2010-11-18 Thread brlcad
Revision: 41402
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41402view=rev
Author:   brlcad
Date: 2010-11-18 15:17:43 + (Thu, 18 Nov 2010)

Log Message:
---
check for c89 float.h constants and use those instead of calculating epsilon if 
the constants are available.  also added method that does not assume ieee754 
but it may find a smaller epsilon than ieee specifies.

Modified Paths:
--
brlcad/trunk/src/libbn/ulp.c

Modified: brlcad/trunk/src/libbn/ulp.c
===
--- brlcad/trunk/src/libbn/ulp.c2010-11-17 23:10:22 UTC (rev 41401)
+++ brlcad/trunk/src/libbn/ulp.c2010-11-18 15:17:43 UTC (rev 41402)
@@ -35,22 +35,46 @@
  * representation.
  */
 
+#include common.h
 
+#include float.h
+
+
 double
 bn_epsilon()
 {
+#if defined(DBL_EPSILON)
+return DBL_EPSILON;
+#elif defined(HAVE_IEEE754)
 static const double val = 1.0;
 register long long next = *(long long*)val + 1;
 return val - *(double *)next;
+#else
+/* must be volatile to avoid long registers */
+volatile double tol = 1.0;
+while (1.0 + (tol * 0.5) != 1.0) {
+   tol *= 0.5;
+}
+#endif
 }
 
 
-double
+float
 bn_epsilonf()
 {
+#if defined(FLT_EPSILON)
+return FLT_EPSILON;
+#elif defined(HAVE_IEEE754)
 static const float val = 1.0;
 register long next = *(long*)val + 1;
 return val - *(float *)next;
+#else
+/* must be volatile to avoid long registers */
+volatile float tol = 1.0f;
+while (1.0f + (tol * 0.5f) != 1.0f) {
+   tol *= 0.5f;
+}
+#endif
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits


[brlcad-commits] SF.net SVN: brlcad:[41403] brlcad/trunk/src/tclscripts

2010-11-18 Thread bob1961
Revision: 41403
  http://brlcad.svn.sourceforge.net/brlcad/?rev=41403view=rev
Author:   bob1961
Date: 2010-11-18 22:16:33 + (Thu, 18 Nov 2010)

Log Message:
---
Mouse ray callbacks are now required to have pane as its first argument.

Modified Paths:
--
brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
brlcad/trunk/src/tclscripts/lib/Ged.tcl

Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2010-11-18 15:17:43 UTC 
(rev 41402)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2010-11-18 22:16:33 UTC 
(rev 41403)
@@ -762,9 +762,9 @@
method initCompSelect {}
method compSelectCallback {_mstring}
 
-   method mrayCallback_cvo {_start _target _partitions}
-   method mrayCallback_erase {_start _target _partitions}
-   method mrayCallback_pick {_start _target _partitions}
+   method mrayCallback_cvo {_pane _start _target _partitions}
+   method mrayCallback_erase {_pane _start _target _partitions}
+   method mrayCallback_pick {_pane _start _target _partitions}
 
method initViewMeasure {}
method endViewMeasure {_mstring}
@@ -2528,7 +2528,7 @@
 putString $_mstring
 }
 
-::itcl::body ArcherCore::mrayCallback_cvo {_start _target _partitions} {
+::itcl::body ArcherCore::mrayCallback_cvo {_pane _start _target _partitions} {
 if {$_partitions == } {
set rpos [$itk_component(ged) lastMouseRayPos]
eval $itk_component(ged) vslew $rpos
@@ -2550,10 +2550,10 @@
 }
 
 set point [vscale $point [$itk_component(ged) base2local]]
-$itk_component(ged) center $point
+$itk_component(ged) pane_center $_pane $point
 }
 
-::itcl::body ArcherCore::mrayCallback_erase {_start _target _partitions} {
+::itcl::body ArcherCore::mrayCallback_erase {_pane _start _target _partitions} 
{
 if {$_partitions == } {
return
 }
@@ -2581,7 +2581,7 @@
 set mStatusStr erase $path
 }
 
-::itcl::body ArcherCore::mrayCallback_pick {_start _target _partitions} {
+::itcl::body ArcherCore::mrayCallback_pick {_pane _start _target _partitions} {
 set partition [lindex $_partitions 0]
 if {$partition == {}} {
putString Missed!

Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl 2010-11-18 15:17:43 UTC (rev 
41402)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl 2010-11-18 22:16:33 UTC (rev 
41403)
@@ -3324,7 +3324,7 @@
}
 } else {
foreach callback $mMouseRayCallbacks {
-   catch {$callback $mLastMouseRayStart $mLastMouseRayTarget 
$partitions}
+   catch {$callback $_pane $mLastMouseRayStart $mLastMouseRayTarget 
$partitions}
}
 }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits