Revision: 7813
http://playerstage.svn.sourceforge.net/playerstage/?rev=7813&view=rev
Author: rtv
Date: 2009-06-08 06:11:07 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
fixed rare ray tracing bug
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/world.cc
code/stage/trunk/worlds/fasr.world
code/stage/trunk/worlds/simple.world
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2009-06-07 19:34:03 UTC (rev 7812)
+++ code/stage/trunk/libstage/canvas.cc 2009-06-08 06:11:07 UTC (rev 7813)
@@ -795,24 +795,32 @@
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ glPointSize( 2 );
+ glBegin( GL_POINTS );
+
for( unsigned int i=0;
i < world->rt_cells.size();
i++ )
{
-// char str[128];
-// snprintf( str, 128, "(%d,%d)",
-// world->rt_cells[i].x,
-// world->rt_cells[i].y );
+ char str[128];
+ snprintf( str, 128, "(%d,%d)",
+ world->rt_cells[i].x,
+ world->rt_cells[i].y );
-// Gl::draw_string( world->rt_cells[i].x+1,
-//
world->rt_cells[i].y+1, 0.1, str );
+ Gl::draw_string( world->rt_cells[i].x+1,
+
world->rt_cells[i].y+1, 0.1, str );
//printf( "x: %d y: %d\n", world->rt_regions[i].x,
world->rt_regions[i].y );
- glRectf( world->rt_cells[i].x+0.3,
world->rt_cells[i].y+0.3,
- world->rt_cells[i].x+0.7,
world->rt_cells[i].y+0.7 );
+ //glRectf( world->rt_cells[i].x+0.3,
world->rt_cells[i].y+0.3,
+ // world->rt_cells[i].x+0.7,
world->rt_cells[i].y+0.7 );
+
+ glVertex2f( world->rt_cells[i].x,
world->rt_cells[i].y );
+
}
-#if 0
+ glEnd();
+
+#if 1
world->PushColor( stg_color_pack( 0,1,0,0.2) );
glBegin( GL_LINE_STRIP );
for( unsigned int i=0;
@@ -827,8 +835,6 @@
glPopMatrix();
world->PopColor();
-
- //world->rt_cells.clear();
}
if( ! world->rt_candidate_cells.empty() )
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-06-07 19:34:03 UTC (rev 7812)
+++ code/stage/trunk/libstage/world.cc 2009-06-08 06:11:07 UTC (rev 7813)
@@ -643,7 +643,7 @@
stg_point_t glob( r.origin.x * ppm, r.origin.y * ppm );
// record our starting position
- const stg_point_int_t start( glob.x, glob.y );
+ const stg_point_t start( glob.x, glob.y );
// eliminate a potential divide by zero
const double angle( r.origin.a == 0.0 ? 1e-12 : r.origin.a );
@@ -651,9 +651,10 @@
const double sina(sin(angle));
const double tana(sina/cosa); // = tan(angle)
- // the x and y components of the ray
- const int32_t dx( ppm * r.range * cosa);
- const int32_t dy( ppm * r.range * sina);
+ // the x and y components of the ray (these need to be doubles, or a
+ // very weird and rare bug is produced)
+ const double dx( ppm * r.range * cosa);
+ const double dy( ppm * r.range * sina);
// fast integer line 3d algorithm adapted from Cohen's code from
// Graphics Gems IV
@@ -665,12 +666,7 @@
const int32_t by(2*ay);
int32_t exy(ay-ax);
int32_t n(ax+ay); // the manhattan distance to the goal cell
-
- // fix a little issue where rays are not drawn long enough when
- // drawing to the right or up
- if( (dx > 0) || ( dy > 0 ) )
- n++;
-
+
// the distances between region crossings in X and Y
const double xjumpx( sx * REGIONWIDTH );
const double xjumpy( sx * REGIONWIDTH * tana );
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-06-07 19:34:03 UTC (rev 7812)
+++ code/stage/trunk/worlds/fasr.world 2009-06-08 06:11:07 UTC (rev 7813)
@@ -25,9 +25,9 @@
(
size [ 788.000 842.000 ]
- center [ 0.121 -0.854 ]
+ center [ 6.871 -3.092 ]
rotate [ 0 0 ]
- scale 42.424
+ scale 198.439
pcam_loc [ 0 -4.000 2.000 ]
pcam_angle [ 70.000 0 ]
@@ -44,7 +44,7 @@
(
name "cave"
pose [0 0 0 0]
- size [16 16 0.600]
+ size [16.000 16.000 0.600]
bitmap "bitmaps/cave.png"
)
@@ -94,10 +94,10 @@
)
-charge_station( pose [ 7.803 -1.332 0 34.377 ] )
-charge_station( pose [ 7.940 -2.349 0 0 ] )
-charge_station( pose [ 7.931 -3.367 0 0 ] )
-charge_station( pose [ 7.931 -4.444 0 0 ] )
+charge_station( pose [ 7.936 -1.627 0 0 ] )
+charge_station( pose [ 7.935 -2.616 0 0 ] )
+charge_station( pose [ 7.931 -3.478 0 0 ] )
+charge_station( pose [ 7.931 -4.615 0 0 ] )
define puck model (
size [0.120 0.120 0.100]
@@ -157,16 +157,16 @@
# )
)
-autorob( pose [5.488 5.149 0 35.947] joules 300000 name "r0" )
-autorob( pose [6.431 5.593 0 -111.715] joules 100000 )
-autorob( pose [5.615 6.185 0 107.666] joules 200000 )
-autorob( pose [7.028 6.502 0 -128.279] joules 400000 )
-autorob( pose [5.750 4.137 0 -97.047] joules 100000 )
-autorob( pose [4.909 6.097 0 -44.366] joules 200000 )
-autorob( pose [6.898 4.775 0 -117.576] joules 300000 )
-autorob( pose [7.394 5.595 0 129.497] joules 400000 )
-autorob( pose [5.422 7.030 0 170.743] joules 100000 )
-autorob( pose [6.451 4.189 0 -61.453] joules 200000 )
+autorob( pose [5.676 5.188 0 -19.596] joules 300000 name "r0" )
+autorob( pose [6.371 5.403 0 -102.139] joules 100000 )
+autorob( pose [5.509 6.300 0 164.865] joules 200000 )
+autorob( pose [6.926 6.331 0 -111.398] joules 400000 )
+autorob( pose [5.730 3.938 0 -93.939] joules 100000 )
+autorob( pose [4.925 6.078 0 -58.690] joules 200000 )
+autorob( pose [6.889 4.752 0 -103.252] joules 300000 )
+autorob( pose [7.220 5.671 0 -168.541] joules 400000 )
+autorob( pose [5.230 6.997 0 -145.485] joules 100000 )
+autorob( pose [6.529 4.005 0 -74.042] joules 200000 )
#autorob( pose [5.060 6.868 0 -61.295] joules 300000 )
#autorob( pose [4.161 5.544 0 -147.713] joules 400000 )
Modified: code/stage/trunk/worlds/simple.world
===================================================================
--- code/stage/trunk/worlds/simple.world 2009-06-07 19:34:03 UTC (rev
7812)
+++ code/stage/trunk/worlds/simple.world 2009-06-08 06:11:07 UTC (rev
7813)
@@ -18,10 +18,10 @@
# configure the GUI window
window
(
- size [ 556.000 557.000 ] # in pixels
- scale 29.162
+ size [ 635.000 666.000 ] # in pixels
+ scale 37.481
# pixels per meter
- center [ 0.095 -0.359 ]
+ center [ -0.019 -0.282 ]
rotate [ 0 0 ]
show_data 1 # 1=on 0=off
@@ -44,7 +44,7 @@
# size [ 0.050 0.050 0.050 ]
#pose [ 0.329 0.284 0 108.025 ]
- pose [ -7.000 -7.000 0 45.000 ]
+ pose [ -7 -7 0 45 ]
sicklaser()
ctrl "wander"
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit