<commit_before>/**
 * 
 */
package io.github.data4all.util;

import io.github.data4all.model.data.Node;

import java.util.List;

/**
 * @author Richard
 *
 */
public class RectangleFunction {

    public static List<Node> makeRectangular(List<Node> nodes) {
        if (nodes.size() >= 4) {

            Node a = nodes.get(0);
            Node b = nodes.get(1);
            Node c = nodes.get(2);
            Node d = nodes.get(3);

            double ax = a.getLat();
            double ay = a.getLon();
            double bx = b.getLat();
            double by = b.getLon();
            double cx = c.getLat();
            double cy = c.getLon();
            double dx = d.getLat();
            double dy = d.getLon();

            double abx = bx - ax;
            double aby = by - ay;

            double bcx = cx - bx;
            double bcy = cy - by;

            double cdx = dx - cx;
            double cdy = dy - cy;

            double dax = ax - dx;
            double day = ay - dy;

        }
        return nodes;
    }

}
<commit_msg>refs #3309 added length, angles,..<commit_after>/**
 * 
 */
package io.github.data4all.util;

import io.github.data4all.model.data.Node;

import java.util.List;

/**
 * @author Richard
 *
 */
public class RectangleFunction {

    public static List<Node> makeRectangular(List<Node> nodes) {
        if (nodes.size() >= 4) {

            Node a = nodes.get(0);
            Node b = nodes.get(1);
            Node c = nodes.get(2);
            Node d = nodes.get(3);

            double ax = a.getLat();
            double ay = a.getLon();
            double bx = b.getLat();
            double by = b.getLon();
            double cx = c.getLat();
            double cy = c.getLon();
            double dx = d.getLat();
            double dy = d.getLon();

            double abx = bx - ax;
            double aby = by - ay;

            double bcx = cx - bx;
            double bcy = cy - by;

            double cdx = dx - cx;
            double cdy = dy - cy;

            double dax = ax - dx;
            double day = ay - dy;

            double abLength = Math.sqrt((abx * abx) + (aby * aby));
            double bcLength = Math.sqrt((bcx * bcx) + (bcy * bcy));
            double cdLength = Math.sqrt((cdx * cdx) + (cdy * cdy));
            double daLength = Math.sqrt((dax * dax) + (day * day));

            double alpha = Math.acos(((-1 * abx * bcx) + (-1 * aby * bcy))
                    / (abLength * bcLength));
            double beta = Math.acos(((-1 * bcx * cdx) + (-1 * bcy * cdy))
                    / (bcLength * cdLength));
            double gamma = Math.acos(((-1 * cdx * dax) + (-1 * cdy * day)
                    / (cdLength * daLength)));
            double delta = Math.acos(((-1 * dax * abx) + (-1 * day * aby)
                    / (daLength * abLength)));

        }
        return nodes;
    }

}

{'fraction_non_alphanumeric': 0.14201388888888888, 'fraction_numerical': 0.009027777777777777, 'mean_word_length': 1.3441822620016273, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5449880', 'n_tokens_mistral': 939, 'n_tokens_neox': 903, 'n_words': 248}