POV-Ray : Newsgroups : povray.newusers : Applying a Border to a "triangle" : Re: Applying a Border to a "triangle" Server Time
28 Jul 2024 16:26:27 EDT (-0400)
  Re: Applying a Border to a "triangle"  
From: Chris B
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

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