How can I ADD vertices and faces to a mesh?

I want to make my own mesh manipulation scripts, but I can’t find anywhere how to simply, for example, create a vertex at the midpoint of the edge connecting vertex A and vertex B, or, for building upon this idea, how to make a vertex 40% distance from A to B, to 5 units away from B on y axis, etc. I’m good at coding, I just don’t know what to reference. I look at the API, go to Mesh, look at methods, but find nothing helpful. Please help.

The Mesh documentation tells you how you can create a new mesh. If you are changing the number of vertices, or how triangles are formed from the verts then you’ll need to create a new one.

If you need a new vertex C midway between A and B, then just add them together and divide by two. If C is 40% between them, make a direction vector between A and B, and add 40% of this to A. I guess your problem is the maths to do the vertex creation or edits.