Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

# Keisuke OTAKIcocomoff

🏠
Working from home
• Sort options
Created Dec 11, 2019
segments and intersect
View line_segment_intersect.py
 def line_segment_intersection(p1, p2, p3, p4): d = (p2[0] - p1[0]) * (p4[1] - p3[1]) - (p2[1] - p1[1]) * (p4[0] - p3[0]) if d == 0.0: return None intersect = [0.0, 0.0] u = ((p3[0] - p1[0]) * (p4[1] - p3[1]) - (p3[1] - p1[1]) * (p4[0] - p3[0])) / d v = ((p3[0] - p1[0]) * (p2[1] - p1[1]) - (p3[1] - p1[1]) * (p2[0] - p1[0])) / d if u < 0.0 or u > 1.0 or v < 0.0 or v > 1.0: return None
Created Dec 4, 2019
example of module
View dFrechet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Dec 3, 2019
Plots in Julia for graph visualizer (tentative)
View edge.txt
 1 2 1 3 2 4 3 4 3 5 4 5
Created Sep 24, 2019
tekitou public
View public.rs
 use fast_paths::InputGraph; use fast_paths::PreparationGraph; use fast_paths::Dijkstra; use fast_paths::contract_node; fn main() { let mut input_graph = InputGraph::new(); // // 01234=ABCDE // input_graph.add_edge_bidir(0, 2, 1); // input_graph.add_edge_bidir(1, 2, 4);
Created Sep 24, 2019
tekitou public
View public.rs
 use fast_paths::InputGraph; use fast_paths::PreparationGraph; use fast_paths::Dijkstra; use fast_paths::contract_node; fn main() { let mut input_graph = InputGraph::new(); // // 01234=ABCDE // input_graph.add_edge_bidir(0, 2, 1); // input_graph.add_edge_bidir(1, 2, 4);
Created Aug 26, 2019
bokeh example (index template)
View index.html
 Flask Bokeh Sample {% autoescape False %} {{ resources }} {% endautoescape %}
Created Aug 26, 2019
bokeh example
View bokeh_example.py
 # -*- coding: utf-8 -*- import json from bokeh.embed import json_item from bokeh.plotting import figure from bokeh.resources import CDN from bokeh.sampledata.iris import flowers from bokeh.embed import components from bokeh.plotting import figure from flask import Flask, render_template
Created Aug 15, 2019
Legendre変換のお勉強: (x, y)ではなく(p, w)で関数を表す
View example_legendre.jl
 using Plots # 適当な2次関数，導関数，接線の方程式 f(x; b=-3, d=2) = (b .+ x) .^2 .+ d df(x; b=-3, d=2) = 2 .* (b .+ x) fₜₐₙ(x, xₚ; b=-3, d=2) = df(xₚ) .* (x .- xₚ) .+ f(xₚ, b=b, d=d) # 関数 x = 1:0.1:5;
Created Aug 12, 2019
random_road_network.py
View random_road_network.py
 # -*- coding: utf-8 -*- # # build random road network # # 1. randomly sample location points # 2. compute pair-wise shortest paths # 3. keep pairs if its length < 1.5 x (ST) import numpy as np import networkx as nx
Created Aug 12, 2019
dp_zdd.cpp
View dp_zdd.cpp
 #include #include "cuddObj.hh" using namespace std; const string red = "\033[0;31m"; const string green = "\033[0;32m"; const string reset = "\033[0m"; // Global manager Cudd mgr;
You can’t perform that action at this time.