Hello,
I’m drawing triangles.
I’d like to fill in these triangles with lots of points.
I believe in order to do so I’d need to know the coordinates of each point belonging within the triangle.
I could find solutions to compute the surface of a triangle but I can’t think about a way to get an array containing all x,y coordinates of each points inside a specific triangle.
Here iy my code so far:
function setup() {
createCanvas(1000, 1000);
colorMode(HSB);
noStroke();
}
function draw() {
let myTriangles = [];
let myTriangleValue1 = [500,500,750,0,1000,500];
myTriangles.push(myTriangleValue1);
for (let i = 0; i < myTriangles.length; i++) {
triangle(myTriangles[i][0],myTriangles[i][1],myTriangles[i][2],myTriangles[i][3],myTriangles[i][4],
myTriangles[i][5],myTriangles[i][6]);
}
}
}