5
$\begingroup$

I moved one vertex in but now I have a kink in my surface.

Is there a clever way to move the second edge so the kink disappears?

enter image description hereenter image description here

$\endgroup$

2 Answers 2

5
$\begingroup$

A script.

Thought this would be a good little exercise in edit mode bmesh scripting.

enter image description here

  • Select two edges that share a middle vert.
  • Move middle vert the least distance such that it is on the line defined by the other two.
import bpy
import bmesh
from bmesh.types import BMEdge
from mathutils.geometry import intersect_point_line
ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

edges = bm.select_history[-2:]
verts = set(v for e in edges for v in e.verts)

# ensure the last two selections are both edges that share a vert
assert (
       len(verts) == 3 
       and len(edges) == 2 
       and all(isinstance(e, BMEdge) for e in edges)
       )
# All Ok, the edges 
e1, e2 = edges
# The middle vert
v =  set(e1.verts).intersection(e2.verts).pop()
# helper method to find closest point on line segment to a given point.
co, d = intersect_point_line(
        v.co,
        e1.other_vert(v).co,
        e2.other_vert(v).co
        )
v.co = co

bmesh.update_edit_mesh(me)

other options would be to move middle vert to center (or other defined ratio) of other two, keep the ratio of lengths constant.

$\endgroup$
3
  • $\begingroup$ Thanks, didn't even think about a script :) That makes that may faster and less tides. $\endgroup$
    – Phönix 64
    Commented Feb 7, 2021 at 8:45
  • $\begingroup$ could you explain your code a bit? I get everything until verts = set(v for e in edges for v in e.verts) then don't know what it does. $\endgroup$
    – Phönix 64
    Commented Feb 7, 2021 at 11:32
  • $\begingroup$ OY! What's this minus 15 business? :D (Don't worry, @Phönix64, just kidding the scriptmeister...) $\endgroup$
    – Robin Betts
    Commented Feb 7, 2021 at 11:58
6
$\begingroup$

To straighten vertices to a line:

  • Set pivot to 'Active Element'

  • Select the 2 vertices at the ends, and create a Custom Transform Orientation from them. (The little '+' in the header's Transform Orientation dropdown)

    enter image description here

  • With all 3 vertices selected, and one of the ends selected last, so active, and the new transform orientation active, hit S Shift Y 0, scaling to 0 in all dimensions, except 'Y', the one along the line between the end vertices.

$\endgroup$
2
  • 1
    $\begingroup$ Okay, thanks. It worked $\endgroup$
    – Phönix 64
    Commented Feb 6, 2021 at 11:34
  • $\begingroup$ @susu Thanks.. I'll have to watch myself... I must be getting lazy :) $\endgroup$
    – Robin Betts
    Commented Feb 6, 2021 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .