Skip to content

polygon

arnholm edited this page May 1, 2017 · 1 revision

polygon

A polygon is defined by its vertex loop (<vertices>), containing 2d vertex coordinates delineating the external polygon contour using at least 3 vertices in CCW (counterclockwise) order as viewed from +Z. Failing to observe the CCW order is an error. The polygon may be convex or concave, but the edges may not intersect other edges of the same polygon. The vertex coordinates must be such that neither the whole nor part of the polygon area is collapsed.

XML syntax for basic polygon primitive (2d) with 5 vertices

<polygon>
    <vertices>
        <vertex x="0" y="0"/>
        <vertex x="20" y="0"/>
        <vertex x="20" y="20"/>
        <vertex x="10" y="30"/>
        <vertex x="0" y="20"/>
    </vertices>
</polygon>

Complete example extruding a polygon to create a 3d solid

<?xml version="1.0" encoding="utf-8"?>
<xcsg version="1.0">
    <linear_extrude dz="1">
        <polygon>
            <vertices>
                <vertex x="0" y="0"/>
                <vertex x="20" y="0"/>
                <vertex x="20" y="20"/>
                <vertex x="10" y="30"/>
                <vertex x="0" y="20"/>
            </vertices>
        </polygon>
    </linear_extrude>
</xcsg>

Clone this wiki locally