POV-Ray : Newsgroups : povray.pov4.discussion.general : Suggest v4.0 updates to 'brick'. (yuqk R15 v0.6.9.0) : Re: Suggest v4.0 updates to 'brick'. (yuqk R15 v0.6.9.0) Server Time
27 Jul 2024 12:38:48 EDT (-0400)
  Re: Suggest v4.0 updates to 'brick'. (yuqk R15 v0.6.9.0)  
From: William F Pokorny
Date: 29 May 2024 04:00:23
Message: <6656e097$1@news.povray.org>
On 5/28/24 13:23, Bald Eagle wrote:
> I'd like a look at the source for that little snippet, to see how you made the
> improvements.  🙂
> 
> Did you borrow your solution from somewhere, or is this home-rolled?

In this case, once I finally looked in detail at the core 'brick' code, 
I found it was mostly, already set up in a way to support the changes I 
made...

In the yuqk code base, and the file pattern.cpp (where there was already 
change relative to v3.8), the older code:

double BrickPattern::Evaluate(const Vector3d& EPoint,
   const Intersection* /*pIsection*/,
   const Ray* /*pRay*/, TraceThreadData* /*pThread*/) const
{
// pIsection, pRay, pThread not presently used.
// Commented to avoid -Wunused-parameter

     int ibrickx, ibricky, ibrickz;
     double brickheight, brickwidth, brickdepth;
     double brickmortar, mortarheight, mortarwidth, mortardepth;
     double brickx, bricky, brickz;
     double x, y, z, fudgit;

     fudgit = gkDBL_epsilon + mortar;

     x =  EPoint[X]+fudgit;
     y =  EPoint[Y]+fudgit;
     z =  EPoint[Z]+fudgit;

     brickwidth  = brickSize[X];
     brickheight = brickSize[Y];
     brickdepth  = brickSize[Z];
     brickmortar = mortar;

     mortarwidth  = brickmortar / brickwidth;
     mortarheight = brickmortar / brickheight;
     mortardepth  = brickmortar / brickdepth;
...

was changed to:

double BrickPattern::Evaluate(const Vector3d& EPoint,
   const Intersection* /*pIsection*/,
   const Ray* /*pRay*/, TraceThreadData* /*pThread*/) const
{
// pIsection, pRay, pThread not presently used.
// Commented to avoid -Wunused-parameter

     int ibrickx, ibricky, ibrickz;
     double brickheight, brickwidth, brickdepth;
     double mortarheight, mortarwidth, mortardepth;
     double brickx, bricky, brickz;
     double x, y, z;

     x = EPoint[X]+gkMinIsectDepthReturned;
     y = EPoint[Y]+gkMinIsectDepthReturned;
     z = EPoint[Z]+gkMinIsectDepthReturned;

     brickwidth  = brickSize[X] + brickSpacing[X];
     brickheight = brickSize[Y] + brickSpacing[Y];
     brickdepth  = brickSize[Z] + brickSpacing[Z];

     mortarwidth  = brickSpacing[X] / brickwidth;
     mortarheight = brickSpacing[Y] / brickheight;
     mortardepth  = brickSpacing[Z] / brickdepth;
...

The whole of the change covers roughly a half a dozen source code files 
and as many, or more, files related to documentation, examples and 
testing. All of that not being very interesting and amounting to the 
cost of almost any change in how stuff works! :-)

Bill P.


Post a reply to this message

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