so far I understand the average node computes an average of multiple inputs. every point with the input. what I need is the average of all points.
general speaking, how one would work on the whole set of components?
grayOlorin
dependnig on what you are trying to do, it may be also useful to use the point cloud vop nodes.
http://www.sidefx.com/docs/houdini13.0/nodes/vop/pcopen [sidefx.com]
the advantage on these is that they are really fast if you only are looking for weighted average data withing a radius.
pusat
Or easier to do it in VEX:
vector computeCenter ( )
{
(…)
}
These will not be very fast though.
SYmek
I would say this code has a good chance to have comparable performance with C++ node, but apparently not (it's ~x3.5 slower from AttributePromote in average mode, which is not bad, as it's still bellow a second for 5mil points, but still…).
Pure speculation here, but this is probably due to point()/import() functions which force atomic access to the attribute's array and per element compute (bye bye simd), unlike HDK which has these days very cache/simd friendly batch access to attributes. Looks like llvm/vex doesn't do its best here.
I think avg() on a big array of x, y, z's might be a way faster, but costs creating such an array doesn't make any sense. VEX functions like min(string attr)/max(string attr)/avg(string attr) would be helpful.