This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc planeFit(cluster: Tensor[float], threshold = 10e-2): Option[Plane] = | |
## Fit points to a 3D plane | |
# At least 3 points are required to fit a plane | |
if cluster.shape[0] < 3: return | |
let points = cluster[_, 0..2] | |
let mean = points.mean(axis=0) | |
let delta = points .- mean | |
let covarMatrix = delta.covariance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define-command sort-selections -params 0.. -override -docstring ' | |
sort-selections: Sort current selections using GNU sort utility | |
All parameters will be passed to the GNU sort utility | |
' %{ | |
# Copy current selections to a temporary sort buffer | |
execute-keys %{"sy} | |
edit -scratch *sort-selections* | |
execute-keys %{"s<a-p>} | |
# Seperate selections with null characters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local camera = workspace.CurrentCamera | |
local fixedCFrame = CFrame.new(0, 100, 0) -- CFrame of default looking direction/position | |
local rate = 1/5 -- Speed at which the camera will sway | |
local xSwayAngle = math.pi/9 -- X angle change interval | |
local ySwayAngle = math.pi/9 -- Y angle change interval | |
local rollAngle = math.pi/18 -- Roll angle change interval | |
function update(t) | |
local phi = math.pi/2 + math.noise(t*rate, 0) * xSwayAngle | |
local theta = math.pi/2 + math.noise(t*rate, 10) * ySwayAngle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Text as T | |
import Data.Attoparsec.Text | |
data Op | |
= Add Op Op | |
| Sub Op Op | |
| Mul Op Op | |
| Div Op Op | |
| Const Double |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ lib, newScope, stdenv, pkgs }: let | |
# nicer aliases | |
derive = stdenv.mkDerivation; | |
concat = builtins.concatStringsSep " "; | |
# vendored libuvc: don't build, just make sources available | |
libuvc-src = derive { | |
name = "libuvc-src"; | |
# using fetchgit instead fetchFromGitHub because |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
fn mergeInPlace(comptime T: type, s: []T, midpoint: usize) void { | |
std.debug.assert(midpoint <= s.len); | |
if (midpoint == 0 or midpoint == s.len) return; | |
var a: usize = 0; | |
var b: usize = midpoint; | |
var c: usize = midpoint; |
OlderNewer