<commit_before>package gsvm_project;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JPanel;

/**
 * @author jn
 */
public class Canvas extends JPanel {

  Object object;

  public Canvas(Object object) {
    this.object = object;

    setSize(600, 400);
    setLocation(0, 0);
    setBackground(Color.white);
  }

  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    for (ArrayList<Integer> surface : object.surfaces) {
      ArrayList<Vertex> vertices = new ArrayList<>();
      for (Integer vertex_index : surface) {
        vertices.add(object.getVertex(vertex_index));
      }

      int vertices_size = vertices.size();
      int x[] = new int[vertices_size];
      int y[] = new int[vertices_size];
      int i = 0;
      for (Vertex vertex : vertices) {
        x[i] = (int) (vertex.x * 100) + 300;
        y[i] = (int) (-vertex.y * 100) + 200;
        i++;
      }
      g.drawPolygon(x, y, vertices_size);
    }
  }
}<commit_msg>gsvm: Updated canvas.<commit_after>package gsvm_project;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JPanel;

/**
 * @author JakubNvk
 */
public class Canvas extends JPanel {

  Object object;

  public Canvas(Object object) {
    this.object = object;

    setSize(600, 400);
    setLocation(0, 0);
    setBackground(Color.white);
  }

  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    for (ArrayList<Integer> surface : object.surfaces) {
      ArrayList<Vertex> vertices = new ArrayList<>();
      for (Integer vertex_index : surface) {
        vertices.add(object.getVertex(vertex_index));
      }

      int vertices_size = vertices.size();
      int x[] = new int[vertices_size];
      int y[] = new int[vertices_size];
      int i = 0;
      for (Vertex vertex : vertices) {
        x[i] = (int) (vertex.x * 100) + 300;
        y[i] = (int) (-vertex.y * 100) + 200;
        i++;
      }

      if (!object.isHidden) {
        g.drawPolygon(x, y, vertices_size);
      } else {
        Vertex v0 = vertices.get(0);
        Vertex v1 = vertices.get(1);
        Vertex v2 = vertices.get(2);
        float[] vector_a = {v2.x - v1.x, v2.y - v1.y, v2.z - v1.z};
        float[] vector_b = {v2.x - v0.x, v2.y - v0.y, v2.z - v0.z};
        float[] vector_normal = {
          vector_a[1] * vector_b[2] - vector_a[2] * vector_b[1],
          vector_a[2] * vector_b[0] - vector_a[0] * vector_b[2],
          vector_a[0] * vector_b[1] - vector_a[1] * vector_b[0]};

        if (vector_normal[2] >= 0) {
          g.setColor(object.getColour(i));
          g.fillPolygon(x, y, vertices.size());
          g.drawPolygon(x, y, vertices.size());
        }
      }
      i++;
    }
  }
}
{'fraction_non_alphanumeric': 0.14751163623344074, 'fraction_numerical': 0.026494808449695668, 'mean_word_length': 2.4366543665436655, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '6332820', 'n_tokens_mistral': 1023, 'n_tokens_neox': 966, 'n_words': 215}