Skip to content

Instantly share code, notes, and snippets.

@domitry
domitry / Barnes-Hut.pde
Last active February 7, 2020 06:44
N-body simulation using Barnes-Hut method and Processing.
import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D;
public static final int FRAME_X = 1024;
public static final int FRAME_Y = 1024;
public static final int GENERATION_NUM = 4;
public static final int WALL_POWER = 10;
public static final int COFF_COULUMB = 1;
private ArrayList<Body> bodies;
@domitry
domitry / plot.erb
Last active August 29, 2015 13:57
Sample of the new Plotrb, GSoC2014
<!DOCTYPE html>
<html lang="en">
...
<script>
function hover_province(var state_num){
// when hovering a state on the right map, show the chart relating to it.
$("#income_graph").load("graph/"+state_num);
}
@domitry
domitry / intermediate.js
Last active August 29, 2015 13:57
Sample of the new Plotrb, GSoC2014
models = [{"attributes":
{"data_source":{"type":"ColumnDataSource","id":"3c6d2ed9-dcfc-4b9f-8d9b-0c26a0272ccc"}
"doc":null,
"id":"3c6d2ed9-dcfc-4b9f-8d9b-0c26a0272ccc"
}.
"type":"Glyph",
"id":"3c6d2ed9-dcfc-4b9f-8d9b-0c26a0272ccc"
},
{"attributes":
{"column_names":["fill_color","line_color","shape","x","y"],
@domitry
domitry / sin.rb
Created March 21, 2014 17:27
Sample of the new Plotrb, GSoC2014
require 'plotrb'
N = 1000
x_arr = NVector.linspace(0, 5 * Math::PI, N)
y_arr = NMath.sin(x_arr)
line = Line.new(x: x_arr, y: y_arr) do
axis_titles(x: "x", y: "y")
legend(title: "sin")
end
@domitry
domitry / 3d_scatter_example.rb
Last active August 29, 2015 13:58
3D Scatter demo with Plotrb
require 'plotrb'
values = []
for x in -5..5
for z in -5..5
values.push({x: x, y: (x*x+z*z)/5, z: z})
end
end
@domitry
domitry / README.md
Last active November 14, 2023 10:11
a demo of surface plot with three.js

3D Surface plot demo with three.js

alt text

@domitry
domitry / README.md
Last active August 29, 2015 14:00
the Particles example with Elegans

About this sample

This is a sample to show how Elegans.Particles works.

About Elegans

Click here to learn more about Elegans.

@domitry
domitry / README.md
Last active June 8, 2023 02:42
the Surface example with Elegans

About this sample

This is a sample to show how Elegans.Surface works. This shows a graph of the equetion below:

alt text

About Elegans

Click here to learn more about Elegans.

@domitry
domitry / README.md
Last active August 29, 2015 14:00
the Line example with Elegans

About this sample

This is a sample to show how Elegans.Line works. This shows a sample solution in the Lorenz attractor, when p=10, r=28, b=8/3.

About Elegans

Click here to learn more about Elegans.

@domitry
domitry / README.md
Last active August 29, 2015 14:00
The Scatter example with Elegans

About this sample

This is a sample to show how Elegans.Scatter works.

About Elegans

Click here to learn more about Elegans.