<commit_before>#!/usr/bin/env python2.7

import numpy

p1 = numpy.array([0,0,0])
p2 = numpy.array([2,0,0])
p3 = numpy.array([0,0,2])

def mimLocInit(x,y):
    v12 = p2 - p1
    v13 = p3 - p1

    planeNormal = numpy.cross(v12, v13)

    print v12, v13

    axisX = v12 / numpy.linalg.norm(v12)
    axisY = v13 / numpy.linalg.norm(v13)

    print numpy.linalg.norm(v12), numpy.linalg.norm(v13)
    print axisX, axisY, planeNormal

    point = (x * axisX) + (y * axisY)

    print point
<commit_msg>transformed mimLocator into a class<commit_after>#!/usr/bin/env python2.7

import numpy

class Locator:
    def __init__(self, p1, p2, p3):

        # initialize points
        self.p1 = numpy.array(p1)
        self.p2 = numpy.array(p2)
        self.p3 = numpy.array(p3)

        # set vectors form p1 to p2 and from p1 to p3
        self.v12 = self.p2 - self.p1
        self.v13 = self.p3 - self.p1

        # calculate the normal to v12 and v13
        self.planeNormal = numpy.cross(self.v12, self.v13)

        # calculate corresponding axes of the plane, having p1 as base
        self.axisX = self.v12 / numpy.linalg.norm(self.v12)
        self.axisY = self.v13 / numpy.linalg.norm(self.v13)

    def planeToCartesian(self, x, y):
        """Takes a point (x,y) on the plane the Locator was initialized for and
        transforms it into (x,y,z) coordinates located in cartesian space.
        """
        point = (x * self.axisX) + (y * self.axisY)
        print point

{'fraction_non_alphanumeric': 0.12152070604209098, 'fraction_numerical': 0.055668703326544465, 'mean_word_length': 2.365296803652968, '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': '5645135', 'n_tokens_mistral': 586, 'n_tokens_neox': 548, 'n_words': 143}