Erase a vertex from ofPath?

Hi, I wonder if it’s possible to remove a vertex from ofPath which is already set.

For example, if I draw a rectangle using ofPath, I can add vertices as below.

path.moveTo(0,0);
path.lineTo(100,0);
path.lineTo(100,100);
path.lineTo(0,100);
path.close();

And what if I want to remove “path.lineTo(0,100);” to make it a triangle shape?
Is it possible to do this without clearing and re-adding vertices?

a path is not formed by vertices but by commands. you can access the commands using getCommands and manipulate that vector directly to for example remove one of them

1 Like

Great! Thank you @arturo :slight_smile: