pcfilter VEX function

Filters the points found by pcopen using a simple reconstruction filter.

Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex

  1. float pcfilter(int handle, string channel_name)

  2. vector pcfilter(int handle, string channel_name)

  3. vector4 pcfilter(int handle, string channel_name)

  4. matrix pcfilter(int handle, string channel_name)

  5. matrix3 pcfilter(int handle, string channel_name)

Filters the points queued up by pcopen using a simple reconstruction filter.

This function is roughly equivalent to:

float pcfilter(int handle; string channel)
{
    float    sum, w, d;
    float    value, result = 0;
    while (pciterate(handle))
    {
        pcimport(handle, "point.distance", d);
        pcimport(handle, channel, value);
        w = 1 - smooth(0, radius, d);
        sum += w;
        result += w * value;
    }
    result /= sum;
    return result;
}