Summary
//+FN +UA#
#version 3.6;
#include "colors.inc"
global_settings {
assumed_gamma 2.1
ambient_light color rgb 1
}
// ----------------------------------------
camera {
location <1.35, 1.35, 1.35>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
light_source {
<0, 0, 20>
color rgb <1, 1, 1>
area_light
x*10, y*10, 5, 5
//jitter
rotate -x*45
}
light_source {
<20, 0, 0>
color rgb <1, 1, 1>
area_light
z*10, y*10, 5, 5
// jitter
}
#declare MODE_ARMCHAIR = 1;
#declare MODE_RIBBON = 2;
#declare MODE_ZIGZAG = 3;
#macro nanoTube(mode, ba, bb, atomColor)
#local s = sqrt(3)/2;
#local b1 = max(ba, bb);
#switch(mode)
#case(MODE_ARMCHAIR)
#local bb = bb + 6;
#local r = (bb - 6)/pi;
#macro ab2Vector(b, a) <b, sin(a/r)*r, cos(a/r)*r>
#end
#break
#case(MODE_RIBBON)
#macro ab2Vector(a, b) <a, 0, b>
#end
#break
#case(MODE_ZIGZAG)
#local ba = ba + 2;
#local r = (ba*s)/pi;
#macro ab2Vector(a, b) <cos(a/r)*r, sin(a/r)*r, b>
#end
#break
#end
#macro atom(pos)
sphere {
pos, 0.2
texture {
pigment {
color rgb atomColor
}
finish{
specular 0.4
}
}
}
#end
#macro bond(from, to)
cylinder {
from, to, 0.075
texture {
pigment {
color rgb atomColor*0.5 + 0.5
}
finish{
specular 0.6
}
}
}
#end
union {
#local m = -b1;
#while (m < b1)
#local n = -b1;
#while (n < b1)
#local a0 = (n*2 + m)*s;
#local b0 = m*1.5;
#if (abs(a0) < ba & abs(b0) < bb)
union{
#if (b0 > -bb + 2)
atom(ab2Vector(a0, b0))
#end
#if (abs(b0) < bb-2)
bond(ab2Vector(a0, b0), ab2Vector(a0, b0 + 1))
#end
#if (b0<bb-2)
atom(ab2Vector(a0, b0 + 1))
#if (a0 < ba-s)
bond(ab2Vector(a0, b0 + 1), ab2Vector(a0 + s, b0 + 1.5))
#end
#if (a0 > s-ba)
bond(ab2Vector(a0, b0 + 1), ab2Vector(a0-s, b0 + 1.5))
#end
#end
}
#end
#local n = n + 1;
#end
#local m = m + 1;
#end
scale 0.08
}
#end
union {
nanoTube(MODE_ARMCHAIR, 6, 12, <1, 0, 0>)
nanoTube(MODE_ARMCHAIR, 9, 9, <0, 1, 0>)
nanoTube(MODE_ARMCHAIR, 12, 6, <0, 0, 1> )
rotate -clock*60*x
}
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
You are free:
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original. https://creativecommons.org/licenses/by-sa/3.0 CC BY-SA 3.0 Creative Commons Attribution-Share Alike 3.0 true true English Add a one-line explanation of what this file represents
author name string<\/a>"}},"text\/plain":{"en":{"":"author name string"}}},"{\"value\":\"Eric Wieser\",\"type\":\"string\"}":{"text\/html":{"en":{"P2093":"Eric Wieser","P4174":"
Eric Wieser<\/a>"}},"text\/plain":{"en":{"P2093":"Eric Wieser","P4174":"Eric Wieser"}}},"{\"value\":{\"entity-type\":\"property\",\"numeric-id\":4174,\"id\":\"P4174\"},\"type\":\"wikibase-entityid\"}":{"text\/html":{"en":{"":" Wikimedia username<\/a>"}},"text\/plain":{"en":{"":"Wikimedia username"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P170 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed"> copyrighted<\/a>"}},"text\/plain":{"en":{"P6216":"copyrighted"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P6216 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">
Creative Commons Attribution-ShareAlike 3.0 Unported<\/a>"}},"text\/plain":{"en":{"P275":"Creative Commons Attribution-ShareAlike 3.0 Unported"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P275 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">
original creation by uploader<\/a>"}},"text\/plain":{"en":{"P7482":"original creation by uploader"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P7482 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">