Skip to content

Instantly share code, notes, and snippets.

@horushe93
horushe93 / color-mixing-algorithm.md
Last active November 18, 2024 02:22
RGB Color Mixing Algorithm: A Mathematical Approach to Digital Color Blending

RGB Color Mixing Algorithm: A Mathematical Approach to Digital Color Blending

Color mixing in digital space is fundamentally different from mixing physical pigments. While artists blend paints using subtractive color mixing, digital displays use additive color mixing with RGB values. This implementation demonstrates a precise mathematical approach to mixing RGB colors with specific proportions.

The Algorithm

Here's a TypeScript implementation that handles proportional color mixing:

typescript
@horushe93
horushe93 / calculate-geographic-distance.md
Last active February 23, 2025 10:26
Calculating Geographic Distances: The Haversine Formula in TypeScript

Calculating Geographic Distances: The Haversine Formula in TypeScript

Introduction

When building location-based applications, one of the most common requirements is calculating the distance between two points on Earth. While it might seem straightforward at first, accurately calculating distances on a spherical surface requires some careful consideration. In this article, I'll share how I implemented this calculation for an educational geography game, Flagle Explorer.

The Challenge

The primary requirements for our distance calculation were:

  1. Accuracy suitable for educational purposes