3
$\begingroup$

I have two triangular faces that are connected with one edge (one object, in edit mode). I would like to move the second triangle into the plane of the first triangular face. This means that the third not connected point will have to move.

This would be easy if the plane would be x,y or z by using the scale trick, but I would like for it to work in any given plane. How could I do this?

$\endgroup$
6
$\begingroup$

I think the answer is: yes you can.

  • Select the connecting edge and snap the 3D cursor to it
  • Set the pivot point to 3D Cursor
  • The connecting edge still selected, add a custom transformation orientation and keep it as orientation

Now

  • Select the first triangle (the target)
  • Use ShiftNumpad 1 or ShiftNumpad 3 to be in orthographic view aligned with this triangle and so that the connecting edge is aligned to the view. This is useful in order to snap as we want later.

To snap:

  • Enable snapping, set it to vertex, snap with closest, project onto self and enable it for rotation

To rotate:

  • Select the opposite vertex (the one of the other triangle)
  • Rotate R, hit Y to rotate around the connecting edge
  • Set the mouse cursor onto the opposite vertex of the target triangle

To rotate to the opposite:

  • Rotate R, hit Y, then hit 180 on the numpad

enter image description here

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Script wise getting the rotational difference of the linked faces normals and rotating about edge does the trick too. Similar to blender.stackexchange.com/questions/68609/… $\endgroup$ – batFINGER Feb 2 at 14:44
  • $\begingroup$ This was exactly what I was looking for. A bit strange that the functionality is not in Blender itself. There is an option via cleanup that does pretty much this, but it only works on one plane (with more than 3 vertices of course). $\endgroup$ – takje Feb 2 at 18:39
  • $\begingroup$ @takje I think this is not built in because Blender is still essentially quad based, so this generally don't matter. But consider batFINGERS answer as his answer leads to a much more simple process. $\endgroup$ – lemon Feb 2 at 18:41
  • 1
    $\begingroup$ @batFINGER Yes but you could generalize it to two quads (that are each perfectly planar) and you would have the same problem in my view. $\endgroup$ – takje Feb 2 at 18:45
5
$\begingroup$

Script Version

enter image description here

For two triangles can use the rotation difference of the hinge edges adjoining face normals. In angle axis format this will be the angle required to rotate, and axis should be parallel to the hinge edge.

To use, edit mode, edge selection.

  • Select hinge edge.
  • Shift select edge on tri face you wish to rotate to coplanar.
  • Hit run script.

Test script.

import bpy
import bmesh
from mathutils import Matrix


TOL = 1e-7
context = bpy.context
edit_object = context.edit_object
me = edit_object.data
bm = bmesh.from_edit_mesh(me)

e0, e1  = bm.select_history[-2:]
# connected faces
f0, f1 = e0.link_faces

if all(e in f1.edges for e in (e0, e1)):
    f1, f0 = e0.link_faces

while f0.normal.angle(f1.normal) > TOL:    
    axis, angle = f0.normal.rotation_difference(f1.normal).to_axis_angle()
    evec = (e0.verts[1].co - e0.verts[0].co).normalized()

    if axis.dot(evec) < 0:
       axis.negate()

    bmesh.ops.rotate(bm, 
            verts = f0.verts,
            cent=(e0.verts[0].co + e0.verts[1].co) / 2,
            matrix = Matrix.Rotation(angle, 3, axis)
            )

bmesh.update_edit_mesh(me)
me.update()
| improve this answer | |
$\endgroup$
  • $\begingroup$ Much more easy... once you have the script : ) $\endgroup$ – lemon Feb 2 at 16:40
  • 1
    $\begingroup$ Cheers. Still confused how to do this in one hit from rot dif. Ended up doing the ugly iterative thing. .. Tried looking at normals and dot products changing orders..??? btw noticed galdalf answered other q the other day. Agree, tis a shame. $\endgroup$ – batFINGER Feb 2 at 16:43
  • $\begingroup$ In fact we only have to move one vertex. So if we use the altitude of the triangle, it can be move from the altitude intersection point in the altitude distance and colinear to the altitude of the opposite summit vertex (?). $\endgroup$ – lemon Feb 2 at 18:20
  • 1
    $\begingroup$ While I picked the other one as the answer since it is a little more generic, I think I will use this one the most. I haven't used any scripting yet before this, but I really like the simplicity. $\endgroup$ – takje Feb 2 at 18:41
  • $\begingroup$ @lemon since the other two verts are on the axis I didn't bother to find the "other" vert. The issue is (as I see it) rotating the wrong way, and some test or order to go the right way. Could project the normals down the axis as 2d vectors and get the signed angle difference but getting to overkill for an answer. $\endgroup$ – batFINGER Feb 3 at 7:37
4
$\begingroup$

To Rotate the vertex into the plane, follow @Lemon's answer, or a variant.

To Project the vertex onto the plane:

  • With pivot set to 'Active Element'

  • Create a Custom Orientation from the face/ 3 vertices which will remain stationary.

    This is the '+' in the Orientation dropdown. You may want to add this to your Quick Menu, or create a shortcut for it. You may also want to set it to 'Use after Creation' and/or 'Overwrite Previous'. Those settings will persist.

  • Select the vertex/vertices you want moved, with one of the stationary vertices last, so it's active.

  • Hit SZ0

Actually, for rotation, these steps can be used in combination with parts of @Lemon's answer: use them to project a ShiftD duplicate of the vertex you want to rotate onto the plane, which can then be used as a snapping target for the rotation, and deleted after use.

| improve this answer | |
$\endgroup$
0
$\begingroup$

The answer is: You can't.

But you can trick Blender to do so:

Let's say we have two triangle faces in random locations. They are part of one object:

enter image description here

What we can do to align the faces is this:

1) Since we cannot automatically align the faces in edit mode, we will select one face, and P to separate it into another object, and transform origin to geometry:

enter image description here

2) Align the two objects by selecting both, going to object > Transform > Align, and SHFT-RMB on all axes. This is the result:

enter image description here

Now the objects are aligned so that they are only visible as "one" object.

If you want to connect the faces when making one object, follow these next steps. If not, then skip to step 4.

3) Select one, move it down to about the bottom of the other, (try to make exact as possible), and rotate the object so that is perpendicular to the former like this:

enter image description here

4) Select both objects, and press CTRL+J to join to one object.

Result: enter image description here

(optional) 5) Join the faces on one edge. Origin to geometry first, then go to edit mode. Choose select edges and select the edges where the triangles meet.

enter image description here enter image description here

Now press F to mark as a face. This is the final result when one face is moved:

enter image description here

The faces are aligned and joined.

I hope this solved your problem.

Note: Please don't mess up the location of the faces, and if you do, Don't Worry!

Just press CTRL+Z, and you're fixed.

| improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ "I have two triangular faces that are connected with one edge" $\endgroup$ – batFINGER Feb 2 at 3:36
  • $\begingroup$ There is always a longer way. $\endgroup$ – Nate_Sycro27 Feb 2 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.