In [1]:
Copied!
import numpy as np
from molpy.op.geometry import (
rotate_by_rodrigues,
translate,
)
# Rotate coordinates using Rodrigues formula
coords = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
axis = np.array([0.0, 0.0, 1.0])
theta = np.pi / 2 # 90 degrees
rotated = rotate_by_rodrigues(coords, axis, theta)
print(f"Rotated coordinates:\n{rotated}")
# Translate coordinates
vector = np.array([1.0, 1.0, 1.0])
translated = translate(coords, vector)
print(f"Translated coordinates:\n{translated}")
import numpy as np
from molpy.op.geometry import (
rotate_by_rodrigues,
translate,
)
# Rotate coordinates using Rodrigues formula
coords = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
axis = np.array([0.0, 0.0, 1.0])
theta = np.pi / 2 # 90 degrees
rotated = rotate_by_rodrigues(coords, axis, theta)
print(f"Rotated coordinates:\n{rotated}")
# Translate coordinates
vector = np.array([1.0, 1.0, 1.0])
translated = translate(coords, vector)
print(f"Translated coordinates:\n{translated}")
Rotated coordinates: [[ 6.123234e-17 1.000000e+00 0.000000e+00] [-1.000000e+00 6.123234e-17 0.000000e+00]] Translated coordinates: [[2. 1. 1.] [1. 2. 1.]]