Skip to content

Instantly share code, notes, and snippets.

@roxlu ☾ roxlu

Block or report user

Report or block roxlu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md

Mitchell’s best-candidate algorithm generates a new random sample by creating k candidate samples and picking the best of k. Here the “best” sample is defined as the sample that is farthest away from previous samples. The algorithm approximates Poisson-disc sampling, producing a much more natural appearance (better blue noise spectral characteristics) than uniform random sampling.

See also the white-on-black and Voronoi variations of this example.

View Mist.cpp
#include <swnt/Effects.h>
#include <swnt/effects/Mist.h>
template<class T>
inline bool intersect(const Vec3<T>& p0, const Vec3<T>& p1, const Vec3<T>& p2, const Vec3<T>& p3, Vec3<T>& result) {
Vec3<T> s1 = p1 - p0;
Vec3<T> s2 = p3 - p2;
float s, t;
s = (-s1.y * (p0.x - p2.x) + s1.x * (p0.y - p2.y)) / (-s2.x * s1.y + s1.x * s2.y);
@roxlu
roxlu / Weather.cpp
Created Jan 6, 2014
CURL retrieve HTML into string
View Weather.cpp
size_t weather_write_data(void* ptr, size_t size, size_t nmemb, void* str) {
std::string* s = static_cast<std::string*>(str);
std::copy((char*)ptr, (char*)ptr + (size + nmemb), std::back_inserter(*s));
return size * nmemb;
}
std::string weather_download_yahoo_rss() {
std::string result;
std::string url = "http://weather.yahooapis.com/forecastrss?w=10242&u=c"; // w=10242 is Aberaron
@roxlu
roxlu / compile.sh
Created Jan 5, 2014
NGINX + PHP + MySQL
View compile.sh
#!/bin/sh
# Compiling nginx + php + mysql on Mac OSX 10.9
# ---------------------------------------------
#
#
# CONFIGURE
# ---------------
# 1) Edit `conf/nginx.conf` and add this to the between the server { ... } config.
# NOTE: the current config you only need to uncomment the example that looks like this,
@roxlu
roxlu / main.cpp
Created Jan 4, 2014
Reading up on numerical methods and c++
View main.cpp
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void triangulate(float* a, float* b, int n);
void backsubst(float* a, float* b, int n);
void print(float* a, int rows, int cols);
int main() {
printf("\nGauss Seidel Elimination - Ch. 10 - Direct Solution of Linear Equation, page 204, An Introduction To Numerical Methods in C++\n\n");
@roxlu
roxlu / compile.sh
Created Jan 4, 2014
NGINX + PHP + configuration
View compile.sh
#!/bin/sh
# Compiling nginx + php + mysql on Mac OSX 10.9
# ---------------------------------------------
#
#
# CONFIGURE
# ---------------
# 1) Edit `conf/nginx.conf` and add this to the between the server { ... } config.
# NOTE: the current config you only need to uncomment the example that looks like this,
@roxlu
roxlu / GUI.cpp
Created Dec 29, 2013
Minimal AntTweakBar integration with GLFW
View GUI.cpp
#include <assert.h>
#include <GLFW/glfw3.h>
#include <swnt/GUI.h>
GUI::GUI()
:win_w(0)
,win_h(0)
{
}
@roxlu
roxlu / README.txt
Created Dec 11, 2013
Compile Apache, PHP and MySQL on Mac
View README.txt
COMPILE APACHE / PHP / MYSQL
===========================
- First compile/install apache, see compile_apache.sh for more info
- Then compile/install php/mysql, see compile_php.sh for more info
- Tested on Mac OSX 10.8, 2013.01.15
@roxlu
roxlu / tinylib.h
Last active Jul 24, 2019
Tinylib - the most basic features for easy graphics development with GL
View tinylib.h
/*
--------------------------------------------------------------------------------
oooo
`888
oooo d8b .ooooo. oooo ooo 888 oooo oooo
`888""8P d88' `88b `88b..8P' 888 `888 `888
888 888 888 Y888' 888 888 888
888 888 888 .o8"'88b 888 888 888
@roxlu
roxlu / code.cpp
Last active Apr 18, 2018
Signature :)
View code.cpp
---------------------------------------------------------------
oooo
`888
oooo d8b .ooooo. oooo ooo 888 oooo oooo
`888""8P d88' `88b `88b..8P' 888 `888 `888
888 888 888 Y888' 888 888 888
888 888 888 .o8"'88b 888 888 888
d888b `Y8bod8P' o88' 888o o888o `V88V"V8P'
You can’t perform that action at this time.