You are here: Start » AVL.NET » Function Reference » Path » Polygon Features » AVL.PolygonMoment

AVL.PolygonMoment

Computes the selected second-order moment of a polygon in regular and normalized ( divided by polygon area ) variant.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void PolygonMoment
(
	AvlNet.Path inPolygon,
	AvlNet.PolygonMomentType inMomentType,
	bool inCentral,
	out float outMoment,
	out float outNormMoment
)

Parameters

Name Type Range Default Description
inPolygonAvlNet.Path
inMomentTypeAvlNet.PolygonMomentType
inCentralbool
outMomentfloat
outNormMomentfloat

Description

The operation computes the mathematical features of a polygon called moments. Those are integrals computed as follows:

\[ \begin{aligned} Moment_{2,0}(S) &= \int_{S} p_x^2 \\ Moment_{1,1}(S) &= \int_{S} p_x p_y \\ Moment_{0,2}(S) &= \int_{S} p_y^2 \end{aligned} \]

The integration is conducted over polygon surface, while \( p_x \) and \( p_y \) denote, accordingly, x and y coordinate of a point.

When inCentral parameter is set, the polygon is shifted before computations so that its mass center is at location (0,0).

Note that if the input path is not a valid polygon (i.e. it has at least one self-intersection), the computation may lead to results that are not intuitive.

Errors

List of possible exceptions:

Error type Description
DomainError Not supported moment type in PolygonMoment.
DomainError Open path on input in PolygonMoment.

See also