POV-Ray : Newsgroups : povray.newusers : What does the 'mod' operator do? : Re: What does the 'mod' operator do? Server Time
10 Nov 2025 18:58:48 EST (-0500)
  Re: What does the 'mod' operator do?  
From: Bald Eagle
Date: 10 Nov 2025 16:15:00
Message: <web.691255891bdd44317f81dbac25979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> >
> > I can attest that there are an amazing number of things that can be done with
> > the simplest of "tricks" - just using vcross, vdot, matrix determinants,
> > eigenvalues, and vector swizzling.
>
> About the only thing I truly grasp from that bunch is vector swizzling. :-( I
> have lots more learnin' to do...

I did some tutorial stuff on vcross and vdot.  Hopefully that's clear enough for
you.  There's also the stuff in the distro.
Matrix determinants are ... not my strong point, but I believe relate to area or
volume, and IIRC can signify other things as well (maybe?) - probably depending
on what the input data is.
Eigenvalues are the scalar values in a transformation matrix that tell you how
much the associated vector gets stretched or compressed.  3Blue1Brown does an
EXCELLENT series on linear algebra, which you absolutely should watch - it's
VERY visual and intuitive.  He will tell you EXACTLY what all these things are
and mean, and WHY.

> > And while that may all sound complicated and "out of reach" - the point
> > is that you don't have to understand a damned thing about how any of it
> > is "done" - you just need to understand the significance of the result.
> > What it means.
> >
> > And then you can go on to code some pretty amazing stuff, that's easy to
> > write (as a result of knowing the "tricks"), and is FAST - compared to
> > the usual "I'm going to write my code in the exact same way as I went about
> > figuring this out the long way" that we all do so often.

Yeah, but what I mean here, is that if you did something like rename mod (A,B)
to "remainder" - using a macro or function, then you really wouldn't need to be
able to regurgitate the exact steps of the process - you'd intuitively know what
the calculated result meant.

I just coded a "Cash Register" macro, since it was one of the fun examples that
I found while searching for examples for you.   Hopefully I'll get a little time
to test it out tonight to see if I did it right without the code-parse
error-edit cycle.  ;)

-BW


Post a reply to this message

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