This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | df['x'] = df['latitude'].values + df['longitude'].values | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # l is a list of dictionaries, of the form [{...},{...}] | |
| for o in l: | |
| o['distance'] = o['latitude'] + o['longitude'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # summation on a dataframe | |
| df['x'] = df['latitude'].values + df['longitude'].values | |
| # summation on a list of dictionaries, of the form [{...},{...}] | |
| for o in l: | |
| o['distance'] = o['latitude'] + o['longitude'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # DataFrame Optimised Haversine function | |
| def haversine(lat1, lon1, lat2, lon2): | |
| miles_constant = 3959 | |
| lat1, lon1, lat2, lon2 = map(np.deg2rad, [lat1, lon1, lat2, lon2]) | |
| dlat = lat2 - lat1 | |
| dlon = lon2 - lon1 | |
| a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2 | |
| c = 2 * np.arcsin(np.sqrt(a)) | |
| mi = miles_constant * c | |
| return mi | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # List Optimised Haversine function | |
| def haversine(lat1, lon1, lat2, lon2): | |
| miles_constant = 3959 | |
| lat1, lon1, lat2, lon2 = map(math.radians, [lat1, lon1, lat2, lon2]) | |
| dlat = lat2 - lat1 | |
| dlon = lon2 - lon1 | |
| a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2 | |
| c = 2 * math.asin(math.sqrt(a)) | |
| mi = miles_constant * c | |
| return mi | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/material.dart'; | |
| import 'camera.dart'; | |
| import 'gallery.dart'; | |
| Future<void> main() async { | |
| WidgetsFlutterBinding.ensureInitialized(); | |
| runApp(MyApp()); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Future<void> main() async { | |
| WidgetsFlutterBinding.ensureInitialized(); | |
| runApp(MyApp()); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Gallery extends StatefulWidget { | |
| @override | |
| _GalleryState createState() => _GalleryState(); | |
| } | |
| class _GalleryState extends State<Gallery> { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/foundation.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:camera/camera.dart'; | |
| import 'package:permission_handler/permission_handler.dart'; | |
| import 'camera.dart'; | |
| class Camera extends StatefulWidget { | |
| final loadingWidget; | |
| Camera(this.loadingWidget); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Future<void> setupCamera() async { | |
| await [ | |
| Permission.camera, | |
| ].request(); | |
| _cameras = await availableCameras(); | |
| var controller = await selectCamera(); | |
| setState(() => _controller = controller); | |
| } | 
OlderNewer