Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to calculate distance between device and anchor and distance between two anchors #115

Merged
merged 7 commits into from Jul 4, 2022

Conversation

dnkoulouris
Copy link
Contributor

This pull request implements two functionalities that are required for many use cases:

  • calculate distance from device to anchor
  • calculate distance between two anchors

The distance is counted in meters and uses the Vector 3 square root method.
Method getCameraPose() that obtains device coordinates is required and was cloned from gps branch

Methods added in ar_session_manager.dart along with the required platform code in Swift and Kotlin:

  • getPose(ARAnchor anchor): Returns the given anchor pose in Matrix4 format with respect to the world coordinate system of the ARView.
  • getDistanceBetweenAnchors(ARAnchor anchor1, ARAnchor anchor2): Returns the distance in meters between @anchor1 and @Anchor2.
  • getDistanceFromAnchor(ARAnchor anchor): Returns the distance in meters between @anchor and device's camera.
  • getDistanceBetweenVectors(Vector3 vector1, Vector3 vector2): Returns the distance in meters between @vector1 and @vector2.

@Petroni
Copy link

Petroni commented Jun 15, 2022

Tested out getDistanceFromAnchor and getDistanceBetweenAnchors on iOS and all seems to be working well without any issues. Currently in the process of testing on Android

@CariusLars
Copy link
Owner

Hey @dnkoulouris , thanks for the contribution! I left a few comments on your code but looks good otherwise, once @Petroni is done testing on Android and the comments are fixed I'm happy to merge :)

@Petroni
Copy link

Petroni commented Jun 16, 2022

2 Small issues on the Android side. AndroidARView.kt f line 108 & 116 are throwing errors due to being passing null values.
Managed to fix this from my end by passing an empty string instead of null.

@dnkoulouris
Copy link
Contributor Author

So, what is the current status?

@dnkoulouris
Copy link
Contributor Author

I also fixed the error that @Petroni mentioned in my fork

@CariusLars
Copy link
Owner

Hey folks, sorry for the late reply, I've been very busy the last couple of weeks..

@dnkoulouris thanks for the fix, could you reply to / fix the three review comments I left after your initial PR above? After that I´m happy to merge :)

@dnkoulouris
Copy link
Contributor Author

@CariusLars I can not see your commits. In which branch/repo are they?

@CariusLars
Copy link
Owner

if you scroll up on this page you should see three review comments (they are not commits). I'v attached a screenshot below
image

@dnkoulouris
Copy link
Contributor Author

Readme file reverted to the original state.
Concerning the Info.plist issue, according to this:
https://github.com/flutter/flutter/issues/94508
I added the flag to support higher frame rates in iPhone screens (iPhone 13 series).

@dnkoulouris
Copy link
Contributor Author

I also made a commit that fixes this issue.
In this commit I included required dependency upgrades.

@CariusLars CariusLars merged commit 6bee948 into CariusLars:main Jul 4, 2022
@CariusLars
Copy link
Owner

awesome, thanks @dnkoulouris! I merged this just now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants