# How to divide an edge?

Can someone give me a “light” on how do i divide an edge using python?

Thank you very much!!

Blender has no “edge objects”. You have to:
create new vertex (on edge where it has to be divided),
create new 4 faces with this new vertex
copy data from existing 2 faces which share edge
delete existing 2 faces
update mesh

how do i know the exact position of the new vertice?

Ex:
vertice_a = 0.00, 0.00, 0.00
vertice_b = 1.00, 3.14, 0.56

If i have an edge in these 2 vertices, how do i found the middle point?

I need some math knoledge!

Thank you!!

coord_new - 3d coordinates of new vertex
coord_a - 3d coordinates of vertex a
coord_b - 3d coordinates of verrex b
idx - coordinate index 0=x, 1=y, 2=z
t - parameter

coord_new[idx] = (coord_b[idx] - coord_a[idx]) * t + coord_a[idx]

t = 0 - position at vertex a
t = 1 - position at vertex b
t = 0.5 - position at middle of the edge between a and b

thank you again!!

Sorry to be so pain in the …

What is (idx)?
What is (parameter)?

Thank you!!