average - finds the centre of gravity of a point, line or triangle cloud
average [-?|-h|--help] [-p|--point|-l|--line|-t|--triangle] [-b|--box] [-c|--covariance] [-m|--mass] [-sf FILE|--scalar-file FILE]
average finds the centre of gravity of a point, line or triangle cloud.
For point clouds, the average of the coordinates is returned. For line and triangle clouds, the centre of gravity is, by default, calculated assuming that the elements have a uniform density of 1 per unit of length/surface. Option -sf allows weighting each element individually.
Options allow to output more measures.
The input cloud is read from the standard input and the result is returned to the standard output.
The format of the clouds is described in view_pt(1), view_li(1) and view_tri(1).
Returns the manual page
Input is a point cloud (default)
Input is a line cloud.
Input is a triangle cloud. If you do not want to weight the result using the surface of the triangles, use option --point instead.
Bounding box.
Mass is calculated, possibly weighted by a scalar file.
Weighting factor for mass, inertia. The number of scalars should correspond to the number of points/lines/triangles.
Covariance matrix of the coordinates. The eigen-values and -vectors of the matrix can be computed redirecting the output to 'octave':
cat somefile.tri | average -c | awk 'BEGIN {printf "a=["} NR>2 {printf "%f %f %f; ",$1,$2,$3} END {print "];"; print "[v l]=eigs(a)"}' | octave
Prefix output with its meaning.
Written by Pierre Smars (first version: 2007)
Reports of bugs or problems should be submitted via electronic mail to <smars@yuntech.edu.tw>.
Copyright (C) 2017-2020 Pierre Smars. License GPLv2 <http://www.gnu.org/licenses/gpl-2.0.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
trisize(1)