[svn] r5983: nemerle/trunk/snippets/raytracer/ray.n

malekith svnadmin at nemerle.org
Tue Nov 29 22:10:41 CET 2005


Log:
It doesn't seem to change anything now.

Author: malekith
Date: Tue Nov 29 22:10:40 2005
New Revision: 5983

Modified:
   nemerle/trunk/snippets/raytracer/ray.n

Modified: nemerle/trunk/snippets/raytracer/ray.n
==============================================================================
--- nemerle/trunk/snippets/raytracer/ray.n	(original)
+++ nemerle/trunk/snippets/raytracer/ray.n	Tue Nov 29 22:10:40 2005
@@ -2,8 +2,6 @@
 #pragma indent
 using System.Math
 
-#define BETTER_MATCHING
-
 [Record] \
 struct Vec
   x : double
@@ -47,31 +45,14 @@
   def aux (elt, first)
     def l = first [0]
     match (elt)
-// this gives 5% speedup...
-#if BETTER_MATCHING
-      | Scene.Sphere as s =>
-        def center = s.m
-        def radius = s.r
-        def l' = ray_sphere (center, radius)
-        if (l' >= l) first
-        else (l', (orig + l' * dir - center).Unitise ())
-      | Scene.Group as g =>
-        def center = g.m
-        def radius = g.r
-        def scenes = g.l
-        def l' = ray_sphere (center, radius)
-        if (l' >= l) first
-        else scenes.FoldLeft (first, aux)
-#else
       | Scene.Sphere (center, radius) =>
-        def l' = ray_sphere (orig, dir, center, radius)
+        def l' = ray_sphere (center, radius)
         if (l' >= l) first
         else (l', (orig + l' * dir - center).Unitise ())
       | Scene.Group (center, radius, scenes) =>
-        def l' = ray_sphere (orig, dir, center, radius)
+        def l' = ray_sphere (center, radius)
         if (l' >= l) first
         else scenes.FoldLeft (first, aux)
-#endif
   aux (scene, (inf, Vec ()))
 
 



More information about the svn mailing list