Skip to content

Instantly share code, notes, and snippets.

View ale2x72's full-sized avatar
🎯
< you are here

Alessio Erioli ale2x72

🎯
< you are here
View GitHub Profile
@ale2x72
ale2x72 / imgGrid.pde
Last active September 18, 2016 09:14
imgGrid - Processing sketch to add a pixel grid over an existing raster image
/*
image processing sketch
puts a pixel grid of variable size over a picture
code for Processing 3
code © Alessio Erioli - Co-de-iT
Keys:
@ale2x72
ale2x72 / weightedDivision.pde
Last active September 18, 2016 09:15
weighted division - divides an interval d in n parts l, l1, l2...ln so that l1 = l * f, l2 = l1 *f, etc
/*
weighted division
divides an interval d in n parts l, l1, l2...ln
so that l1 = l * f, l2 = l1 *f, etc
the weighing factor f is mapped to mouseX
code for Processing 3
@ale2x72
ale2x72 / fading_rectangle.pde
Last active September 18, 2016 12:29
improved fading using blendMode()
/*
an improvement upon the fading rectangle technique
using blendMode() to get rid of the 'streaks' that
usually remained
code for Processing 3
*/
@ale2x72
ale2x72 / ReadAssemblage.cs
Last active April 11, 2021 20:00
Instantiate objects in Unity importing orientation from a Rhino file in t;O;X;Y;Z format (coordinates are comma separated) - see example file ZZ_Assemblage.txt
using System;
using System.IO;
using UnityEngine;
public class ReadAssemblage : MonoBehaviour
{
public bool debugMode;
[Range(0.5f, 5)]
public float axisLength;
[Header("AssemblyObjects")]
@ale2x72
ale2x72 / IndicesConversion.cs
Created May 4, 2022 09:00
Sequential to dimensional indices conversion
// conversion between dimensional indices for a multidimensional or jagged array to sequential index
// and vice-versa
// 2D array (nX, nY) created as [i,j] or jagged array indexed as [i][j]
// array created with nested for loops, i (nX), then j (nY) (outmost to innermost)
private int GetSequentialIndex(int i, int j, int nY) => i * nY + j;
private int[] GetDimensionalIndices(int index, int nY)
{
@ale2x72
ale2x72 / ReadAssemblage_Quaternions.cs
Last active June 7, 2022 15:58
Upgrade of ReadAssemblage.cs..... now with Quaternions! Imports Rhiono OXYZ plane data in Unity and orients prefabs according to type and corresponding orientation plane
using System;
using System.IO;
using UnityEngine;
public class ReadAssemblage : MonoBehaviour
{
public bool debugMode;
[Range(0.5f, 5)]
public float axisLength;
[Header("AssemblyObjects")]
@ale2x72
ale2x72 / ReadAssemblage 20220611.cs
Last active June 11, 2022 14:00
Read Assemblage 20220611
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor;
/*
Script by Alessio Erioli - Co-de-iT
(c) Co-de-iT 2022
*/
@ale2x72
ale2x72 / ConnectHandle_cmd.py
Created February 6, 2023 11:15
Two commands to get acquainted with the logic of assemblages in Rhino: OrientHandle and ConnectHandle
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import Rhino
from Rhino.Commands import *
from scriptcontext import doc
# Script written by Alessio Erioli
__commandname__ = "ConnectHandle"
@ale2x72
ale2x72 / AutoLabelPoints.py
Created February 6, 2023 11:10
AutoLabelPoints: label points in Rhino using text Dots
import rhinoscriptsyntax as rs
import scriptcontext as sc
"""
Script written by Alessio Erioli - mod of willemderks.com
Script version October 6, 2020
"""
def AutolabelPoints():
text_height = 10
@ale2x72
ale2x72 / screenshot.gd
Last active January 6, 2024 18:24 — forked from jotson/screenshot.gd
Godot GDScript screenshot function
# This is a function for capturing screenshots with GDScript
# from: https://gist.github.com/jotson/84681c2064653d093083a690e9fa5998
# Adapted for Godot4.2.1 by ale2x72
func screenshot():
# Capture the screenshot
var image = get_viewport().get_texture().get_image()
# Setup path and screenshot filename
var date = Time.get_datetime_dict_from_system()