Skip to content

Instantly share code, notes, and snippets.

View Orbots's full-sized avatar

Michael Alexander Ewert Orbots

View GitHub Profile
@Orbots
Orbots / trig_curvature_gradient.h
Created March 8, 2025 00:27
another curvature gradient based on trig function
void computeGradients(const Vector3& pa, const Vector3& pb, const Vector3& pc, const Vector3& pd,
Vector3& grad_pa, Vector3& grad_pb, Vector3& grad_pc, Vector3& grad_pd) {
// Step 1: Compute edge vectors using operator-
Vector3 eca = pc - pa;
Vector3 eda = pd - pa;
Vector3 edb = pd - pb;
Vector3 ecb = pc - pb;
Vector3 pd_pc = pd - pc;
double L = pd_pc.Norm();
Vector3 ecd = (L < 1e-8) ? Vector3(0.0, 0.0, 0.0) : (pd_pc * (1.0 / L));
#include <iostream>
#include <cmath>
#include "Vector3.h" // Assumes Vector3 class with standard operations
// Function to compute gradients of kappa with respect to pa, pb, pc, pd
void computeGradients(const Vector3& pa, const Vector3& pb, const Vector3& pc, const Vector3& pd,
Vector3& grad_pa, Vector3& grad_pb, Vector3& grad_pc, Vector3& grad_pd) {
// Step 1: Compute edge vectors
Vector3 eca = pc - pa; // pc - pa
Vector3 eda = pd - pa; // pd - pa
@Orbots
Orbots / Ga3.jl
Last active March 7, 2025 02:40
Ga3.jl
# Geometric Algebra G(3) Library in Julia
# Types
struct G3Empty end
struct G3Vector{T<:Number}
e1::T
e2::T
e3::T
end
@Orbots
Orbots / gist:b114ef7fd030ee291fffb57e8ddb6df0
Created February 27, 2025 23:26
triangle bending constraint
#include <iostream>
// Assume Vector3 is a simple 3D vector class with basic operations
struct Vector3 {
float x, y, z;
Vector3(float x_ = 0, float y_ = 0, float z_ = 0) : x(x_), y(y_), z(z_) {}
Vector3 operator+(const Vector3& v) const { return Vector3(x + v.x, y + v.y, z + v.z); }
Vector3 operator-(const Vector3& v) const { return Vector3(x - v.x, y - v.y, z - v.z); }
Vector3 operator*(float s) const { return Vector3(x * s, y * s, z * s); }
@Orbots
Orbots / ga3.h
Last active May 30, 2024 23:38
Geometric Algebra with signature (3,0,0)
// Example:
// ga_versor q = normalize(add(1.0, (ga_bivector){ .e12 = 1.0 }));
// see tests at end of file for more
#pragma once
#include <stdarg.h>
#include <complex.h>
#include <math.h>
@Orbots
Orbots / TypedPools.jl
Last active December 19, 2018 00:27
Typed memory pool for julia.
module TypedPools
export
Handle,
TypedPool,
StructPool,
MutableStructPool,
alloc!,
alloc_args!,
alloc_inplace!,
@Orbots
Orbots / Graph Laplacian on Constraints.ipynb
Created June 30, 2017 23:38
Graph Laplacian on Constraints.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbots
Orbots / .vimrc
Created October 7, 2015 19:31
.vimrc
execute pathogen#infect()
set ignorecase
set smartcase
set hlsearch
set wildmenu
set showcmd
set nocompatible
syntax on
filetype plugin indent on
set shiftwidth=2
@Orbots
Orbots / evaluator.cljs
Last active December 25, 2015 00:29
bare-bones metacircular evaluator in clojurescript
;; Develop your clojurescript program here
(ns metacirc.evaluator (:require [cljs.reader :as reader]))
;; TODO:
;; globals: "let", "do"
;; javascript interop
;; var args or at least get more than 4 for list
;; {} [] #{} '()
@Orbots
Orbots / entity.cljs
Created October 8, 2013 17:23
component entity system in clojurescript
;; TODO: deletion. warning when adding group to existing name. is this implemenation of groups a good thing?
(ns forces.framework.component
)
(def !nextEntityGUID (atom 1))
(def !names (atom {}))
(def !nameReverseLookup (atom {})) ;; name to guid map