This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ['app/component/world'], (World) -> | |
class MainWindow | |
constructor: -> | |
@world = new World() | |
@renderer = new THREE.WebGLRenderer() | |
@renderer.setSize(window.innerWidth, window.innerHeight) | |
document.body.appendChild(@renderer.domElement) | |
update: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ['app/component/ground'], (Ground) -> | |
class World | |
constructor: -> | |
@scene = new Physijs.Scene() | |
@scene.setGravity(new THREE.Vector3(0, -30, 0)) | |
@init_camera() | |
@init_light() | |
ground = new Ground(new THREE.Vector3(100, 1, 100)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define -> | |
class Ground | |
constructor: (shape) -> | |
geometry = new THREE.CubeGeometry(shape.x, shape.y, shape.z) | |
material = Physijs.createMaterial( | |
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture('images/rocks.jpg') }), | |
8, # high friction | |
4 # low restitution | |
) | |
material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 衝突検出方法の選択(デフォルトを選択) | |
btDefaultCollisionConfiguration *config = new btSoftBodyRigidBodyCollisionConfiguration(); | |
btCollisionDispatcher *dispatcher = new btCollisionDispatcher(config); | |
// ブロードフェーズ法の設定(Dynamic AABB tree method) | |
btDbvtBroadphase *broadphase = new btDbvtBroadphase(); | |
// 拘束(剛体間リンク)のソルバ設定 | |
btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=clang | |
LDFLAGS=-lstdc++ | |
LIBDIR= | |
INCDIR= | |
CFLAGS=-Wall -g -O3 -std=c++11 | |
TARGETS= | |
SRCS= | |
OBJS=$(SRCS:.cpp=.o) | |
all: $(TARGETS) $(OBJS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func _genP(slice []bool, i, n int, ch chan []bool) { | |
if n == i { | |
ch <- slice | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
import subprocess | |
class Window(object): | |
def __init__(self, x = None, y = None, width = None, height = None): | |
self._x = x | |
self._y = y | |
self._width = width | |
self._height = height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _HMM_HPP_ | |
#define _HMM_HPP_ | |
#include <vector> | |
#include <string> | |
#include <list> | |
#include <utility> | |
#include <map> | |
template<typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
println((args(0).toInt to args(1).toInt).par.map(_ + 1).reduceLeft(_ + _)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex> foo = %{person: %{name: "foo", age: 21}, place: "Shibuya"} | |
iex> put_in(foo.person.age, 30) | |
%{person: %{age: 30, name: "foo"}, place: "Shibuya"} | |
iex> foo | |
%{person: %{age: 21, name: "foo"}, place: "Shibuya"} |
OlderNewer