# Grid of rectangles produces weird triangle pattern

**URL:** <https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432>\
**Category:** Coding Questions\
**Created:** [November 10, 2021, 5:51am UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432 "2021-11-10T05:51:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![UnusualUsual](https://avatars.discourse-cdn.com/v4/letter/u/e274bd/32.png) [@UnusualUsual](https://discourse.processing.org/u/UnusualUsual)\
**Post date:** [November 10, 2021, 5:51am UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432/1 "2021-11-10T05:51:59Z")

</div>

I’m creating a grid of black rectangles on a white background and for some reason unknown to me, part of some rectangles are split and pushed up a pixel to make a weird triangle looking thing in the middle of the grid.

```auto
    private final int columns = 15;
    private final int rows = 15;
    private final int scale = 40;

    public void settings() {
        noSmooth();
        size(600,600);
    }

    public void setup() {
        frameRate(30);
    }

    public void draw() {
        background(255);
        noStroke();
        fill(0);

        for (int x = 0; x < columns; x++) {
            for (int y = 0; y < rows; y++) {
                rect((x*scale)+1, (y*scale)+1, scale-2, scale-2);
            }
        }
    }

```

You can see the effect starting in the upper right corner of this image. I have no idea what is causing this.

 ![error](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c603bfe059478b099ff129b2c22cb60906c6384e.png)

---

<div class="post-metadata">

**Author:** ![UnusualUsual](https://avatars.discourse-cdn.com/v4/letter/u/e274bd/32.png) [@UnusualUsual](https://discourse.processing.org/u/UnusualUsual)\
**Post date:** [November 10, 2021, 6:48am UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432/2 "2021-11-10T06:48:46Z")

</div>

(Won’t allow me to put a second image in my post)

I put stroke back in and you can definitely see something is wrong. I even translated the grid over by 130 and the triangle shows up in the same exact spot.

 ![stroke](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f158ec5243fa4fe9345856dd27bf4e9cc7794d23.png)

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 10, 2021, 2:04pm UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432/3 "2021-11-10T14:04:17Z")

</div>

Looks ok here; I’m curious why you use noSmooth().

 ![grid](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7c907de7ee884e66ce72ca79f19a77110a9bdd3a.png)

---

<div class="post-metadata">

**Author:** ![UnusualUsual](https://avatars.discourse-cdn.com/v4/letter/u/e274bd/32.png) [@UnusualUsual](https://discourse.processing.org/u/UnusualUsual)\
**Post date:** [November 10, 2021, 5:29pm UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432/4 "2021-11-10T17:29:55Z")

</div>

I’ve done all smoothing, I just ended with noSmooth() because that was my final idea.

Also the things I’ve tried since I put this question up are:  
Cleared my IDE’s cache  
Reinstalled the processing library
