Hacker News .hnnew | past | comments | ask | show | jobs | submit | GreedCtrl's commentslogin

This is awesome. I was looking for a solution for averaging multiple rotations, and I found https://mathweb.ucsd.edu/~sbuss/ResearchWeb/spheremean/paper...

This method looks a lot easier than that paper, at least at my level of math.


What's your context for averaging multiple rotations?

Averages are something that you can do with sums, where order of composition doesn't matter.

Rotations don't commute, so the concept of average as we understand it doesn't normally apply to them.

If you're holding a phone: rotate the screen away from you 180° (so you'd be seeing the back), then clockwise 90° relative to the ground (around vertical axis).

Your camera will be facing your left.

Now hold the phone normally, and do the same rotations in the opposite order. Your camera will now be facing your right.

Question: where should the camera be facing in the "average" of these two rotations?

There's no single answer — it depends on what you need from the average.


The most widely-used concept of "average" is surely a point that minimizes the sum of squared distances to each of a list of input points. Distances are canonically defined in the space of rotations, and so are averages in this sense (not always uniquely).

Commutativity has nothing to do with this; do not confuse the typical formula for averaging with the reason for doing so! Of course, there are other senses of "average" (which generally do continue to apply to the space of rotations as well).

The application for this given by GreedCtrl's reference is to spline interpolation. Another is in robotics, when combining multiple noisy observations of the orientation of an object.


>Distances are canonically defined in the space of rotations

I am sorry, but this is simply not true.

There are many distance/metric definitions that are applicable to the space of rotations, and the best choice of metric is defined by the application, which is why I asked that question.

None of them is any more "canonical" than the other. See [1][2][3] for an introduction and comparison.

[1] https://www.cs.cmu.edu/~cga/dynopt/readings/Rmetric.pdf

[2] https://rotations.berkeley.edu/geodesics-of-the-rotation-gro...

[3] https://lucaballan.altervista.org/pdfs/IK.pdf

One will find there at least four "canonical" distance definitions, and applications ranging from optometry to computer graphics to IK (which is what you referred to).

>The most widely-used concept of "average" is surely a point that minimizes the sum of squared distances...Of course, there are other senses of "average" (which generally do continue to apply to the space of rotations as well).

I know this, not all of the readers may.

What I don't know is what context the parent is coming from.

Maybe all they need is interpolating between two camera positions - which is a much simpler problem than the paper they found (and what we're discussing) is addressing.

>The application for this given by GreedCtrl's reference is to spline interpolation.

It is not clear that the reference that they have found is actually the best for their application - they only said it was something they found, and that the article we're discussing looks "simpler" for their level of mathematics.

The article we are discussing does not provide any means of "averaging" any more than two rotations, though, which motivated my question.


The bi-invariant metric as pointed out by chombier is what I have in mind. I agree that a non-canonical metric may be the right one for some applications, but those are the exceptional ones. The bi-invariant metric (which has a simple, geometric meaning given by Euler's rotation theorem) is the right starting point for thinking about distances in this space.

(Your reference [2] supports this point of view: read "simplest" as "canonical". Your reference [1] claims five distinct bi-invariant metrics, but this is wrong. The argument given is that any metric related to a bi-invariant metric by a "positive continuous strictly increasing function" is itself bi-invariant, which is not true.)


> >Distances are canonically defined in the space of rotations

> I am sorry, but this is simply not true.

It is true, there is a canonical choice given by the bi-invariant Riemannian metric on compact Lie groups, such as rotations (in this case the shortest angle between rotations)

Whether or not you want this metric in practice is another problem, of course.

> The article we are discussing does not provide any means of "averaging" any more than two rotations,

The Karcher/Fréchet mean described in the original article does average more than two rotations


> Rotations don't commute, so the concept of average as we understand it doesn't normally apply to them.

It does apply, considering that the Euclidean mean minimizes the sum of squared lengths to samples there's a fairly obvious generalization to Riemannian manifolds using geodesic distance.

There are some reasonable assumptions to be made on the manifold and/or sample distribution to ensure convergence but in practice it works pretty well.


Maybe it's Friday and my brain is cooked, but my camera keeps facing left in both cases.


If you start with the phone upright and rotate the screen away from you by turning the phone around the vertical axis, then both rotations are around the same axis and of course they do commute.

My guess is that romwell is holding the phone flat, so that the rotation away from you is about a horizontal axis; then you should experience the noncommutativity.

(The resulting orientations are 180 degrees apart, which indeed makes it difficult to say that any one orientation should be the unique average. But this is due to the geodesic structure of the space of rotations, not the noncommutative product that happened to construct these points, see above.)


Draw a line on the screen from top to bottom. You interpreted "rotate away" as turning it around this axis, which is the same axis you used for the 90-degree clockwise turn. You end up with the screen right-side-up, just facing away from you. It's the same thing I intuitively did.

Now draw a line on the screen from left to right. "Rotate away" by turning the phone around this new axis - so the top of the phone moves away from you, and the bottom of the phone moves closer to you. You end up with the screen upside-down, and also facing away from you.


Can confirm. Followed instructions, got the camera facing the same in both cases (left, with phone upside down). I interpreted the 180 part as flipping the phone around the horizontal axis.


The 180 first part was right. Make sure you are rotating 90 degrees in the same direction both times from your frame of reference (clockwise looking from the top).


I'm making a video game, and I want to map a joystick position to a rotation (of a sword). I have a set of keyframes for certain joystick positions, and I want to interpolate between the three nearest ones to create a continuous function from joystick position to sword rotation.


OK. What kind of positions can the joystick take?

I.e., is it a point on a hemisphere (equivalently, X/Y controller)?

And what kind of rotations are you talking about for the sword? Are they constrained in any way? I'm assuming it's attached to something - is that point moving too?

Finally why do you need to interpolate? Why three? What are you interpolating between?

I.e. why not simply convert the input of the joystick to a rotation - you're literally rotating a stick when you're moving a joystick in the first place.

You don't need interpolation to convert a rotation (of the joystick relative to its base) to the rotation of the sword unless you're doing something that I don't understand.

If you describe what you're doing in detail, I think we might save you a deep dive into deeper math than necessary for this (..or dive into even deeper math :).


The technique you are looking for is SLERP


I had written a tangentially related comment a few days ago. Its related to rotation in a plane. In that case things become a lot simpler, especially if your programming environment support operations on complex numbers as a first class citizen.

https://hackernews.hn/item?id=40333541

The key intuition is that additions are translations and multiplications are rotations. So two model average translation one can use arithmetic mean, for average rotation the geometric mean.


A game called 4D Golf came out recently if you want to try interacting with the physics of minigolf in 4 spatial dimensions.


For crypto, isn't assembly used to help prevent timing attacks? I don't know if that can be done in pure Rust.


At least let’s get rid of c and put this in stdlib, shall we ?


As someone who's doing some accessibility programming but has no background in the field, I do have a random question to throw your way if you are game.

Our team is developing voice control for a website. This is mainly requested by sighted users who want to use the site hands-free. But we also have an accessibility mode for better screen reader support.

We think voice control might be appreciated by screen reader users too, but we aren't sure how well it would work with a screen reader.

Are there common pitfalls we should be wary of?

One thing we're worried about is that the voice from the screen reader might interfere with the detection of the user's voice.

I know general dictation and voice control software already exists, so my initial assumption that screen reader users would benefit might be wrong. If the existing tools are good enough, perhaps this whole question is moot.


Yes, the screen reader output will probably interfere with your speech recognition. You may be able to work around that on some platforms by enabling echo cancellation when getting mic input from navigator.getUserMedia, but I don't know if that actually works on any desktop platforms.

In general, you should assume that the user already has whatever assistive technologies they need, and you don't need to provide your own, just make the content and UI accessible using semantic HTML and (if needed) ARIA. Providing your own screen reader, for example, would definitely be a mistake. The same should ideally also hold for voice control, but apparently you're actually getting some demand for that.


The college in question is Lincoln College.

This is somewhat confusing because there is a college called Illinois College. Because of this news, they are accepting transfers from Lincoln for all students in good academic standing: https://www.ic.edu/news/04-4-2022/illinois-college-extends-b...


I thought this feature was built in, but maybe not? All I can find is https://support.apple.com/en-us/HT212842 which seems to be on a per-app basis.


Apple's solution is per-app and when you go full screen otherwise you can't avoid it.


That kind of engine exists! It's called Maia, as mentioned in a sibling comment.

https://maiachess.com/


A bit off topic, but I'd caution against using business tactics in chess.

> While the opportunities Rockefeller capitalized on are unlikely to come about again, they show how chess strategies can translate into business acumen.

India's youngest billionaire Nikhil Kamath played chess when he was younger, and he used his chess background much as this article does to promote his business acumen.

Just yesterday, he played in a charity simul against 5-time world champion Viswanathan Anand. He was the only player to defeat Anand, an obvious sign of computer assistance.

That's what can happen now that computers are better than humans at chess. Maybe one day they will outclass us at business too?


> He was the only player to defeat Anand, an obvious sign of computer assistance.

Ok this is a bit much. This was a celebrities simultaneously against the grandmaster match, and this guy is a serious player who competed when he was young, and likely plays regularly for fun and practice. Given this was an exhibition fundraiser, and the guy had nothing to prove (already runs a very successful brokerage and hedge fund, India’s youngest billionaire and all) why make an accusation of cheating?


He has already publicly admitted and apologized for it [1].

[1] https://www.thehindu.com/sport/other-sports/chess-fundraiser...


Ah, thanks. Yeah, makes sense. I still don't get how everyone jumped to the conclusion that he was cheating before, though. Is there something so utterly impossible about the situation that make it obvious? Do grandmasters never lose games to non-GM players even when playing multiple people for fun?


Anand isn't a regular-ol GM; Anand is a former world champion. These super-GMs spend thousands and thousands of hours studying the game. Generally super-GMs don't lose to anyone except other GMs in classical time formats.

If a super-GM does lose, then it's probably because they blundered. That's not what happened — Anand played well, but Kamath played basically a perfect game with an accuracy of 99%. There are a handful of people on the planet who can do that consistently in classical, and they are all rated 2700+.


> Do grandmasters never lose games to non-GM players even when playing multiple people for fun?

Pretty much, yeah. Especially when they don’t make any big mistakes, as was the case here.


The guy didn't just cheat, he blatantly cheated, using the computer for every move outside of his first move blunder. Then he bragged about winning in the post-game interview.

The guy obviously lied about his chess background, he lost to a scholar's mate (4 move checkmate) in one of his recent games. He probably just said he had a chess background to sound smart. Arrogant narcissist.


There is a considerable gulf between "someone who competed when they were young" and a world champion. Looking at their rankings, Kamath is/was about 2055 and Anand is about -2753-. He is among a handful of players who have managed to peak above 2800. [0]

As to why people cheat, there are a plethora of reasons. Running a brokerage or hedgefund is whatever, nothing really special to anyone. Being able to defeat someone like Anand -is- an incredible feat to have under one's belt. The thrill of dominating and/or getting key victories in a competitive sport far surpasses things like running a successful business or being rich. Money can't get you that. Business acumen can't get you that. Only your personal knowledge and skill can get you that.

[0]: https://en.wikipedia.org/wiki/List_of_chess_players_by_peak_...


The difference is that business has no particular win condiion or let's say "end" - the goal of it is in the name itself: to keep busy.

What do you want a computer to do: to sell as many apple as the trees can grow ? To change the way people consume so they start eating berries instead because they're cheaper to grow ? To diversify into building the collection machine and not just the apple sales infrastructure ? To sell to far away outsiders ? To cultivate in more and more places ?

It seems just so arbitrary and tied to human interest that a computer would have to have its own desires to satisfy to start doing "business" and then be so isolated from human desires that we d have no interest in keeping them online.

Or we d have to imagine very clever yet obedient machines that would stick and readapt to our changing desire and assist us, but then are they doing business or we are ?


James Carse has a theory[0] about this: “There are at least two kinds of games. One could be called finite, the other infinite. A finite game is played for the purpose of winning, an infinite game for the purpose of continuing the play.”

[0]: https://www.goodreads.com/book/show/189989


I agree; business tactics and chess tactics are different worlds.

The big difference between chess and the real world is that in chess you lack resource production: the pieces you have are the pieces you will always have, and no more. This makes the hypermodern strategies viable: let your opponent occupy the middle while you prepare to attack from the flanks. While I am sure there is a business metaphor there waiting to be realized, a game with resource management like Settlers of Catan probably has metaphors that don't break down as easily under scrutiny.


I'd recommend Megalobox 2: Nomad as a rare gem, much more so than its first season. It takes a classic underdog story then asks: What happens after the hero wins?

It's an adult story. A story of homelessness, of community; of addiction, of compassion; of parenthood, of adolescence. And there's some boxing.


Determinism! [0] I'm switching a browser game side project from Typescript to WebAssembly because determinism enables a simpler style of multiplayer. Instead of relying on a server to manage state, I can just send inputs p2p like a modern fighting game (with rollback [1]). Then the game acts just like singleplayer! For a hobbyist like me, WebAssembly makes the minefield of multiplayer so much easier to navigate.

[0]: https://github.com/WebAssembly/design/blob/master/Nondetermi... [1] A blog post on rollback netcode (not in wasm): https://ki.infil.net/w02-netcode.html


What's nondeterministic about TypeScript / JavaScript?


Performance. See the graphs here: https://fitzgeraldnick.com/2018/02/26/speed-without-wizardry...

Look how much spread there is in the JS, and how little there is in the wasm.

Depending on what you're doing, this may or may not matter to you.


Object enumeration order (before ES2020 [1]), math function accuracy (Firefox and Chrome did standardize on fdlibm though [2]), various timings. All of them can be fixed with caution but it might be easier to use a platform where none of them matters (well, as long as you don't import Math.sin etc. from the environment...).

[1] https://stackoverflow.com/a/30919039/225272

[2] https://www.linux.com/training-tutorials/math-v8-broken-how-...


In many languages like those used to compile to WebAssembly (c++, c#, rust) enumerating standard dictionaries is non-deterministic. A javascript object is a dictionary, it is not surprising that it had an undefined order. If you need order use an array, if you need to lookup a value quickly use a dictionary, if you need both then you compose some ordered dictionary structure that internally has a dictionary and an array.

I guess since so many js devs never understood this and built code around one js engines property order behavior they had to go and specify it as a standard and now all js engine must add extra overhead to track and maintain property order...

Not sure how webassembly helps object enumeration order, it doesn't have objects to enumerate! To make objects you compile to webassembly from languages that most likely have undefined dictionary order and may not even have reflection to enumerate an object at runtime.


I agree that those issues are easy enough to avoid.

I think OP is saying that WebAsm allows for using languages that don't have these footguns. Perhaps there is some language they prefer to JS.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: