<commit_before>#include "SM_Polyline.h"

#include <cavc/polylineoffset.hpp>

namespace sm
{

std::vector<std::vector<vec2>> 
polyline_offset(const std::vector<vec2>& polyline, float distance, bool is_closed)
{
	cavc::Polyline<float> input;
	input.isClosed() = is_closed;

	for (int i = 0, n = polyline.size(); i < n; ++i) {
		input.addVertex(polyline[i].x, polyline[i].y, 0.0f);
	}

	auto results = cavc::parallelOffset(input, distance);

	std::vector<std::vector<vec2>> polylines;
	for (auto& src : results)
	{
		std::vector<vec2> dst;
		for (auto& pos : src.vertexes()) {
			dst.push_back(sm::vec2(pos.x(), pos.y()));
		}
		polylines.push_back(dst);
	}

	return polylines;
}

std::vector<std::vector<vec2>>
polyline_expand(const std::vector<vec2>& polyline, float offste, bool is_closed)
{<commit_msg>[FIXED] polyline_offset() pop back pos if is closed<commit_after>#include "SM_Polyline.h"

#include <cavc/polylineoffset.hpp>

namespace sm
{

std::vector<std::vector<vec2>> 
polyline_offset(const std::vector<vec2>& polyline, float distance, bool is_closed)
{
	cavc::Polyline<float> input;
	input.isClosed() = is_closed;

	const size_t n = is_closed ? polyline.size() - 1 : polyline.size();
	for (int i = 0; i < n; ++i) {
		input.addVertex(polyline[i].x, polyline[i].y, 0.0f);
	}

	auto results = cavc::parallelOffset(input, distance);

	std::vector<std::vector<vec2>> polylines;
	for (auto& src : results)
	{
		std::vector<vec2> dst;
		for (auto& pos : src.vertexes()) {
			dst.push_back(sm::vec2(pos.x(), pos.y()));
		}
		polylines.push_back(dst);
	}

	return polylines;
}

std::vector<std::vector<vec2>>
polyline_expand(const std::vector<vec2>& polyline, float offste, bool is_closed)
{
{'fraction_non_alphanumeric': 0.17612293144208038, 'fraction_numerical': 0.012411347517730497, 'mean_word_length': 5.486590038314176, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '2077151', 'n_tokens_mistral': 696, 'n_tokens_neox': 661, 'n_words': 130}