Underscore example:
_.each([1, 2, 3], function(num) { alert(num); });
import numpy as np | |
import matplotlib.pyplot as plt | |
def makeLayer(y, height): | |
neg=0.0 | |
pos=0.0 | |
if y > 0: | |
if y - height >= 0: | |
pos = height | |
y -= pos |
#! /bin/sh | |
# Script to provide answer for question: | |
# http://stackoverflow.com/questions/5149872/how-to-git-remote-add-and-track-a-branch-in-the-same-filesystem | |
echo create origin | |
mkdir origin | |
cd origin/ | |
git init --bare | |
cd .. |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>D3 Ternary Plot</title> | |
<style> | |
line.axis { | |
stroke-width: 2; | |
stroke: #363636; | |
} |
const vertex = ` | |
attribute vec2 a_position; | |
attribute vec3 a_barycentric; | |
uniform mat3 u_matrix; | |
varying vec3 vbc; | |
void main() { | |
vbc = a_barycentric; | |
gl_Position = vec4((u_matrix * vec3(a_position, 1)).xy, 0, 1); | |
}` |
license: gpl-3.0 |
const glslify = require('glslify'); | |
const path = require('path'); | |
// This is the original source, we will copy + paste it for our own GLSL | |
// const vertexShader = THREE.ShaderChunk.meshphysical_vert; | |
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag; | |
// Our custom shaders | |
const fragmentShader = glslify(path.resolve(__dirname, 'standard.frag')); | |
const vertexShader = glslify(path.resolve(__dirname, 'standard.vert')); |
This example adapts mbostock's quadtree brushing demo to find the nearest neighbor (shown red) of a new point (shown yellow). Choose a new point to classify by clicking on the diagram. (An alternative approach for nearest neighbors of the mouse position is D3's Voronoi polygons, but the idea here would extend to rapidly classifying many new points against a base collection of points.)
We use a data-dependent order of recursion through the quadtree
license: gpl-3.0 |