Skip to content

Instantly share code, notes, and snippets.

View rms80's full-sized avatar

Ryan Schmidt rms80

View GitHub Profile
@rms80
rms80 / CLA.md
Created January 9, 2026 15:50
geometry3Sharp Contributor License Agreement V1

Contributor License Agreement: geometry3Sharp

Project: geometry3Sharp (https://github.com/gradientspace/geometry3Sharp)

Thank you for your interest in contributing to geometry3Sharp (the "Project"). This Contributor License Agreement ("Agreement") documents the rights granted by contributors to the Project maintainers. By submitting a Contribution to the Project, you accept and agree to the following terms and conditions.

1. Definitions

  • "You" (or "Your") means the individual or legal entity submitting a Contribution to the Project.
  • "Contribution" means any source code, documentation, or other original work of authorship, including any modifications or additions to an existing work, that is submitted to the Project via pull request, patch, or any other means.
@rms80
rms80 / gist:622fd2fadd7fbecd2ab411fc7561d727
Created July 29, 2024 04:14
bit of code to add Mode Buttons to the Modes Toolbar in UE5 (to the right of Modes dropdown)
// grab some global stuff from the level editor
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
TSharedRef<FUICommandList> CommandBindings = LevelEditorModule.GetGlobalLevelEditorActions();
const FLevelEditorModesCommands& ModesCommands = LevelEditorModule.GetLevelEditorModesCommands();
FToolMenuOwnerScoped OwnerScoped(this); // not sure what this is for exactly, but other UToolMenu extenders do it
// hardcoded name for the modes toolbar, from FLevelEditorToolBar::RegisterLevelEditorToolBar()
UToolMenu* ModesToolbar = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.ModesToolBar");
// add a new section
@rms80
rms80 / gist:daec2304f44ea344486669b7e404e4c0
Last active October 19, 2020 02:01
Monte Carlo Walk-on-Spheres sampling of a vector field defined on mesh surfaces
// Copyright Ryan Schmidt 2020
// Released under the terms of the Boost License: https://www.boost.org/LICENSE_1_0.txt
static FVector ComputeMonteCarloVectorFieldSample(
FDynamicMesh3& Mesh,
FDynamicMeshAABBTree3& AABBTree,
FVector3d FixedDirection, // target fixed direction. This will be projected onto mesh normals to create vector field that is interpolated
FVector3d WorldPosition, // position we want to sample at
int NumSamples, // How many monte-carlo paths to compute and average
float Epsilon, // path is terminated when we are within Epsilon of boundary constraints (ie mesh)
@rms80
rms80 / gist:11f680a32bd36b3c82ef572bb3c18982
Created July 4, 2018 16:58
Setting face colors in mesh shader
//int N = 256;
//Texture2D tex = new Texture2D(N, N, TextureFormat.RFloat, false);
//float[] buffer = new float[N * N];
//foreach (int tid in startMesh.TriangleIndices()) {
// int v = tid / N;
// int u = tid % N;
// int n = 0;
// Vector3d c = startMesh.GetTriCentroid(tid);
// if (c.x > startMesh.CachedBounds.Center.x)
@rms80
rms80 / gist:c1512d32e9f8ea6ce539801ef111bbf2
Created April 13, 2018 03:16
MeshInsertUVPolyCurve debugging code
// at top of Apply()
DMesh3 saveMesh = new DMesh3(Mesh);
insert_corners();
DMesh3 pokedMesh = new DMesh3(Mesh);
// to append segments to pokedMesh (in si loop)
MeshEditor.AppendLine(pokedMesh, new Segment3d(Mesh.GetVertex(i0_vid), Mesh.GetVertex(i1_vid)), 0.003f);
@rms80
rms80 / grab_latest_submodules.bat
Created November 10, 2017 19:17
update each submodule to most recent commit to master branch
REM grab latest commits from server
git submodule update --recursive --remote
REM above command will set current branch to detached HEAD. set back to master.
git submodule foreach git checkout master
REM now do pull to fast-forward to latest commit
git submodule foreach git pull origin master
float voxelSize = 1.0f;
DMeshSO meshSO = CotangentUI.ActiveScene.FindSceneObjectsOfType<DMeshSO>()[0];
AxisAlignedBox3f bounds = meshSO.GetTransformedBoundingBox();
bounds.Expand(2*voxelSize);
Vector3i gridSize = (Vector3i)(bounds.Diagonal / voxelSize);
Bitmap3d bitmap = new Bitmap3d(gridSize);
foreach ( Vector3i idx in bitmap.Indices() ) {
// Tool that should be immediately applied on Activation.
// Not clear how to end it though...don't know hand!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using g3;
@rms80
rms80 / gist:d5a654be7a98af7e4370c50f545c63e7
Created May 23, 2017 19:26
eigensolver test matrices
// make wilkinson matrix
int N = 7;
double[] matrix = new double[] {
3, 1, 0, 0, 0, 0, 0,
1, 2, 1, 0, 0, 0, 0,
0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0,
0, 0, 0, 0, 1, 2, 1,
@rms80
rms80 / gist:58e0cc959027ddbb57056ac9317b814c
Created May 15, 2017 18:46
vsmac install failure log
[2017-05-13 03:13:20.112] [Info] Installation ID: 14d6dc45-bf24-45fe-a790-c834d82648df
[2017-05-13 03:13:20.114] [Info] Operating system: Mac OS X v10.11.6 (10.11.6; Mac OS X 10.11.6 (10.11.6 build version: 15G1217)), 64-bit
[2017-05-13 03:13:20.115] [Info] Installer product: Visual Studio
[2017-05-13 03:13:20.115] [Info] Installer version: 4.0.0.308 (HEAD detached at 1d420fd9) (1d420fd9f355adc77406dc2ec9677b6c2bd7ff14 on 11/05/2017 13:22:51)
[2017-05-13 03:13:20.115] [Info] Status: in progress
[2017-05-13 03:13:21.161] [Debug] Waiting for manifests to finish downloading.
[2017-05-13 03:13:21.161] [Debug] Initial task executing (WaitingForActivation). Waiting for it to finish.
[2017-05-13 03:13:21.368] [Info] Retrieving installation manifest.
[2017-05-13 03:13:21.368] [Info] Downloading from 'https://www.xamarin.com/installer_assets/v3/vsmac/1d420fd9f355adc77406dc2ec9677b6c2bd7ff14/Mac/Universal/InstallationManifest.xml'.
[2017-05-13 03:13:21.369] [Debug] Setting download timeout for 'https://www.xamarin.com/