POV-Ray : Newsgroups : povray.general : inside_vector ??? Server Time
5 Aug 2024 18:21:57 EDT (-0400)
  inside_vector ??? (Message 18 to 27 of 27)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tom Melly
Subject: Re: inside_vector ???
Date: 6 Sep 2002 05:26:25
Message: <3d7874c1$1@news.povray.org>
"Ernst Fritsch" <ern### [at] citywebde> wrote in message
news:web.3d779780d2c57d2a751dcdca0@news.povray.org...

<snip>

Judging from the various responses, it would seem a minor clarification in the
docs might be a good idea ;)

Catch-22 (no. 600) Only a person who understands a concept can explain it. Only
a person who doesn't understand a concept can decide whether the explanation is
complete.


Post a reply to this message

From: Le Forgeron
Subject: Re: inside_vector ???
Date: 6 Sep 2002 05:37:11
Message: <3D787760.6040002@free.fr>
Warp wrote:

> Slime <slm### [at] slimelandcom> wrote:
> 
>>To determine if point A is inside the mesh, with the information that point
>>B *is*, shoot a ray from point A to point B, counting the number of times it
>>intersects the mesh. If it intersects an even number of times (counting 0 as
>>even), then A is inside the mesh.
>>
> 
>   Possibly, but AFAIK the intersection test of a ray and the mesh returns
> all the intersections,


It should, but the mesh code is 'optimised' to return only the nearest.
At least it was so in 3.1 code. It was one of the two reason Mesh where 
bad in CSG (there is a kludge in the mesh code testing if the 
intersection is part of a CSG or not, if not only the first intersection 
was computed).
And I still do not trust mesh now.


Post a reply to this message

From: Christoph Hormann
Subject: Re: inside_vector ???
Date: 6 Sep 2002 05:40:52
Message: <3D787825.B3AE949F@gmx.de>
Tom Melly wrote:
> 
> [...]
> 
> Catch-22 (no. 600) Only a person who understands a concept can explain it. Only
> a person who doesn't understand a concept can decide whether the explanation is
> complete.

No, a person not familiar with the details is qualified to decide whether
an explanation is generally understandable but not whether it is
complete.  

The text about inside_vector is surely not the easiest to understand for
the beginner but it is correct and precisely and completely describes how
things work.  Some hints how to choose the inside vector would be useful
probably but not mandatory IMO.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Ernst Fritsch
Subject: Re: inside_vector ???
Date: 6 Sep 2002 11:50:07
Message: <web.3d78cd8610f4d924df77d9a70@news.povray.org>
Christoph Hormann wrote:
>

>The text about inside_vector is surely not the easiest to understand for
>the beginner but it is correct and precisely and completely describes how
>things work.  Some hints how to choose the inside vector would be useful
>probably but not mandatory IMO.
>
Still I think the number of different opinions about the way this works
shows that the explanation may be complete and correct but definitely
not perfect.
Since a lot of people using POV-Ray are not into the mathematical theories
the program is based on these people (like myself) would appreciate some
hints
even if they may not be mandatory. (Although they are obviously mandatory if
you want "stupid" guys like me to understand that passage).


Post a reply to this message

From: Tom & Lu Melly
Subject: Re: inside_vector ???
Date: 6 Sep 2002 15:32:06
Message: <3d7902b6@news.povray.org>
"Ernst Fritsch" <ern### [at] citywebde> wrote in message
news:web.3d78cd8610f4d924df77d9a70@news.povray.org...

<snip>

What he said - where there is possibility for confusion, why not ammend?
It's not a criticism of the docs - they are of far greater quality than
most, even (hah!) commercial ones.

Still, it's often hard when writing documentation to anticipate exactly what
problems users might run into.

To be honest, I don't think it matters - this forum is more than adequate to
fill in the gaps.


Post a reply to this message

From: Charles Fusner
Subject: Re: inside_vector ???
Date: 6 Sep 2002 19:03:26
Message: <3D793482.1030806@enter.net>
How about the following? I have really only changed the wording
a tiny bit on the explanation of solid mesh (by changing "a point"
to "a point on an object", and beginning with a brief summary of
why meshes used to be a problem to emphasize better why the
solution works.) I've also added something to suggest how to
pick an inside vector (assuming that I'm understanding this
correctly myself). Does this clarify better (and is it technically
correct?)

-------------------------------------------

In order to compute a CSG, POV-Ray must be able to determine if a
portion of a given object lies inside or outside other objects in
the CSG. This used to be a problem, since unlike geometric primitives
a mesh has no mathematically defined "inside". This is no longer a
problem, because of the addition of the "inside_vector" to POV-Ray.

To determine if a point on an object lies inside a mesh, POV-Ray
now fires a ray in an arbitrary direction and tests to see how many
times it intersects the mesh. An odd number of intersections means
that point is in the mesh, and an even number means it is outside.

This usually works, on most completely closed shapes, although it
may still fail on meshes which have gaps or holes in them. It may
sometimes be possible to correct this situation by adding an
inside_vector to your mesh or mesh2. Then, instead of an "arbitrary"
direction, POV will use the direction of your inside_vector. By
choosing a direction that does not point through the gaps on your
mesh (if possible!) the intersection test for insideness may be
made more reliable.

In the end, open shapes are simply not always usable in CSG, but
a carefully chosen inside_vector may sometimes make less than
perfect meshes suffice.


---------------------------------------------------------------






-- 
@C[$F];
The Silver Tome ::  http://www.silvertome.com
"You may sing to my cat if you like..."


Post a reply to this message

From: Mike Williams
Subject: Re: inside_vector ???
Date: 7 Sep 2002 02:22:18
Message: <mLbyPDAQqZe9Ewo3@econym.demon.co.uk>
Wasn't it Charles Fusner who wrote:
>How about the following? I have really only changed the wording
>a tiny bit on the explanation of solid mesh (by changing "a point"
>to "a point on an object", and beginning with a brief summary of
>why meshes used to be a problem to emphasize better why the
>solution works.) I've also added something to suggest how to
>pick an inside vector (assuming that I'm understanding this
>correctly myself). Does this clarify better (and is it technically
>correct?)
>
>-------------------------------------------
>
>In order to compute a CSG, POV-Ray must be able to determine if a
>portion of a given object lies inside or outside other objects in
>the CSG. This used to be a problem, since unlike geometric primitives
>a mesh has no mathematically defined "inside". This is no longer a
>problem, because of the addition of the "inside_vector" to POV-Ray.
>
>To determine if a point on an object lies inside a mesh, POV-Ray
>now fires a ray in an arbitrary direction and tests to see how many
>times it intersects the mesh. An odd number of intersections means
>that point is in the mesh, and an even number means it is outside.
>
>This usually works, on most completely closed shapes, although it
>may still fail on meshes which have gaps or holes in them. It may
>sometimes be possible to correct this situation by adding an
>inside_vector to your mesh or mesh2. Then, instead of an "arbitrary"
>direction, POV will use the direction of your inside_vector. By
>choosing a direction that does not point through the gaps on your
>mesh (if possible!) the intersection test for insideness may be
>made more reliable.
>
>In the end, open shapes are simply not always usable in CSG, but
>a carefully chosen inside_vector may sometimes make less than
>perfect meshes suffice.
>
>
>---------------------------------------------------------------

My understanding (supported by a few quick experiments) is that CSG
never works with mesh objects that don't have an inside_vector
specified, even if they are properly closed.

If the mesh is properly closed, then any non-zero inside_vector can be
used and will produce exactly the same result.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christoph Hormann
Subject: Re: inside_vector ???
Date: 7 Sep 2002 03:05:37
Message: <3D79A541.7A3C90B0@gmx.de>
Charles Fusner wrote:
> 
> How about the following? I have really only changed the wording
> a tiny bit on the explanation of solid mesh (by changing "a point"
> to "a point on an object", and beginning with a brief summary of
> why meshes used to be a problem to emphasize better why the
> solution works.) I've also added something to suggest how to
> pick an inside vector (assuming that I'm understanding this
> correctly myself). Does this clarify better (and is it technically
> correct?)
> 
> [...]

With all respect for your writing abilities i think you text lacks the
understanding of inner workings to a large extent.  First of all your
introductory paragraph is quite misleading since you are talking about 'a
portion of a given object' - in fact only the insideness of individual
points in important.  Also CSG in not the only field in POV-Ray where
solid objects are required (see object pattern and inside() function). 
Finally 'firing' a ray might sound interesting but is definitely not the
common term for this matter.

I think such a long and more elaborate text would belong in the tutorial
section, and in that case should be illustrated with examples etc.  For
the reference section i find the current text way more precise and less
possible misleading.

For example the current text says:

"This will only work for well-behaved meshes, which are completely closed
volumes. If meshes have any holes in them, this might work, but the
results are not guaranteed."

Which is compact and precise.  You write:

"This usually works, on most completely closed shapes, although it may
still fail on meshes which have gaps or holes in them."

But the 'usually', 'most' and 'may' do not really help the reader, they
just irritate him.  Unexperienced users will think there is some kind of
magic randomly making it function or not.  And of course a torus shaped
mesh has a hole and is NTL suited for being solid. :-)

This is just IMHO of course.


Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Charles Fusner
Subject: Re: inside_vector ???
Date: 7 Sep 2002 21:14:25
Message: <3D7AA4B8.4060407@enter.net>
Christoph Hormann wrote:

 >I think such a long and more elaborate text would belong in the
 >tutorial section, and in that case should be illustrated with
 >examples etc.

Agreed completely. I was using search and hyperlinks to find
my way through the docs when I read this section. Didn't even
notice I was in the reference section. You're perfectly right.
A more detailed description belongs either in a tutorial or a
well commented sample scene file.

> 
> With all respect for your writing abilities i think you text lacks the
> understanding of inner workings to a large extent.  First of all your
> introductory paragraph is quite misleading since you are talking about 'a
> portion of a given object' - in fact only the insideness of individual
> points in important.  Also CSG in not the only field in POV-Ray where
> solid objects are required (see object pattern and inside() function). 

True enough. "Point" conceded. <g>

Except of course, that while insideness does matter for much
more (including, I presume, media) we *were* talking about CSG 
originally. Hence, the *user* will be reading with the intent
to learn how to predict what "portion of a given object" will
remain after a difference or intersection. Only the inner
workings of the raytracer will be considering individual points.
And presumably, the program already knows how it works. :)

I agree with your comments about the compactness of the
description, and I certainly see your point about how a
hole doesn't always mean an unclosed volume. Although if
compactness is the aim, why use the non self-explanatory
term "well behaved" one time only and then only to define
it in the same sentence?

> Finally 'firing' a ray might sound interesting but is definitely not the
> common term for this matter.

Gasp! Dear Lord! You mean POV-Ray is using unfired rays?
That sounds so... cold (and possibly dangerous!)

      "T'is a cold, unfired light we trace. "

Does have a ring to it, now that you mention it.
POV-Ray, is, afterall, poetry to us all.


-- 
@C[$F];
The Silver Tome ::  http://www.silvertome.com
"You may sing to my cat if you like..."


Post a reply to this message

From: ezfzx
Subject: Re: inside_vector ???
Date: 20 Jan 2013 17:45:00
Message: <web.50fc730410f4d924132b49cc0@news.povray.org>
Let's see if this example clears things up.

Let's pretend we've created a simple mesh, a single triangle which lies in the
y-z plane.

There is no obvious inside or outside.

Subtract a sphere and you see a circular hole, as if a circle had been cut out
of paper.

difference{
  #local txtr = texture{pigment{rgb x}}
  mesh{
    triangle{ <0,+2,0>, <0,-1,+1>, <0,-1,-1> texture{txtr} }
  }
  sphere{0,0.5 texture{pigment{rgb z}}}
}

No surprise.  Now, add an inside_vector that is parallel to the surface, say,
pointing in the +z direction:

difference{
  #local txtr = texture{pigment{rgb x}}
  mesh{
    triangle{ <0,+2,0>, <0,-1,+1>, <0,-1,-1> texture{txtr} }
    inside_vector +z
  }
  sphere{0,0.5 texture{pigment{rgb z}}}
}

And you STILL see just a hole.

If this were a 3D object, subtracting a sphere would result in a spherical dent.

So why don't see now see a spherical dent?

Because POV-Ray will test every point in the volume space to see if it's inside
or outside the object.

It will run an imaginary line from each point and if that line crosses an odd
number of surfaces, it will decide that point is inside the object.

If that line crosses an even number of surfaces, it will decide that point is
outside the object.

If you are outside the object when the sphere is subtracted, you'd see a
spherical hole.

If you are inside the object when the sphere is subtracted, you'd see a
spherical bump.

But when the inside_vector is parallel to the surface, the imaginary lines from
all of the points in the volume never cross a surface, and so they are all
"outside".

NOW, add an inside_vector that is perpendicular to the surface pointing in the
+x direction:

difference{
  #local txtr = texture{pigment{rgb x}}
  mesh{
    triangle{ <0,+2,0>, <0,-1,+1>, <0,-1,-1> texture{txtr} }
    inside_vector +x
  }
  sphere{0,0.5 texture{pigment{rgb z}}}
}

All points immediately in the -x side of the surface will draw lines pointing +x
and pass through the one surface, so they are considered "inside".

So, now, the spherical bump appears on the -x side, while the +x side sees a
spherical hole.

If we reverse the inside_vector:

difference{
  #local txtr = texture{pigment{rgb x}}
  mesh{
    triangle{ <0,+2,0>, <0,-1,+1>, <0,-1,-1> texture{txtr} }
    inside_vector -x
  }
  sphere{0,0.5 texture{pigment{rgb z}}}
}

The bump/hole switch sides, because now everything on the +x side is "inside".

Hope that clear it all up, ten years after the fact. :)


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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