# Create missing point of a rectangle from right-angled triangle

Assume you have 3 connected vertices, which form a right-angled triangle. Is there any easy way to fill in the 4th point to make it a square? I usually copy the corresponding coordinates, when the triangle is axis aligned. But that is a rather slow workflow.

• You could duplicate the triangle, flip it around by scaling it by -1, and then use snapping to position it... and then remove doubles. You would end up with a square made out of 2 triangles, which you can change to one face by selecting both and dissolving faces. – RBlong2us Jul 17 '19 at 2:58
• You should activate the F2 addon (called 'Mesh F2' and should be standard in 2.8). See for instance blendernation.com/2013/01/20/f2-modeling-add-on-released – lemon Jul 17 '19 at 7:00

Edit mode script.

• Select face in face select mode and run script.

• Finds longest edge (hypotenuse) doesn't test for right angle.

• Creates a new vertex at location of other vert.

• Rotates it 180 degrees about the hypotenuse.

• Creates a new face from new vert and hypotenuse edge.

• Uncomment (remove #) from #bmesh.ops.dissolve_edges(bm, edges=[le]) to dissolve the hypotenuse edge, if you want the resultant quad.

import bpy
import bmesh
from mathutils import Matrix
from math import pi

context = bpy.context
ob = context.edit_object
me = ob.data

bm = bmesh.from_edit_mesh(me)

f = bm.select_history.active
if isinstance(f, bmesh.types.BMFace) and len(f.verts) == 3:
# longest edge
le = sorted(f.edges, key=lambda e: e.calc_length()).pop()
v = (set(f.verts) - set(le.verts)).pop()
nv = bm.verts.new(v.co)
bmesh.ops.rotate(bm,
cent=le.verts[0].co,
matrix=Matrix.Rotation(pi, 3, le.verts[0].co - le.verts[1].co),
verts = [nv],
)
bm.faces.new([nv] + le.verts[:]).select = True
#bmesh.ops.dissolve_edges(bm, edges=[le])
bm.normal_update()
bmesh.update_edit_mesh(me)

• I think you win the sledgehammer prize for this one! :D – Robin Betts Jul 17 '19 at 15:59
• Thanks a lot, thats quite awesome! – Notion Jul 20 '19 at 0:11

With pivot set to 3D cursor, in Edit Mode, assuming the triangle is lying in the XY plane:

1. With the hypotenuse selected : ShiftS > 'Cursor to selected'
2. With all selected : ShiftDRZ180

.. and then, with all selected, Removing Doubles in 2.79 / Merging by Proximity in 2.8, and F to merge the faces.