background preloader

The Nature of Code

“Roger, Roger. What’s our vector, Victor?” — Captain Oveur (Airplane) This book is all about looking at the world around us and coming up with clever ways to simulate that world with code. Now, the word vector can mean a lot of different things. A vector is typically drawn as a arrow; the direction is indicated by where the arrow is pointing, and the magnitude by the length of the arrow itself. Figure 1.1: A vector (drawn as an arrow) has magnitude (length of arrow) and direction (which way it is pointing). In the above illustration, the vector is drawn as an arrow from point A to point B and serves as an instruction for how to travel from A to B. 1.1 Vectors, You Complete Me Before we dive into more of the details about vectors, let’s look at a basic Processing example that demonstrates why we should care about vectors in the first place. If you are reading this book as a PDF or in print, then you will only see screenshots of the code. Example 1.1: Bouncing ball with no vectors Show Raw Wind Related:  Processingmat, design & code

Processing ControlP5 library example 2 : Style and setValue – kasperkamperman.com : creative media technology // ControlP5 Example 2 : Style UI elements and setValue// ControlP5 by Andreas Schlegel : import controlP5.*; ControlP5 controlP5; void setup() { size(300,260); smooth(); controlP5 = new ControlP5(this); // change the default font to Verdana PFont p = createFont("Verdana",9); controlP5.setControlFont(p); // change the original colors controlP5.setColorForeground(0xffaa0000); controlP5.setColorBackground(0xff660000); controlP5.setColorLabel(0xffdddddd); controlP5.setColorValue(0xffff88ff); controlP5.setColorActive(0xffff0000); // add the elments ( see example 1 for the parameters ) controlP5.addBang("bang1",10,10,20,20); controlP5.addButton("button1",1,70,10,60,20); controlP5.addToggle("toggle1",false,170,10,20,20); controlP5.addSlider("slider1",0,255,128,10,80,10,100); Slider s = controlP5.addSlider("slider2",0,255,128,70,80,100,10); // change sliderMode of the Slider object. void draw() { background(0); // background black}

Skeleton Tracking with the Kinect - Learning This tutorial will explain how to track human skeletons using the Kinect. The OpenNI library can identify the position of key joints on the human body such as the hands, elbows, knees, head and so on. These points form a representation we call the 'skeleton'. Enabling Skeleton Tracking Let us start with the code that we had by the end of the tutorial called Drawing Depth with the Kinect: import SimpleOpenNI.*; SimpleOpenNI context; void setup(){ // instantiate a new context context = new SimpleOpenNI(this); // enable depth image generation context.enableDepth(); // create a window the size of the depth information size(context.depthWidth(), context.depthHeight()); } void draw(){ // update the camera context.update(); // draw depth image image(context.depthImage(),0,0); } First we must tell the OpenNI library to determine joint positions by enabling the skeleton tracking functionality . // enable skeleton generation for all joints context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);

A Primer on Bézier Curves In order to draw things in 2D, we usually rely on lines, which typically get classified into two categories: straight lines, and curves. The first of these are as easy to draw as they are easy to make a computer draw. Give a computer the first and last point in the line, and BAM! straight line. Curves, however, are a much bigger problem. They're named after Pierre Bézier, who is principally responsible for getting them known to the world as a curve well-suited for design work (working for Renault and publishing his investigations in 1962), although he was not the first, or only one, to "invent" these type of curves. So, what if you need to program them yourself? All Bézier graphics are interactive. This page uses Processing examples, rendering as interactive graphics on the page using Processing.js, which means you don't need any plugins if you're on a modern browser. Examples have a "view source" option. Questions, comments: —Pomax (or in the tweetworld, @TheRealPomax) Introduction

Processing & Open Data à Rennes | v3ga Ce tutoriel fait suite à l’atelier Processing qui s’est déroulé à Rennes le 4 et 5 Novembre 2011. Introduction Il a pour but de montrer comment interroger la base de données Open Data de la ville de Rennes depuis Processing et interpréter les données qui sont renvoyées.Nous allons nous intéresser plus particulièrement aux données relatives au Vélo Star, et visualiser les informations sur une carte de la ville. Inscription sur le site data.keolis-rennes.com Pour pouvoir interroger la base de données, la première étape consiste à s’inscrire sur le site. Accès à la base de données Une fois notre clé récupérée, nous allons écrire un programme de quelques lignes avec Processing qui va se connecter au service pour l’interroger.Cette connexion s’effectue par le biais d’une simple adresse internet (ou URL) formatée de telle sorte à contenir non seulement notre clé mais aussi la commande de la requête. La requête s’effectue en une seule instruction avec Processing : loadStrings. Temps réel Notes

Kinect / Kinect La Kinect est une caméra qui permet de capter trois types d'images différentes, une image de profondeur, une image RGB et une image infrarouge: Images de profondeur, RGB et infrarouge L'image de profondeur peut-être utilisée pour assembler des maillages 3D en temps réel. L'image RGB peut-être mappée à ce maillage 3D ou le maillage peut-être déformé pour créer des effets intéressants: En appliquant des modules d'analyses à l'image de profondeur, il est possible de poursuivre plusieurs interacteurs et d'interpréter leurs mouvements: Modules d'analyse de la scène, squelettique et gestuel L'utilisation de la Kinect nécessite un pilote. OpenNI: réalisé par les concepteurs de la Kinect et très riche en fonctionnalités libfreenect: réalisé par la communauté et très élémentaire Parfois il est nécessaire de télécharger et d'installer les pilotes et parfois ils sont déjà inclus et compilés.

Visualizing Algorithms The power of the unaided mind is highly overrated… The real powers come from devising external aids that enhance cognitive abilities. —Donald Norman Algorithms are a fascinating use case for visualization. To visualize an algorithm, we don’t merely fit data to a chart; there is no primary dataset. Instead there are logical rules that describe behavior. But algorithms are also a reminder that visualization is more than a tool for finding patterns in data. #Sampling Before I can explain the first algorithm, I first need to explain the problem it addresses. Light — electromagnetic radiation — the light emanating from this screen, traveling through the air, focused by your lens and projected onto the retina — is a continuous signal. This reduction process is called sampling, and it is essential to vision. Sampling is made difficult by competing goals. Unfortunately, creating a Poisson-disc distribution is hard. Here’s how it works: Now here’s the code: The distance function is simple geometry:

PVector This tutorial is for Processing version 1.1+. If you see any errors or have comments, please let us know. This tutorial is adapted from The Nature of Code by Daniel Shiffman. The source code contained in this tutorial is also available on github. The most basic building block for programming motion is the vector. Vector is the name of a new wave rock band formed in Sacremento, CA in the early 1980s. While all interesting, these are not the definitions we are looking for. A vector is a collection of values that describe relative position in space. Vectors: You Complete Me Before we get into vectors themselves, let's look at a beginner Processing example that demonstrates why it is in the first place we should care. Example: Bouncing Ball with No Vectors In the above example, we have a very simple world -- a blank canvas with a circular shape ("ball") traveling around. Instead of: float x; float y; float xspeed; float yspeed; Woudn't it be nice to have. . . Vector location; Vector speed;

Computing CSS matrix3d transforms | Franklin Ta I was cleaning out some old notes from my previous job and found some math scribbles for computing CSS transforms and thought I would share it. For some context, I was working on a page which had an image that looked like this: I wanted to add an easter egg where I could use the screens of those devices to display arbitrary things. I thought it would just be a simple matter of pixel pushing with translate/rotate/scale/etc using CSS transforms but couldn’t really get things to line up perfectly. Frustrated, I started trying to solve it analytically instead. See the coffeescript tab for the code. Using that you can drag things into whatever (convex quadrilateral) shape you want: Blah blah blah blah blah I ended up not using this for anything but hope someone else will find it useful! The rest of this post will explain how to derive the equation for the transform since I remember not being able to find much about it back then. for each i, where the knowns are x_i, y_i, u_i, v_i.

Processing Rennes Álgebra Elemental Sebas Piedrahita excelentes cursos seria muy chevere aun mas que colocaran los cursos de acorde a como se deben osea por ejemplo tu buscas matemática elemental y te salgas los temas desde el básico hasta el mas avanzado de ellos y poder seguir los cursos en una linea sucesoria muchas gracias excelente pagina angie carolina Cantillo Muuuuy bueno me gusta mucho la forma de explicar hasta ahora he entendido todo muy bn... Mil gracias :D :) Marta Lopez Muchas gracias por hacer estos videos y con esta calidad tan buena. alonso silva Breve claro y conciso bueno para los que no comprendemos rapido Mauricio Rubiano Sierra Este curso es excelente por su profesor que lo explica muy bien en cada tema que se expone y muy expresado en cada ejercicio. ricardo gomez muy bueno solo necesito algo de tiempo y mucha practica gracias estoy completamente seguro que me sera de util. l bj como diría el sr. burns: excelenteeeeeeee!! Juan pablo Zuluaga juan sanchez antonio candelo rada pedro vargas bryan rosales claudia vanini

Processing for Programmers Processing is a wonderful little language. It's designed to be easy to pick up by artists who want to learn some programming, etc. However, it's a real programming language. If you haven't played with Processing, I'd recommend you go do that right now. They have a great series of tutorials, and of course the entire SDK is free. This post is for people like me - programmers who want to take advantage of Processing's short iteration cycle, clear syntax, and simple API to use it as a prototyping environment. First, here is what I think Processing excels at: Interactivity - It's dead easy to get and use mouse and keyboard input and define event handlers.Graphics - "Hello world" in Processing is drawing a circle. Here is what I think Processing is weak at: Large, complex programs (they tend to get a bit unwieldy since it's impossible to organize your classes inside a folder structure.)Programmer assistance (No out-of-the-box debugger. This took me a really long time to realize. Phew!

Linear Algebra Toolkit This Linear Algebra Toolkit is composed of the modules listed below. Each module is designed to help a linear algebra student learn and practice a basic linear algebra procedure, such as Gauss-Jordan reduction, calculating the determinant, or checking for linear independence. Click here for additional information on the toolkit. The Linear Algebra Toolkit has been written entirely in PERL. Every effort has been made to make it compatible with a broad range of browsers, however, no guarantee can be made that every browser will properly handle this application.In order to bookmark the toolkit, first go to the cover page; all the other pages in this toolkit (including the one you are reading) are created dynamically.The toolkit represents all the data (such as matrix entries, vector components and polynomial coefficients) as rational numbers, where both the numerator and denominator are stored as integers. All operations on these rational numbers are performed exactly.

Halleck Hi, my name is Eliot Lash. I have a BFA in Film Production with an emphasis in Sound Design. I'm a mostly inactive Freesound admin/moderator. I mainly do programming and game design now instead of sound design, but I am still happy to help you if I can. Just direct message me. I've updated all my sounds to be CC-BY 3.0, enjoy! Wishlist: *Zoom H4 Current inventory: *Macbook Pro with a firewire 800 port and a 16" line in!! Old request queue: Uber-old requests: *Toy robot [recorded] *Steel drum *San Francisco ambience *Spring peepers (creek frogs) *Kitchen timer *Cell phone vibrating on table *helicopter & sirens *ice skating ambience *doctor talking General queue: *Party wheezer *Didgeridoo *Camera [recorded] *Flute [recorded] Halleck's latest sounds Foley SFX produced by my me and the other members of my foley class for the jungle car chase segment ... more...

Fun Programming

Related: