Skip to content

Triangle

Christopher Ross-Gill edited this page Aug 1, 2016 · 1 revision

TRIANGLE

Arg Type Description Values
vertex1 [pair!]
vertex2 [pair!]
vertex3 [pair!]
color1 [tuple!]
color2 [tuple!]
color3 [tuple!]
dilation [decimal!] Useful for eliminating anitaliased edges
The TRIANGLE command provides a shortcut for a triangular polygon with optional shading parameters (Gouraud shading). The three vertices of the triangle are used to specify it.

Notes and Examples

Simple triangle:

fill-pen red
triangle 50x1

A group of triangles. This should make it easy to see where each triangle is:
pen off
triangle 50x150 150x50 150x150 red green blue
triangle 150x50 250x150 150x150 green yellow blue
triangle 250x150 150x350 150x150 yellow orange blue
triangle 150x350 50x150 150x150 orange red blue
translate 200x-15

The same triangle group but slightly rotated illustrating the dilation parameter:

pen off
rotate 5
triangle 50x150 150x50 150x150 red green blue
triangle 150x50 250x150 150x150 green yellow blue
triangle 250x150 150x350 150x150 yellow orange blue
triangle 150x350 50x150 150x150 orange red blue
translate 200x-15
triangle 50x150 150x50 150x150 red green blue 0.33
triangle 150x50 250x150 150x150 green yellow blue 0.33
triangle 250x150 150x350 150x150 yellow orange blue 0.33
triangle 150x350 50x150 150x150 orange red blue 0.33

This gives you a much more subtle blending in the middle:
pen off
triangle 50x150  150x50  150x150 red    green  gray
triangle 150x50  250x150 150x150 green  yellow gray
triangle 250x150 150x350 150x150 yellow orange gray
triangle 150x350 50x150  150x150 orange red    gray

And this shows simple highlighting/shading:

pen off
triangle 50x150  150x50  150x150 water sky   sky
triangle 150x50  250x150 150x150 water coal  sky
triangle 250x150 150x350 150x150 coal  coal  sky
triangle 150x350 50x150  150x150 coal  water sky

Pages

Chapters
Clone this wiki locally