1
$\begingroup$

enter image description hereHow do i get these vertices to align perfectly? The left image is the actual wall of the center shape. Every vertices of the 6 external walls are calculated to stand on the radius of a sphere. I can rotate the mesh 60 degrees at a time and all the vertices of the walls always end up at the exact same X,Y,Z position. Therefor, theoretically, i should be able to tile this shape side by side and form a sphere. The problem is that blender doesn't allow a true edge hinge. I can snap a vertex from both shape and then use it as a pivot point to snap the opposing vertices, in essence snapping, let say, the upper edges together. This part is easy even when i reach far from the actual X,Y,Z axes. But then i have to align the bottom edge and that is where it all goes to smurf! Even on the exact axes it doesn't align perfectly, so the further i go from the X or Y or Z axes the more i get drifting. By the time i have filled a sixth ring around the central shape, when i try to merge the shapes into a single mesh, the vertex merger begins to create zig-zags. If i select two opposing vertices on the upper edges, after aligning it, i can only get a pivot "POINT" in the middle of the 2. The problem with that is that the mesh can swivel in every direction from a "POINT". I need a way to pivot from the entire edge. Either by keeping the 2 points as simultaneous pivot or by having an actual "EDGE HING" instead of a "POINT HING". Been searching everywhere for a solution but haven't found anything that can achieve this easily, and i have to put a lot of them together to form a sphere.(by ring it is: 1, 6, 12, 18, 24, 30, 36 and by then i already have 127 copies and not even a quarter of the final mesh completed). (The shape is actually made up of 4 different meshes which are parented to their top part, so they moves as one mesh.) So if anyone can provide me with a solution i would greatly appreciate it! p.s. i am not looking for a geometry lesson, as you can clearly see it does tile perfectly. there is no need for you to understand exactly what i am trying to do this since what i'm asking is how to achieve the equivalent of using an entire edge as a swivel instead of just a point, you know like a door hinge does. or how to get the four opposing vertices of one wall of one shape to all line up perfectly with their equivalent vertices on the other shape as that shape gets copied and displaced in 3d space. myshapes

$\endgroup$
15
  • $\begingroup$ It's unclear what you're trying to achieve. What do you mean by "tile this shape side by side and form a sphere". Tiled hexagons or hexagonal prisms don't form a sphere but a flat plane. $\endgroup$
    – Benedikt
    Commented Oct 26, 2021 at 14:15
  • $\begingroup$ you are concerning yourself with the wrong part of this problem, not looking for a geometry lesson. i am trying to get the four lite vertices of the shape on the right to snap perfectly on the four light vertices of the shape on the left, so that both shapes (identical copies of each other)line up perfectly vertices to vertices as i create a tiling. my reasons for doing this and all the rest is without importance. whether it was for this or that reason or purpose would change nothing to the problem. $\endgroup$ Commented Oct 26, 2021 at 16:09
  • $\begingroup$ these two shapes are specifically designed to be tiled up to my needs, that's why in the question it said "each vertices are specifically calculated to stand on the radius of a sphere". and i don't understand why every time i ask a question here i get people trying to give me geometry lessons? after all the question explains what i am looking for and if i wanted geometry lessons i could find a million of them on the net. so again i ask: $\endgroup$ Commented Oct 26, 2021 at 16:10
  • $\begingroup$ Is there a way to create a "EDGE HING" instead of just a "POINT HING" or is there a way to achieve the equivalent of swiveling a shape by one full edge instead of just a point on the edge? $\endgroup$ Commented Oct 26, 2021 at 16:11
  • $\begingroup$ If its not important, then why are you even mentioning it? My point is that there's wall of irrelevant text and you have to break down your problem to make it clear to the reader or you probably won't get an answer. $\endgroup$
    – Benedikt
    Commented Oct 26, 2021 at 16:44

2 Answers 2

2
$\begingroup$

If I've got you right, you're looking for snapping a rotation about an arbitrary hinge? When you create a Custom Orientation from an edge, or any 2 vertices, the Y axis of the orientation is the line between them.

Starting worst-case, no alignment.

  • Set Pivot to 3D Cursor, Snap to 'To': 'Vertex', and 'With': 'Active'
  • ShiftS Put the 3D Cursor at one end of your hinge.

enter image description here

  1. Create a Custom Orientation from your hinge-edge, and make sure it's being used. (Mine is in my Quick Menu, with 'Use After Creation', and 'Overwrite Previous' set.)
  2. G snap a suitable active vertex to one end of your hinge.
  3. With the other end-vertex active, snap to the other end of your hinge, by rotating in the non-Y dimensions of your hinge-orientation.. (X, then Z, or Z, then X)
  4. Now, RY will rotate about the hinge-edge, and you can make another vertex active, to snap about the hinge to another target.
$\endgroup$
5
  • $\begingroup$ Oh, this works like a charm, nice one :)) $\endgroup$ Commented Oct 26, 2021 at 19:25
  • $\begingroup$ @JachymMichal.. where are you getting to watch Dune ? $\endgroup$
    – Robin Betts
    Commented Oct 26, 2021 at 19:26
  • $\begingroup$ Well those HBO guys have it available online... :)) $\endgroup$ Commented Oct 26, 2021 at 19:33
  • 1
    $\begingroup$ @JachymMichal Ahhhh.. maybe should subscribe :) $\endgroup$
    – Robin Betts
    Commented Oct 26, 2021 at 19:34
  • 2
    $\begingroup$ BRILLIANT! i knew it couldn't be that complicated. this is simple and all vertices finally line up perfectly. i couldn't thank you enough. been looking for this for a month now. very much so newbi. have a great evening, i know i will! $\endgroup$ Commented Oct 26, 2021 at 22:14
0
$\begingroup$

I've solved this via scripting.

  • Make a vertex group for each of 3 of the points on the first object. Obj1 and its vertex groups with one vertex each.

  • Make a vertex group for the corresponding 3 points on the second object in the same order. Make sure the vertex group of a point has the same name as the vertex group of the other object containg the point it should land on. Obj2 and its corresponding vertex groups.

  • Make a new text file in the script editor. Paste the script.

  • Select the two objects. The active object (selected last) will land on the other object.

  • Run the script.

import bpy
from mathutils import Matrix

selected = bpy.context.selected_objects
assert len(selected) == 2
obj1 = bpy.context.active_object
obj0 = [obj for obj in selected if obj != obj0][0]

# get the coordinates of the points from the vertex groups
def get_coords(obj): 
    pts = []
    for vg_name in ["Group", "Group.001", "Group.002"]: # group names
        for v in obj.data.vertices:
            if obj.vertex_groups[vg_name].index in [i.group for i in v.groups]:
                pts.append(v.co)
                break
    return pts
pts0 = get_coords(obj0)
pts1 = get_coords(obj1)

# construct a matrix for each object:
def make_matrix(o, b, c):    
    x_axis_dir = b-o
    z_axis = x_axis_dir.cross(c-o).normalized()
    y_axis = z_axis.cross(x_axis_dir).normalized()
    x_axis = x_axis_dir.normalized()
    mx = Matrix([x_axis, y_axis, z_axis]).transposed()
    return Matrix.Translation(o) @ mx.to_4x4()
mx0 = obj0.matrix_world @ make_matrix(*pts0)
mx1 = obj1.matrix_world @ make_matrix(*pts1)

# place the object from the first to the second matrix
obj1.matrix_world = mx0 @ mx1.inverted() @ obj1.matrix_world
$\endgroup$

You must log in to answer this question.

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