Skip to content

Instantly share code, notes, and snippets.

View heronyang's full-sized avatar
😶
No Regrets

Heron Yang heronyang

😶
No Regrets
View GitHub Profile
/* 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);
/* point.h */
class Point {
public:
Point(double x, double y);
double getDistance(const Point& p) const;
private:
double x;
double y;
}
/* point.c */
#include "point.h"
#include <stdlib.h>
#include <math.h>
struct Point {
double x, y;
}
struct Point* makePoint(double x, double y) {
/* point.h */
struct Point;
struct Point* makePoint(double x, double y);
double getDistance(struct Point *p1, struct Point *p2);
/* 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>
struct Point {
double x, y;
}
struct Point* makePoint(double x, double y) {
/* point.c */
#include "point.h"
#include <stdlib.h>
#include <math.h>
struct Point {
double x, y;
}
struct Point* makePoint(double x, double y) {
/* 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>
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: {
<!DOCTYPE html>
<html>
<head>
<title>Accident Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
#map {
height: 100%;
}