Stereographic projection

A simple hack using OpenSCAD.

Stereographic projection similar do this one by Henry Segerman.

Notes

References

OpenSCAD code

// Author: Tiago Charters de Azevedo
// Maintainer: Tiago Charters de Azevedo

// Copyright (c) - 2017 Tiago Charters de Azevedo (tca@diale.org)

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301, USA.

$fn=2*32;
phi=(1+sqrt(5))/2;
h=2;
R=40;
n=6;
delta=.2;

echo(R*(n-1));

module drawing(){
    for(i=[-(n-1)/2:(n-1)/2]){
        for(j=[-(n-1)/2:(n-1)/2]){
            translate([(1+delta)*i*R,(1+delta)*j*R,0]){
                square(.9*[R,R], center=true);
                //              circle(R/2,center=true);
            }}}

    difference(){
        square(1000*R*[1,1],center=true);
        square(((1+delta)*n*R+delta*R)*[1,1],center=true);}}

module drawingshadow(){
    for(i=[-(n-1)/2:(n-1)/2]){
        for(j=[-(n-1)/2:(n-1)/2]){
            translate([(1+delta)*i*R,(1+delta)*j*R,0]){
                square(.9*[R,R], center=true);
                //      circle(.9*R/2,center=true);

            }}}}

module drawingescher(){
    for(i=[-(n-1)/2:(n-1)/2]){
        for(j=[-(n-1)/2:(n-1)/2]){
            translate([6*i*6.8,j*R,0]){
                rotate([0,0,180]){
                    escher();}
                translate([3.*6.8,2.9*8.05,0]){escher();}
            }}}
        difference(){
        square(1000*R*[1,1],center=true);
        square(((1+delta)*n*R+delta*R)*[1,1],center=true);}}

module projection(l){
    linear_extrude(height=l, scale=10e-6, center=false){
        children();}}

module ball(r,h){
    difference(){
        union(){
            sphere(r=r, center=true);
            translate([0,0,-r/2]){
                cylinder(h=r,r=r*sqrt(2)/2,center=true);}}
        sphere(r=r-h, center=true);}}


module stproj(){
    render(){
        difference(){
            translate([0,0,R]){
                ball(R,h);}

            projection(2*R){
                drawing();}

            translate([0,0,2*R]){
                cylinder(h=R,r=R/2,center=true);
//              sphere(R/2,center=true);
            }
        }}}

module seeall(){
    stproj();
    color("red")
    translate([0,0,2*R]){
        sphere(R/32,center=true);}

    %projection(2*R){
        drawingshadow();}}

module squaregrid(l,m){
    difference(){
        square([l,l],center=true);
        for(i=[-(m-1)/2:(m-1)/2]){
            for(j=[-(m-1)/2:(m-1)/2]){
                translate([i*l/m,j*l/m,0])
                square([.5*l/m,.5*l/m],center=true);
            }}}
}




module grid(){
    color("black")
    render(){
        difference(){
            linear_extrude(height=.1, scale=1, center=true){
                square(((1+delta)*n*R+0*delta*R)*[1,1],center=true);}
            linear_extrude(height=10, scale=1, center=true){
                for(i=[-(n-1)/2:(n-1)/2]){
                    for(j=[-(n-1)/2:(n-1)/2]){
                        translate([(1+delta)*i*R,(1+delta)*j*R,0]){
                            square([R,R], center=true);}}}}}}}







module escher(s=.01){
    polygon(s*
        [[-1022.58620689655,    -1206.46551724138],
            [-527.586206896552, -1701.46551724138],
            [192.413793103448 , -1386.46551724138],
            [462.413793103448 , -1116.46551724138],
            [597.413793103448 , -936.46551724138 ],
            [687.413793103448 , -756.46551724138 ],
            [732.413793103448 , -621.46551724138 ],
            [867.413793103448 , -756.46551724138 ],
            [957.413793103448 , -891.46551724138 ],
            [1002.41379310345 , -1071.46551724138],
            [1047.41379310345 , -1161.46551724138],
            [1317.41379310345 , -1116.46551724138],
            [1452.41379310345 , -1026.46551724138],
            [1632.41379310345 , -846.46551724138 ],
            [1452.41379310345 , -801.465517241379],
            [1227.41379310345 , -711.46551724138 ],
            [1092.41379310345 , -576.46551724138 ],
            [957.413793103448 , -441.46551724138 ],
            [867.413793103448 , -261.46551724138 ],
            [642.413793103448 , 143.53448275862  ],
            [552.413793103448 , 368.53448275862  ],
            [1047.41379310345 , 908.534482758621 ],
            [507.413793103448 , 1448.53448275862 ],
            [687.413793103448 , 1718.53448275862 ],
            [507.413793103448 , 1673.53448275862 ],
            [282.413793103448 , 1583.53448275862 ],
            [147.413793103448 , 1583.53448275862 ],
            [192.413793103448 , 1358.53448275862 ],
            [282.413793103448 , 1223.53448275862 ],
            [417.413793103448 , 1088.53448275862 ],
            [732.413793103448 , 908.534482758621 ],
            [282.413793103448 , 773.53448275862  ],
            [-392.586206896552, 1583.53448275862 ],
            [-392.586206896552, 728.53448275862  ],
            [-752.586206896552, 638.534482758621 ],
            [-977.586206896552, 548.53448275862  ],
            [-977.586206896552, 773.53448275862  ],
            [-1022.58620689655, 908.534482758621 ],
            [-1157.58620689655, 863.53448275862  ],
            [-1292.58620689655, 818.53448275862  ],
            [-1427.58620689655, 863.53448275862  ],
            [-1337.58620689655, 728.53448275862  ],
            [-1247.58620689655, 548.53448275862  ],
            [-1247.58620689655, 413.534482758621 ],
            [-1247.58620689655, 278.53448275862  ],
            [-347.586206896552, 278.53448275862  ],
            [-1157.58620689655, -396.46551724138 ],
            [-1067.58620689655, -846.46551724138 ],
            [-887.586206896552, -576.46551724138 ],
            [-752.586206896552, -396.46551724138 ],
            [-572.586206896552, -306.46551724138 ],
            [-392.586206896552, -261.46551724138 ],
            [-347.586206896552, -486.46551724138 ],
            [-257.586206896552, -666.46551724138 ],
            [-212.586206896552, -756.46551724138 ],
            [-257.586206896552, -801.465517241379],
            [-527.586206896552, -666.46551724138 ],
            [-1022.58620689655, -1206.46551724138]]);}


//%square(.9*[R,R], center=true);


// henryseg
// https://www.thingiverse.com/thing:202774/
//color("green")

// translate([0,0,R+1.8]){
//     sphere(R+1.1,center=true);}
//1.8
//translate([0,0,R]){    import("stereographic_projection_wider_base.stl");}
Palavras chave/keywords: Stereographic projection, 3dprint, reprap

Criado/Created: 27-06-2018 [16:40]

Última actualização/Last updated: 13-07-2018 [09:49]


Voltar à página inicial.


GNU/Emacs Creative Commons License

(c) Tiago Charters de Azevedo