<commit_before>package com.nicefontaine.projections;

import processing.core.PVector;

public class CylinderProjection implements Projection {

    private final float distance;
    private final float halfWidth;
    private final Projection projection;

    public CylinderProjection(float radius, float width, float distance) {
        this.distance = distance;
        this.halfWidth = width / 2;
        this.projection = new PlaneToCylinderProjection(radius, width);
    }

    @Override
    public float[] project(float x, float y) {
        float sigma = distance / (distance - y);
        PVector support = new PVector(halfWidth, halfWidth, distance);
        float[] result = projection.project(x, y);
        PVector direction = new PVector(halfWidth - result[0],halfWidth - result[1],distance - y);
        PVector res = support.sub(direction.mult(sigma));
        return new float[] {res.x, res.y};
    }
}<commit_msg>fixed cylinder projection bug to use radius as outer ring<commit_after>package com.nicefontaine.projections;

import processing.core.PVector;

public class CylinderProjection implements Projection {

    private final float distance;
    private final float halfWidth;
    private final Projection projection;

    public CylinderProjection(float radius, float width, float distance) {
        this.distance = distance;
        this.halfWidth = width / 2;
        this.projection = new PlaneToCylinderProjection(radius, width);
    }

    @Override
    public float[] project(float x, float y) {
        y = -y;
        float sigma = distance / (distance - y);
        PVector support = new PVector(halfWidth, halfWidth, distance);
        float[] result = projection.project(x, y);
        PVector direction = new PVector(halfWidth - result[0],halfWidth - result[1],distance - y);
        PVector res = support.sub(direction.mult(sigma));
        return new float[] {res.x, res.y};
    }
}
{'fraction_non_alphanumeric': 0.0953125, 'fraction_numerical': 0.003125, 'mean_word_length': 3.158008658008658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7660450', 'n_tokens_mistral': 532, 'n_tokens_neox': 519, 'n_words': 159}