This file contains hidden or 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
round=lambda x:(x*2+1)//2 |
This file contains hidden or 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
#pragma once | |
#include "ofMain.h" | |
class WorkerThread : public ofThread | |
{ | |
public: | |
bool pinpon = false; | |
atomic_bool isFrameNew; | |
int value = 0; | |
void threadedFunction() | |
{ |
This file contains hidden or 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
#pragma once | |
#include "ofMain.h" | |
class BadSim | |
{ | |
public: | |
const float mass = 5.19; | |
const float grav = 9.80665; | |
const float terminal_velocity = 6.7; | |
float scale = 30; // 30 pix == 1m | |
This file contains hidden or 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
// | |
// Description : Array and textureless GLSL 2D/3D/4D simplex | |
// noise functions. | |
// Author : Ian McEwan, Ashima Arts. | |
// Maintainer : ijm | |
// Lastmod : 20110822 (ijm) | |
// License : Copyright (C) 2011 Ashima Arts. All rights reserved. | |
// Distributed under the MIT License. See LICENSE file. | |
// https://github.com/ashima/webgl-noise | |
// |
This file contains hidden or 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
// fragment shader | |
#version 150 | |
// this is how we receive the texture | |
uniform sampler2D tex0; | |
in vec2 varyingtexcoord; | |
out vec4 outputColor; | |
void main() | |
{ |
This file contains hidden or 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
void testApp::setup() | |
{ | |
img.loadImage("history.png"); | |
ofSetWindowShape(img.getWidth(), img.getHeight()); | |
scale = 1.0; | |
} | |
void testApp::update() | |
{ | |
This file contains hidden or 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
*.mov | |
*.jpg | |
*.aif | |
*.mpeg | |
*.exe | |
*.exp | |
*.ilk | |
*.pdb | |
*.lib | |
*.otf |
This file contains hidden or 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
//http://alienryderflex.com/polygon/ | |
bool tricks::math::pointInsidePolygon(ofVec2f &p, const vector<ofVec2f> &polygon, int resolution){ | |
int counter = 0; | |
int i; | |
double xinters; | |
ofVec2f p1,p2; | |
float x = p.x; | |
float y = p.y; | |
This file contains hidden or 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
/** | |
* converts cartesion to polar coordinates | |
* result: | |
* [0] = length | |
* [1] = angle z-axis rotation [-PI, PI](range) Z軸回転 | |
* [2] = angle of projection into x,y, plane with x-axis [-PI, PI](range) | |
*/ | |
static ofVec3f cartesianToPolar(const ofVec3f &v) | |
{ | |
ofVec3f polar; |
This file contains hidden or 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
bool checkCrc() | |
{ | |
u_short crc = BCapMessage::getMemCRC16( 0xffff, (u_char *)receivedData, 1, message_length - 3 );//add CRC by horristic | |
bool result = (receivedData[ message_length - 2 ] << 8) + receivedData[ message_length - 3 ] == crc; | |
return result; | |
} | |
static u_short getMemCRC16( unsigned short crc16, unsigned const char buff[], unsigned const short from, unsigned const short to ) | |
{ | |
int i; | |
unsigned short CRC16Table[ 256 ] = { |