Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mesh=mesh,
translation=np.array(([
position[0] - barycenter[0],
position[1] - barycenter[1],
position[2] - barycenter[2],
])))
scene.add_node(node)
cube_nodes.append(node)
update_cube_color_and_position(cube_nodes, color_candidates)
# Place a light
light = DirectionalLight(color=np.ones(3), intensity=15.0)
quaternion_yaw = pyrender.quaternion.from_yaw(math.pi / 4)
quaternion_pitch = pyrender.quaternion.from_pitch(-math.pi / 5)
quaternion = pyrender.quaternion.multiply(quaternion_pitch, quaternion_yaw)
quaternion = quaternion / np.linalg.norm(quaternion)
node = Node(
light=light, rotation=quaternion, translation=np.array([1, 1, 1]))
scene.add_node(node)
return scene, cube_nodes
def genearte_camera_quaternion(yaw, pitch):
quaternion_yaw = pyrender.quaternion.from_yaw(yaw)
quaternion_pitch = pyrender.quaternion.from_pitch(pitch)
quaternion = pyrender.quaternion.multiply(quaternion_pitch, quaternion_yaw)
quaternion = quaternion / np.linalg.norm(quaternion)
return quaternion
mesh=mesh,
translation=np.array(([
position[0] - center_of_gravity[0],
position[1] - center_of_gravity[1],
position[2] - center_of_gravity[2],
])))
scene.add_node(node)
cube_nodes.append(node)
update_cube_color_and_position(cube_nodes, color_candidates)
# Place a light
light = DirectionalLight(color=np.ones(3), intensity=15.0)
quaternion_yaw = pyrender.quaternion.from_yaw(math.pi / 4)
quaternion_pitch = pyrender.quaternion.from_pitch(-math.pi / 5)
quaternion = pyrender.quaternion.multiply(quaternion_pitch, quaternion_yaw)
quaternion = quaternion / np.linalg.norm(quaternion)
node = Node(
light=light, rotation=quaternion, translation=np.array([1, 1, 1]))
scene.add_node(node)
return scene, cube_nodes
def genearte_camera_quaternion(yaw, pitch):
quaternion_yaw = pyrender.quaternion.from_yaw(yaw)
quaternion_pitch = pyrender.quaternion.from_pitch(pitch)
quaternion = pyrender.quaternion.multiply(quaternion_pitch, quaternion_yaw)
quaternion = quaternion / np.linalg.norm(quaternion)
return quaternion