Permalink
Browse files

deleted geocoordidate

  • Loading branch information...
1 parent 6ba3242 commit 5da893226dc8ab00be97e112886e53f6c3ac0633 Krzysiek committed Feb 10, 2012
Showing with 0 additions and 98 deletions.
  1. +0 −21 GitHubDetector/GeoCoordinate.h
  2. +0 −77 GitHubDetector/GeoCoordinate.m
@@ -1,21 +0,0 @@
-//
-// GeoCoordinate.h
-//
-// Created by Krzysztof Profic on 11-03-02.
-// Copyright 2011 Krzysztof Profic. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <CoreLocation/CoreLocation.h>
-#import "HKCheckIn.h"
-
-@interface GeoCoordinate : HKCheckIn {
-}
-
-- (void)calibrateUsingOrigin:(CLLocation *)origin;
-- (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second;
-
-@property (nonatomic) double distance;
-@property (nonatomic) double inclination;
-@property (nonatomic) double azimuth;
-@end
@@ -1,77 +0,0 @@
-//
-// GeoCoordinate.m
-//
-// Created by Krzysztof Profic on 11-03-02.
-// Copyright 2011 Krzysztof Profic. All rights reserved.
-//
-
-#import "GeoCoordinate.h"
-
-@interface GeoCoordinate(Private)
-- (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second;
-@end
-
-
-@implementation GeoCoordinate
-@synthesize distance, inclination, azimuth;
-
-// Override the azimuth accessor method
-- (double)azimuth {
- if ( azimuth < 0.0 ) {
- azimuth = (M_PI * 2.0) + azimuth;
- } else if ( azimuth > (M_PI * 2.0) ) {
- azimuth = azimuth - (M_PI * 2.0);
- }
- return azimuth;
-}
-
-- (id)initWithLocation:(CLLocation *)loc {
- self = [super init];
- if ( self != nil ) {
- self.location = loc;
- }
- return self;
-}
-
-- (id)initWithCoordiante:(CLLocation *)loc andOrigin:(CLLocation *)origin {
- self = [super init];
- if ( self != nil ) {
- self.location = loc;
- [self calibrateUsingOrigin:origin];
- }
- return self;
-}
-
-//returns the angle between north -> first <- second
-- (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second {
- float longitudinalDifference = second.longitude - first.longitude;
- float latitudinalDifference = second.latitude - first.latitude;
- float possibleAzimuth = (M_PI_2) - atan(latitudinalDifference / longitudinalDifference); // arc ctan
-
- if (longitudinalDifference > 0)
- return possibleAzimuth;
- else if (longitudinalDifference < 0)
- return possibleAzimuth + M_PI; // ?
- else if (latitudinalDifference < 0)
- return M_PI;
-
- return 0.0f;
-}
-
-// calculating GeoCoordinate's distance
-- (void)calibrateUsingOrigin:(CLLocation *)origin {
- double baseDistance = [origin distanceFromLocation:self.location];
- self.distance = baseDistance;// sqrt( pow( [origin altitude] - [self.location altitude], 2) + pow(baseDistance, 2));
-
- //calculating GeoCoorginate's inclination
- float angle = asin( ABS([origin altitude] - [self.location altitude]) / self.distance);
- if ([origin altitude] > [self.location altitude]) {
- angle = -angle;
- }
- self.inclination = angle;
-
- // calculating GeoCoordinate's azimuth
- self.azimuth = [self angleFromCoordinate:[origin coordinate] toCoordinate:[self.location coordinate]];
-}
-
-@end

0 comments on commit 5da8932

Please sign in to comment.