|
|
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
|
|