average

NAME

average - finds the centre of gravity of a point, line or triangle cloud

SYNOPSIS

average [-?|-h|--help] [-p|--point|-l|--line|-t|--triangle] [-b|--box] [-c|--covariance] [-m|--mass] [-sf FILE|--scalar-file FILE]

DESCRIPTION

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).

OPTIONS

-h,--help,-?

Returns the manual page

-p,--point

Input is a point cloud (default)

-l,--line

Input is a line cloud.

-t,--triangle

Input is a triangle cloud. If you do not want to weight the result using the surface of the triangles, use option --point instead.

-b,--box

Bounding box.

-m,--mass

Mass is calculated, possibly weighted by a scalar file.

-sf FILE, --scalar-file FILE

Weighting factor for mass, inertia. The number of scalars should correspond to the number of points/lines/triangles.

-c,--covariance

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

-v,--verbose

Prefix output with its meaning.

AUTHORS

Written by Pierre Smars (first version: 2007)

BUGS

Reports of bugs or problems should be submitted via electronic mail to <smars@yuntech.edu.tw>.

COPYRIGHT

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.

SEE ALSO

trisize(1)

Pierre SMARS (tools, home page)