POV-Ray : Newsgroups : povray.newusers : Applying a Border to a "triangle" Server Time
1 Nov 2024 14:20:19 EDT (-0400)
  Applying a Border to a "triangle" (Message 1 to 8 of 8)  
From: Catseye
Subject: Applying a Border to a "triangle"
Date: 7 Jun 2008 07:40:58
Message: <484a73ca$1@news.povray.org>
How can I create a border of a specified width and color for a "triangle" 
Finite_Patch Object having a different color?  I tried "merge" and "union" 
of two different-size triangle and that doesn't want to compute.

If this can't be done, what is the slickest way to create a thin equilateral 
"Finite Solid" triangle having a border edge and different color than the 
remainder of the triangle?


Post a reply to this message

From: Chris B
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 08:44:59
Message: <484a82cb$1@news.povray.org>
"Catseye" <jpf### [at] comcastnet> wrote in message 
news:484a73ca$1@news.povray.org...
> How can I create a border of a specified width and color for a "triangle" 
> Finite_Patch Object having a different color?  I tried "merge" and "union" 
> of two different-size triangle and that doesn't want to compute.

There's lots of ways of doing this with a triangular object. Using a 
different-size triangle is one that should work. You can use union but you 
don't have to, just two differently scaled copies of the same triangle 
should work just as well.

There are a couple of things that you'll need to get right though:
  o  When you scale the triangle it's easiest to do by translating it so 
that it is centred at the origin, scale it and then translate it back again.
  o  You also need to avoid concurrent surfaces, so the smaller object 
should be very slightly in front of the 'border' object (e.g. 
translate -z*0.00001).
  o  If you are going to union them, then remember to apply the pigments to 
the individual items and not to the union/merge.

If you want the triangle to show up on both surfaces on the triangle you can 
use a third copy translated slightly in the opposite direction.

I'm not sure what a merge would produce because it removes internal surfaces 
and I don't know what that would do with something like a bicubic_patch, a 
mesh or a mesh2 etc.

> If this can't be done, what is the slickest way to create a thin 
> equilateral "Finite Solid" triangle having a border edge and different 
> color than the remainder of the triangle?

This is possible too. You can use an object as a pigment, so, off the top of 
my head, I would think the quickest way is probably to get the intersection 
of 3 planes. Then define a pigment using that object:

#declare PlaneIntersectionObject =  intersection {
  plane {z,1}
  plane {z,1 rotate 120*y}
  plane {z,1 rotate 240*y}
}

pigment {
  object {
    PlaneIntersectionObject
    color rgb <1,0,0>  // Red Border
    color rgb <1,1,0>  // Yellow Triangle
  }
}

You'd obviously then need to align it with your triangle object.

Regards,
Chris B.


Post a reply to this message

From: Catseye
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 09:14:51
Message: <484a89cb$1@news.povray.org>
Thanks Chris,

I get the impression from the user's manual discussion that CSG functions 
like "merge" and "union" don't typically work with "patch" objects like 
"triangle" and "disc".  That said, I have successfully used "difference" to 
subtract a solid cylinder from a patch but I can't get two "patches" (in the 
same plane) to "merge" or "union".

Any insight as to whether this is possible? - perhaps I'm overlooking some 
basic protocol coding error.

If I comprehend what you are saying about the method to color the edge (90 
degrees from the face) of a solid triangle; however that's not what I need. 
If possible I need to be able to generate a border around the triangle face 
(visible looking at the face the face).

I had already considered the compromise of translate-offsetting two 
different sized triangles (of different colors) a miniscule amount as you 
suggested, but I was looking for a more elegant solution.

Jim

"Chris B" <nom### [at] nomailcom> wrote in message 
news:484a82cb$1@news.povray.org...
>
> "Catseye" <jpf### [at] comcastnet> wrote in message 
> news:484a73ca$1@news.povray.org...
>> How can I create a border of a specified width and color for a "triangle" 
>> Finite_Patch Object having a different color?  I tried "merge" and 
>> "union" of two different-size triangle and that doesn't want to compute.
>
> There's lots of ways of doing this with a triangular object. Using a 
> different-size triangle is one that should work. You can use union but you 
> don't have to, just two differently scaled copies of the same triangle 
> should work just as well.
>
> There are a couple of things that you'll need to get right though:
>  o  When you scale the triangle it's easiest to do by translating it so 
> that it is centred at the origin, scale it and then translate it back 
> again.
>  o  You also need to avoid concurrent surfaces, so the smaller object 
> should be very slightly in front of the 'border' object (e.g. 
> translate -z*0.00001).
>  o  If you are going to union them, then remember to apply the pigments to 
> the individual items and not to the union/merge.
>
> If you want the triangle to show up on both surfaces on the triangle you 
> can use a third copy translated slightly in the opposite direction.
>
> I'm not sure what a merge would produce because it removes internal 
> surfaces and I don't know what that would do with something like a 
> bicubic_patch, a mesh or a mesh2 etc.
>
>> If this can't be done, what is the slickest way to create a thin 
>> equilateral "Finite Solid" triangle having a border edge and different 
>> color than the remainder of the triangle?
>
> This is possible too. You can use an object as a pigment, so, off the top 
> of my head, I would think the quickest way is probably to get the 
> intersection of 3 planes. Then define a pigment using that object:
>
> #declare PlaneIntersectionObject =  intersection {
>  plane {z,1}
>  plane {z,1 rotate 120*y}
>  plane {z,1 rotate 240*y}
> }
>
> pigment {
>  object {
>    PlaneIntersectionObject
>    color rgb <1,0,0>  // Red Border
>    color rgb <1,1,0>  // Yellow Triangle
>  }
> }
>
> You'd obviously then need to align it with your triangle object.
>
> Regards,
> Chris B.
>


Post a reply to this message

From: Stephen
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 10:16:20
Message: <016l44do023lm9t82u322pe80f9ig3bfdk@4ax.com>
On Sat, 7 Jun 2008 08:14:37 -0500, "Catseye" <jpf### [at] comcastnet>
wrote:

>
>I had already considered the compromise of translate-offsetting two 
>different sized triangles (of different colors) a miniscule amount as you 
>suggested, but I was looking for a more elegant solution.

PovRay does not support what you want but :)
Thibaut Jonckheere has created PovEdge which might help you.
http://tuabiht.chez-alice.fr/PovEdge_Site/PovEdge.html

See Harold on the road  and Harold #3 in povray.binaries.images 
-- 

Regards
     Stephen


Post a reply to this message

From: Catseye
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 10:48:39
Message: <484a9fc7$1@news.povray.org>
Thanks Stephen,

I had already explored the link on POV's home page.  It's touted to work 
with "mesh2" objects.  Do you know if it also works also on 
"triangle"-generated objects?

Jim

"Stephen" <mcavoysAT@aolDOTcom> wrote in message 
news:016l44do023lm9t82u322pe80f9ig3bfdk@4ax.com...
> On Sat, 7 Jun 2008 08:14:37 -0500, "Catseye" <jpf### [at] comcastnet>
> wrote:
>
>>
>>I had already considered the compromise of translate-offsetting two
>>different sized triangles (of different colors) a miniscule amount as you
>>suggested, but I was looking for a more elegant solution.
>
> PovRay does not support what you want but :)
> Thibaut Jonckheere has created PovEdge which might help you.
> http://tuabiht.chez-alice.fr/PovEdge_Site/PovEdge.html
>
> See Harold on the road  and Harold #3 in povray.binaries.images
> -- 
>
> Regards
>     Stephen


Post a reply to this message

From: Chris B
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 11:20:20
Message: <484aa734@news.povray.org>
"Catseye" <jpf### [at] comcastnet> wrote in message 
news:484a89cb$1@news.povray.org...
> If I comprehend what you are saying about the method to color the edge (90 
> degrees from the face) of a solid triangle; however that's not what I 
> need. If possible I need to be able to generate a border around the 
> triangle face (visible looking at the face the face).
>

No that's not it. Using an object as a pigment colours everything outside 
the conceptual 'object' one colour and everything inside the conceptual 
'object' another colour. When such a pigment is applied to a surface you see 
the outline of the section of the shape as the real object 'cuts through' 
the pattern. In this case, if we slice the pattern at right angles we get a 
yellow triangle with a red border. Here's a complete example using the 
triangle object.

camera {location <0,2,-0.01> look_at 0}
light_source {   <-4,75 ,-10   >, rgb 1}

#declare PlaneIntersectionObject =  intersection {
  plane {z,0.2}
  plane {z,0.2 rotate 120*y}
  plane {z,0.2 rotate 240*y}
}

triangle {
  <0,0,-2*0.3>, vrotate(<0,0,-2*0.3>,y*120), vrotate(<0,0,-2*0.3>,y*240)
  pigment {
    object {
      PlaneIntersectionObject
      color rgb <1,0,0>  // Red Border
      color rgb <1,1,0>  // Yellow Triangle
    }
  }
}


Post a reply to this message

From: Stephen
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 12:02:50
Message: <08cl44tgprm9n8s45f92uh5ds2dl8ds8dh@4ax.com>
On Sat, 7 Jun 2008 09:48:30 -0500, "Catseye" <jpf### [at] comcastnet>
wrote:

>Thanks Stephen,
>
>I had already explored the link on POV's home page.  It's touted to work 
>with "mesh2" objects.  Do you know if it also works also on 
>"triangle"-generated objects?
>
I'm sorry Jim, I don't know.
-- 

Regards
     Stephen


Post a reply to this message

From: Catseye
Subject: Re: Applying a Border to a "triangle"
Date: 7 Jun 2008 16:31:18
Message: <484af016$1@news.povray.org>
Perfect! - that's cool!

Thanks for sharing the example.

Jim

"Chris B" <nom### [at] nomailcom> wrote in message 
news:484aa734@news.povray.org...
>
> "Catseye" <jpf### [at] comcastnet> wrote in message 
> news:484a89cb$1@news.povray.org...
>> If I comprehend what you are saying about the method to color the edge 
>> (90 degrees from the face) of a solid triangle; however that's not what I 
>> need. If possible I need to be able to generate a border around the 
>> triangle face (visible looking at the face the face).
>>
>
> No that's not it. Using an object as a pigment colours everything outside 
> the conceptual 'object' one colour and everything inside the conceptual 
> 'object' another colour. When such a pigment is applied to a surface you 
> see the outline of the section of the shape as the real object 'cuts 
> through' the pattern. In this case, if we slice the pattern at right 
> angles we get a yellow triangle with a red border. Here's a complete 
> example using the triangle object.
>
> camera {location <0,2,-0.01> look_at 0}
> light_source {   <-4,75 ,-10   >, rgb 1}
>
> #declare PlaneIntersectionObject =  intersection {
>  plane {z,0.2}
>  plane {z,0.2 rotate 120*y}
>  plane {z,0.2 rotate 240*y}
> }
>
> triangle {
>  <0,0,-2*0.3>, vrotate(<0,0,-2*0.3>,y*120), vrotate(<0,0,-2*0.3>,y*240)
>  pigment {
>    object {
>      PlaneIntersectionObject
>      color rgb <1,0,0>  // Red Border
>      color rgb <1,1,0>  // Yellow Triangle
>    }
>  }
> }
>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.