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
/* point.cc */ | |
#include "point.h" | |
#include <math.h> | |
Point::Point(double x, double y): x(x), y(y) {} | |
double Point::getDistance(const Point& p) const { | |
double dx = x - p.x; | |
double dy = y - p.y; | |
return sqrt(dx*dx + dy*dy); |
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
/* point.h */ | |
class Point { | |
public: | |
Point(double x, double y); | |
double getDistance(const Point& p) const; | |
private: | |
double x; | |
double y; | |
} |
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
/* point.c */ | |
#include "point.h" | |
#include <stdlib.h> | |
#include <math.h> | |
struct Point { | |
double x, y; | |
} | |
struct Point* makePoint(double x, double y) { |
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
/* point.h */ | |
struct Point; | |
struct Point* makePoint(double x, double y); | |
double getDistance(struct Point *p1, struct Point *p2); |
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
/* point.h */ | |
struct Point; | |
struct Point* makePoint(double x, double y); | |
double getDistance(struct Point *p1, struct Point *p2); |
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
/* point.c */ | |
#include "point.h" | |
#include <stdlib.h> | |
#include <math.h> | |
struct Point { | |
double x, y; | |
} | |
struct Point* makePoint(double x, double y) { |
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
/* point.c */ | |
#include "point.h" | |
#include <stdlib.h> | |
#include <math.h> | |
struct Point { | |
double x, y; | |
} | |
struct Point* makePoint(double x, double y) { |
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
/* point.h */ | |
struct Point; | |
struct Point* makePoint(double x, double y); | |
double getDistance(struct Point *p1, struct Point *p2); | |
/* point.c */ | |
#include "point.h" | |
#include <stdlib.h> | |
#include <math.h> |
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
function map_loaded_handler() { | |
console.log("Map is loaded"); | |
var taiwan = new google.maps.LatLng(23.7115779, 121.0267781); | |
var map = new google.maps.Map(document.getElementById("map"), { | |
center: taiwan, | |
zoom: 8 | |
}); | |
// Adds heatmap layer | |
var layer = new google.maps.FusionTablesLayer({ | |
query: { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Accident Map</title> | |
<meta name="viewport" content="initial-scale=1.0"> | |
<meta charset="utf-8"> | |
<style> | |
#map { | |
height: 100%; | |
} |