So I have a polygon in QGIS (3.18) and it will always be a rectangle (I create it using minimum bounding geometry, oriented rectangle) I want to buffer the width out using some math to get the total width to a number divisible by a number input by the user, and I want to do the same to the height but the buffer amount will need to be different to get it divisible by the same number. What is the best way to go about this?
This is for a plugin so I need to do this in PyQGIS.
EDIT: the end goal here is to divide this rectangle up into a grid of squares (side length of whatever the user inputs), and the squares should fill the rectangle up without any partial squares. If there is an even better way to get to this end goal then great. But I figure I will need to get the dimensions of the rectangle correct first.
here is the code to create the rectangle:
newconvexhulllayer = processing.run("qgis:minimumboundinggeometry", {
'INPUT': self.poly_layer,
'TYPE': 1,
'OUTPUT': 'memory:'})
QgsProject.instance().addMapLayer(newconvexhulllayer['OUTPUT'])
I don't know where to begin for code for the buffer since I need to buffer the width and height by a different amount. I'm not worried about the math I just need to know how to buffer the width and height differently in qgis.