Skip to content

Instantly share code, notes, and snippets.

@tomilov
Last active June 29, 2022 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomilov/5f83d18f1243405e109128ffaeb33122 to your computer and use it in GitHub Desktop.
Save tomilov/5f83d18f1243405e109128ffaeb33122 to your computer and use it in GitHub Desktop.
nonagon as result of intersection of parallelotope and triangle in space
reset
set view equal xyz
unset border
unset tics
set xyplane 0
set xrange [-3:3]
set yrange [-3:3]
set zrange [-3:3]
$cube << EOI
-2 -2 -2
2 -2 -2
2 -2 2
2 2 2
-2 2 2
-2 2 -2
-2 -2 -2
-2 -2 2
-2 -2 -2
-2 -2 2
2 -2 2
-2 -2 2
-2 2 2
2 2 -2
2 2 2
2 2 -2
2 -2 -2
2 2 -2
-2 2 -2
EOI
$hexagon << EOI
0 -2 -2
2 -2 0
2 0 2
0 2 2
-2 2 0
-2 0 -2
0 -2 -2
EOI
$triangle << EOI
3 0 3
0 -3 -3
-3 3 0
3 0 3
EOI
set title 'nonagon'
set object 1 polygon from -1,-1,-2 to 0,-2,-2 to 1,-2,-1 to 2,-1,1 to 2,0,2 to 1,1,2 to -1,2,1 to -2,2,0 to -2,1,-1 to -1,-1,-2 fillstyle solid noborder fillcolor rgb 'dark-green'
set terminal gif size 512, 512 animate delay 4 optimize
set output 'box_triangle_intersection.gif'
set angles degrees
do for [z=315:-44:-1] {
set view acos(1 / sqrt(3)), (z + 360) % 360, 1.3
splot '$cube' with lines linecolor rgbcolor 'red' title 'cube', \
'$hexagon' with lines linecolor rgbcolor 'green' title 'hexagon', \
'$triangle' with lines linecolor rgbcolor 'blue' title 'triangle'
}
@tomilov
Copy link
Author

tomilov commented Jun 28, 2022

box_triangle_intersection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment