There are many ways in which you can modify that code.
The easiest (but not the most general) one for you for your specific case would be to add a "Shrink" factor that the user can specify.
You can use this factor to "shrink" the 4-node polygon towards the center.
The function where we eval if a node is in the cut-plane is here (you need the case with 4 corner nodes):
More specifically the function "point_in_triangle" (that I call twice: the 2 triangles that make the quad polygon):
Where I compute the position matrix X, you can "shrink" it towards the center (you may need to pass the center to this function).
something like:
X = Center + (X-Center)*shrink_factor