<commit_before>using System;
using System.Collections.Generic;

namespace Boing
{
    public struct Rectangle2f
    {
        public Vector2f Min { get; }
        public Vector2f Max { get; }

        public Rectangle2f(Vector2f min, Vector2f max)
        {
            if (min.X > max.X)
                throw new ArgumentException("min.X is greater than max.X");
            if (min.Y > max.Y)
                throw new ArgumentException("min.Y is greater than max.Y");

            Min = min;
            Max = max;
        }

        public Rectangle2f(float x, float y, float width, float height)
        {
            Min = new Vector2f(x, y);
            Max = new Vector2f(x + width, y + height);
        }

        public Vector2f TopLeft => Min;
        public Vector2f TopRight => new Vector2f(Min.Y, Max.X);
        public Vector2f BottomLeft => new Vector2f(Max.Y, Min.X);
        public Vector2f BottomRight => Max;

        public IEnumerable<LineSegment2f> Edges
        {
            get
            {
                yield return new LineSegment2f(TopLeft, TopRight);
                yield return new LineSegment2f(TopRight, BottomRight);
                yield return new LineSegment2f(BottomLeft, BottomRight);
                yield return new LineSegment2f(TopLeft, BottomLeft);
            }
        }

        /// <summary>
        /// Attempt to intersect a line segment with this rectangle.
        /// </summary>
        /// <param name="line">The line to intersect with this rectangle.</param>
        /// <param name="intersectionPoint">The point of intersection.</param>
        /// <param name="t">the distance along this line at which intersection would occur, or zero if no intersection occurs.</param>
        /// <returns><c>true</c> if an intersection exists, otherwise <c>false</c>.</returns>
        public bool TryIntersect(LineSegment2f line, out Vector2f intersectionPoint, out float t)
        {
            var minT = float.MaxValue;
            var found = false;<commit_msg>Chain constructors to reuse validation.<commit_after>using System;
using System.Collections.Generic;

namespace Boing
{
    public struct Rectangle2f
    {
        public Vector2f Min { get; }
        public Vector2f Max { get; }

        public Rectangle2f(Vector2f min, Vector2f max)
        {
            if (min.X > max.X)
                throw new ArgumentException("min.X is greater than max.X");
            if (min.Y > max.Y)
                throw new ArgumentException("min.Y is greater than max.Y");

            Min = min;
            Max = max;
        }

        public Rectangle2f(float x, float y, float width, float height)
            : this(new Vector2f(x, y), new Vector2f(x + width, y + height))
        {}

        public Vector2f TopLeft => Min;
        public Vector2f TopRight => new Vector2f(Min.Y, Max.X);
        public Vector2f BottomLeft => new Vector2f(Max.Y, Min.X);
        public Vector2f BottomRight => Max;

        public IEnumerable<LineSegment2f> Edges
        {
            get
            {
                yield return new LineSegment2f(TopLeft, TopRight);
                yield return new LineSegment2f(TopRight, BottomRight);
                yield return new LineSegment2f(BottomLeft, BottomRight);
                yield return new LineSegment2f(TopLeft, BottomLeft);
            }
        }

        /// <summary>
        /// Attempt to intersect a line segment with this rectangle.
        /// </summary>
        /// <param name="line">The line to intersect with this rectangle.</param>
        /// <param name="intersectionPoint">The point of intersection.</param>
        /// <param name="t">the distance along this line at which intersection would occur, or zero if no intersection occurs.</param>
        /// <returns><c>true</c> if an intersection exists, otherwise <c>false</c>.</returns>
        public bool TryIntersect(LineSegment2f line, out Vector2f intersectionPoint, out float t)
        {
            var minT = float.MaxValue;
            var found = false;
{'fraction_non_alphanumeric': 0.09593455627169063, 'fraction_numerical': 0.010907288051561725, 'mean_word_length': 1.9582111436950147, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 45, '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': '7516151', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1062, 'n_words': 347}