POV-Ray : Newsgroups : povray.unofficial.patches : ANNOUNCE: Acceleration of box' normal Server Time
2 Sep 2024 10:16:15 EDT (-0400)
  ANNOUNCE: Acceleration of box' normal (Message 1 to 10 of 10)  
From: Dejan D  M  Milosavljevic
Subject: ANNOUNCE: Acceleration of box' normal
Date: 9 Apr 2000 08:42:48
Message: <38f07ac8@news.povray.org>
Old code:

static void Box_Normal(VECTOR Result, OBJECT *Object, INTERSECTION *Inter)
{
  switch (Inter->i1)
  {
    case SIDE_X_0: Make_Vector(Result, -1.0,  0.0,  0.0); break;
    case SIDE_X_1: Make_Vector(Result,  1.0,  0.0,  0.0); break;
    case SIDE_Y_0: Make_Vector(Result,  0.0, -1.0,  0.0); break;
    case SIDE_Y_1: Make_Vector(Result,  0.0,  1.0,  0.0); break;
    case SIDE_Z_0: Make_Vector(Result,  0.0,  0.0, -1.0); break;
    case SIDE_Z_1: Make_Vector(Result,  0.0,  0.0,  1.0); break;

    default: Error("Unknown box side in Box_Normal().\n");
  }

  /* Transform the point into the boxes space. */

  if (((BOX *)Object)->Trans != NULL)
  {
    MTransNormal(Result, Result, ((BOX *)Object)->Trans);

    VNormalize(Result, Result);
  }
}

New code:
static void Box_Normal(VECTOR Result, OBJECT *Object, INTERSECTION *Inter)
{

 if (((BOX *)Object)->Trans == NULL )
  switch (Inter->i1)
   {
     case SIDE_X_0: Make_Vector(Result, -1.0,  0.0,  0.0); break;
     case SIDE_X_1: Make_Vector(Result,  1.0,  0.0,  0.0); break;
     case SIDE_Y_0: Make_Vector(Result,  0.0, -1.0,  0.0); break;
     case SIDE_Y_1: Make_Vector(Result,  0.0,  1.0,  0.0); break;
     case SIDE_Z_0: Make_Vector(Result,  0.0,  0.0, -1.0); break;
     case SIDE_Z_1: Make_Vector(Result,  0.0,  0.0,  1.0); break;

     default: Error("Unknown box side in Box_Normal().\n");
   }
 else
  switch (Inter->i1)
   {
     case SIDE_X_0: Assign_Vector(Result, ((BOX *)Object)->N_X_0); break;
     case SIDE_X_1: Assign_Vector(Result, ((BOX *)Object)->N_X_1); break;
     case SIDE_Y_0: Assign_Vector(Result, ((BOX *)Object)->N_Y_0); break;
     case SIDE_Y_1: Assign_Vector(Result, ((BOX *)Object)->N_Y_1); break;
     case SIDE_Z_0: Assign_Vector(Result, ((BOX *)Object)->N_Z_0); break;
     case SIDE_Z_1: Assign_Vector(Result, ((BOX *)Object)->N_Z_1); break;

     default: Error("Unknown box side in Box_Normal().\n");
   }

}

Complete source at  page -- Box' patch -- via
http://members.xoom.com/dmilos/pov/mypovpage.htm


Post a reply to this message

From: Dejan D  M  Milosavljevic
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 9 Apr 2000 08:50:59
Message: <38f07cb3$1@news.povray.org>
> Complete source at  page -- Box' patch -- via
WRONG > http://members.xoom.com/dmilos/pov/mypovpage.htm
>
RIGHT:  http://members.xoom.com/dmilos/prg/pov/mypovpage.htm

Sorry. I and my fingers.


Post a reply to this message

From: Warp
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 10 Apr 2000 03:58:02
Message: <38f1898a@news.povray.org>
../boxes.c: In function `Box_Normal':
../boxes.c:634: structure has no member named `N_X_0'
../boxes.c:635: structure has no member named `N_X_1'
../boxes.c:636: structure has no member named `N_Y_0'
../boxes.c:637: structure has no member named `N_Y_1'
../boxes.c:638: structure has no member named `N_Z_0'
../boxes.c:639: structure has no member named `N_Z_1'


-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Dejan D  M  Milosavljevic
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 10 Apr 2000 08:41:18
Message: <38f1cbee@news.povray.org>
One part from file BOXES.H

typedef struct Box_Struct BOX;

struct Box_Struct
{
  OBJECT_FIELDS
  TRANSFORM *Trans;
  VECTOR bounds[2];
  VECTOR N_X_0, N_X_1, N_Y_0, N_Y_1, N_Z_0, N_Z_1; /* [DDMM] */
};

Entire source at: http://members.xoom.com/dmilos/prg/pov/box/boxsrc.zip

And apologize to Warp. Because I sent answer to <war### [at] tagpovrayorg>.
Replay to sender and Replay to Group are to close.

Warp <war### [at] tagpovrayorg> wrote in message news:38f1898a@news.povray.org...
> ../boxes.c: In function `Box_Normal':
> ../boxes.c:634: structure has no member named `N_X_0'
> ../boxes.c:635: structure has no member named `N_X_1'
> ../boxes.c:636: structure has no member named `N_Y_0'
> ../boxes.c:637: structure has no member named `N_Y_1'
> ../boxes.c:638: structure has no member named `N_Z_0'
> ../boxes.c:639: structure has no member named `N_Z_1'
>
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 11 Apr 2000 07:41:16
Message: <38f30f5c@news.povray.org>
I used the following scene to test this patch:

camera { location -z*30 look_at 0 }
light_source { <100,200,-300> 1 }
light_source { <-100,100,0> <.5,.25,0> }
light_source { <0,-300,-200> <0,.25,.5> }

#declare R=seed(0);
#declare ind=0;
#while(ind<1000)
  box
  { -.1, 1 pigment { rgb 1 }
    rotate <rand(R)*180, rand(R)*180, rand(R)*180>
    scale <.1+rand(R)*1.9, .1+rand(R)*1.9, .1+rand(R)*1.9>
    translate <-10+rand(R)*20, -10+rand(R)*20, -10+rand(R)*20>
  }
  #declare ind=ind+1;
#end

  It has 1000 boxes rotated, scaled and translated randomly. I rendered
it at 640x480 with aa 0.1 in this Ultra 5 with the official povray and
this patched version.
  The times were:

  Official:
Time For Parse:    0 hours  0 minutes   1.0 seconds (1 seconds)
Time For Trace:    0 hours  1 minutes   6.0 seconds (66 seconds)
    Total Time:    0 hours  1 minutes   7.0 seconds (67 seconds)

  Patched:
Time For Parse:    0 hours  0 minutes   1.0 seconds (1 seconds)
Time For Trace:    0 hours  1 minutes   4.0 seconds (64 seconds)
    Total Time:    0 hours  1 minutes   5.0 seconds (65 seconds)


-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 11 Apr 2000 07:44:23
Message: <38F3102B.4A794F05@pacbell.net>
So what do you conclude from your tests ?

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Warp
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 11 Apr 2000 10:48:59
Message: <38f33b5a@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: So what do you conclude from your tests ?

  There definitely is a speedup, but it's so small that I'm not sure if
it's worth the extra amount of memory needed for it (the box struct is
bigger now).

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Dejan D  M  Milosavljevic
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 12 Apr 2000 03:02:44
Message: <38f41f94@news.povray.org>
** Many a little makes a mickle. **

Faster rendering or memory usage? That is the question!


Warp <war### [at] tagpovrayorg> wrote in message news:38f30f5c@news.povray.org...
>   I used the following scene to test this patch:
>
> camera { location -z*30 look_at 0 }
> light_source { <100,200,-300> 1 }
> light_source { <-100,100,0> <.5,.25,0> }
> light_source { <0,-300,-200> <0,.25,.5> }
>
> #declare R=seed(0);
> #declare ind=0;
> #while(ind<1000)
>   box
>   { -.1, 1 pigment { rgb 1 }
>     rotate <rand(R)*180, rand(R)*180, rand(R)*180>
>     scale <.1+rand(R)*1.9, .1+rand(R)*1.9, .1+rand(R)*1.9>
>     translate <-10+rand(R)*20, -10+rand(R)*20, -10+rand(R)*20>
>   }
>   #declare ind=ind+1;
> #end
>
>   It has 1000 boxes rotated, scaled and translated randomly. I rendered
> it at 640x480 with aa 0.1 in this Ultra 5 with the official povray and
> this patched version.
>   The times were:
>
>   Official:
> Time For Parse:    0 hours  0 minutes   1.0 seconds (1 seconds)
> Time For Trace:    0 hours  1 minutes   6.0 seconds (66 seconds)
>     Total Time:    0 hours  1 minutes   7.0 seconds (67 seconds)
>
>   Patched:
> Time For Parse:    0 hours  0 minutes   1.0 seconds (1 seconds)
> Time For Trace:    0 hours  1 minutes   4.0 seconds (64 seconds)
>     Total Time:    0 hours  1 minutes   5.0 seconds (65 seconds)
>
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 12 Apr 2000 07:04:39
Message: <38f45847@news.povray.org>
Dejan D. M. Milosavljevic <dmi### [at] pttyu> wrote:
: Faster rendering or memory usage? That is the question!

  The memory usage doesn't matter very much until it runs out of it. Then
less memory usage means considerable increase in speed.

  (Btw: Less memory usage _might_ mean a bit performance boost since the
cache memory misses may be rarer...)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Dejan D  M  Milosavljevic
Subject: Re: ANNOUNCE: Acceleration of box' normal
Date: 13 Apr 2000 02:45:23
Message: <38f56d03@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote in message news:38f45847@news.povray.org...
> Dejan D. M. Milosavljevic <dmi### [at] pttyu> wrote:
> : Faster rendering or memory usage? That is the question!
>
>   The memory usage doesn't matter very much until it runs out of it. Then

Absolutely right.

> less memory usage means considerable increase in speed.

Not always.  Hash table can be large in some cases.

>
>   (Btw: Less memory usage _might_ mean a bit performance boost since the
> cache memory misses may be rarer...)
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.