<commit_before>/**
* @file Edgel.h
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
* Definition of struct Edgel
*/

#ifndef _Edgel_H_
#define _Edgel_H_

#include <Tools/Math/Vector2.h>

template<class T>
class EdgelT
{
public:
  EdgelT() : angle(0.0)
  {}

  Vector2<T> point;
  Vector2d direction;

  double angle; // deprecated

  // calculate the simmilarity to the other edgel
  // returns a value [0,1], 0 - not simmilar, 1 - very simmilar
  inline double sim(const EdgelT<T>& other) const
  {
    double s = 0.0;
    if(direction*other.direction > 0) {
      Vector2d v = (other.point - point).rotateRight().normalize();
      s = 1.0-0.5*(fabs(direction*v) + fabs(other.direction*v));
    }

    return s;
  }
};

typedef EdgelT<int> Edgel;
typedef EdgelT<double> EdgelD;

class DoubleEdgel
{
public:
  DoubleEdgel()
    :
    center_angle(0.0),
    begin_angle(0.0),
    end_angle(0.0),
    valid(false),
    runID(0),
    ScanLineID(0)
  {}
<commit_msg>- added enum for type of edgel - added a second type of similarity check method<commit_after>/**
* @file Edgel.h
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
* Definition of struct Edgel
*/

#ifndef _Edgel_H_
#define _Edgel_H_

#include <Tools/Math/Vector2.h>

template<class T>
class EdgelT
{
public:
  EdgelT() : type(unknown), angle(0.0)
  {}

  enum Type
  {
    positive,
    negative,
    unknown
  };

  Vector2<T> point;
  Vector2d direction;
  Type type;

  double angle; // deprecated

  // calculate the simmilarity to the other edgel
  // returns a value [0,1], 0 - not simmilar, 1 - very simmilar
  inline double sim(const EdgelT<T>& other) const
  {
    double s = 0.0;
    if(direction*other.direction > 0) {
      Vector2d v = (other.point - point).rotateRight().normalize();
      s = 1.0-0.5*(fabs(direction*v) + fabs(other.direction*v));
    }

    return s;
  }

  // calculate the simmilarity to the other edgel
  // returns a value [0,1], 0 - not simmilar, 1 - very simmilar
  inline double sim2(const EdgelT<T>& other) const
  {
    double s = 0.0;
    if(direction*other.direction > 0) {
      Vector2d v = (other.point - point).normalize();
      s = 1.0-0.5*(fabs(direction*v) + fabs(other.direction*v));
    }

    return s;
  }
};

typedef EdgelT<int> Edgel;
typedef EdgelT<double> EdgelD;

class DoubleEdgel
{
public:
  DoubleEdgel()
    :
    center_angle(0.0),
    begin_angle(0.0),
    end_angle(0.0),
    valid(false),
    runID(0),
    ScanLineID(0)
  {}

{'fraction_non_alphanumeric': 0.1462917685411573, 'fraction_numerical': 0.02567237163814181, 'mean_word_length': 3.0180032733224222, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 27, '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': '4547695', 'n_tokens_mistral': 977, 'n_tokens_neox': 936, 'n_words': 225}