Skip to content

Instantly share code, notes, and snippets.

View v3c70r's full-sized avatar
🐱
Cats typing ...

QGu v3c70r

🐱
Cats typing ...
View GitHub Profile
/**
* @brief Get distance from a point to line
*
* @param p0 The point
* @param p1 Starting point of line
* @param p2 End point of line
*
* @return distance*distance
*/
float pointLineDistance(const glm::vec2 &p0, const glm::vec2 &p1, const glm::vec2 &p2)
@v3c70r
v3c70r / XYZ2EYE.glsl
Last active September 16, 2015 19:53
vec4 uvToEye(vec2 texCoord, float z) //screen to camera coordinate
{
const vec4 viewport = vec4(0, 0, 1, 1);
vec3 ndcPos;
//ndcPos.xy = ((2.0 * texCoord.xy)-(2.0*viewport.xy))/(viewport.zw)-1;
ndcPos.xy = 2 * (texCoord.xy) - vec2(1.0, 1.0);
ndcPos.z = (2.0 * z - 1.0);
vec4 clipPos;
//clipPos.w = camMats.projMat[3][2]/ (ndcPos.z - (camMats.projMat[2][2]/camMats.projMat[2][3]));
import Tkinter, Tkconstants, tkFileDialog
import DFS_BFS
class TkFileDialogExample(Tkinter.Frame):
adjPath = ''
infoPath = ''
res = []
def __init__(self, root):
cuh
void *dDensSum;
void *dDensCount;
cu:init()
gpuErrchk(cudaMalloc((void**)&dDensSum, sizeof(float)));
gpuErrchk(cudaMalloc((void**)&dDensCount, sizeof(int)));
cu:~Points()
gpuErrchk(cudaFree(dDensSum))
gpuErrchk(cudafree(dDensCount))
cu: //Copy back to CPU
@v3c70r
v3c70r / DFS_BFS.py
Last active August 29, 2015 14:25
DFS et BFS pour Shino
#This python file is used to search the tree
from collections import deque
class GraphSearcher:
res = []
flag = [];
adjMat = [];
nodeNames = [];
def init(self, fileName, nodeNameFile):
#reset everything
self.res = []
@v3c70r
v3c70r / rainbowDragon.cpp
Created November 11, 2014 01:46
generate a colourful dragon in terminal
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
std::string RESET = "\033[0m" ;
std::string BLACK = "\033[30m"; /* Black */
std::string RED = "\033[31m"; /* Red */
std::string GREEN = "\033[32m"; /* Green */
std::string YELLOW = "\033[33m"; /* Yellow */
std::string BLUE = "\033[34m"; /* Blue */
//This part of code should be in the else block of mouseMoveEvent() function of glMain.cpp
const int dx = x - _mouseX;
const int dy = y - _mouseY;
int fviewport[]={0,0,1,1};
double projection[16];
double modelview[16];
glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );