Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // IMK0TTER_VALVE.h
- //
- #pragma once
- ////////////////////// !IMPORTANT! //////////////////////
- ///////////////TODO: DEFINE MOUSE_PI as PI///////////////
- ////////////////////// !IMPORTANT! //////////////////////
- #define MOUSE_PI 3.14159265358979323846f
- ////////////////////// !IMPORTANT! //////////////////////
- ///////////////TODO: DEFINE MOUSE_PI as PI///////////////
- ////////////////////// !IMPORTANT! //////////////////////
- namespace IMK0TTER
- {
- namespace MOUSE_CODE
- {
- float ABSN(float INPUT);
- float ATANN(float INPUT);
- float CLAMP(float rotations_in_n_units, float half_n_unit);
- float TRANSDUCE(float input_in_radians, float size_of_circle);
- // TRANSDUCTION is for transducing line segements into rotations
- int RAW_MOUSE_INPUT_TO_PIXELS_ACCELERATION(float input_in_radians, float sensitivity, float radius_in_pixels);
- int RAW_MOUSE_INPUT_TO_PIXELS(float input_in_radians, float sensitivity, float radius_in_pixels);
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_DEGREES_TO_RADIUS_IN_PIXELS(float resolution_in_pixels, float fov_in_degrees);
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_DEGREES_TO_CIRCUMFERENCE_IN_PIXELS(float resolution_in_pixels, float fov_in_degrees);
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_PIXELS_TO_RADIUS_IN_PIXELS(float resolution_in_pixels, float fov_in_pixels);
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_PIXELS_TO_CIRCUMFERENCE_IN_PIXELS(float resolution_in_pixels, float fov_in_pixels);
- }
- }
- // IMK0TTER_VALVE.cpp : Defines the functions for the static library.
- //
- #include "IMK0TTER_VALVE.h"
- #include <math.h>
- namespace IMK0TTER
- {
- namespace MOUSE_CODE
- {
- inline float ABSN(float INPUT) { return sqrtf(INPUT * INPUT); }
- inline float ATANN(float INPUT) { return INPUT / ABSN(INPUT); }
- inline float CLAMP(float rotations_in_n_units, float half_n_unit) { return fmodf(truncf(rotations_in_n_units / half_n_unit), 2) * -1 * half_n_unit + fmodf(rotations_in_n_units, half_n_unit); }
- inline float TRANSDUCE(float input_in_radians, float size_of_circle) { return ATANN(input_in_radians) * acosf(((size_of_circle * size_of_circle * 2) - (CLAMP(input_in_radians, 2 * size_of_circle) * CLAMP(input_in_radians, 2 * size_of_circle))) / (size_of_circle * size_of_circle * 2)); }
- int RAW_MOUSE_INPUT_TO_PIXELS_ACCELERATION(float input_in_radians, float sensitivity, float radius_in_pixels) { return int(fmodf(TRANSDUCE(input_in_radians, 1 / sensitivity) * radius_in_pixels, radius_in_pixels * MOUSE_PI * 2)); }
- int RAW_MOUSE_INPUT_TO_PIXELS(float input_in_radians, float sensitivity, float radius_in_pixels) { return int(input_in_radians * sensitivity * radius_in_pixels); }
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_DEGREES_TO_RADIUS_IN_PIXELS(float resolution_in_pixels, float fov_in_degrees) { return (resolution_in_pixels / sinf(MOUSE_PI / (360 / fov_in_degrees))) / 2; }
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_DEGREES_TO_CIRCUMFERENCE_IN_PIXELS(float resolution_in_pixels, float fov_in_degrees) { return RESOLUTION_IN_PIXELS_AND_FOV_IN_DEGREES_TO_RADIUS_IN_PIXELS(resolution_in_pixels, fov_in_degrees) * MOUSE_PI * 2; }
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_PIXELS_TO_RADIUS_IN_PIXELS(float resolution_in_pixels, float fov_in_pixels) { return 0.0f; }
- float RESOLUTION_IN_PIXELS_AND_FOV_IN_PIXELS_TO_CIRCUMFERENCE_IN_PIXELS(float resolution_in_pixels, float fov_in_pixels) { return RESOLUTION_IN_PIXELS_AND_FOV_IN_PIXELS_TO_RADIUS_IN_PIXELS(resolution_in_pixels, fov_in_pixels) * MOUSE_PI * 2; }
- }
- }
Advertisement
Advertisement