nowfound

Life & fun · October 16, 2017

IA

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 →
  • VT
    Visualizing 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…

  • SP
    Simple 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

  • 3 Lanes2015 · apps.apple.com · ▲65

    A real physics environment into 90's old school racing game

  • Odyssey 313d ago · odyssey.systems · ▲159

    A world model that simulates physics in real time

  • Magnetic Versatiles2015 · ▲74

    A dynamic landscape magnetized art puzzle

  • Axis2014 · axisthegame.com · ▲65

    A multiplayer math game

More life & fun this month

the category →

Source: Show HN post ↗

Launched alongside, October 2017

the whole month →
  • Coda▲1,647

    It's a new day for docs

    Work · 2017 · coda.io

  • Station▲1,377

    One app to rule them all

    Work · 2017 · stationhq.com

  • Google is launching a new look + new features for Calendar

    Work · 2017 · support.google.com

  • The world’s most powerful screen design tool

    Work · 2017 · miro.com

  • Slite▲876

    One combined workspace. All of your team documentation.

    Work · 2017 · slite.com

  • Beautiful, smart checkout flows 💳💸

    Commerce · 2017 · stripe.com