Star

Created With

linkrasterizeTriangle()

Rasterize the triangle defined by vertices (row0, col0), (row1, col1), and (row2, col2), using barycentric coordinates. The user provided software rendered (fragment) shader is a function parameterized with the object literal { pattern: interpolated_data_array, row: i, col: j } and that should return a p5.Color. Refer to the colorizeTriangle() method for an example.

linkSyntax

rasterizeTriangle(row0, col0, row1, col1, row2, col2, shader, pattern0, [pattern1], [pattern2])

linkParameters

row0Number: vertex0 row coordinate
col0Number: vertex0 col coordinate
row1Number: vertex1 row coordinate
col1Number: vertex1 col coordinate
row2Number: vertex2 row coordinate
col2Number: vertex2 col coordinate
shaderFunction: taking { pattern: interpolated_data_array, row: i, col: j } params and returning a p5.Color
pattern0Array: vertex0 attributes to be interpolated
pattern1Array: vertex1 attributes to be interpolated default is pattern0
pattern2Array: vertex2 attributes to be interpolated default is pattern0
rasterizeTriangle()SyntaxParameters

Home

p5.js functionschevron_right

Properties

I/Ochevron_right
Boolean operatorschevron_right
Geometry transformationschevron_right
Visual computingchevron_right
Other representationschevron_right

Demo