Skip to content

Instantly share code, notes, and snippets.

View norgeotloic's full-sized avatar

Loïc Norgeot norgeotloic

  • Roscoff, France
View GitHub Profile
@norgeotloic
norgeotloic / viewer.py
Created November 14, 2019 21:03
VTK point cloud animation viewer
"""
Helper script to view a .ply point cloud animation (or a single point cloud).
Info:
Takes as input a directory, which must contain point clouds in .ply format,
as well as a sketchfab.timeframe file specifying the order of the files,
and the duration of each frame (although the duration is not used here).
More information on the sketchfab.timeframe format can be obtained here:
https://help.sketchfab.com/hc/en-us/articles/203058018-Animations#timeframe
Please note that the input files must be generated else where (manually, C++, Python...)
"""
Create a Sketchfab milestone with followers avatars.
COMES WITH 0 GUARANTEES :(
My 1k followers milestone is available here:
https://sketchfab.com/models/0f661ac56c444c5cb9b73bf6046488f0
Usage:
1. create a nice particle system with a single cube set as render object, and X particles, with X = your number of followers
@norgeotloic
norgeotloic / HSVhistogram.py
Created September 29, 2018 00:59
Images to HSV 3D pointclouds
"""
Description:
Creates colored point clouds from image(s).
Maps the HSV channels to 3D coordinates:
The hue is mapped to the angle, the saturation to the radius and the value to the height
Prerequisites:
* python3
* opencv for python
* numpy
.sketchfabmodels, #lastmodels{
display:flex;
flex-wrap: wrap;
}
.model{
height:200px;
min-width:250px;
background-size:cover;
background-repeat: no-repeat;
background-position: center;
$(".sketchfabmodels").each(function(){
var item = $(this);
$.get(
url="https://api.sketchfab.com/v3/collections/" + item.attr("collection") + "/models?sort_by=createdAt",
success=function(data){
console.log(item);
for(var i = 0 ; i < data.results.length; i++){
var d = data.results[data.results.length - 1 - i];
var card = "<a class=\"model\" style=\"background-image: url('"
+ String(d["thumbnails"]["images"][2]["url"])
//Because str.replace only replaces the first occurence
String.prototype.replaceAll = function(str1, str2, ignore){
return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),(ignore?"gi":"g")),(typeof(str2)=="string")?str2.replace(/\$/g,"$$$$"):str2);
}
$.get(
url="https://api.github.com/repos/norgeotloic/norgeotloic.github.io/issues/2", //Adress for the API call
success=function(data){
//get the raw issue content
var todo = data["body"];
@norgeotloic
norgeotloic / openmenu.js
Created August 16, 2018 20:23
An example of jQuery code to open and close my website menu
//Open the menu by clicking on the "burger" icon
$("#burger").on("click", function(){
$("#menu").animate({width:'toggle'}); //toggle the menu width
$("#page").addClass("toggled"); //add the class "toggled" to the page to make it transparent
$("#sidebar").hide(); //hide the social icons on the left side of the page
});
//Close it by clicking on the - expertly drawn - close icon and restore the main page
$("#close").on("click", function(){
if ($("#page").hasClass("toggled")){