<commit_before>﻿using raytracer.core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;

namespace raytracer.shapes
{
    class Triangle : Shape
    {
        /// <summary>
        /// Stores the three triangle vertices.
        /// </summary>
        private readonly Vector3[] Vertices;

        /// <summary>
        /// Stores the triangle's plane normalized normal vector.
        /// </summary>
        private Vector3 PlaneNormal;

        /// <summary>
        /// Creates a new Triangle from 3 vertices
        /// </summary>
        /// <param name="vertices"></param>
        public Triangle(Vector3[] vertices)
        {
            if (vertices.Length != 3)
                throw new Exception();
            Vertices = vertices;

            Vector3 v1, v2, normal;
            Vector3.Subtract(ref vertices[1], ref vertices[0], out v1);
            Vector3.Subtract(ref vertices[2], ref vertices[0], out v2);
            Vector3.Cross(ref v1, ref v2, out normal);
            Vector3.Normalize(ref normal, out PlaneNormal);
        }<commit_msg>Make Triangle public<commit_after>﻿using raytracer.core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;

namespace raytracer.shapes
{
    public class Triangle : Shape
    {
        /// <summary>
        /// Stores the three triangle vertices.
        /// </summary>
        private readonly Vector3[] Vertices;

        /// <summary>
        /// Stores the triangle's plane normalized normal vector.
        /// </summary>
        private Vector3 PlaneNormal;

        /// <summary>
        /// Creates a new Triangle from 3 vertices
        /// </summary>
        /// <param name="vertices"></param>
        public Triangle(Vector3[] vertices)
        {
            if (vertices.Length != 3)
                throw new Exception();
            Vertices = vertices;

            Vector3 v1, v2, normal;
            Vector3.Subtract(ref vertices[1], ref vertices[0], out v1);
            Vector3.Subtract(ref vertices[2], ref vertices[0], out v2);
            Vector3.Cross(ref v1, ref v2, out normal);
            Vector3.Normalize(ref normal, out PlaneNormal);
        }
{'fraction_non_alphanumeric': 0.11508282476024412, 'fraction_numerical': 0.017436791630340016, 'mean_word_length': 1.9498714652956297, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '7044004', 'n_tokens_mistral': 635, 'n_tokens_neox': 615, 'n_words': 183}