Title: Enhancement - SceneKitExtension / map a lat / lng coordinate to scenekit earth planet of where user is · Issue #47 · ThumbWorks/AugmentedSolarSystem · GitHub
Open Graph Title: Enhancement - SceneKitExtension / map a lat / lng coordinate to scenekit earth planet of where user is · Issue #47 · ThumbWorks/AugmentedSolarSystem
X Title: Enhancement - SceneKitExtension / map a lat / lng coordinate to scenekit earth planet of where user is · Issue #47 · ThumbWorks/AugmentedSolarSystem
Description: let earthNode = PlanetoidGroupNode(planet: Planet.earth) earthNode.updatePlanetLocation(earthAA.position()) currently these lines map SwiftAA into the scenekit. however, I don't believe there's any way to get scenekit camera to specific ...
Open Graph Description: let earthNode = PlanetoidGroupNode(planet: Planet.earth) earthNode.updatePlanetLocation(earthAA.position()) currently these lines map SwiftAA into the scenekit. however, I don't believe there's any...
X Description: let earthNode = PlanetoidGroupNode(planet: Planet.earth) earthNode.updatePlanetLocation(earthAA.position()) currently these lines map SwiftAA into the scenekit. however, I don't believe there...
Opengraph URL: https://github.com/ThumbWorks/AugmentedSolarSystem/issues/47
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enhancement - SceneKitExtension / map a lat / lng coordinate to scenekit earth planet of where user is","articleBody":"```swift\r\n let earthNode = PlanetoidGroupNode(planet: Planet.earth)\r\n earthNode.updatePlanetLocation(earthAA.position())\r\n```\r\n\r\ncurrently these lines map SwiftAA into the scenekit.\r\nhowever, I don't believe there's any way to get scenekit camera to specific point of latitude / longitude.\r\n\r\nthis plist contains a bunch of cities with lat / lngs\r\nhttps://github.com/op1000/EarthTravel/blob/master/EarthTravel/Resources/AllCititesToTravel_258.plist\r\n\r\n\r\n```objective-c\r\n\r\n NSString* filePath = [[NSBundle mainBundle] pathForResource:@\"AllCititesToTravel_258\" ofType:@\"plist\"];\r\n NSDictionary* objectData = [NSDictionary dictionaryWithContentsOfFile:filePath];\r\n \r\n NSArray* arrayList = [objectData valueForKeyPath:@\"list\"];\r\n NSMutableArray* arrayCordinate = [[NSMutableArray alloc] init];\r\n for (NSDictionary* dicInfo in arrayList) {\r\n \r\n NSString* cityName = dicInfo[@\"dest_name\"];\r\n float lat = [dicInfo[@\"lat\"] floatValue];\r\n float lng = [dicInfo[@\"lng\"] floatValue];\r\n NSString* countryCode = [dicInfo objectForKey:@\"country_code\"];\r\n \r\n // drop some pins\r\n KGLEarthCoordinate *pin = [KGLEarthCoordinate coordinateWithLatitude:lat\r\n andLongitude:lng\r\n andPinIdentifier:cityName\r\n andConturyCode:countryCode];\r\n [arrayCordinate addObject:pin];\r\n }\r\n [self dropPinsAtLocations:arrayCordinate];\r\n\r\n\r\n-(void)dropPinsAtLocations:(NSArray *)pinArray\r\n{\r\n // remove any existing pins\r\n for (SCNNode *node in _currentPins) {\r\n [node removeFromParentNode];\r\n }\r\n _currentPins = [NSMutableArray array];\r\n \r\n // create new pins\r\n for (KGLEarthCoordinate *coord in pinArray) {\r\n KGLPinNode *newPin = [KGLPinNode pinAtLatitude:coord.latitude\r\n andLongitude:coord.longitude\r\n title:coord.pinIdentifier\r\n countryCode:coord.contryCode];\r\n if (coord.pinIdentifier) {\r\n newPin.identifier = coord.pinIdentifier;\r\n }\r\n [_shadedNode addChildNode:newPin];\r\n [_currentPins addObject:newPin];\r\n }\r\n/*!\r\n * @discussion Convenience method for creating a pin, with internal nodes set up, at a specified location, assuming an Earth at the center of the scene with a radius of 50 units.\r\n * @param latitude The pin's latitude, in degrees.\r\n * @param longitude The pin's longitude, in degrees.\r\n * @return An instance of the KGLPinNode class.\r\n */\r\n\r\n+ (KGLPinNode *)pinAtLatitude:(float)latitude\r\n andLongitude:(float)longitude\r\n title:(NSString*)title\r\n countryCode:(NSString*)countryCode\r\n{\r\n KGLPinNode *pin = [super node];\r\n\r\n if (pin) {\r\n pin.latitude = latitude;\r\n pin.longitude = longitude;\r\n pin.countryCode = countryCode;\r\n }\r\n \r\n pin.name = @\"pinWrapper\";\r\n\r\n SCNBox* pinScene = [SCNBox boxWithWidth:1.0 height:1.0 length:1.0*108.0/159.0 chamferRadius:0];\r\n\r\n //SCNPyramid* pinScene = [SCNPyramid pyramidWithWidth:1.0 height:1.0 length:1.0];\r\n SCNNode *pinNode = [SCNNode nodeWithGeometry:pinScene];\r\n NSString* strCountryImagePath = [NSString stringWithFormat: @\"icon_%@\", countryCode];\r\n {\r\n // ambient light\r\n SCNMaterial *greenMaterial = [SCNMaterial material];\r\n greenMaterial.diffuse.contents = [UIColor clearColor];\r\n greenMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n SCNMaterial *redMaterial = [SCNMaterial material];\r\n redMaterial.diffuse.contents = [UIColor clearColor];\r\n redMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n SCNMaterial *blueMaterial = [SCNMaterial material];\r\n blueMaterial.diffuse.contents = [UIColor clearColor];\r\n blueMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n SCNMaterial *yellowMaterial = [SCNMaterial material];\r\n yellowMaterial.diffuse.contents = [UIColor clearColor];\r\n yellowMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n SCNMaterial *purpleMaterial = [SCNMaterial material];\r\n purpleMaterial.diffuse.contents = strCountryImagePath; // 위를 쳐다보는 면\r\n purpleMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n SCNMaterial *magentaMaterial = [SCNMaterial material];\r\n magentaMaterial.diffuse.contents = [UIColor clearColor];\r\n magentaMaterial.locksAmbientWithDiffuse = YES;\r\n \r\n \r\n pinScene.materials = @[greenMaterial, redMaterial, blueMaterial,\r\n yellowMaterial, purpleMaterial, magentaMaterial];\r\n }\r\n \r\n // add the pin geometry to the pin node\r\n [pin addChildNode:pinNode];\r\n \r\n // pins are small, especially from directly above or zoomed out, so wrap a larger rectangular node around the pin\r\n // this will create a greater touch area\r\n SCNBox *touchBrick = [SCNBox boxWithWidth:5.0f height:7.5f length:5.0f chamferRadius:0];\r\n SCNNode *touchNode = [SCNNode nodeWithGeometry:touchBrick];\r\n touchNode.hidden = YES;\r\n touchNode.name = @\"TouchPin\";\r\n [pin addChildNode:touchNode];\r\n \r\n // position the pin\r\n // calculate the pin's position along the Y axis of the Earth, based on the given latitude\r\n float yPos = sinf(DEGREES_TO_RADIANS(latitude)) * 27.8f*ZOOME_RATIO;\r\n // calculate what the radius of the horizontal circle that cuts through the Earth is at the given Y position\r\n float localRadius = [KGLEarthCommonMath radiusOfCircleBisectingSphereOfRadius:27.8f*ZOOME_RATIO atHeight:yPos];\r\n // using the local radius, calculate the X and Z positions of the pin, based on the given longitude\r\n HorizontalCoords coords = [KGLEarthCommonMath horizontalCoordinatesAtDegrees:longitude ofSphereRadius:localRadius];\r\n pin.position = SCNVector3Make(-1 * coords.x, yPos, coords.z);\r\n \r\n // rotate the pin so it stands vertically at 90 degrees from the surface of the Earth\r\n // first, set the pin's euler angles such that it lies flat against the surface of the Earth, given the pin's location\r\n // the yaw angle positions the pin so it faces out from the surface of the Earth at its location\r\n float yawAngle = atan2f(-1 * coords.x, coords.z);\r\n // the pitch angle tilts the pin so it lies on the ground\r\n float pitchAngle = -1 * DEGREES_TO_RADIANS(latitude) - M_PI_2;\r\n pin.eulerAngles = SCNVector3Make(pitchAngle, yawAngle, 0);\r\n \r\n // now rotate the pin by 180 degrees vertically, so it stands up\r\n SCNMatrix4 latRotation = SCNMatrix4MakeRotation(DEGREES_TO_RADIANS(180),1, 0, 0);\r\n pin.transform = SCNMatrix4Mult(latRotation, pin.transform);\r\n \r\n //==============================\r\n // label\r\n //==============================\r\n SCNText *text = [SCNText textWithString:title extrusionDepth:0.1];\r\n \r\n SCNMaterial *magentaMaterial = [SCNMaterial material];\r\n magentaMaterial.diffuse.contents = [UtilManager colorWithHexString:@\"ec4f30\"];\r\n magentaMaterial.locksAmbientWithDiffuse = YES;\r\n text.materials = @[magentaMaterial];\r\n \r\n SCNNode *textNode = [SCNNode nodeWithGeometry:text];\r\n textNode.position = SCNVector3Make(-1+M_PI_2, 0, 0);\r\n textNode.transform = SCNMatrix4Mult(SCNMatrix4MakeScale(0.05, 0.05, 0.05), textNode.transform);\r\n [pin addChildNode:textNode];\r\n \r\n return pin;\r\n}\r\n}\r\n```\r\n\r\n\r\n","author":{"url":"https://github.com/johndpope","@type":"Person","name":"johndpope"},"datePublished":"2017-11-17T20:47:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/47/AugmentedSolarSystem/issues/47"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0beba9f2-70d5-f750-c922-6f3107c2b3c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8048:2B96DA:20276EA:2CBFA5F:6A5F4005 |
| html-safe-nonce | 0ac136d6d9345fad05a16ebd0cc01411f65b3852685fb2a35bcfd96f33c1a11a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDQ4OjJCOTZEQToyMDI3NkVBOjJDQkZBNUY6NkE1RjQwMDUiLCJ2aXNpdG9yX2lkIjoiNDYwNTM1MzYxNDkyMDA3MzIyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bbb8fefc2db0739f71bbface723bddbb0f8cd046f553d00bc459e074c09d3680 |
| hovercard-subject-tag | issue:274991989 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ThumbWorks/AugmentedSolarSystem/47/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f168c52f1412e183cd5b87ed7e1f59edf9070005ba2d7e36af25a11c9223dab2/ThumbWorks/AugmentedSolarSystem/issues/47 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f168c52f1412e183cd5b87ed7e1f59edf9070005ba2d7e36af25a11c9223dab2/ThumbWorks/AugmentedSolarSystem/issues/47 |
| og:image:alt | let earthNode = PlanetoidGroupNode(planet: Planet.earth) earthNode.updatePlanetLocation(earthAA.position()) currently these lines map SwiftAA into the scenekit. however, I don't believe there's any... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johndpope |
| hostname | github.com |
| expected-hostname | github.com |
| None | ab2497d9345a59709926b385d88458fa5932c82ec066288448eb68b34cbcbbda |
| turbo-cache-control | no-preview |
| go-import | github.com/ThumbWorks/AugmentedSolarSystem git https://github.com/ThumbWorks/AugmentedSolarSystem.git |
| octolytics-dimension-user_id | 10676374 |
| octolytics-dimension-user_login | ThumbWorks |
| octolytics-dimension-repository_id | 93695109 |
| octolytics-dimension-repository_nwo | ThumbWorks/AugmentedSolarSystem |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 93695109 |
| octolytics-dimension-repository_network_root_nwo | ThumbWorks/AugmentedSolarSystem |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ba0ac57287507693938b0a2de45402a22cda0785 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width