CommonTypesDrawing
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos

//@version=5

// @description Provides a common library source for common types of used graphical drawing structures.
// Includes: `Triangle, Quad, Polygon`
library("CommonTypesDrawing")

//#region ~~~ Drawings interface:

// @type Representation of a triangle using lines and linefill.
// @field ab    Edge of point a to b.
// @field bc    Edge of point b to c.
// @field ca    Edge of point c to a.
// @field fill  Fill of the object.
// @field solid Check if polygon should have a fill.
export type Triangle
	line ab
	line bc
	line ca
	linefill fill
	// option properties:
	bool solid = true

// @type Representation of a quadrilateral using lines and linefill.
// @field ab    Edge of point a to b.
// @field bc    Edge of point b to c.
// @field cd    Edge of point c to d.
// @field da    Edge of point d to a.
// @field fill  Fill of the object.
// @field solid Check if polygon should have a fill.
export type Quad
	line ab
	line bc
	line cd
	line da
	linefill fill
	// option properties:
	bool solid = true

// @type Representation of a polygon using lines and linefill.
// @field edges  List of edges in the polygon.
// @field fills  Fills of the object.
// @field closed Check if polygon line should connect last vertice to first.
// @field solid  Check if polygon should have a fill.
export type Polygon
	array<line> edges
	array<linefill> fills
	// graphical properties:
	bool closed = true
	bool solid  = true

//#endregion