Ar.js: Location-Based only available for A-Frame?

Created on 28 Nov 2019  路  5Comments  路  Source: jeromeetienne/AR.js

@nicolocarpignoli

I personally think that linking location-based developments to A-Frame is not necessarily a convenient approach. Despite the move of the industry there are still those who rely on a less opinionated framework. Those who are coding directly on THREE.js, for example.

Actually, in my opinion, THREE.js is the base, not A-Frame.

I would suggest a separate module under a wrapper or something similar so the location module can be used independently in both contexts?

In fact, Nicolo, the location-based project is an stand-alone development, IMHO.

(Great job, by the way... :clap: )

location based

All 5 comments

Hi @evaristoc

First of all, thanks a lot, I appreciate.

I personally agree with you: making the location-based agnostic from implementation would be of great benefit. We can make a layer that abstracts the implementation of AR content, and then, for now, use aframe implementation, and after that the three.js one. So it will be similar to marker-based feature of AR.js.

The answer about me not doing that already is simple: time and knowledge.
I know aframe better than three.js and for me was much simpler to start with aframe implementation.
So I started developing it with aframe and make it work. Then, a lot of requests of help came, and also other personal stuff/other work.
I honestly do not have time for this, 'cause i'm carrying on also other OSS efforts (like NFT on AR.js).

If someone is will to help, I can offer a bit of support, although I tried to make code standard and documented as possible, for this reason among the others.

@nicolocarpignoli

As this is a topic I am strongly interested I have been checking other implementations for a while, specifically in the THREE.js library. I confess though I haven't worked any solution myself. I bit of lack of confidence, perhaps?

Before talking about contributions, let me first point you some important issues about the implementation you worked that _might_ be relevant:

  • Although the implementation you are using might work for several cases and are cost-effective (the haversine equation for the distance and the use of Euler angles for the calculation of the rotation transform) there are some caveats.
  • The first to mention is the haversine - [it is not bad but a bit of expensive calculation. A problem might arise when you want the distance(s) to be updated in real time]. If you are interested in short distances and precision is NOT an issue I would suggest to try a simple Pitagoras equation instead, which is simpler.
  • The problem with the rotation might be a bit more challenging to solve. The use of Euler angles is cost effective but might result into Gimbal locks, where some rotational axes align in a way that permanently affect reduce the number of the rotational degrees of freedom, [giving a wrong reading] destroying the rotational system. In order to solve this issue, many prefer the use of quaternions [which are also easier to use for rotation calculations]. However, [transforming from matrices to] quaternions calculation is far more expensive.
    Looking at the Three.JS library, there are already a few helpers that go over the Euler angles issue. I will find out for you.
  • The other problem is what the alpha, beta and gamma really mean per devices. Depending on the device, you can get the absolute or the relative heading. According to this reference the relative heading is useless as it doesn't point to the Earth's North. It appears that my device has that problem, but I haven't been able to verify if that really affects the reading after a quit test of your implementation. In any case fortunately there is apparently an existing solution to the relative heading. I haven't deeply tested any yet. More research is required, with several different devices.

I understand you don't have time. I might have some but I am not sure. Let you know?

@evaristoc thank you so much for this accurate analysis.

Of the four point, the latest might be the more critical as it potentially makes this unusable for some device.
Yes, I don't have time for this, if you can help in ANY way it would be great and I will appreciate it a lot.

@nicolocarpignoli

I will make a separate issue to verify that point and see if we can get some help from the community. Closing this one.

I'm also interested in location based AR in three.js. Therefore I'm shamelessly referencing my dedicated issue on the topic here...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soundTricker picture soundTricker  路  5Comments

thiagolopess picture thiagolopess  路  3Comments

ghost picture ghost  路  4Comments

mercem picture mercem  路  7Comments

nicolocarpignoli picture nicolocarpignoli  路  4Comments