<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Engine
{
    /// <summary>
    ///  Points must be clockwise from top-left
    /// </summary>
    public struct GridQuad
    {
        public float Area
        {
            get
            {
                return 0.5f * Math.Abs(
                    ((p[2].X - p[0].X) * (p[3].Y - p[1].Y)) -
                    ((p[3].X - p[1].X) * (p[2].Y - p[0].Y))
                    );
            }
        }

        public System.Drawing.PointF[] p;

        public GridQuad(System.Drawing.PointF[] points)
        {
            this.p = points;
        }

        public float Width
        {
            get
            {
                return Math.Max(p[1].X, p[2].X) - Math.Min(p[0].X, p[3].X);
            }
        }

        public float Height
        {
            get
            {
                return Math.Max(p[2].Y, p[3].Y) - Math.Min(p[0].Y, p[1].Y);
            }
        }
    }
}<commit_msg>added centroid<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Engine
{
    /// <summary>
    ///  Points must be clockwise from top-left
    /// </summary>
    public struct GridQuad
    {
        public float Area
        {
            get
            {
                return 0.5f * Math.Abs(
                    ((p[2].X - p[0].X) * (p[3].Y - p[1].Y)) -
                    ((p[3].X - p[1].X) * (p[2].Y - p[0].Y))
                    );
            }
        }

        public PointF[] p;

        public GridQuad(System.Drawing.PointF[] points)
        {
            this.p = points;
        }

        public float Width
        {
            get
            {
                return Math.Max(p[1].X, p[2].X) - Math.Min(p[0].X, p[3].X);
            }
        }

        public PointF Centroid
        {
            get
            {
                return new PointF((p[0].X + p[1].X + p[2].X + p[3].X) / 4, (p[0].Y + p[1].Y + p[2].Y + p[3].Y) / 4);
            }
        }

        public float Height
        {
            get
            {
                return Math.Max(p[2].Y, p[3].Y) - Math.Min(p[0].Y, p[1].Y);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.15391419725785052, 'fraction_numerical': 0.020344980097302078, 'mean_word_length': 1.0053191489361701, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2309026', 'n_tokens_mistral': 771, 'n_tokens_neox': 741, 'n_words': 143}