std-vector-mean


Synopsis

(std-vector-mean <pts>) ; "average" vector in any dimension

(std-vector-mean-3d <pts>) ; 3d dimensional special case

Description

STD-VECTOR-MEAN returns a point of the average of the given pointlist, the list of mean values of each coordinate. It returns a point with the same dimension as the points in the pointlist (if 2D, 3D or more).

STD-VECTOR-MEAN-3D is optimized to work with 3D points, this always returns a 3D point.

To return the midpoint use STD-MIDPT with two points or STD-HALFPT with one point instead.

This is NOT the centroid nor the center of gravity for an arbitrary shaped polygon, it is only for convex polygons! See STD-CENTROID-2D instead.

Arguments

pts: a list of points. Each point must be any list of two or three numbers. If the third number, the z-value is omitted, 0.0 is used instead.

Return Value

A list of numbers:

STD-VECTOR-MEAN returns a point in the same dimension as the given pointlist.

STD-VECTOR-MEAN-3D returns a 3D point

Side Effects

None.

Module

(std-require 'STDPOINT)

Defined in STDPOINT

Note: before version 0.4001 it was in STDENT.

For a short time they were named GEOM-VECTOR-MEAN and GEOM-VECTOR-MEAN3D