POV-Ray : Newsgroups : povray.unofficial.patches : csg error with megapov's solid mesh? Server Time
2 Sep 2024 04:12:50 EDT (-0400)
  csg error with megapov's solid mesh? (Message 11 to 20 of 35)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 12:11:02
Message: <39abe095@news.povray.org>
Chris Huff <chr### [at] maccom> wrote:
: Just an idea, but could it help to test multiple times with different 
: vectors to avoid these errors? Just use the result that the majority of 
: vectors produce.

  There's one problem here.
  Suppose that you shoot two rays instead of one, to be sure. Then one
ray says that you are outside, the other one says that you are inside.
What do you do?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nicolas Calimet
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 12:17:31
Message: <39ABE49D.E1A2E206@free.fr>
>   There's one problem here.
>   Suppose that you shoot two rays instead of one, to be sure. Then one
> ray says that you are outside, the other one says that you are inside.
> What do you do?

	Check at least three rays in the x/y/z directions ?


*** Nicolas Calimet
*** http://pov4grasp.free.fr


Post a reply to this message

From: Chris Huff
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 12:20:59
Message: <chrishuff-D69A73.11223129082000@news.povray.org>
In article <39abe095@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   There's one problem here.
>   Suppose that you shoot two rays instead of one, to be sure. Then one
> ray says that you are outside, the other one says that you are inside.
> What do you do?

Easy: shoot a third one.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Warp
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 12:24:28
Message: <39abe3bc@news.povray.org>
I have done this kind of triangle mesh "fixing" myself (in my triangle
mesh smoother program).
  The idea is quite simple:

  1. Take the first triangle and mark it as 'handled'.

  2. Search all the triangles which are adjacent to this one and are
     not marked as 'handled'. An adjacent triangle is one that shares two
     vertices with this one.

  3. Check if the adjacent triangle is ordered correctly. That is, if the
     shared vertices are listed in inverse order in the adjacent triangle than
     in the current triangle, then it's ok. If they are listed in the same
     order, then you have to swap the other triangle.

  4. Now mark these adjacent triangles as 'handled' and for each one of them
     make recursively steps 2, 3 and 4 until no more triangles are found.

  5. After that, search for some unhandled triangle. If the mesh consisted of
     one contiguous surface, you'll not find any, but you have to do this
     because the mesh may consist of several separate parts. If you find
     an unhandled triangle, make all steps 1, 2, 3, 4 and 5 for it.


  This works pretty well, but it's very slow, specially with big meshes.
The slowest step is the second one (ie. the searching). There's probably some
way of speeding it up using some tree structure or hash table.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 12:29:02
Message: <39abe4ce@news.povray.org>
Chris Huff <chr### [at] maccom> wrote:
: Easy: shoot a third one.

  Could it be possible that two of them are wrong and one is right?-)

  All right, all right, I know that it's more probable that two are right
and one wrong and the other way around is a very rare case.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 14:28:56
Message: <slrn8qo0vq.1fc.ron.parker@fwi.com>
On 29 Aug 2000 12:24:28 -0400, Warp wrote:
>  I have done this kind of triangle mesh "fixing" myself (in my triangle
>mesh smoother program).
>  The idea is quite simple:
>
>  1. Take the first triangle and mark it as 'handled'.
>
>  2. Search all the triangles which are adjacent to this one and are
>     not marked as 'handled'. An adjacent triangle is one that shares two
>     vertices with this one.
>
>  3. Check if the adjacent triangle is ordered correctly. That is, if the
>     shared vertices are listed in inverse order in the adjacent triangle than
>     in the current triangle, then it's ok. If they are listed in the same
>     order, then you have to swap the other triangle.
>
>  4. Now mark these adjacent triangles as 'handled' and for each one of them
>     make recursively steps 2, 3 and 4 until no more triangles are found.
>
>  5. After that, search for some unhandled triangle. If the mesh consisted of
>     one contiguous surface, you'll not find any, but you have to do this
>     because the mesh may consist of several separate parts. If you find
>     an unhandled triangle, make all steps 1, 2, 3, 4 and 5 for it.
>
>
>  This works pretty well, but it's very slow, specially with big meshes.
>The slowest step is the second one (ie. the searching). There's probably some
>way of speeding it up using some tree structure or hash table.

You missed a step.  After you finish all the surfaces, you have to make sure 
they're correctly oriented.  Even if it's just one surface, you have to 
make sure you haven't inverted it.

The searching would be faster if each edge were a structure containing 
pointers to the two triangles that share it.  Building such a structure 
would be O(n log n).


-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: ryan constantine
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 18:28:47
Message: <39AC391A.659EAEFF@yahoo.com>
what kind of meshes does this work on?  can it convert from regular to
mesh2?

Warp wrote:
> 
>   I have done this kind of triangle mesh "fixing" myself (in my triangle
> mesh smoother program).
>   The idea is quite simple:
> 
>   1. Take the first triangle and mark it as 'handled'.
> 
>   2. Search all the triangles which are adjacent to this one and are
>      not marked as 'handled'. An adjacent triangle is one that shares two
>      vertices with this one.
> 
>   3. Check if the adjacent triangle is ordered correctly. That is, if the
>      shared vertices are listed in inverse order in the adjacent triangle than
>      in the current triangle, then it's ok. If they are listed in the same
>      order, then you have to swap the other triangle.
> 
>   4. Now mark these adjacent triangles as 'handled' and for each one of them
>      make recursively steps 2, 3 and 4 until no more triangles are found.
> 
>   5. After that, search for some unhandled triangle. If the mesh consisted of
>      one contiguous surface, you'll not find any, but you have to do this
>      because the mesh may consist of several separate parts. If you find
>      an unhandled triangle, make all steps 1, 2, 3, 4 and 5 for it.
> 
>   This works pretty well, but it's very slow, specially with big meshes.
> The slowest step is the second one (ie. the searching). There's probably some
> way of speeding it up using some tree structure or hash table.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nathan Kopp
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 18:52:22
Message: <39ac3ea6@news.povray.org>
"ryan constantine" <rco### [at] yahoocom> wrote...
> > >, or do i need to convert to mesh2?  if so how?  or can i use
> > > uv mapping?  how?
> >
> > Yes.
>
> which?  all?

Yes, you can use uv mapping. You do not have to convert to mesh2.

> i read it, but i'm a little foggy.  as a regular mesh, there are no face
> entries right?  unless i'm blind i only saw instructions for texturing
> mesh2 objects.

Are you looking in the MegaPov documentation or the official POV 3.1
documentation?  I was referring to the 3.1 docs.  From that documentation,
in the "Mesh Object" section, you'll read:

------ begin quote -------
Now let's begin. We will create a simple box with differently colored sides.
We create an empty file called meshdemo.pov and add the following lines.

  camera {
    location <20, 20, -50>
    look_at <0, 5, 0>
  }
  light_source { <50, 50, -50> color rgb<1, 1, 1> }
  #declare Red = texture {
    pigment { color rgb<0.8, 0.2, 0.2> }
    finish { ambient 0.2 diffuse 0.5 }
  }
  #declare Green = texture {
    pigment { color rgb<0.2, 0.8, 0.2> }
    finish { ambient 0.2 diffuse 0.5 }
  }
  #declare Blue = texture {
    pigment { color rgb<0.2, 0.2, 0.8> }
    finish { ambient 0.2 diffuse 0.5 }
  }

We must declare all textures we want to use inside the mesh before the mesh
is created. Textures cannot be specified inside the mesh due to the poor
memory performance that would result.

Now we add the mesh object. Three sides of the box will use individual
textures while the other will use the global mesh texture.

  mesh {
    /* top side */
    triangle { <-10, 10, -10>, <10, 10, -10>, <10, 10, 10>
      texture { Red }
    }
    triangle { <-10, 10, -10>, <-10, 10, 10>, <10, 10, 10>
      texture { Red }
    }
    /* bottom side */
    triangle { <-10, -10, -10>, <10, -10, -10>, <10, -10, 10> }
    triangle { <-10, -10, -10>, <-10, -10, 10>, <10, -10, 10> }
    /* left side */
    triangle { <-10, -10, -10>, <-10, -10, 10>, <-10, 10, 10> }
    triangle { <-10, -10, -10>, <-10, 10, -10>, <-10, 10, 10> }
    /* right side */
    triangle { <10, -10, -10>, <10, -10, 10>, <10, 10, 10>
      texture { Green }
    }
    triangle { <10, -10, -10>, <10, 10, -10>, <10, 10, 10>
      texture { Green }
    }
    /* front side */
    triangle { <-10, -10, -10>, <10, -10, -10>, <-10, 10, -10>
      texture { Blue }
    }
    triangle { <-10, 10, -10>, <10, 10, -10>, <10, -10, -10>
      texture { Blue }
    }
    /* back side */
    triangle { <-10, -10, 10>, <10, -10, 10>, <-10, 10, 10> }
    triangle { <-10, 10, 10>, <10, 10, 10>, <10, -10, 10> }
    texture {
      pigment { color rgb<0.9, 0.9, 0.9> }
      finish { ambient 0.2 diffuse 0.7 }
    }
  }
--------- end quote --------

>  is there a uv mapping tut' out there?

I don't think there currently is.  Sorry.

-Nathan


Post a reply to this message

From: ryan constantine
Subject: Re: csg error with megapov's solid mesh?
Date: 29 Aug 2000 23:05:10
Message: <39AC79E7.D9EC59F0@yahoo.com>
thanks, i was thinking that uv mapping was megapov only so i was only
looking there.  no i just have to figure out which tringle is which and
what i want to texture it with.

Nathan Kopp wrote:
> 
> "ryan constantine" <rco### [at] yahoocom> wrote...
> > > >, or do i need to convert to mesh2?  if so how?  or can i use
> > > > uv mapping?  how?
> > >
> > > Yes.
> >
> > which?  all?
> 
> Yes, you can use uv mapping. You do not have to convert to mesh2.
> 
> > i read it, but i'm a little foggy.  as a regular mesh, there are no face
> > entries right?  unless i'm blind i only saw instructions for texturing
> > mesh2 objects.
> 
> Are you looking in the MegaPov documentation or the official POV 3.1
> documentation?  I was referring to the 3.1 docs.  From that documentation,
> in the "Mesh Object" section, you'll read:
> 
> ------ begin quote -------
> Now let's begin. We will create a simple box with differently colored sides.
> We create an empty file called meshdemo.pov and add the following lines.
> 
>   camera {
>     location <20, 20, -50>
>     look_at <0, 5, 0>
>   }
>   light_source { <50, 50, -50> color rgb<1, 1, 1> }
>   #declare Red = texture {
>     pigment { color rgb<0.8, 0.2, 0.2> }
>     finish { ambient 0.2 diffuse 0.5 }
>   }
>   #declare Green = texture {
>     pigment { color rgb<0.2, 0.8, 0.2> }
>     finish { ambient 0.2 diffuse 0.5 }
>   }
>   #declare Blue = texture {
>     pigment { color rgb<0.2, 0.2, 0.8> }
>     finish { ambient 0.2 diffuse 0.5 }
>   }
> 
> We must declare all textures we want to use inside the mesh before the mesh
> is created. Textures cannot be specified inside the mesh due to the poor
> memory performance that would result.
> 
> Now we add the mesh object. Three sides of the box will use individual
> textures while the other will use the global mesh texture.
> 
>   mesh {
>     /* top side */
>     triangle { <-10, 10, -10>, <10, 10, -10>, <10, 10, 10>
>       texture { Red }
>     }
>     triangle { <-10, 10, -10>, <-10, 10, 10>, <10, 10, 10>
>       texture { Red }
>     }
>     /* bottom side */
>     triangle { <-10, -10, -10>, <10, -10, -10>, <10, -10, 10> }
>     triangle { <-10, -10, -10>, <-10, -10, 10>, <10, -10, 10> }
>     /* left side */
>     triangle { <-10, -10, -10>, <-10, -10, 10>, <-10, 10, 10> }
>     triangle { <-10, -10, -10>, <-10, 10, -10>, <-10, 10, 10> }
>     /* right side */
>     triangle { <10, -10, -10>, <10, -10, 10>, <10, 10, 10>
>       texture { Green }
>     }
>     triangle { <10, -10, -10>, <10, 10, -10>, <10, 10, 10>
>       texture { Green }
>     }
>     /* front side */
>     triangle { <-10, -10, -10>, <10, -10, -10>, <-10, 10, -10>
>       texture { Blue }
>     }
>     triangle { <-10, 10, -10>, <10, 10, -10>, <10, -10, -10>
>       texture { Blue }
>     }
>     /* back side */
>     triangle { <-10, -10, 10>, <10, -10, 10>, <-10, 10, 10> }
>     triangle { <-10, 10, 10>, <10, 10, 10>, <10, -10, 10> }
>     texture {
>       pigment { color rgb<0.9, 0.9, 0.9> }
>       finish { ambient 0.2 diffuse 0.7 }
>     }
>   }
> --------- end quote --------
> 
> >  is there a uv mapping tut' out there?
> 
> I don't think there currently is.  Sorry.
> 
> -Nathan


Post a reply to this message

From: Jérôme Berger
Subject: Re: csg error with megapov's solid mesh?
Date: 30 Aug 2000 04:46:25
Message: <39ACC9DE.5F1D0365@enst.fr>
ryan constantine wrote:
> 
> thanks, i was thinking that uv mapping was megapov only so i was only
> looking there.  no i just have to figure out which tringle is which and
> what i want to texture it with.
> 
	uv mapping is megapov only. For a tutorial on uv mapping, you can look
here: http://www.mediaport.net/Artichaud/Tran/sources/tutuve.htm


-- 

* Doctor Jekyll had something * mailto:ber### [at] inamecom
* to Hyde...                  * http://www.enst.fr/~jberger
*******************************


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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