3
$\begingroup$

this seems to be a simple question, still I'm surprised that I couldn't find any really satisfying answer...

Supposed, I'm looking from Blender's world origin on two spheres sitting in somewhere the x-y-plane, and I want to know the precise angle between the sphere origins.

I read lots of posts on the simple "Measure Tool" as well as on the "Measurelt" add-on, and I tried both. However, the measure tool shows angle values >10° only in integer degrees, but I need much higher precision. In an 8-year-old post I read that the value shows more digits, if copied to the clipbord, but I didn't succeed.

enter image description here

Moreover, I had to manually move the end points and the angle point of the measure lines to the object origins and the world origin respectively. That's somewhat cumbersome, inaccurate, and time-consuming, but there seems not to be any way to snap (except to vertices).

With the Measurelt add-on I had the problem that for angle measurement I could just select vertices of the same mesh, and only in the Edit Mode. Maybe I missed something, but I could neither select vertices from different objects, nor any other points, e.g. object origins, world origin, any grid points, or else.

Isn't there any simple and obvious method, like clicking three freely selectable points and choose "measure angle" from some menu, as it is implemented in many CAD programs?

My final goal is to animate the mechanisms of simple chemical reactions. But they have to be precise concerning the distances, angles, and atom sizes. For the creation of realistic 3D representations of molecules I use energy minimizing software to produce the geometry in the local or global energy minimum of a molecule. I usually get a PDB file containing all necessary geometric information, which I can import using the Atomic Blender add-on.

That means the spheres (atoms) and cylinders (bonds) are already there and are not created later on. It also does't really help to select vertices of these spheres, and for some reason the origins (usually in the sphere centers) appear to be non-selectable with MeasureIt.

During the animation, some atoms change their places by rotation around specified points within the molecule (not necessarily vertices or sphere origins), and they have to rotate within defined planes which depend on the shape of the molecule (and have nothing to do with the given planes xy, xz, yz in Blender). Also, the animated rotation angles depend on the angles in the initial situation.

The molecules sometimes contain dozens of atom spheres connected by bond cylindres, and must not be changed or reconstructed. Besides, this would take much too long... Therefore I have to measure lots of angles in a given molecule geometry, and would need a preferably simple and quick method to get the angles with an accuracy of about 3 decimals.

For general info, I'm using Blender version 3.4.1 on Windows 10, and I'm a very beginner with blender...

Grateful for any help,
Dirk

$\endgroup$
0

2 Answers 2

3
$\begingroup$

The measure it tool allows you to add 5 decimals of precision when calculating the angle of 3 vertices.

Choose 3 vertices of an object. Open the measure-it sidebar, and press angle, then show.

Scroll down past cube and adjust precision to 5.

enter image description here

Then with a vertice selected press shift+s to snap the 3d cursor to the vertice location. Create your sphere there. Repeat the process for the second sphere. The angle and the spheres will all be separate objects.

With a vertice of your angle selected switch to object mode. Select the sphere and press ctrl+p to parent the spheres to the vertices.

enter image description here

Then, you can calculate that angle from the origin.

enter image description here

$\endgroup$
1
$\begingroup$

You could also use Python. Let's steal some bits from https://stackoverflow.com/a/13849249/10259287:

import bpy
import numpy as np


def unit_vector(vector):
    return vector / np.linalg.norm(vector)

def angle_between(v1, v2):
    v1_u = unit_vector(v1)
    v2_u = unit_vector(v2)
    return np.degrees(np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0)))


if len(bpy.context.selected_objects) != 2:
    print("Select 2 objects.")
else:
    vector_1 = bpy.context.selected_objects[0].location
    vector_2 = bpy.context.selected_objects[1].location
    print(angle_between(vector_1, vector_2))

You would have to open Blender's System Console to see what's printed once you run it in the Text Editor:

enter image description here

$\endgroup$

You must log in to answer this question.

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