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
// Created in 2018 by Ryan A. Colyer. | |
// This work is released with CC0 into the public domain. | |
// https://creativecommons.org/publicdomain/zero/1.0/ | |
include <plot_function.scad> // https://www.thingiverse.com/thing:2391851 | |
finger_spacing = 21; | |
oblong_factor = 1.8; | |
ripple_sharpness = 0.6; // range [0:1] | |
grip_width = 20; |
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
#!/bin/bash | |
# This script is meant to help with updating old PRs. | |
# Mainly any OpenSCAD branch which has not been updated since 2022-02-06 | |
# It is intended to be run on a git repo in which a merge has already been started (merging master into the current, old branch), | |
# and has conflicts which show as "deleted by them:", or "(modified/deleted)". | |
# | |
# Due to how git DOES NOT track file moves/renames, in addition to how it determines file "similarity" (by # of exactly matched lines in a file), | |
# it makes it very difficult to merge master into branches created before 2 significant events in the OpenSCAD repo: | |
# 1) A large code style reformatting (PR #4095 on 2022-02-06), and |
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
use <FunctionalOpenSCAD/functional.scad> | |
// https://github.com/thehans/FunctionalOpenSCAD/blob/master/functional.scad | |
module arc_slot(R,r,a) { | |
polygon(concat( | |
arc(r=R-r, angle=a, offsetAngle=0, c=[0,0], endpoint=false), | |
arc(r=r, angle=-180, offsetAngle=a-180, c=R*[cos(a),sin(a)], endpoint=false), | |
arc(r=R+r, angle=-a, offsetAngle=a, c=[0,0], endpoint=false), | |
arc(r=r, angle=-180, offsetAngle=0, c=[R,0], endpoint=false) | |
)); |
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
dims = [8,8,3]; | |
min = 0; | |
max = 2; | |
seed = 0; | |
tricubic = create_tricubic_interp(dims, min, max, seed); | |
step = 1/8; | |
frames = 64; | |
z = dims[2] * $t; |
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
// Bicubic interpolation of value noise | |
// by Hans Loeblich | |
// Reference: https://en.wikipedia.org/wiki/Bicubic_interpolation | |
dims = [4,4]; | |
min = 0; | |
max = 2; | |
seed = 0; | |
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
$fs=0.5; | |
$fa=1; | |
// General offset_extrude and fillet_extrude. | |
// These use minkowski which can be incredibly slow and resource intensive, but should theoretically work on any 2d geometry. | |
// fillet_extrude is also much slower than offset_extrude, due to significantly more facets needed for rounded edges. | |
// There are some alternative methods which are much faster, | |
// ***BUT*** they have the limitation of only working for CONVEX children. | |
// chamfer_extrude (basically like offset_extrude): https://gist.github.com/thehans/072005c68e5fcef3394b8c08e37d1c35 |
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
$fs = 2; | |
$fa = 2; | |
r_cyl = 10; | |
h_cyl = 100; | |
// Take a 2d shape and extrude outward (or inward with r_delta < 0) | |
// from a theoretical cylinder of given radius and height (centered). | |
// Input geometry should fit within the bounds of [-PI*r_cyl, -h/2] and [PI*r_cyl, h/2] | |
module cylinder_extrude(r_cyl, r_delta, h, eps=0.01) { | |
frags = fragments(r_cyl); |
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
//use <../Libraries/drawPath.scad> | |
// Width of base | |
wBase = 20; | |
// Length of base | |
lBase = 25; | |
// Thickness of base | |
thBase = 5; | |
// Fillet radius | |
rFillet = 1; |
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
independent = false; // Note: Independent mirroring of 2 axes is actually a rotation | |
fix111 = false; // Only relevant if independent=false | |
module thing(i,j,k) { | |
translate([2,2,2]) difference() { | |
cube(2,center=true); | |
linear_extrude(convexity=10) | |
text(text=str("M",i,j,k),size=0.5,valign="center",halign="center"); | |
} | |
} |
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
function vsum(v,i=0) = len(v)-1 > i ? v[i] + vsum(v, i+1) : v[i]; | |
function N(p, i, U, u) = p == 0 ? | |
U[i] <= u && u <= U[i+1] ? 1 : 0 : | |
let(a=u-U[i],b=U[i+p]-U[i],c=U[i+p+1]-u,d=U[i+p+1]-U[i+1]) | |
(b==0?0:a/b*N(p-1,i,U,u)) + (d==0?0:c/d*N(p-1,i+1,U,u)); | |
module nurbs_circle() { | |
step = 0.0001; | |
// degree of curve | |
p = 2; |
NewerOlder