# I need help with Processing (objects are cut off the screen)

**URL:** <https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128>\
**Category:** Beginners\
**Created:** [December 15, 2021, 4:31am UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128 "2021-12-15T04:31:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwong5102](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@rwong5102](https://discourse.processing.org/u/rwong5102)\
**Post date:** [December 15, 2021, 4:31am UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128/1 "2021-12-15T04:31:42Z")

</div>

[Hello! I am new to processing and this forum, srry if I’m messing up the format. I am trying to have an array of 100 random objects on my canvas but I don’t want the objects to be cut off the screen. Can someone help me with this? thx]

```auto
PShape honeycomb;
int x,y;

void setup () {
  size (600,400);
  background (240,248,255);  
  honeycomb = createShape ();
  honeycomb.beginShape ();
  honeycomb.fill (255,215,0);
  honeycomb.stroke(255,255,0);
  honeycomb.vertex (15,0);
  honeycomb.vertex (30,0);
  honeycomb.vertex (45,22.5);
  honeycomb.vertex (30,45);
  honeycomb.vertex (15,45);
  honeycomb.vertex (0,22.5);
  honeycomb.vertex (15,0);
  honeycomb.endShape (CLOSE);

for (int i = 0; i < 80; i ++) {
   shape(honeycomb,random(width),random(height));
}
}

void draw () {
 
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 15, 2021, 12:02pm UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128/2 "2021-12-15T12:02:21Z")

</div>

Hello,

Take a look at these references and the _Related_ references:

- [https://processing.org/reference/shape\_.html](https://processing.org/reference/shape_.html) What is the width and center of your shape?
- [https://processing.org/reference/random\_.html](https://processing.org/reference/random_.html) You can set a low and high!

`:)`

---

<div class="post-metadata">

**Author:** ![rwong5102](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@rwong5102](https://discourse.processing.org/u/rwong5102)\
**Post date:** [December 15, 2021, 4:31pm UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128/3 "2021-12-15T16:31:30Z")

</div>

Thankyou for replying! Currently the width of my shape is 45, so from the centre to the edge should be about 22.5. If I set a high and low for the random command, would I have to subtract the radius from it? Like width-radiusofshape?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 15, 2021, 8:21pm UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128/4 "2021-12-15T20:21:54Z")

</div>

yes,

```auto
......random(23,width-23),random(23,height-23)

```

**Remark**

> [@rwong5102](#):
>
> ```auto
> for (int i = 0; i < 80; i ++) {
> shape(honeycomb,random(width),random(height));
> }
> 
> ```

it will look more sharp / crisp with this in draw() (and with background() before it)

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 16, 2021, 3:58am UTC](https://discourse.processing.org/t/i-need-help-with-processing-objects-are-cut-off-the-screen/34128/5 "2021-12-16T03:58:15Z")

</div>

> [@glv](#):
>
> Take a look at these references and the _Related_ references:

ShapeMode() is one of the related references.

> [@rwong5102](#):
>
> If I set a high and low for the random command, would I have to subtract the radius from it? Like width-radiusofshape?

These are all things you can try yourself.

`:)`
