|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using the
following code, but the object's inside is empty (I noticed it, when I used
difference command to subtract 4 spheres from the tetrahedron.
This is the code I am using:
//---------------------------------------
global_settings { assumed_gamma 1.0 }
#include "colors.inc"
//---------------------------------------
camera{ ultra_wide_angle
angle 75
right x*image_width/image_height
location <2 , 3 , -4>
look_at <0,0,0> }
//---------------------------------------
light_source{ <0,0,-2500>
color rgb<1,1,1> }
//---------------------------------------
background {color rgb<1,1,1>}
//---------------------------------------
#declare d =1.05;
difference{
object{
union {
triangle { < 1, 1, 1>, <-1, 1, -1>, < 1, -1, -1> }
triangle { <-1, 1, -1>, <-1, -1, 1>, < 1, -1, -1> }
triangle { < 1, 1, 1>, < 1, -1, -1>, <-1, -1, 1> }
triangle { < 1, 1, 1>, <-1, -1, 1>, <-1, 1, -1> }
}
pigment{ color rgb<1,0,0> }
}
sphere { < 1, 1, 1> , d}
sphere { <1, -1, -1> , d}
sphere { < -1, 1, -1> , d}
sphere { < -1, -1, 1> , d}
}
Post a reply to this message
|
|
| |
| |
|
|
From: m a r c
Subject: Re: Constructing a solid tetrahedron by 4 triangles
Date: 5 Feb 2009 09:55:43
Message: <498afdef@news.povray.org>
|
|
|
| |
| |
|
|
web.498adf1b1f5de9ab792c7d270@news.povray.org...
> Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using
> the
> following code, but the object's inside is empty (I noticed it, when I
> used
> difference command to subtract 4 spheres from the tetrahedron.
>
You should arrange your triangles as a mesh instead a union.
then put a inside_vector after triangle definitions this way
Marc
difference{
object{
mesh {
triangle { < 1, 1, 1>, <-1, 1, -1>, < 1, -1, -1> }
triangle { <-1, 1, -1>, <-1, -1, 1>, < 1, -1, -1> }
triangle { < 1, 1, 1>, < 1, -1, -1>, <-1, -1, 1> }
triangle { < 1, 1, 1>, <-1, -1, 1>, <-1, 1, -1> }
inside_vector z
}
pigment{ color rgb<1,0,0> }
}
sphere { < 1, 1, 1> , d}
sphere { <1, -1, -1> , d}
sphere { < -1, 1, -1> , d}
sphere { < -1, -1, 1> , d}
}
Post a reply to this message
|
|
| |
| |
|
|
From: m a r c
Subject: Re: Constructing a solid tetrahedron by 4 triangles
Date: 5 Feb 2009 09:58:34
Message: <498afe9a@news.povray.org>
|
|
|
| |
| |
|
|
498afdef@news.povray.org...
>
oh and if you want your whole object to have the same pigment, put the
pigment in the CSG rather than in the mesh
Marc
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Amir_ni" <nomail@nomail> wrote:
> Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using the
> following code, but the object's inside is empty (I noticed it, when I used
This generic pyramid is solid (CSG):
// pyramid 1 unit high, 1 unit radius
#macro Pyramid_N ( NSides )
#local Height = 1;
#local Radius = 1/2;
#local SW2 = Radius * cos( 2 * pi / NSides / 2 );
#local SW = 2 * SW2;
#local Alpha_rad = atan( SW / Height );
#local Alpha_deg = Alpha_rad * 180 / pi;
#local H2 = 1.01 * Height / cos ( Alpha_rad );
#local Side = 0;
intersection {
#while (Side < NSides)
box { < -2, 0, -2 >, < 0, 2, 2 >
rotate z * Alpha_deg translate SW2 * x rotate y * ( Side * 360 /
NSides )
}
#local Side = Side + 1;
#end
cylinder { 0 < 0, Height + 1.01, 0 > Radius }
rotate y * 360 / NSides / 2
}
#end
object {
Pyramid_N (4)
pigment { color Red }
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Marc,Steven! Thanks for your help. good luck!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Amir_ni" <nomail@nomail> wrote:
> Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using the
> following code, but the object's inside is empty (I noticed it, when I used
> difference command to subtract 4 spheres from the tetrahedron.
Try using a mesh or mesh2 object instead; they are fully "inside aware" if your
mesh is closed.
Post a reply to this message
|
|
| |
| |
|
|
From: Nicolas George
Subject: Re: Constructing a solid tetrahedron by 4 triangles
Date: 6 Feb 2009 15:52:55
Message: <498ca327$1@news.povray.org>
|
|
|
| |
| |
|
|
"Amir_ni" wrote in message
<web.498adf1b1f5de9ab792c7d270@news.povray.org>:
> Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using the
> following code, but the object's inside is empty (I noticed it, when I used
> difference command to subtract 4 spheres from the tetrahedron.
I am pretty sure the "correct" way to do a tetrahedron is the intersection
of four planes (which, fortunately, are actually half-spaces; otherwise, the
previous sentence would be mathematically stupid).
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|