Revision: 46334
          http://brlcad.svn.sourceforge.net/brlcad/?rev=46334&view=rev
Author:   bob1961
Date:     2011-08-23 15:30:45 +0000 (Tue, 23 Aug 2011)

Log Message:
-----------
Updated Ged::pane_mouse_ray to calculate the mLastMouseRayStart point (i.e. the 
point from which to fire a ray) so that all displayed geometry is in front of 
the ray firing point.

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

Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl     2011-08-23 14:59:41 UTC (rev 
46333)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl     2011-08-23 15:30:45 UTC (rev 
46334)
@@ -3387,8 +3387,21 @@
     set view [$mGed screen2view $itk_component($_pane) $_x $_y]
     set view [$mGed snap_view $itk_component($_pane) [lindex $view 0] [lindex 
$view 1]]
 
-    set bounds [$mGed bounds $itk_component($_pane)]
-    set vZ [expr {[lindex $bounds 4] / -2048.0}]
+    if {[catch {eval $mGed bb -q -e [$mGed who]} bblist]} {
+       set bounds [$mGed bounds $itk_component($_pane)]
+       set vZ [expr {[lindex $bounds 4] / -2048.0}]
+    } else {
+       set base2local [$mGed base2local]
+       set vcenter [center]
+       set vsize [size]
+
+       set bbmin [vscale [lindex $bblist 1] $base2local]
+       set bbmax [vscale [lindex $bblist 3] $base2local]
+       set bbdiag [vmagnitude [vsub2 $bbmax $bbmin]]
+       set bbcenter [vscale [vadd2 $bbmin $bbmax] 0.5]
+       set dist [expr [vmagnitude [vsub2 $vcenter $bbcenter]] + $bbdiag]
+       set vZ [expr $dist / $vsize]
+    }
     set mLastMouseRayStart [$mGed v2m_point $itk_component($_pane) [lindex 
$view 0] [lindex $view 1] $vZ]
     set mLastMouseRayTarget [$mGed v2m_point $itk_component($_pane) [lindex 
$view 0] [lindex $view 1] 0]
 


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

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to