Giter VIP home page Giter VIP logo

Comments (4)

calonso avatar calonso commented on June 16, 2024

Hi @Stingray1
That sounds cool! Of course I'm happy to help. The way I'd do it is by:

  • Add a new maximum_distance configuration parameter that holds the maximum distance from the observer that you want POIs to appear. Think about a way of 'disabling' this feature should other user not want to filter POIs out based on that distance.
  • Then we can either reuse the viewportContainsCoordinate method or even better, create a new method that will decide wether a POI has to appear or not based on its coordinate's radialDistance to the observer. That new method should be invoked by the engine when it is positioning views
  • The radar bit shouldn't be hard either. We'll probably need to pass that maximum_distance parameter upon initialisation somehow and then, when it is updating points add a check so that only points whose radialDistance is smaller than the limit appear.

How does it sound? Does it make sense?
Please, contribute it back to the project as a Pull Request so that we can keep the engine improving!

Thanks and good luck!

from ios-arkit.

VadimPlasiciuc avatar VadimPlasiciuc commented on June 16, 2024
  • (void)addCoordinate:(ARGeoCoordinate *)coordinate {
    [ar_coordinates addObject:coordinate];

    if (coordinate.radialDistance > maximumScaleDistance) {
    maximumScaleDistance = coordinate.radialDistance;
    }

    //message the delegate.
    ARObjectView * ob = [delegate viewForCoordinate:coordinate floorLooking:NO];
    ob.controller = self;
    [ar_coordinateViews addObject:ob];

    if (showsFloorImages) {
    ARObjectView *floor = [delegate viewForCoordinate:coordinate floorLooking:YES];
    floor.controller = self;
    [ar_floorCoordinateViews addObject:floor];
    }

    [coordinate calibrateUsingOrigin:centerCoordinate.geoLocation useAltitude:useAltitude];
    if (coordinate.radialDistance > maximumScaleDistance) {
    maximumScaleDistance = coordinate.radialDistance;
    radar.farthest = maximumScaleDistance;
    }
    }

  • (void)addCoordinates:(NSArray *)newCoordinates {
    for (ARGeoCoordinate *coordinate in newCoordinates) {
    [self addCoordinate:coordinate];
    }
    }
    i studied this method , but i got a question, how do i get the locationManager position for observer through "LocalizationHelper ? "

from ios-arkit.

VadimPlasiciuc avatar VadimPlasiciuc commented on June 16, 2024

Hey i got a problem, i tried for myself adding a locationManager to calculate the distance between him and himself. as for example :
location1 = [[CLLocation alloc] initWithLatitude:locationManager.location.coordinate.latitude longitude:locationManager.location.coordinate.longitude ];
ARGeoCoordinate *la = [ARGeoCoordinate coo rdinateWithLocation:location];
la.dataObject = @"Vasile Alexandri";
I've added a button in DetailView.h and he will display on label the distances :

-(void)buttonPressed:(UIButton *) sender {

distance = [locationManager.location distanceFromLocation:location1];
NSLog(@"dISTANCE IS %Lf",distance);
currentDetailView.distsanceLabel.text = [NSString stringWithFormat:@"%Lf",distance];

}
and it gives me sometime time the distance correct ,sometimes with a little error . But it also have big error when i get a distance of 40-120meter.

i tried to call the delegate
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
{
distance = [locations.lastObject distanceFromLocation:location1];
}

But it didn't help

from ios-arkit.

calonso avatar calonso commented on June 16, 2024

So about the first comment you were close, but I'd recommend you to look at this other method: locationFound: which is where the LocalizationHelper will notify the engine of a new position. Bascially everytime a new position is registered, distances have to be recomputed based on that new location.

About the second comment I'm not sure I've fully understood. I'd suggest maybe getting rid of the LocalizationHelper and using CLLocationManager instead on the engine as the LocalizationHelper's utilities are all unused in this project. That will maybe make it easier for you to debug.

On the other hand I wouldn't call locationManager:didUpdateLocations directly as that method is intended to be called by the GPS of the device when a new location is found. Also it is worth checking that the age of the location received as well as the accuracies are good enough for your computations, maybe they're causing the error you're experimenting.

Finally I'd suggest you to fork the project and open a PR. That way we can use Github's utilities for code comparing and better communication.

Thanks for your effort!

from ios-arkit.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.