Subscribed unsubscribe Subscribe Subscribe

pushMatrix() / popMatrix()

pushMatirx() pushMatrix() \ Language (API) \ Processing 2+ popMatrix() popMatrix() \ Language (API) \ Processing 2+record (0,0) and pull (0,0)Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack. …

lights()

lights() lights() \ Language (API) \ Processing 2+ Sets the default ambient light,directional light, falloff, and specular values. The defaults are ambientLight(128, 128, 128) and directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, …

Rotate camera with mouse Dragging

マウス操作によるカメラ移動 with Processing : 東京工業大学 ロボット技術研究会 class MouseCamera { float eyeX, eyeY, eyeZ; float centerX, centerY, centerZ; float upX, upY, upZ; float radius; float[][] matrix; PVector preVector; MouseCamera(f…

Rotate camera with mouse location

import processing.opengl.*; void setup(){ size(600,600,OPENGL); smooth(); } void draw(){ background(200); translate(width*0.5,height*0.5,0); rotateY(map(mouseX,0,width,-PI,PI)); rotateX((map(mouseY,0,height,-PI,PI))*(-1)); // origin stroke…

sphere()

sphere() sphere() \ Language (API) \ Processing 2+create sphere on center centerModesphere(radius) size(100,100,P3D); noStroke(); lights(); translate(width*0.25,height*0.5,0); sphere(30); translate(width*0.5,0,0); sphere(20);

box()

box() box() \ Language (API) \ Processing 2+create box on center box width is width centerMode size(100,100,P3D); translate(50,50,0); rotateY(0); noFill(); box(40); box(40,20,50); fill(255,0,0); ellipse(0,0,5,5); // red fill(0,255,0); elli…

int() / byte() / float()

int() int() \ Language (API) \ Processing 2+convert primitive datatype to integer float f = 65.0; int i = int(f); println(f+" : " +i); // console: 65.0 : 65 char c = 'E'; i = int(c); println(c+ " : " +i); // console: E : 69 byte() byte() \…

sq() / sprt() / pow()

sq() sq() \ Language (API) \ Processing 2+squares a number (multiplies a number by itself) the result is always a positive number return float noStroke(); float a = sq(1); float b = sq(-5); float c = sq(9); rect(0,25,a,10); rect(0,45,b,10)…

noise()

noise noise() \ Language (API) \ Processing 2+returns the perlin noise value at specified coodinates Perlin noise is a type of gradient noise float noiseScale = 0.02; void draw(){ background(0); for (int x=0; x

Str_length()

str.length() String::length() \ Language (API) \ Processing 2+returns the total number of characters included in the String as an intger number String str1 = "Hoge"; String str2 = "HogeHoge"; int s1 = str1.length(); int s2 = str2.length();…

map()

map() map() \ Language (API) \ Processing 2+x = map(value, d1,d2, d3,d4);value in the domain [d1 to d2] remap x in the domain [d3 to d4]d1,d2,d3,d4 and ReturnNum is """float""" float value = 50; float m = map(value, 0, 100, -20, -10); prin…

random()

random() random() \ Language (API) \ Processing 2+set upper limit [ 0 to X ] random(float:X);set domain [ Xmini to Ymax ] random(float:Xmini , float;Ymax);upper limit [ 0 to 10 ] for(int i=0; i<10; i++){ float r = random(10); println(r); }…

stroke()

stroke() stroke() \ Language (API) \ Processing 2+baced colorMode(); int rs = 400; // rect Size size(800,800); strokeWeight(20); noFill(); // default rectMode is CORNER // rect(start_X,start_Y,width,height); colorMode(RGB,255); stroke(0); …

rectMode()

rectMode() rectMode() \ Language (API) \ Processing 2+CORNER, CORNERS, RADIUS or CENTERCORNER mode is defalut rect(start_X,start_Y,width,height); size(800,800); for (int i=200; i<800; i=i+200){ line(i,0,i,height); line(0,i,width,i); } noSt…

ellipseMode()

ellipseMode() ellipseMode() \ Language (API) \ Processing 2+CENTER, RADIUS, CORNER or CORNERSCENTER Mode is default ellipse(center_X,center_Y,diameter_X,diameter_Y); size(800,800); noFill(); strokeWeight(10); smooth(); colorMode(RGB,255); …

fill()

fill() fill() \ Language (API) \ Processing 2+based colorMode(); int rs = 400; //rectSize size(800,800); noStroke(); /* colorMode(RGB or HSB,max) colorMode() is RGB,default max: remap range */ colorMode(RGB,255); /* colorMode(RGB); fill(Re…

colorMode()

colorMode() colorMode() \ Language (API) \ Processing 2+set color mode RGB or HSBRGB mode red,green,blue size(240,240); background(0); noStroke(); colorMode(RGB,100); /* colorMode(RGB,max); Red - Green - Blue max float: range for all color…