Skip to content

Instantly share code, notes, and snippets.

View piotoor's full-sized avatar

Piotr K piotoor

View GitHub Profile
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
#include <cstdlib>
#include <cstring>
using namespace std;
earth_r = 6371000; // Earth's mean radius in meters
diff = 1;
angle = 0;
a = 120;
b = 120;
h = 250;
space = 300;
translate([0, 0, -earth_r])
{
earth_r = 6371000; // Earth's mean radius in meters
diff = 1;
angle = 15;
a = 1200;
b = 1200;
h = 2500;
space = 3000;
translate([0, 0, -earth_r])
{
@piotoor
piotoor / gist:b6a8578b36e02871ea4f6ba28ad1ed98
Created November 5, 2018 22:00
OpenSCAD Simple Earth wireframe
module MeridianCircle(r, angle, pen, col)
{
rotate([90, 0, angle])
color(col)
difference()
{
circle(r);
circle(r - pen);
}
}
@piotoor
piotoor / gist:f93c544f240f98b83f47ccc317e1813c
Created October 30, 2018 18:57
OpenSCAD Circle vs Square
circle_r = 5000;
offset = 5;
$vpr=[0, 0, 340]; // Viewport rotation
$vpd = 150 + 10 * circle_r * $t * $t * $t; // Camera distance as function of time
translate([-(circle_r + offset), 0, 0])
{
color("blue")
@piotoor
piotoor / gist:1dc2ada33259df5980d186c853bf036e
Created October 30, 2018 18:56
OpenSCAD simple Earth model with four buildings
earth_r = 6371000; // Earth's mean radius in meters
$vpr = [80, 0, 320]; // Viewport rotation
$vpd = 500 + 100000000 * $t * $t * $t; // Camera distance as function of time
translate([0, 0, -earth_r])
{
color("green")
sphere(earth_r, $fn=1000);
translate([0, 0, earth_r])
{