Multi-Object Queries¶
[13]:
from geo3d.query import distance_between_points, minimize_points_to_points_distance, distances_plane_to_points
from geo3d import Point, Plane, Vector
Point-to-Point Distance¶
The distance between points can be queried as
[14]:
pointA = Point([1,2,3])
pointB = Point([1,2,6])
distance_between_points(pointA, pointB)
[14]:
3.0
Plane-to-Points Distance¶
The distance from a plane to an array of points, positive along the plane normal vector.
[29]:
plane = Plane(
normal=Vector([0,0,-1]),
point=Point([1,2,0])
)
points = [[1,2,3], [1,2,6]]
distances_plane_to_points(plane, points)
[29]:
array([-3., -6.])
Transformation minimizing group-to-group distance¶
For two point groups, find the transformation – applied to the first group – that minimizes the RMS distance between the corresponding points in the two groups:
Here, we extract a rotation of 90 degrees between the point groups, that is, groupA
needs to be rotated by 90 degrees to coincide with groupB
.
[8]:
groupA = [[1,0,0], [0,1,0], [-1,0,0], [0,-1,0], [0,0,1], [0,0,-1]]
groupB = [[0,1,0], [-1,0,0], [0,-1,0], [1,0,0], [0,0,1], [0,0,-1]]
minimize_points_to_points_distance(groupA, groupB)
[8]:
rotation matrix | Fixed angles (xyz, extr., deg.) |
Euler angles (xyz, intr., deg.) |
translation |
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|