[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in Line()



There's a bug in the Line() function in version 0.8.10rc6, which may draw
a spurious segment when the Line is parallel to a coordinate plane. The
attached file should fix things.

For those of you who (like me) are not fluent with "patch": Copy the
attachment into the source directory, and do

patch -i objects.cc.patch

Then build as usual.

--Andy

Andrew D. Hwang			ahwang at mathcs dot holycross dot edu
Department of Math and CS	http://mathcs.holycross.edu/~ahwang
College of the Holy Cross	(508) 793-2458 (Office: 320 Swords)
Worcester, MA, 01610-2395	(508) 793-3530 (fax)
Index: objects.cc
===================================================================
RCS file: /usr/local/cvs/epix/objects.cc,v
retrieving revision 1.29
diff -c -r1.29 objects.cc
*** objects.cc	17 Apr 2003 04:46:10 -0000	1.29
--- objects.cc	17 Apr 2003 12:37:40 -0000
***************
*** 670,677 ****
        }
      else
        {
! 	t1_min = -EPIX_INFTY;
! 	t1_max =  EPIX_INFTY;
        }
  
      if (dir.x2 != 0)
--- 670,683 ----
        }
      else
        {
! 	// is Line between bounding planes?
! 	if (clip1_min <= arg1.x1 && arg1.x1 <= clip1_max)
! 	  {
! 	    t1_min = -EPIX_INFTY;
! 	    t1_max =  EPIX_INFTY;
! 	  }
! 	else // Line is empty
! 	  return;
        }
  
      if (dir.x2 != 0)
***************
*** 684,691 ****
        }
      else
        {
! 	t2_min = -EPIX_INFTY;
! 	t2_max =  EPIX_INFTY;
        }
  
      if (dir.x3 != 0)
--- 690,702 ----
        }
      else
        {
! 	if (clip2_min <= arg1.x2 && arg1.x2 <= clip2_max)
! 	  {
! 	    t2_min = -EPIX_INFTY;
! 	    t2_max =  EPIX_INFTY;
! 	  }
! 	else // Line is empty
! 	  return;
        }
  
      if (dir.x3 != 0)
***************
*** 698,705 ****
        }
      else
        {
! 	t3_min = -EPIX_INFTY;
! 	t3_max =  EPIX_INFTY;
        }
  
      t_min = max(t1_min, t2_min);
--- 709,721 ----
        }
      else
        {
! 	if (clip3_min <= arg1.x3 && arg1.x3 <= clip3_max)
! 	  {
! 	    t3_min = -EPIX_INFTY;
! 	    t3_max =  EPIX_INFTY;
! 	  }
! 	else // Line is empty
! 	  return;
        }
  
      t_min = max(t1_min, t2_min);