POV-Ray : Newsgroups : povray.advanced-users : How to do a fill in : Re: How to do a fill in Server Time
29 Jul 2024 20:27:43 EDT (-0400)
  Re: How to do a fill in  
From: Francois Labreque
Date: 17 Jan 2001 19:09:51
Message: <3A6633C2.16DA40EB@videotron.ca>
Geoff Wedig wrote:
> 
> I have a set of points on the XY plane which have a clockwise order to form
> a shape.  I want to fill this shape with something.  I can't use a prism
> object for this purpose as it will eventually add a height element.  Does
> anyone know how to generate a mesh to do this?

Method 1:  (The fan)
- You have a set of n points.  Let's call them p1, p2, ... pn
- Make a triangle with {p1, p2, p3}
- Make a triangle with {p1, p3, p4}
- Repeat until you  {p1, pn-1, pn}

Method 2: (The potato-chip)
- You have a set of n points.  Let's call them p1, p2, ... pn
- Find the average of your points .  This is the center of your shape. 
Let's call it C
- Make a triangle with {C, p1, p2 }
- Make a triangle with {C, p2, p3 }
- repeat until you hit {C, pn-1, pn }
- Make a last triangle with { C, pn, p1}

This works with 2D as well as 3D points.

This shouldn't be too hard to script or program.
-- 
Francois Labreque | In the future, performance will be measured
    flabreque     | by the size of your pipe.
        @         |             - Dogbert, on networking
   videotron.ca


Post a reply to this message

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