<commit_before>
from pedemath.quat import invert_quat
from pedemath.quat import lerp_quat
from pedemath.quat import Quat
from pedemath.vec3 import Vec3
from pedemath.vec3 import neg_v3
from pedemath.vec3 import sub_v3


def invert_transform(transform):
    return Transform(neg_v3(transform.pos), invert_quat(transform.rot))


def lerp_transform(transform1, transform2, percent):

    dist_vec = sub_v3(transform2.pos, transform1.pos)
    dist_vec.scale(percent)

    rot = lerp_quat(transform1.rot, transform2.rot, percent)

    return Transform(transform1.pos + dist_vec, rot)


class Transform(object):
    """ Define a common api for a transform.

    # TODO: trying set and get, possibly move to attribute
    """

    def __init__(self, pos=None, rot=None):

        if not pos:
            pos = Vec3(0, 0, 0)

        self.pos = Vec3(*pos)

        if not rot:
            rot = Quat()

        self.rot = rot

        # Optional parent transform
        # self.parent = None

    def transform(self, target):
        """Transform the target and return it's new value.
        It may be a Vec3 point or a Transform"""

        if isinstance(target, Vec3):<commit_msg>New Quat instead of keeping reference to parameter<commit_after>
from pedemath.quat import invert_quat
from pedemath.quat import lerp_quat
from pedemath.quat import Quat
from pedemath.vec3 import Vec3
from pedemath.vec3 import neg_v3
from pedemath.vec3 import sub_v3


def invert_transform(transform):
    return Transform(neg_v3(transform.pos), invert_quat(transform.rot))


def lerp_transform(transform1, transform2, percent):

    dist_vec = sub_v3(transform2.pos, transform1.pos)
    dist_vec.scale(percent)

    rot = lerp_quat(transform1.rot, transform2.rot, percent)

    return Transform(transform1.pos + dist_vec, rot)


class Transform(object):
    """ Define a common api for a transform.

    # TODO: trying set and get, possibly move to attribute
    """

    def __init__(self, pos=None, rot=None):

        if not pos:
            pos = Vec3(0, 0, 0)

        self.pos = Vec3(*pos)

        if not rot:
            rot = Quat()

        self.rot = Quat(*rot)

        # Optional parent transform
        # self.parent = None

    def transform(self, target):
        """Transform the target and return it's new value.
        It may be a Vec3 point or a Transform"""

        if isinstance(target, Vec3):
{'fraction_non_alphanumeric': 0.08813700918964076, 'fraction_numerical': 0.018379281537176273, 'mean_word_length': 2.978405315614618, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3669099', 'n_tokens_mistral': 789, 'n_tokens_neox': 732, 'n_words': 230}