Implementing a trackball with rational numbers
Implementing a trackball with rational numbers launched on October 16, 2017 with 11 votes, #996 of 3,169 launches that month and more than 75% of that year's launches. The site was still online in September 2026, 9 years on.
In plain words
This project presents a mathematical approach to implementing a trackball rotation system using only rational numbers instead of trigonometric functions or floating-point calculations. It demonstrates how mouse displacements can drive 3D rotations through a matrix constructed entirely from rational expressions. The work addresses precision concerns in interactive graphics by exploring exact arithmetic as an alternative to approximate floating-point operations.
written from the facts on this page · September 2026
From the sources
Some time ago, I implemented a trackball without any trigonometric function . In a nutshell, I did it with the following matrix: where \(x\) and \(y\) are the displacements of the mouse on the screen and \(q\) and \(s\) are short for \(1 + x^2 + y^2\) and \(1 - x^2 - y^2\) respectively. It worked very well and I was happy about it, but there was a little concern: floating point approximations. Since this matrix is made purely out of rational numbers, I was wondering if I could try to do exact calculations. I was expecting things to be slower, but I wanted to see how bad it'd be. As you can see, things go smooth at first, but if you keeping rotating the cube around, soon enough you'll notice…from grondilu.github.io
Does a similar job
all alternatives →- VTVisualizing the math that powers 3D character animation2022 · diegomacario.github.io · ▲238
Hi everyone! I'm the author of this project. I wrote it because I think that the math that makes characters move in games and movies is incredibly beautiful, and I wanted to give others a glimpse into it. It's crazy to think that quaternions, an abstract mathematical tool discovered by William Rowan Hamilton in 1843, would be so perfectly suited to solve hard problems in the world of 3D character animation more than a hundred years later. The story of how he discovered quaternions is also beautiful. Here's an excerpt from Wikipedia: "Hamilton was looking for ways of extending complex numbers…
- SPSimple pendulum simulation with rational trigonometry2016 · grondilu.github.io · ▲52
Context: I'm looking at Norman Wildberger's rational trigonometry[1], and here I was wondering how useful it is in physics. So I thought about testing it with the famous simple pendulum exercise. It's not obvious we get any FPS gain, but still I find it cool to even be able to get the same result differently. 1. https://en.wikipedia.org/wiki/Rational_trigonometry




More life & fun this month
the category →
A free city-building game in your browser. You are the mayor. You know what the city needs. Now get it past the zoning board, the neighbors, the appeals court and the next election.
Life & fun · 1d ago · permit.petercai.com
- IV
Life & fun · 13d ago · tanzaniaeducationproject.org

Turn a phone, tablet or TV into a sign. Type a message and it fills the screen: welcome signs, timers, Wi-Fi passwords and more. No app, no account, free.
Life & fun · 14d ago · bigwords.page

Play a free virtual guitar online with your keyboard or by touch. Slow songs down and see every chord, string and strum. Acoustic, classic, electric and bass.
Life & fun · 8d ago · guitoro.com

Carrier settings from iPhone, Pixel and Galaxy firmware, decoded and compared: APNs, VoLTE, 5G and Wi-Fi Calling per carrier, and what each build changed.
Life & fun · 12d ago · carrierexplode.com

Life & fun · 22d ago · space.bl2.net
Source: Show HN post ↗
Launched alongside, October 2017
the whole month →

New Google Calendar▲1,041Google is launching a new look + new features for Calendar
Work · 2017 · support.google.com


