Skip to content

Instantly share code, notes, and snippets.

View companje's full-sized avatar

Rick Companje companje

View GitHub Profile
@companje
companje / Orientate circle on sphere.pde
Created March 25, 2024 01:03
Orientate circle on sphere
//...
PVector axis = PVector.cross(lens, new PVector(0, 0, -1), null);
float angle = PVector.angleBetween(lens, new PVector(0, 0, 1));
pushMatrix();
rotate(angle, axis.x, axis.y, axis.z);
translate(0, 0, height/2-3);
noFill();
stroke(0);
strokeWeight(5);
hint(DISABLE_DEPTH_TEST);
@companje
companje / gestures.pde
Last active March 17, 2024 14:56
Gestures - patterns in lines - WIP
import java.util.ArrayList;
ArrayList<Line> lines = new ArrayList();
float downX, downY;
String title = "";
void setup() {
size(400, 400);
loadLines("vmove.txt");
}
@companje
companje / rotate-sphere-with-anchorpoint.pde
Last active March 17, 2024 13:34
Rotate sphere with anchorpoint
float d, r, eyeZ = 1900;
PShape sphere;
Quaternion qTo = new Quaternion();
Quaternion qNow = new Quaternion();
PVector anchorPoint = null;
ArrayList<PVector> points = new ArrayList();
PVector center = new PVector(0, 0, 0);
PVector top = new PVector(0, 0, 1);
void settings() {
@companje
companje / rgbw-leds.ino
Created March 7, 2024 19:41
RGBW LEDs with Arduino
#include <Adafruit_NeoPixel.h>
#define LED_PIN 3
#define LED_COUNT 163
#define DELAYVAL 25
int i=0;
Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);
void setup() {
@companje
companje / perspective-sphere.pde
Created February 28, 2024 22:40
Load WorldMap .OBJ with adjusted perspective
PShape globe;
float w,h,eyeZ;
void setup() {
fullScreen(P3D);
w = width;
h = height;
eyeZ = 1460; // = h/2 + offset
@companje
companje / 0.Sphere.pde
Created February 27, 2024 06:55
Sphere
Quaternion q = new Quaternion(1, 0, 0, 0);
ArrayList<PVector> dots = new ArrayList();
PImage tex;
PShape sphere;
PShader shader;
void setup() {
size(900, 900, P3D);
tex = loadImage("earth.jpg");
sphere = createShape(SPHERE, height/2);
@companje
companje / 0.Sphere-with-red-dots-reacting-to-mouse.pde
Last active February 24, 2024 15:47
Sphere ArcBall rotate with Quaternion, also with inverse rotation
Quaternion q = new Quaternion(1, 0, 0, 0);
PShape globe;
PImage tex;
ArrayList<PVector> points = new ArrayList();
float radius;
void setup() {
size(800, 800, P3D);
tex = loadImage("earth.jpg");
radius = height/2;
@companje
companje / Zoom-Shader-Processing.pde
Last active February 20, 2024 09:39
Zoom shader for sphere
PShader shader;
PImage tex;
PShape sphere;
PVector lensCenter = new PVector(0,0,1);
float zoom = 2;
void setup() {
size(1169, 1169, P3D);
tex = loadImage("1539.jpg");
sphere = createShape(SPHERE, height/2);
@companje
companje / Load WorldMap .OBJ with adjusted perspective (Basic Perspective Sphere).pde
Created February 17, 2024 08:21
Load WorldMap .OBJ with adjusted perspective (Basic Perspective Sphere)
PShape globe;
float w,h,eyeZ;
void setup() {
fullScreen(P3D);
w = width;
h = height;
eyeZ = 1460; // = h/2 + offset
@companje
companje / merge-csv.py
Created February 13, 2024 08:51
Merge 2 CSV's
# ik heb twee CSV's met de volgende headers:
#
# 1) org_row,filename,straatnaam,afbeelding,oude straatnaam
# 2) "uuid","name","width","height","link"
# Ik wil graag een nieuwe CSV met de onderstaande velden waarbij de sleutelkolommen 'filename' en 'name' gebruikt kunnen worden om te matchen
# 2) "uuid","name","width","height","link","straatnaam"
#
# response from ChatGPT 3.5. In 1x goed!