Function Reference: simple_polygon3D

csg-toolkit: GEOM = polygon3D (section, normal)
csg-toolkit: GEOM = polygon3D (section, normal, direction)
csg-toolkit: [GEOM, SMoA] = polygon3D (...)
csg-toolkit: [GEOM, SMoA, polyline] = polygon3D (...)

This function takes the 3D coordinates of a planar cross section along with with its normal and calculates some of its geometric properties such as cross sectional area, perimeter and principal second moments of area. The points of the planar section may be unsorted, since the function will sort them in counter-clockwise order automatically, but need to constitute a simple polygon (a flat shape consisting of straight, non-intersecting line segments or "sides" that are joined pair-wise to form a closed path).

If called with only 2 input arguments as in the following example

[GEOM, SMoA, polyline] = simple_polygon3D (section, normal)

Then,

sectionis an N×3 matrix containing the x,y,z point coordinates of a planar cross section.
normalis a 1×3 vector defining the unit normal of the sectioning plane.

and,

GEOMis a scalar structure containing the fields:
GEOM.Areacalculated in mm^2.
GEOM.Perimetercalculated in mm.
GEOM.Centroidx,y,z centroid coordinates of the cross section.
SMoAis a scalar structure containing the fields:
SMoA.Ixyproduct of 2nd moments of area in mm^4.
SMoA.Iminminimum 2nd moment of area in mm^4.
SMoA.Imaxmaximum 2nd moment of area in mm^4.
polylineis a scalar structure containing the fields:
polyline.poly2DN×2 matrix containing the x,y coordinates of the cross section on the 2D local axes of the sectioning plane ordered counter.
polyline.poly3DN×3 matrix containing the original 3D coordinates of the cross section ordered counter clockwise.

If called with 3 input arguments as in the following example

[GEOM, SMoA, polyline] = simple_polygon3D (section, normal, direction)

Then, direction is an 1×3 vector defining the unit normal of the coronal plane that provides alignment of the bone to anatomical position, while normal is assumed to point upwards. The SMoA structure contains the additional fields, as follows:

SMoA.Ix2nd moment of area with respect to x axis, which is collinear with the intersection of the coronal plane and the sectioning plane. Calculated in mm^4.
SMoA.Iy2nd moment of area with respect to y axis, which is collinear with the intersection of the sagital plane and the sectioning plane. Calculated in mm^4.
SMoA.thetaangle of rotation of the principal axis Imax of 2nd moment of area with respect to x axis expressed in degrees in the range (-90, 90].

See also: meshArea, meshBarycenter, meshSection, longbone_CustomGeometry, longbone_FragmentGeometry, longbone_Geometry

Source Code: simple_polygon3D