Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whosawhatsis committed Jun 21, 2022
0 parents commit 48e0647
Show file tree
Hide file tree
Showing 69 changed files with 1,154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
3 changes: 3 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Copyright (c) 2020 Joan Horvath and Rich Cameron

These models are licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/).
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Calculus

This repository contains 3D printable calculus models for our book, [Make: Calculus](https://www.amazon.com/dp/168045739X/).

This project was supported, in part by grant number 90RE5024, from the U.S. Administration for Community Living, Department of Health and Human Services, Washington, D.C. 20201.

License [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/), with attribution: “Joan Horvath and Rich Cameron (with link to this repository).”
44 changes: 44 additions & 0 deletions arduino_demos/integral_mouse.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// File led_pendulum.ino
// Makes a Circuit Playground or Circuit Playground Express
// light up with one of three colors, depending on the acceleration
// seen on a chosen axis
// (c) 2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

#include <Adafruit_CircuitPlayground.h>

#define X //capital X, Y or Z, the direction you will be swinging
//use Y for Classic, X for Express (with USB pointed up)
//(see the markings by your board's accelerometer)
#define THRESHOLD 0.3

void setup() {
CircuitPlayground.begin();
CircuitPlayground.setBrightness(255);
CircuitPlayground.clearPixels();
}

void loop() {
float motion =
#if defined(X)
CircuitPlayground.motionX();
#elif defined(Y)
-CircuitPlayground.motionY();
#elif defined(Z)
CircuitPlayground.motionZ();
#else
#error No valid axis specified.
#endif

CircuitPlayground.clearPixels();
if(motion > THRESHOLD) for(int i = 0; i < 3; i++)
CircuitPlayground.setPixelColor(i, 255, 0, 0);
else if(motion < -THRESHOLD) for(int i = 7; i < 10; i++)
CircuitPlayground.setPixelColor(i, 0, 0, 255);
else for(int i = 4; i < 6; i++)
CircuitPlayground.setPixelColor(i, 0, 255, 0);
}
42 changes: 42 additions & 0 deletions arduino_demos/led_pendulum.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// File led_pendulum.ino
// Makes a Circuit Playground or Circuit Playground Express
// light up with one of two colors, depending on the acceleration
// seen on a chosen axis
// (c) 2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

#include <Adafruit_CircuitPlayground.h>

#define Y //capital X, Y or Z, this is the direction you will be swinging (see the markings by your board's accelerometer).
#define THRESHOLD 0.3

void setup() {
CircuitPlayground.begin();
CircuitPlayground.setBrightness(255);
CircuitPlayground.clearPixels();
}

void loop() {
float motion =
#if defined(X)
CircuitPlayground.motionX();
#elif defined(Y)
-CircuitPlayground.motionY();
#elif defined(Z)
CircuitPlayground.motionZ();
#else
#error No valid axis specified.
#endif

CircuitPlayground.clearPixels();
if(motion > THRESHOLD) for(int i = 0; i < 3; i++)
CircuitPlayground.setPixelColor(i, 255, 0, 0);
else if(motion < -THRESHOLD) for(int i = 7; i < 10; i++)
CircuitPlayground.setPixelColor(i, 0, 0, 255);
else for(int i = 4; i < 6; i++)
CircuitPlayground.setPixelColor(i, 0, 255, 0);
}
37 changes: 37 additions & 0 deletions cones/coneOfCylinders.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// File coneOfCylinders.scad
// Creates a cone (or pyramid) of stacked cylinders
// based on volume and height of the approximated cone
// (actual volume will be greater)
// (c) 2019-2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

cylinders = 3;
offset = [0, 0];

v = 50000; // volume in cubic mm (cc * 1000)
h = 90; // height in mm
n = 300; // number of sides (not including bottom)

// STL files don't have curves, so a cone must be approximated by using a large number for n. Depending on size, you'll want to find a value for area that results in a side length (check the console output) around 0.2-0.5mm. Sides shorter than this will not look smoother noticeably smoother once printed.

// the rest is calculated...

a = v / h * 3; // base-sectional area
s = 2 * sqrt(a * tan(180 / n) / n);
apothem = (2 * a / n / s);
r = apothem / cos(180 / n);

for(i = [0:cylinders - 1]) translate([offset[0] * (1 - i / cylinders), offset[1] * (1 - i / cylinders), i * h / cylinders]) cylinder(r = r * (cylinders - i) / cylinders, h = h / cylinders, $fn = n);

echo(str("base-sectional area: ", a)); // base-sectional area
echo(str("side: ", s)); // side
echo(str("radius: ", r)); // radius
if((n % 2)) echo(str("radius + apothem: ", r + apothem)); // radius + apothem (only calculated for an odd number of sides)
echo(str("apothem: ", apothem)); // apothem
echo(str("circumscribed circle area: ", PI * pow(r, 2))); // circumscribed circle area
echo(str("inscribed circle area: ", PI * pow(apothem, 2))); // inscribed circle area
echo(str("polygon area: ", .5 * n * s * r * cos(180 / n))); // polygon area
Binary file added cones/coneOfCylinders=24.stl
Binary file not shown.
Binary file added cones/coneOfCylinders=3.stl
Binary file not shown.
Binary file added cones/coneOfCylinders=6.stl
Binary file not shown.
59 changes: 59 additions & 0 deletions cones/obliqueCone.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// File obliqueCone.scad
// Creates a hollow oblique cone (or pyramid) based on
// volume and height
// (c) 2016-2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

// enter these three variables:

v = 50000; // volume in cubic mm (cc * 1000)
h = 90; // height in mm
n = 300; // number of sides (not including bottom)

wall = 1;
tol = .2;
lid = true;
lip = .25;
ball = 0;
offset = [30, 0];

// STL files don't have curves, so a cone must be approximated by using a large number for n. Depending on size, you'll want to find a value for area that results in a side length (check the console output) around 0.2-0.5mm. Sides shorter than this will not look smoother noticeably smoother once printed.

// the rest is calculated...

a = v / h * 3; // base-sectional area
s = 2 * sqrt(a * tan(180 / n) / n);
apothem = (2 * a / n / s);
r = apothem / cos(180 / n);

difference() {
union() {
hull() {
translate([0, 0, h]) mirror([0, 0, 1]) cylinder(r = 0 + wall, $fn = n, h = .0001);
translate(offset) cylinder(r = r + wall, $fn = n, h = .0001);
}
if(ball) translate([0, 0, h - ball / 2 * cos(asin(2 * wall / ball))]) intersection() {
sphere(ball / 2, $fs = .2, $fa = 2);
}
}
difference() {
linear_extrude(h * 2, scale = 0, center = true) translate(offset * 2) circle(r * 2, $fn = n);
linear_extrude(1, center = true) translate(offset) difference() {
circle(r * 2, $fn = n);
circle(r - wall, $fn = n);
}
}
}

echo(str("base-sectional area: ", a)); // base-sectional area
echo(str("side: ", s)); // side
echo(str("radius: ", r)); // radius
if((n % 2)) echo(str("radius + apothem: ", r + apothem)); // radius + apothem (only calculated for an odd number of sides)
echo(str("apothem: ", apothem)); // apothem
echo(str("circumscribed circle area: ", PI * pow(r, 2))); // circumscribed circle area
echo(str("inscribed circle area: ", PI * pow(apothem, 2))); // inscribed circle area
echo(str("polygon area: ", .5 * n * s * r * cos(180 / n))); // polygon area
Binary file added cones/obliqueCone.stl
Binary file not shown.
37 changes: 37 additions & 0 deletions cones/simpleCone.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// File simpleCone.scad
// Creates a cone (or pyramid) based on volume and height
// (c) 2016-2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

// enter these three variables:

v = 50000; // volume in cubic mm (cc * 1000)
h = 90; // height in mm
n = 300; // number of sides (not including bottom)

// STL files don't have curves, so a cone must be approximated by using a large number for n. Depending on size, you'll want to find a value for area that results in a side length (check the console output) around 0.2-0.5mm. Sides shorter than this will not look smoother noticeably smoother once printed.

// the rest is calculated...

a = v / h * 3; // base-sectional area
s = 2 * sqrt(a * tan(180 / n) / n);
apothem = (2 * a / n / s);
r = apothem / cos(180 / n);

linear_extrude(h, scale = 0) translate(offset) difference(){
circle(r, $fn = n);
//square(r);
}

echo(str("base-sectional area: ", a)); // base-sectional area
echo(str("side: ", s)); // side
echo(str("radius: ", r)); // radius
if((n % 2)) echo(str("radius + apothem: ", r + apothem)); // radius + apothem (only calculated for an odd number of sides)
echo(str("apothem: ", apothem)); // apothem
echo(str("circumscribed circle area: ", PI * pow(r, 2))); // circumscribed circle area
echo(str("inscribed circle area: ", PI * pow(apothem, 2))); // inscribed circle area
echo(str("polygon area: ", .5 * n * s * r * cos(180 / n))); // polygon area
Binary file added cones/simpleCone.stl
Binary file not shown.
42 changes: 42 additions & 0 deletions coordinate_systems/cartesianGrid.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// File cartesianGrid.scad
// Creates a cube and segments for a cartesian coordinate system
// (c) 2019-2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

segments = false; // true to generate segments, false to generate grid

grid = 15;//size of each cube, mm
size = 3; // size of one-quarter of overall demonstration cube

if(segments) {
%grid();
segment();
} else {
grid();
%segment();
}

module grid() difference() {
linear_extrude(grid * size * 2, center = true, convexity = 5) difference() {
square(grid * size * 2, center = true);
for(i = [0, 1]) mirror([i, -i, 0]) for(i = [0, 1]) mirror([i, i, 0]) for(x = [-size:size]) translate([x * grid, grid * size, 0]) circle(1, $fn = 4);
}
for(i = [0, 1], j = [0, 1], k = [0, 1]) mirror([0, 0, k]) mirror([-k, k, 0]) mirror([i, i, 0]) mirror([j, 0, j]) mirror([0, 1, 1]) linear_extrude(grid * size * 2, center = true) for(x = [-size:size]) translate([x * grid, grid * size, 0]) circle(1, $fn = 4);
intersection_for(i = [0, 1]) mirror([i, i, 0]) intersection_for(i = [0, 1]) mirror([i, 0, i]) cylinder(r = 1, h = 3, $fn = 4, center = true);
for(i = [0, 1], j = [0, 1]) mirror([j, -j, 0]) mirror([i, 0, -i]) linear_extrude(grid * size * 2, convexity = 5) {
square(grid * size * 2);
for(i = [0, 1]) mirror([i, -i, 0]) for(x = [0:size - 1]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
}
}

module segment() difference() {
linear_extrude(grid) difference() {
square(grid);
for(x = [0, 1], y = [0, 1]) translate([x * grid, y * grid, 0]) circle(1, $fn = 4);
}
for(i = [0, 1]) mirror([i, -i, 0]) for(i = [0, 1]) mirror([1, 0, -1]) linear_extrude(grid) for(x = [0, 1], y = [0, 1]) translate([x * grid, y * grid, 0]) circle(1, $fn = 4);
}
Binary file added coordinate_systems/cartesianGrid.stl
Binary file not shown.
Binary file added coordinate_systems/cartesianGridSegment.stl
Binary file not shown.
77 changes: 77 additions & 0 deletions coordinate_systems/cylinderGrid.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// File cylinderGrid.scad
// Creates a cylinder and segments for a cylindrial coordinate system
// (c) 2019-2022 Rich Cameron, for the book Make:Calculus
// Licensed under a Creative Commons, Attribution,
// CC-BY 4.0 international license, per
// https://creativecommons.org/licenses/by/4.0/
// Attribute to Rich Cameron, at
// repository github.com/whosawhatsis/Calculus

segments = false; // true to generate segments, false to generate grid

grid = 15;
grid_angle = 360 / 4 / 3;
size = 3;

$fs = .2;
$fa = 2;

if(segments) {
%grid();
for(i = [0:size - 1]) translate([i + 1, 1, 0]) segment(i);
} else {
grid();
for(i = [0:size - 1]) %segment(i);
}

module grid() difference() {
linear_extrude(grid * size * 2, center = true, convexity = 5) difference() {
circle(grid * size);
for(a = [0:grid_angle:359]) rotate(a) translate([grid * size, 0, 0]) circle(1, $fn = 4);
}
*intersection_for(i = [0, 1]) mirror([i, i, 0]) intersection_for(i = [0, 1]) mirror([i, 0, i]) cylinder(r = 1, h = 3, $fn = 4, center = true);
linear_extrude(grid * size * 2, convexity = 5) {
square(grid * size * 2);
for(i = [0, 1]) mirror([i, -i, 0]) for(x = [1:size - 1]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
circle(1);
}
hull() for(i = [0, 1]) mirror([0, 0, i]) cylinder(r = 1, r2 = 0, h = 1);
for(i = [-1, 1]) translate([0, 0, i * grid * size]) {
rotate_extrude() difference() {
union() for(x = [0:size - 1]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
translate([-1, 0, 0]) square(2, center = true);
}
for(a = [0:grid_angle:179]) rotate(a) mirror([1, 0, 1]) linear_extrude(grid * size * 2, center = true, convexity = 5) circle(1, $fn = 4);
}
for(z = [-size:size]) translate([0, 0, z * grid]) rotate_extrude() translate([size * grid, 0, 0]) circle(1, $fn = 4);
intersection() {
rotate_extrude() difference() {
union() for(x = [0:size]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
translate([-1, 0, 0]) square(2, center = true);
}
linear_extrude(2, center = true) square(grid * size * 2);
}
for(z = [0:size - 1]) translate([0, 0, z * grid]) for(a = [0:grid_angle:90]) rotate(a) mirror([1, 0, -1]) linear_extrude(grid * size * 2, convexity = 5) circle(1, $fn = 4);
}

module segment(choord = 0) difference() {
linear_extrude(grid) difference() {
intersection() {
difference() {
circle((choord + 1) * grid);
circle(choord * grid);
}
square(grid * size * 2);
rotate(grid_angle - 90) square(grid * size * 2);
}
for(a = [0, grid_angle]) rotate(a) for(x = [1:size]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
circle(1);
}
for(i = [0, 1]) translate([0, 0, i * grid]) {
rotate_extrude() difference() {
for(x = [0:size]) translate([x * grid, 0, 0]) circle(1, $fn = 4);
translate([-1, 0, 0]) square(2, center = true);
}
for(a = [0:grid_angle:179]) rotate(a) mirror([1, 0, 1]) linear_extrude(grid * size * 2, center = true, convexity = 5) circle(1, $fn = 4);
}
}
Binary file added coordinate_systems/cylinderGrid.stl
Binary file not shown.
Binary file added coordinate_systems/cylinderGridSegments.stl
Binary file not shown.
Loading

0 comments on commit 48e0647

Please sign in to comment.