Skip to content

Instantly share code, notes, and snippets.

Avatar

Mana Borwornpadungkitti potpath

View GitHub Profile
@potpath
potpath / dijkstra.py
Last active Oct 2, 2020 — forked from econchick/gist:4666413
Python implementation of Dijkstra's Algorithm using heapq
View dijkstra.py
import heapq
from collections import defaultdict
class Graph:
def __init__(self, n):
self.nodes = set(range(n))
self.edges = defaultdict(list)
self.distances = {}
@potpath
potpath / conesIntersection.py
Last active Nov 25, 2016
Check four 3D circular cones intersection
View conesIntersection.py
import ecos
import sys
import os
import numpy as np
from scipy.sparse import csc_matrix
_stdout = sys.stdout
def perpendicular_vector(v):
@potpath
potpath / isPositiveSpan.cpp
Last active Aug 29, 2015
check positive span for 4 fingers using Qhull
View isPositiveSpan.cpp
#include<Qhull.h>
#include<QhullFacetList.h>
using namespace orgQhull;
bool isPositiveSpan(const Point3d &n1,const Point3d &n2,const Point3d &n3,const Point3d &n4){
Qhull qhull;
realT points[12]={n1.x,n1.y,n1.z,n2.x,n2.y,n2.z,n3.x,n3.y,n3.z,n4.x,n4.y,n4.z};
qhull.runQhull("",3,4,points,"");
vector<QhullFacet> facets=qhull.facetList().toStdVector();
for(const QhullFacet &facet : qhull.facetList().toStdVector())
if(facet.getFacetT()->offset>=0) return false;
@potpath
potpath / grader.sh
Last active Aug 29, 2015
Simple grader written in shell script
View grader.sh
#!/bin/bash
ext=sol
if [ "$#" -lt 1 ]
then
echo "Usage: $0 [executable] code [input_output_solution_folder]"
exit 1
fi
if [ -x "`which "$1"`" ]
@potpath
potpath / graspit.patch
Created Sep 4, 2014
patch to make GraspIt! 2.2 compilable in Ubuntu 14.04
View graspit.patch
diff -rupN Graspit/graspit-lib-LINUX.pro GraspitNew/graspit-lib-LINUX.pro
--- Graspit/graspit-lib-LINUX.pro 2012-04-21 01:03:59.000000000 +0700
+++ GraspitNew/graspit-lib-LINUX.pro 2014-09-04 12:06:38.646600227 +0700
@@ -21,7 +21,7 @@ LIBS += -lqhull
LIBS += -lSoQt -lCoin
#add utility libraries
-LIBS += -lGL -lpthread
+LIBS += -lGL -lpthread -ldl
You can’t perform that action at this time.