def bounds_from_minmax(min_pos: Vector, max_pos: Vector) -> BoundsDataStruct_Kenzan: box_rotation = Quaternion() box_rotation.identity() center = (min_pos + max_pos) / 2 box_extents = (max_pos - center) sphere_radius = (box_extents).length return BoundsDataStruct_Kenzan(sphere_pos=center, sphere_radius=sphere_radius, aabox_bottomleft=min_pos, aabox_topright=max_pos)
def bounds_from_minmax(min_pos: Vector, max_pos: Vector) -> BoundsDataStruct_YK1: box_rotation = Quaternion() box_rotation.identity() center = (min_pos + max_pos) / 2 box_extents = (max_pos - center) sphere_radius = (box_extents).length return BoundsDataStruct_YK1(center=center, sphere_radius=sphere_radius, box_extents=box_extents, box_rotation=box_rotation)
def getActionRotation(action, bone, frame=1): rot = Quaternion() rot.identity() if bone.rotation_mode != 'QUATERNION': rot = Euler(Vector(), bone.rotation_mode) for i in range(0, 3): fc = getCurve(action, bone, 'rotation_euler', index = i) if fc != None: rot[i] = fc.evaluate(frame) return rot.to_matrix() else: for i in range(0, 4): fc = getCurve(action, bone, 'rotation_quaternion', index = i) if fc != None: rot[i] = fc.evaluate(frame) return rot.to_matrix() return rot.to_matrix()