Death Star: Difference between revisions
No edit summary |
m (whitespace) |
||
Line 1: | Line 1: | ||
{{task}}{{requires|Graphics}} |
{{task|Constructive Solid Geometry}}{{requires|Graphics}}[[Category:Geometric Subtraction]] |
||
Death Star is a task to display a region that consists of a large sphere with part of a smaller sphere removed from it as a result of geometric subtraction. (This will basically produce a shape like a "death star".) |
Death Star is a task to display a region that consists of a large sphere with part of a smaller sphere removed from it as a result of geometric subtraction. (This will basically produce a shape like a "death star".) |
||
=={{header|Brlcad}}== |
=={{header|Brlcad}}== |
||
⚫ | |||
<lang brlcad> |
|||
⚫ | |||
opendb deathstar.g y |
opendb deathstar.g y |
||
Line 32: | Line 28: | ||
# We now trigger the raytracer to see our finished product |
# We now trigger the raytracer to see our finished product |
||
rt |
rt</lang> |
||
⚫ | |||
=={{header|Openscad}}== |
=={{header|Openscad}}== |
||
⚫ | |||
<lang openscad> |
|||
⚫ | |||
difference() { |
difference() { |
||
Line 57: | Line 49: | ||
sphere(40); |
sphere(40); |
||
} |
} |
||
⚫ | |||
} |
|||
</lang> |
|||
[[Category:Constructive Solid Geometry]] |
|||
[[Category:Geometric Subtraction]] |
|||
=={{header|POV-Ray}}== |
=={{header|POV-Ray}}== |
||
⚫ | |||
<lang POV-Ray> |
|||
⚫ | |||
aperture .1 blur_samples 20 variance 1/100000 focal_point 0} |
aperture .1 blur_samples 20 variance 1/100000 focal_point 0} |
||
Line 82: | Line 68: | ||
finish { phong 1 reflection {0.10 metallic 0.5} } |
finish { phong 1 reflection {0.10 metallic 0.5} } |
||
} |
} |
||
} |
} </lang> |
||
</lang> |
|||
[[image:PovRay-deathstar.jpg]] |
[[image:PovRay-deathstar.jpg]] |
Revision as of 22:25, 25 April 2011
You are encouraged to solve this task according to the task description, using any language you may know.
Death Star is a task to display a region that consists of a large sphere with part of a smaller sphere removed from it as a result of geometric subtraction. (This will basically produce a shape like a "death star".)
Brlcad
<lang brlcad># We need a database to hold the objects opendb deathstar.g y
- We will be measuring in kilometers
units km
- Create a sphere of radius 60km centred at the origin
in sph1.s sph 0 0 0 60
- We will be subtracting an overlapping sphere with a diameter of 40km
- The resultant hole will be smaller than this, because we only
- only catch the edge
in sph2.s sph 0 90 0 40
- Create a region named deathstar.r which consists of big minus small sphere
r deathstar.r u sph1.s - sph2.s
- We will use a plastic material texture with rgb colour 224,224,224
- with specular lighting value of 0.1 and no inheritance
mater deathstar.r "plastic sp=0.1" 224 224 224 0
- Clear the wireframe display and draw the deathstar
B deathstar.r
- We now trigger the raytracer to see our finished product
rt</lang>
Openscad
<lang openscad>// We are performing geometric subtraction
difference() {
// Create the primary sphere of radius 60 centred at the origin
translate(v = [0,0,0]) { sphere(60); }
/*Subtract an overlapping sphere with a diameter of 40 The resultant hole will be smaller than this, because we only only catch the edge */
translate(v = [0,90,0]) { sphere(40); }
}</lang>
POV-Ray
<lang POV-Ray>camera { perspective location <0.0 , .8 ,-3.0> look_at 0
aperture .1 blur_samples 20 variance 1/100000 focal_point 0}
light_source{< 3,3,-3> color rgb 1}
sky_sphere { pigment{ color rgb <0,.2,.5>}}
plane {y,-5 pigment {color rgb .54} normal {hexagon} }
difference {
sphere { 0,1 } sphere { <-1,1,-1>,1 } texture { pigment{ granite } finish { phong 1 reflection {0.10 metallic 0.5} } }