Posts

Showing posts with the label computer graphics

Homogeneous Coordinates: A Simple and Intuitive Primer

Image
Homogeneous Coordinates: A Simple and Intuitive Primer In ordinary geometry, we use familiar coordinates such as (x, y) in 2D or (x, y, z) in 3D. These work well, but they have one major limitation: not all geometric transformations fit neatly into this system—especially translations and perspective projections. To unify everything into one clean mathematical framework, we introduce homogeneous coordinates . They provide a simple way to treat every transformation—from translations to perspective projection— using only matrix multiplication. 1. Why Do We Need Something New? In ordinary coordinates: rotations are matrices, scalings are matrices, shears are matrices, translations are not matrices . Translation is the “odd one out.” This creates friction in computer graphics, robotics, and projective geometry, where we want one system that handles everything the same way. Homogeneous coordinates fix this by adding one extra coordinate. 2. The Bas...

Barycentric Coordinates Made Clear: From a UV Triangle to a 3D Triangle

Image
Barycentric Coordinates Made Clear: From a UV Triangle to a 3D Triangle This post explains, in plain language, why a simple triangular region in a 2-dimensional parameter space can describe every point of a real triangle in 3-dimensional space. Through one clean affine formula, the 2D parameters (u, v) determine points on a 3D triangle. Once this connection is seen, concepts such as interpolation, texture mapping, geometric modelling, and FEM become much easier to understand. Two Worlds Connected by a Map 1) Parameter World (UV-space, 2D) Start in a flat coordinate plane labelled by two parameters, u and v . Consider the square defined by 0 ≤ u ≤ 1 0 ≤ v ≤ 1 If we cut this square along the diagonal line u + v = 1 (or equivalently v = −u + 1 ), we keep only the triangular region 0 ≤ u ≤ 1 0 ≤ v ≤ 1 u + v ≤ 1 This triangle has vertices (0,0) , (1,0) , (0,1) and is called the standard 2-simplex . Every point inside it is a convex mixture of its three corners. 2...

What Are Barycentric Coordinates?

Image
What Are Barycentric Coordinates? Barycentric coordinates provide a way to describe any point inside a triangle using the triangle’s own vertices as a reference. Instead of relying on the usual x–y axes, we express a point as a weighted combination of the three corners. The Core Idea Let a triangle have vertices A , B and C . Any point P inside (or on) the triangle can be written as P = αA + βB + γC The numbers α, β and γ are the barycentric coordinates of P. They indicate how strongly each vertex contributes to P. For this expression to make geometric sense, the three weights must satisfy α + β + γ = 1 This condition ensures that P behaves like a weighted average — a “blend” of A, B and C — rather than drifting away from the triangle. As long as all three values are non-negative ( α, β, γ ≥ 0 ), the point lies somewhere within the triangle. Examples α = 1 , β = γ = 0  →  P = A α = β = 0.5 , γ = 0  →  midpoint of AB α = ...

What Is Graphjacking?

Image
📐 What Is Graphjacking? Graphjacking is the creative act of using 2D graphing tools — such as Desmos or GeoGebra — to produce the illusion of 3D or higher-dimensional space. It turns a flat coordinate plane into a window for exploring depth, rotation, and perspective through pure mathematics. ⚙️ Definition Graphjacking is the process of taking a two-dimensional graphing system and manipulating equations to create 3D-like visualizations. It uses projection and trigonometric techniques to simulate a third dimension within the limits of a 2D plane. 🎨 Examples Drawing isometric cubes or dodecahedra on graph paper. Animating a rotating cube using trigonometric functions. Creating optical illusions such as the “Pringle surface.” 📚 Applications Education: Visualizing higher-dimensional concepts intuitively. Art: Designing 2D mathematical works that appear three-dimensional. Mathematics: Exploring projections, transformations, and geometry in creative wa...

A Primer for Cross Product Calculations

Image
🧭 A Primer for Cross Product Calculations Right Hand Rule for Cross Product. Source: https://commons.wikimedia.org/wiki/File:Right-hand_rule_for_cross_product.png 1. Basis Vectors î = (1, 0, 0), ĵ = (0, 1, 0), k̂ = (0, 0, 1) These are unit and mutually perpendicular vectors. 2. Dot Product (for reference) 𝐀 · 𝐁 = |𝐀| |𝐁| cos θ î · ĵ = ĵ · k̂ = k̂ · î = 0 î² = ĵ² = k̂² = 1 3. Definition of the Cross Product 𝐀 × 𝐁 = |𝐀| |𝐁| sin θ n̂ θ is the angle from 𝐀 to 𝐁. n̂ is a unit vector perpendicular to both 𝐀 and 𝐁. The direction of n̂ follows the right-hand rule (anticlockwise = positive, clockwise = negative). 4. Fundamental Basis Cross Products î × ĵ = k̂ ĵ × k̂ = î k̂ × î = ĵ Reversing the order changes the sign: ĵ × î = −k̂ k̂ × ĵ = −î î × k̂ = −ĵ And any vector crossed with itself is zero: î × î = ĵ × ĵ = k̂ × k̂ = 0 5. Expansion in Component Form 𝐀 = a₁ î + a₂ ĵ + a₃ k̂ 𝐁 = b₁ î + ...