# Scaling problem : newbie ahead :)

**URL:** <https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367>\
**Category:** Coding Questions\
**Created:** [December 18, 2020, 2:11pm UTC](https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367 "2020-12-18T14:11:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![MiguelSanches](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/miguelsanches/32/11172_2.png) [@MiguelSanches](https://discourse.processing.org/u/MiguelSanches)\
**Post date:** [December 18, 2020, 2:57pm UTC](https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367/2 "2020-12-18T14:57:14Z")

</div>

Hi @galleon

Welcome to the community! 🙂

Check the following link

> **[rectMode() / Reference](https://processing.org/reference/rectMode_.html)**
>
> Modifies the location from which rectangles are drawn by changing the way in which parameters given to rect() are interpreted. The default mode is rectMode(CORNER), which inte…

If you define the rectMode to CENTER then all rectangles have their origin in the center, which allows you to draw the square within a square much easier! 😃

Concerning the questions on

> What would be the best way to repeat the same ensemble of shapes on a regular grid pattern ?

I would say to create a class of an object with this drawing and then repeat the pattern over a grid.  
I wrote a similar code in this post on the forum:

> [@Creating a clickable dynamic grid](https://discourse.processing.org/t/creating-a-clickable-dynamic-grid/26259/2):
>
> Hi @Reynaert98, This is a simple example that I made for better understanding. The main idea is the following: A card class represents a card, which has determined position and dimensions. To draw a card, I used a rectangle centered in x and y using the dimensions below. So I draw the rectangle and consider the spacing for the margin [image] 3) - By knowing the dimensions of each card I can know if the mouse is on top of the card (hover() method). 4) - An ArrayList of cards has as…

Hope it helps! And let me know if you have any questions or doubts! I will try to explain or make a simpler example for you if needed 🙂

Best regards

---

_[View the full topic](https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367)._
