|
|
In short, make the brick discrete value pattern easier to use.
Move the 'brick_size' and 'mortar' keywords to the generic 'ip_size' and
'ip_spacing' keywords respectively. The ip_size is now the actual 3D
brick size and not the brick+mortar size. The ip_spacing is now a 3D
vector indicating the brick to brick space (mortar thickness) in each of
the three directions.
The ip_spacing vector components can be zero - in which case the brick
effectively becomes infinite in that direction. This capability makes it
easier to apply and map the 'brick' pattern.
In other words, being able to zero the mortar between bricks in one
direction helps avoid the common issue of surfaces drifting into the
mortar regions of the pattern. See attached image with the traditional
'brick' pattern in the left column and the updated yuqk implementation
in the right column.
Lastly, an internal pattern offset using the mortar value was removed as
its aim now addressed by being able to zero spacing directions. This
change should make the pattern somewhat more intuitive to use as well.
Bill P.
Post a reply to this message
Attachments:
Download 'brick_01.pov.txt' (3 KB)
Download 'brickv4story.png' (124 KB)
Preview of image 'brickv4story.png'
|
|
|
|
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
|
|