Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Last active May 14, 2024 10:15
Show Gist options
  • Save Gro-Tsen/c3d68c801104ac11edea14de871ba4cc to your computer and use it in GitHub Desktop.
Save Gro-Tsen/c3d68c801104ac11edea14de871ba4cc to your computer and use it in GitHub Desktop.
PoV-ray illustration of the theorem of Desargues in 3D
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400px" height="400px" viewBox="-200 -200 400 400"
overflow="hidden" version="1.1" xmlns="http://www.w3.org/2000/svg">
<style type="text/css">
line { stroke-linecap: round; stroke-linejoin: round; }
.uvw { stroke: rgb(0,0,128); stroke-width: 1.2px; }
.uvw-point { stroke: rgb(0,0,255); stroke-width: 5px; }
.lo { stroke: rgb(0,128,0); stroke-width: 1.2px; }
.lo-point { stroke: rgb(0,255,0); stroke-width: 5px; }
.tri1 { stroke: rgb(128,0,64); stroke-width: 0.6px; }
.tri1-point { stroke: rgb(255,0,128); stroke-width: 5px; }
.tri1-poly { fill: rgb(128,0,64); fill-opacity: 0.3; }
.tri2 { stroke: rgb(128,64,0); stroke-width: 0.6px; }
.tri2-point { stroke: rgb(255,128,0); stroke-width: 5px; }
.tri2-poly { fill: rgb(128,64,0); fill-opacity: 0.3; }
text { font-size: 15px; font-style: italic; font-family: "New Century Schoolbook", "Century Schoolbook", "TeX Gyre Schola", serif; }
</style>
<polygon class="tri1-poly" points="0.000,58.462 -66.667,106.667 -100.000,20.000" />
<polygon class="tri2-poly" points="0.000,-25.000 -33.937,-19.344 -25.685,-106.336" />
<line class="lo" x1="-0.000" y1="-200.000" x2="0.000" y2="200.000" />
<line class="lo" x1="12.987" y1="-200.000" x2="-90.909" y2="200.000" />
<line class="lo" x1="-200.000" y1="190.000" x2="29.412" y2="-200.000" />
<line class="uvw" x1="200.000" y1="-100.000" x2="-100.000" y2="200.000" />
<line class="tri1" x1="-100.000" y1="20.000" x2="-50.000" y2="150.000" />
<line class="tri1" x1="-100.000" y1="20.000" x2="30.000" y2="70.000" />
<line class="tri1" x1="-66.667" y1="106.667" x2="150.000" y2="-50.000" />
<line class="tri2" x1="-50.000" y1="150.000" x2="-25.685" y2="-106.336" />
<line class="tri2" x1="-25.685" y1="-106.336" x2="30.000" y2="70.000" />
<line class="tri2" x1="-33.937" y1="-19.344" x2="150.000" y2="-50.000" />
<line class="lo-point" x1="0.000" y1="-150.000" x2="0.000" y2="-150.000" />
<line class="uvw-point" x1="-50.000" y1="150.000" x2="-50.000" y2="150.000" />
<line class="uvw-point" x1="30.000" y1="70.000" x2="30.000" y2="70.000" />
<line class="uvw-point" x1="150.000" y1="-50.000" x2="150.000" y2="-50.000" />
<line class="tri1-point" x1="0.000" y1="58.462" x2="0.000" y2="58.462" />
<line class="tri1-point" x1="-66.667" y1="106.667" x2="-66.667" y2="106.667" />
<line class="tri1-point" x1="-100.000" y1="20.000" x2="-100.000" y2="20.000" />
<line class="tri2-point" x1="0.000" y1="-25.000" x2="0.000" y2="-25.000" />
<line class="tri2-point" x1="-33.937" y1="-19.344" x2="-33.937" y2="-19.344" />
<line class="tri2-point" x1="-25.685" y1="-106.336" x2="-25.685" y2="-106.336" />
<text text-anchor="start" x="5.000" y="-145.000">O</text>
<text text-anchor="start" x="5.000" y="53.462">A₁</text>
<text text-anchor="end" x="-71.667" y="106.667">B₁</text>
<text text-anchor="end" x="-105.000" y="20.000">C₁</text>
<text text-anchor="start" x="5.000" y="-30.000">A₂</text>
<text text-anchor="end" x="-38.937" y="-19.344">B₂</text>
<text text-anchor="end" x="-30.685" y="-106.336">C₂</text>
<text text-anchor="start" x="-45.000" y="165.000">U</text>
<text text-anchor="start" x="35.000" y="85.000">V</text>
<text text-anchor="start" x="155.000" y="-35.000">W</text>
</svg>
#include "consts.inc"
#include "colors.inc"
#include "woods.inc"
#include "stones.inc"
#include "metals.inc"
#include "skies.inc"
// povray +Idesargues.pov final.ini -W800 -H800
// convert desargues.png -quality 98 ~/public_html/images/geom/desargues3d.jpg
// convert desargues.png -resize 300x300 -quality 98 ~/public_html/images/geom/desargues3d-small.jpg
global_settings {
photons { count 100000 }
assumed_gamma 1.0
}
// Memento: POV-Ray uses a left-handed coordinate system.
// Here, x points right, y points down and z points toward camera.
#declare camera_dist = 12;
camera {
location <0, 0, camera_dist>
sky <0, -1, 0>
right <image_width/image_height, 0, 0>
look_at <0,0,0>
angle 2*atan(2/camera_dist * image_width/image_height)*180/pi
}
sky_sphere {
S_Cloud2
rotate <0,0,180>
}
plane {
<0,-1,0>,-1.5
texture {
T_Stone15
scale 5
}
}
light_source {
<-2, -15, 30>
color White
}
#declare point_O = <0,-3/2,0>;
#declare point_A1 = <0, 38/65, 0>;
#declare point_B1 = <-10/15 / (1 + (77/30)/camera_dist), 16/15 / (1 + (77/30)/camera_dist), 77/30 / (1 + (77/30)/camera_dist)>;
#declare point_C1 = <-10/10, 2/10, 0>;
#declare point_A2 = <0, -1/4, 0>;
#declare point_B2 = <-300/884 / (1 + (1155/884)/camera_dist), -171/884 / (1 + (1155/884)/camera_dist), 1155/884 / (1 + (1155/884)/camera_dist)>;
#declare point_C2 = <-150/584, -621/584, 0>;
#declare point_U = <-1/2 / (1 + (77/20)/camera_dist), 3/2 / (1 + (77/20)/camera_dist), 77/20 / (1 + (77/20)/camera_dist)>;
#declare point_V = <3/10, 7/10, 0>;
#declare point_W = <3/2 / (1 + (-231/40)/camera_dist), -1/2 / (1 + (-231/40)/camera_dist), -231/40 / (1 + (-231/40)/camera_dist)>;
sphere {
// The point O
point_O, 0.05
texture {
pigment { color red 0 green 1 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point A₁
point_A1, 0.05
texture {
pigment { color red 1 green 0 blue 0.5 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point B₁
point_B1, 0.05
texture {
pigment { color red 1 green 0 blue 0.5 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point C₁
point_C1, 0.05
texture {
pigment { color red 1 green 0 blue 0.5 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point A₂
point_A2, 0.05
texture {
pigment { color red 1 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point B₂
point_B2, 0.05
texture {
pigment { color red 1 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point C₂
point_C2, 0.05
texture {
pigment { color red 1 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point U
point_U, 0.05
texture {
pigment { color red 0 green 0 blue 1 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point V
point_V, 0.05
texture {
pigment { color red 0 green 0 blue 1 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
sphere {
// The point W
point_W, 0.05
texture {
pigment { color red 0 green 0 blue 1 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_O, 5*point_A1-4*point_O, 0.01
texture {
pigment { color red 0 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_O, 5*point_B1-4*point_O, 0.01
texture {
pigment { color red 0 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_O, 5*point_C1-4*point_O, 0.01
texture {
pigment { color red 0 green 0.5 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_C1, point_U, 0.01
texture {
pigment { color red 0.5 green 0 blue 0.25 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_C1, point_V, 0.01
texture {
pigment { color red 0.5 green 0 blue 0.25 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_B1, point_W, 0.01
texture {
pigment { color red 0.5 green 0 blue 0.25 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_C2, point_U, 0.01
texture {
pigment { color red 0.5 green 0.25 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_C2, point_V, 0.01
texture {
pigment { color red 0.5 green 0.25 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
point_B2, point_W, 0.01
texture {
pigment { color red 0.5 green 0.25 blue 0 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
cylinder {
2*point_U-point_W, 101*point_W-100*point_U, 0.01
texture {
pigment { color red 0 green 0 blue 0.5 }
finish { ambient .45 diffuse .6 phong .3 }
}
}
triangle {
point_A1, point_B1, point_C1
texture {
pigment { color red 0.5 green 0 blue 0.25 transmit 0.2 }
finish { reflection { 0.1 } ambient .45 diffuse .6 phong .3 }
}
}
triangle {
point_A2, point_B2, point_C2
texture {
pigment { color red 0.5 green 0.5 blue 0.25 transmit 0.2 }
finish { reflection { 0.1 } ambient .45 diffuse .6 phong .3 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment