>Sure. Mark data, Compute("mag(a)" ... Include(min=0.0 max=0.0 exclude=1,
>cull=0), Unmark(data). That'll tag each null vector as invalid, and
>Autoglyph won't add a glyph for them.
>
>Greg
>
Warning: the following presentation may contain serious DX weenie-isms.
This post is rated N (nerdly).
This is elegant and clever, but since I'm currently staring down the barrel
of a vector field of some 3.8M nodes, I think "memory optimization" at
every turn. I would argue that my solution is more memory efficient. I've
certainly been wrong before, so pounce on me if I am here.
My calculus is this for Greg's solution:
Field F has positions P, and vector data VD (and maybe some other stuff).
Mark(F, "data") creates a copy of VD -> VD2 (VD is now "saved data"). This
is a pointer only so no new memory is allocated.
Compute("mag(a)") creates a new float scalar array MA; the output of
Compute contains pointers to P, VD, and VD2, and the new array MA.
Include then creates the byte array IP for invalid positions and also
shares pointers to P, VD, VD2, MA.
Unmark does not regain any memory since "saved data" is still at the output
of Mark (therefore memory resident). Unmarks outputs a field with ptrP,
ptrVD, and ptrIP.
Net new memory needed: one float array and one byte array each of count(P).
In some cases (like mine), that new float array could be nasty big.
Note that Greg wisely used cull=0; while culling would have made the arrays
smaller by the number of zero-mag vectors, it would also have precipitated
copying P, VD, and IP to create new smaller versions, almost always likely
to be non-optimal.
My solution was (abbreviated):
Compute(F, "mag(a)!=0"), Include(min=0.5, cull=0), Replace(included,F,"inv
pos", "inv pos")
Field F has positions P, and vector data VD (and maybe some other stuff).
Compute creates a new integer array MAF (mag(a) flag). It outputs a field
with ptrP and the array MAF.
Include creates a new byte array IP and outputs a field with ptrP, ptrMAF,
and array IP.
Replace takes no new memory, just points F to IP, thus outputting ptrP,
ptrVD, ptrIP.
Net new memory needed: one integer array and one byte array each of count(P).
Well, that's not much of a savings, is it?
So now that I've done this analysis, I see that my solution would be
greatly improved if I cast "mag(0)!=0" to byte, thus requiring only a new
byte array.
But then, why bother Include (or exclude)?
!!!!!!!!!!!!!!!!!!!
NEW IMPROVED ANSWER:
IP = Compute(F, "byte(mag(a)==0)"); // new byte array of count(P)
maskedF = Replace(IP, F, "data", "invalid positions"); // pointer shuffling
only
et viola,
Net new memory needed: one byte array of count(P).
Chris Pelkie
Vice President/Scientific Visualization Producer
Conceptual Reality Presentations, Inc.
30 West Meadow Drive
Ithaca, NY 14850
[EMAIL PROTECTED]