|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
I see that POV has a basic triangle built in shape, but I'm looking to do
some CSG involving a large triangular shape. What I'm eventually looking
for is a prism on the xz plane with 6 points. It's shaped like an
equilateral triangle with the 3 points clipped off. In other words, viewed
from above it's a hexagon with 3 long sides and 3 short ones. The short
sides should equal exactly 1/3rd of the long ones. Can someone give me the
gist of how to come up with some exact coordinates for such a shape (or,
ideally, post the code?)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
CreeD wrote:
>
> Hi,
> I see that POV has a basic triangle built in shape, but I'm looking to do
> some CSG involving a large triangular shape. What I'm eventually looking
> for is a prism on the xz plane with 6 points. It's shaped like an
> equilateral triangle with the 3 points clipped off. In other words, viewed
> from above it's a hexagon with 3 long sides and 3 short ones. The short
> sides should equal exactly 1/3rd of the long ones. Can someone give me the
> gist of how to come up with some exact coordinates for such a shape (or,
> ideally, post the code?)
Here is one solution:
intersection {
box { <-1.5, 0, -1.5>, <1.5, 1, 1.5> }
plane {-z, 0 translate <0, 0, -1> }
plane {-z, 0 translate <0, 0, -1> rotate <0, 120, 0> }
plane {-z, 0 translate <0, 0, -1> rotate <0, 240, 0> }
plane {-z, 0 translate <0, 0, -1.4> rotate <0, 60, 0> }
plane {-z, 0 translate <0, 0, -1.4> rotate <0, 180, 0> }
plane {-z, 0 translate <0, 0, -1.4> rotate <0, 300, 0> }
}
/Ib
-------------------------------
Gallery: http://www.ibras.dk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <01c0da8d$feaa6e40$5e6dded1@mk>, CreeD says...
> Hi,
> I see that POV has a basic triangle built in shape, but I'm looking to do
> some CSG involving a large triangular shape. What I'm eventually looking
> for is a prism on the xz plane with 6 points. It's shaped like an
> equilateral triangle with the 3 points clipped off. In other words, viewed
> from above it's a hexagon with 3 long sides and 3 short ones. The short
> sides should equal exactly 1/3rd of the long ones. Can someone give me the
> gist of how to come up with some exact coordinates for such a shape (or,
> ideally, post the code?)
>
I may be wrong and I don't see Ib Rasmussen's solution, but my Excel
gives as the solution the two equilateral triangles with sides R, R, and
A (the other is then R, R, and 3A), in which A/R = 0.48038446.
The smaller one has an angle opposite to A of 27.7957724 degrees, while
the larger has an angle of 92.2042276 degrees. They make together 120
degrees, and you have 3 such sets of triangles...
This should not be difficult to code!
Hope this helps.
--
Regards, Sander
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <MPG### [at] NEWSPOVRAYORG>, Sander says...
> In article <01c0da8d$feaa6e40$5e6dded1@mk>, CreeD says...
> > Hi,
> > I see that POV has a basic triangle built in shape, but I'm looking to do
<snip>
> This should not be difficult to code!
> Hope this helps.
>
Drawing in p.b.i. !
--
Regards, Sander
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
CreeD wrote:
>
> Hi,
> I see that POV has a basic triangle built in shape, but I'm looking to do
> some CSG involving a large triangular shape. What I'm eventually looking
> for is a prism on the xz plane with 6 points. It's shaped like an
> equilateral triangle with the 3 points clipped off. In other words, viewed
> from above it's a hexagon with 3 long sides and 3 short ones. The short
> sides should equal exactly 1/3rd of the long ones. Can someone give me the
> gist of how to come up with some exact coordinates for such a shape (or,
> ideally, post the code?)
Here's another way:
#declare Triang=prism {
linear_spline
0, 1, 3
<-1.732, -1>, <1.732, -1>, <0, 2>
}
intersection {
object { Triang }
object { Triang scale 1.4 rotate <0, 180, 0> }
texture { pigment { Blue } }
}
/Ib
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
CreeD wrote:
>
> Hi,
> I see that POV has a basic triangle built in shape, but I'm looking to do
> some CSG involving a large triangular shape. What I'm eventually looking
> for is a prism on the xz plane with 6 points. It's shaped like an
> equilateral triangle with the 3 points clipped off. In other words, viewed
> from above it's a hexagon with 3 long sides and 3 short ones. The short
> sides should equal exactly 1/3rd of the long ones. Can someone give me the
> gist of how to come up with some exact coordinates for such a shape (or,
> ideally, post the code?)
Here's a third way:
prism {
linear_spline
0, 1, 6
<-1.0392, -1.0000>, < 1.0392, -1.0000>, < 1.3856, -0.4000>,
<0.3464, 1.4>, <-0.3464, 1.4>, <-1.3856, -0.4000>
texture { pigment { Blue } }
}
Got enough? :-)
/Ib
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it CreeD who wrote:
>Hi,
> I see that POV has a basic triangle built in shape, but I'm looking to do
>some CSG involving a large triangular shape. What I'm eventually looking
>for is a prism on the xz plane with 6 points. It's shaped like an
>equilateral triangle with the 3 points clipped off. In other words, viewed
>from above it's a hexagon with 3 long sides and 3 short ones. The short
>sides should equal exactly 1/3rd of the long ones. Can someone give me the
>gist of how to come up with some exact coordinates for such a shape (or,
>ideally, post the code?)
One way to do it is to start with one of the corners at <0,0> and walk
round the shape, calculating the position of the next point relative to
the last one.
The second point is 3 units x-wards of the first point, so we can
declare it as
#declare P2 = <3,0>;
The next point is 1 unit away from P2 at an angle of 60 degrees, so
that's cos(60) x-wards and sin(60) z-wards, i.e.
#declare P3 = P2 + <COS60,SIN60>;
because POV uses radians rather than degrees, we declare COS60 and SIN60
as
#declare SIN60=sin(pi/3);
#declare COS60=cos(pi/3);
Once we've declared all the points, we can build a prism object,
something like this:-
//====================================================
camera { location <1.5, 4, -2> look_at <1.5, 0, 1.5>}
light_source {<-100,200,-100> colour rgb 2}
plane { y, 0 pigment {rgb y/2}}
#declare SIN60=sin(pi/3);
#declare COS60=cos(pi/3);
#declare P1 = <0,0>;
#declare P2 = <3,0>;
#declare P3 = P2 + <COS60,SIN60>;
#declare P4 = P3 + <-3*COS60,3*SIN60>;
#declare P5 = P4 + <-1,0>;
#declare P6 = P5 + <-3*COS60,-3*SIN60>;
prism { linear_sweep linear_spline
0, // base height
1, // top height
7, // number of points
P1, P2, P3, P4, P5, P6, P1 // the points we calculated earlier
pigment {rgb x}
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
CreeD wrote:
> It's shaped like an equilateral triangle with the 3 points clipped
> off. In other words, viewed from above it's a hexagon with 3 long
> sides and 3 short ones. The short sides should equal exactly 1/3rd
> of the long ones. Can someone give me the gist of how to come up
> with some exact coordinates for such a shape (or, ideally, post the
> code?)
The corners are all on a regular triangular lattice ...
b = sqrt(3/4); // sin(pi/3)
P0 = < 0 , 0 >
P1 = < 3 , 0 >
P2 = < 3.5, b >
P3 = < 2 ,4b >
P4 = < 1 ,4b >
P5 = <-0.5, b >
What you need most is the second coordinate of the centroid, which is
5b/3, or 5/sqrt(12) -- that's its distance from the line {P0,P1}.
Subtract it from 4b to get 7b/3 = 7/sqrt(12), the distance from the
centroid to the line {P3,P4}. Thus:
intersection {
plane { z, 5/sqrt(12) }
plane { z, 5/sqrt(12) rotate 120*y }
plane { z, 5/sqrt(12) rotate -120*y }
plane { -z, 7/sqrt(12) }
plane { -z, 7/sqrt(12) rotate 120*y }
plane { -z, 7/sqrt(12) rotate -120*y }
}
--
Anton Sherwood -- br0### [at] p0b0xcom -- http://ogre.nu/
(not an advanced user)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3AFDCD74.8AE230B8@pobox.com>, Anton Sherwood says...
> CreeD wrote:
>
> The corners are all on a regular triangular lattice ...
>
<snip>
Yes: I knew that I missed something simple, as usual :)
--
Regards, Sander
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
#define Thing = box { <-2.5,-h,-5/sqrt(12)>, <2.5,h,7/sqrt(12)> }
intersection {
object { Thing }
object { Thing rotate 120*y translate -y*epsilon }
object { Thing rotate -120*y translate y*epsilon }
}
The translation is to avoid the Coincident Surfaces Problem, though why
that should apply as it does to intersections I have no idea.
--
Anton Sherwood -- br0### [at] p0b0xcom -- http://ogre.nu/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|