Correct math formula for this?
in
Programming Questions
•
4 months ago
Hi all,
I would like to fill this rect with diagonal lines. What would be the correct formula if I were to use vectors? Or just in general?
Thanks
T
- int x = 0;
- int y = 0;
- int w = 300;
- int h = 300;
- int fill = 10;
- void setup() {
- size(300, 300);
- background(255);
- smooth();
- }
- void draw() {
- for (int i = 0; i < fill; i++) {
- line(x,y+(i*(w/fill)),x+(i*(w/fill)),y);
- line(x+(i*(w/fill)), y+w, x+w, y+(i*(w/fill)));
- }
- }
1