<commit_before>using System.Collections.Generic;
using droid.Runtime.Environments;
using droid.Runtime.Interfaces;
using droid.Runtime.Utilities.Misc.SearchableEnum;
using UnityEditor;
using UnityEngine;
using UnityEngine.Serialization;

#if UNITY_EDITOR

#endif

namespace droid.Runtime.Utilities.BoundingBoxes
{
  public enum BasedOn
  {
    Geometry_,
    Collider_
  }

  /// <inheritdoc />
  /// <summary>
  /// </summary>
  [ExecuteInEditMode]
  public class BoundingBox : MonoBehaviour
  {


    /// <summary>
    /// </summary>
    protected Bounds _Bounds;

    /// <summary>
    /// </summary>
    protected Vector3 _Bounds_Offset;

    /// <summary>
    /// </summary>
    Collider[] _childrenColliders;

    /// <summary>
    /// </summary>
    MeshFilter[] _childrenMeshes;

    /// <summary>
    /// </summary>
    [SearchableEnum] public BasedOn basedOn = BasedOn.Geometry_;

    /// <summary>
    /// </summary>
    Vector3[] _points;

    /// <summary>
    /// </summary>
    [SerializeField] bool freezeAfterFirstCalculation = true;

    /// <summary>
    /// </summary>
    [SerializeField] bool includeChildren = false;

    Vector3 _lastPosition;
    Quaternion _lastRotation;

    /// <summary>
    /// </summary>
    Vector3 _lastScale;

    /// <summary>
    /// </summary>
    public Color editorPreviewLineColor = new Color(1f, 0.36f, 0.38f, 0.74f);

    /// <summary>
    /// </summary>
    Vector3[,] _lines;

    List<Vector3[]> _linesList = new List<Vector3[]>();

    /// <summary>
    /// </summary>
    Quaternion _rotation;

    /// <summary>
    /// </summary>
    [SerializeField] bool setupOnAwake;

    [SerializeField] IPrototypingEnvironment environment;


    Vector3 _bottomBackLeftExtend;
    Vector3 _bottomBackRightExtend;
    Vector3 _bottomFrontLeftExtend;
    Vector3 _bottomFrontRightExtend;
    Vector3 _topBackLeftExtend;
    Vector3 _topBackRightExtend;
    Vector3 _topFrontLeftExtend;
    Vector3 _topFrontRightExtend;

    [SerializeField] bool cacheChildren = true;

    public Vector3[] BoundingBoxCoordinates =>
      new[]
      {
        this._topFrontLeftExtend,
        this._topFrontRightExtend,
        this._topBackLeftExtend,
        this._topBackRightExtend,
        this._bottomFrontLeftExtend,
        this._bottomFrontRightExtend,
        this._bottomBackLeftExtend,
        this._bottomBackRightExtend
      };


    public Bounds Bounds => this._Bounds;

    public Vector3 Max => this._Bounds.max;

    public Vector3 Min => this._Bounds.min;

    /// <summary>
    /// </summary>
    public string BoundingBoxCoordinatesAsString
    {
      get
      {
        var str_rep = "";
        str_rep += "\"_top_front_left\":" + this.BoundingBoxCoordinates[0] + ", ";
        str_rep += "\"_top_front_right\":" + this.BoundingBoxCoordinates[1] + ", ";
        str_rep += "\"_top_back_left\":" + this.BoundingBoxCoordinates[2] + ", ";
        str_rep += "\"_top_back_right\":" + this.BoundingBoxCoordinates[3] + ", ";
        str_rep += "\"_bottom_front_left\":" + this.BoundingBoxCoordinates[4] + ", ";
        str_rep += "\"_bottom_front_right\":" + this.BoundingBoxCoordinates[5] + ", ";
        str_rep += "\"_bottom_back_left\":" + this.BoundingBoxCoordinates[6] + ", ";
        str_rep += "\"_bottom_back_right\":" + this.BoundingBoxCoordinates[7];
        return str_rep;
      }
    }

    /// <summary>
    /// </summary>
    public string BoundingBoxCoordinatesWorldSpaceAsJson
    {
      get
      {
        var str_rep = "{";
        var transform1 = this.transform;
        var rotation = transform1.rotation;
        var position = transform1.position;
        str_rep += "\"_top_front_left\":" + this.JsonifyVec3(this.environment.TransformPoint(rotation * this._topFrontLeftExtend + position)) + ", ";
        str_rep += "\"_bottom_back_right\":" +
                   this.JsonifyVec3(this.environment.TransformPoint(rotation *this._bottomBackRightExtend+ position));
        str_rep += "}";
        return str_rep;
      }
    }

    /// <summary>
    /// </summary>
    public Vector3[,] Lines
    {
      get => this._lines;
      set => this._lines = value;
    }

    /// <summary>
    /// </summary><commit_msg>null check<commit_after>using System.Collections.Generic;
using droid.Runtime.Environments;
using droid.Runtime.Interfaces;
using droid.Runtime.Utilities.Misc.SearchableEnum;
using UnityEditor;
using UnityEngine;
using UnityEngine.Serialization;

#if UNITY_EDITOR

#endif

namespace droid.Runtime.Utilities.BoundingBoxes
{
  public enum BasedOn
  {
    Geometry_,
    Collider_
  }

  /// <inheritdoc />
  /// <summary>
  /// </summary>
  [ExecuteInEditMode]
  public class BoundingBox : MonoBehaviour
  {


    /// <summary>
    /// </summary>
    protected Bounds _Bounds;

    /// <summary>
    /// </summary>
    protected Vector3 _Bounds_Offset;

    /// <summary>
    /// </summary>
    Collider[] _childrenColliders;

    /// <summary>
    /// </summary>
    MeshFilter[] _childrenMeshes;

    /// <summary>
    /// </summary>
    [SearchableEnum] public BasedOn basedOn = BasedOn.Geometry_;

    /// <summary>
    /// </summary>
    Vector3[] _points;

    /// <summary>
    /// </summary>
    [SerializeField] bool freezeAfterFirstCalculation = true;

    /// <summary>
    /// </summary>
    [SerializeField] bool includeChildren = false;

    Vector3 _lastPosition;
    Quaternion _lastRotation;

    /// <summary>
    /// </summary>
    Vector3 _lastScale;

    /// <summary>
    /// </summary>
    public Color editorPreviewLineColor = new Color(1f, 0.36f, 0.38f, 0.74f);

    /// <summary>
    /// </summary>
    Vector3[,] _lines;

    List<Vector3[]> _linesList = new List<Vector3[]>();

    /// <summary>
    /// </summary>
    Quaternion _rotation;

    /// <summary>
    /// </summary>
    [SerializeField] bool setupOnAwake;

    [SerializeField] IPrototypingEnvironment environment;


    Vector3 _bottomBackLeftExtend;
    Vector3 _bottomBackRightExtend;
    Vector3 _bottomFrontLeftExtend;
    Vector3 _bottomFrontRightExtend;
    Vector3 _topBackLeftExtend;
    Vector3 _topBackRightExtend;
    Vector3 _topFrontLeftExtend;
    Vector3 _topFrontRightExtend;

    [SerializeField] bool cacheChildren = true;

    public Vector3[] BoundingBoxCoordinates =>
      new[]
      {
        this._topFrontLeftExtend,
        this._topFrontRightExtend,
        this._topBackLeftExtend,
        this._topBackRightExtend,
        this._bottomFrontLeftExtend,
        this._bottomFrontRightExtend,
        this._bottomBackLeftExtend,
        this._bottomBackRightExtend
      };


    public Bounds Bounds => this._Bounds;

    public Vector3 Max => this._Bounds.max;

    public Vector3 Min => this._Bounds.min;

    /// <summary>
    /// </summary>
    public string BoundingBoxCoordinatesAsString
    {
      get
      {
        var str_rep = "";
        str_rep += "\"_top_front_left\":" + this.BoundingBoxCoordinates[0] + ", ";
        str_rep += "\"_top_front_right\":" + this.BoundingBoxCoordinates[1] + ", ";
        str_rep += "\"_top_back_left\":" + this.BoundingBoxCoordinates[2] + ", ";
        str_rep += "\"_top_back_right\":" + this.BoundingBoxCoordinates[3] + ", ";
        str_rep += "\"_bottom_front_left\":" + this.BoundingBoxCoordinates[4] + ", ";
        str_rep += "\"_bottom_front_right\":" + this.BoundingBoxCoordinates[5] + ", ";
        str_rep += "\"_bottom_back_left\":" + this.BoundingBoxCoordinates[6] + ", ";
        str_rep += "\"_bottom_back_right\":" + this.BoundingBoxCoordinates[7];
        return str_rep;
      }
    }

    /// <summary>
    /// </summary>
    public string BoundingBoxCoordinatesWorldSpaceAsJson
    {
      get
      {
        var str_rep = "{";
        var transform1 = this.transform;
        var rotation = transform1.rotation;
        var position = transform1.position;
        if (this.environment != null)
        {
          str_rep +=
            $"\"top_front_left\":{this.JsonifyVec3(this.environment.TransformPoint(rotation * this._topFrontLeftExtend + position))}, ";
          str_rep +=
            $"\"bottom_back_right\":{this.JsonifyVec3(this.environment.TransformPoint(rotation * this._bottomBackRightExtend + position))}";
        }

        str_rep += "}";
        return str_rep;
      }
    }

    /// <summary>
    /// </summary>
    public Vector3[,] Lines
    {
      get => this._lines;
      set => this._lines = value;
    }

    /// <summary>
    /// </summary>
{'fraction_non_alphanumeric': 0.13853427895981088, 'fraction_numerical': 0.009929078014184398, 'mean_word_length': 2.4718916700861717, 'pattern_counts': {'":': 20, '<': 81, '<?xml version=': 0, '>': 93, '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': '5003311', 'n_tokens_mistral': 2704, 'n_tokens_neox': 2601, 'n_words': 463}