Skip to content

Instantly share code, notes, and snippets.

View ikr7's full-sized avatar
🅰️
rch Linux

ikr7

🅰️
rch Linux
View GitHub Profile
LANG=ja_JP.UTF-8
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH # ふつうの
export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH # coreutils
export PATH=$HOME/.nodebrew/current/bin:$PATH # nodebrew
export PATH=/Library/TeX/texbin:$PATH # TeX
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
import std.stdio;
import std.complex : complex, Complex, abs, arg;
import std.algorithm.comparison : clamp;
import std.format : format;
import conv = std.conv;
import math = std.math;
import IF = imageformats;
alias Image = IF.IFImage;
import std.stdio : writeln;
import std.complex : complex, Complex, abs, arg;
import std.algorithm.comparison : clamp;
import conv = std.conv;
import math = std.math;
import IF = imageformats;
alias Image = IF.IFImage;
immutable int size = 64; // 画像サイズ
@ikr7
ikr7 / expr.ts
Created March 25, 2017 13:52
計算です
// これ ( https://www.desmos.com/calculator/ktrb025zjm ) と半直線との交点を求める
// 楕円は this, 楕円の各パラメータは desmos に準じる, ただし desmos での t は theta とした
// 半直線は r, 原点は o, 方向ベクトルは d
const A: number = // t^2の係数
(Math.cos(this.theta) ** 2 * r.d.x ** 2) / this.b ** 2 +
(Math.cos(this.theta) ** 2 * r.d.y ** 2) / this.d ** 2 +
(2 * Math.cos(this.theta) * r.d.x * r.d.y * Math.sin(this.theta)) / this.b ** 2 +
(2 * Math.cos(this.theta) * r.d.x * r.d.y * Math.sin(this.theta)) / this.d ** 2 +
(r.d.x ** 2 * Math.sin(this.theta) ** 2) / this.d ** 2 +
@ikr7
ikr7 / .block
Last active May 1, 2017 22:46
Fractal Dimension Measurement
license: mit
@ikr7
ikr7 / index.html
Last active November 14, 2016 10:00
Play with Hata-map / 畑政義写像で遊ぼう
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Play with Hata-map / 畑政義写像で遊ぼう</title>
<style media="screen">
#container {
max-width: 1000px;
margin-left: auto;
@ikr7
ikr7 / hata_map.go
Created November 1, 2016 12:44
畑政義写像
package main
import (
"math/cmplx"
"image"
"image/color"
"image/png"
"os"
)
@ikr7
ikr7 / mand_pi.c
Created October 5, 2016 11:22
マンデルブロ集合(を定義する漸化式)を用いた円周率の近似
#include <stdio.h>
#include <math.h>
#define MAX_ITER 100000000
int N (long double c) {
long double z = 0.0;
for (int n = 0; n < MAX_ITER; n++) {
z = z * z + c;
if (z >= 2.0) {
@ikr7
ikr7 / index.html
Created October 2, 2016 11:31
WebGL でマンデルブロくん with Distance Estimation
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WebGL でマンデルブロくん</title>
<style>
body {
margin:0;
overflow:hidden
@ikr7
ikr7 / mand.go
Created September 30, 2016 13:25
おせえよ
package main
import (
"math/cmplx"
"image"
"image/color"
"image/png"
"os"
)