<commit_before>//Copyright (c) 2020 <NAME>.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include <stack>

#include "linearAlg2D.h"
#include "logoutput.h"
#include "VoronoiUtils.h"
#include "optional.h"

namespace cura 
{

Point VoronoiUtils::p(const vd_t::vertex_type* node)
{
    return Point(node->x() + 0, node->y() + 0); // gets rid of negative zero
}

bool VoronoiUtils::isSourcePoint(Point p, const vd_t::cell_type& cell, const std::vector<Point>& points, const std::vector<Segment>& segments, coord_t snap_dist)
{
    if (cell.contains_point())
    {
        return shorterThen(p - getSourcePoint(cell, points, segments), snap_dist);
    }<commit_msg>Properly round Voronoi coordinates to IntPoint coordinates<commit_after>//Copyright (c) 2021 <NAME>.
//CuraEngine is released under the terms of the AGPLv3 or higher.

#include <stack>

#include "linearAlg2D.h"
#include "logoutput.h"
#include "VoronoiUtils.h"
#include "optional.h"

namespace cura 
{

Point VoronoiUtils::p(const vd_t::vertex_type* node)
{
    return Point(node->x() + 0.5d, node->y() + 0.5d); //Round to nearest integer coordinates.
}

bool VoronoiUtils::isSourcePoint(Point p, const vd_t::cell_type& cell, const std::vector<Point>& points, const std::vector<Segment>& segments, coord_t snap_dist)
{
    if (cell.contains_point())
    {
        return shorterThen(p - getSourcePoint(cell, points, segments), snap_dist);
    }
{'fraction_non_alphanumeric': 0.136938202247191, 'fraction_numerical': 0.012640449438202247, 'mean_word_length': 4.816326530612245, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '211413', 'n_tokens_mistral': 503, 'n_tokens_neox': 489, 'n_words': 132}