polygon

Help Contents geomland polygon
locus scale

geomland.polygon :points


constructs a polygon object from :points.

:points is a set which must contain point objects named #0, #1, #2,...

Definition:

to geomland.polygon :points

	local "poly "i
	make "poly (set)
	make "poly("type) "polygon
	make "poly("ondrawimage) [[]]
	make "i 0

	repeat setmax :points
	[ 
		make "poly(word "# :i) segment :points(word "# :i) :points(word "# :i+1)
		make "i :i+1 
	]
	output :poly
end

Construct a triangle for example:

make "p set
make "p.#0 point 0 0
make "p.#1 point 100 0
make "p.#2 point 75 sqrt (75*(100-75))
make "p.#3 point 0 0
make "triangle polygon :p 

Examples:

References:

locus scale