POV-Ray : Newsgroups : povray.general : Please help with some really hard math Server Time
5 Nov 2024 05:23:44 EST (-0500)
  Please help with some really hard math (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Peter Popov
Subject: Please help with some really hard math
Date: 12 Jul 1999 13:58:48
Message: <378c1f9d.33971555@204.213.191.228>
Greetings all.

Suppose I have a sphere that is electrostatically charged. The
intensity of its field at any point in space is proportional to the
reciprocal squared distance, and the vector points away from the
sphere. For a plane, it's easy. I think I can manage torii, cylinders,
and cones. Even non-smoothed meshes.

How about a smoothed mesh? OK, I have all the vertices and
corresponding normals stored in two arrays, but then what? How should
I proceed to calculate the field vector and intensity at an arbitrary
point in space?

And yeah, I am talking about POV script here, not C :)

Thanks in advance for any help.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Lewis
Subject: Re: Please help with some really hard math
Date: 12 Jul 1999 15:14:13
Message: <378A3DE1.A2E3FC55@netvision.net.il>
Calculate the distance from the origin sphere with a sqrt(x^2+y^2+z^2),
and the direction is always either towards the sphere or away from it
(which is your normal). I didn't really get what you are trying to do
with the mesh, tho.

Peter Popov wrote:
> 
> Greetings all.
> 
> Suppose I have a sphere that is electrostatically charged. The
> intensity of its field at any point in space is proportional to the
> reciprocal squared distance, and the vector points away from the
> sphere. For a plane, it's easy. I think I can manage torii, cylinders,
> and cones. Even non-smoothed meshes.
> 
> How about a smoothed mesh? OK, I have all the vertices and
> corresponding normals stored in two arrays, but then what? How should
> I proceed to calculate the field vector and intensity at an arbitrary
> point in space?
> 
> And yeah, I am talking about POV script here, not C :)
> 
> Thanks in advance for any help.
> 
> Peter Popov
> ICQ: 15002700


Post a reply to this message

From: Josh English
Subject: Re: Please help with some really hard math
Date: 12 Jul 1999 16:00:56
Message: <378A4942.1EF16290@spiritone.com>
A smooth mesh should hold the same positions in space a a non-smoothed
mesh, so the distance to the surface should be the same.
I'm not sure how the normal vector would affect an electrostatic field.
You need to calculate the closest point between the mesh and your
arbitrary point to determine the strength of the field.

Joshua
eng### [at] spiritonecom

Peter Popov wrote:

> Greetings all.
>
> Suppose I have a sphere that is electrostatically charged. The
> intensity of its field at any point in space is proportional to the
> reciprocal squared distance, and the vector points away from the
> sphere. For a plane, it's easy. I think I can manage torii, cylinders,
> and cones. Even non-smoothed meshes.
>
> How about a smoothed mesh? OK, I have all the vertices and
> corresponding normals stored in two arrays, but then what? How should
> I proceed to calculate the field vector and intensity at an arbitrary
> point in space?
>
> And yeah, I am talking about POV script here, not C :)
>
> Thanks in advance for any help.
>
> Peter Popov
> ICQ: 15002700


Post a reply to this message

From: Jerry Anning
Subject: Re: Please help with some really hard math
Date: 12 Jul 1999 16:08:43
Message: <378a49d9.12492603@news.povray.org>
On Mon, 12 Jul 1999 17:57:49 GMT, pet### [at] usanet (Peter Popov)
wrote:


>Suppose I have a sphere that is electrostatically charged. The
>intensity of its field at any point in space is proportional to the
>reciprocal squared distance, and the vector points away from the
>sphere. For a plane, it's easy. I think I can manage torii, cylinders,
>and cones. Even non-smoothed meshes.
>
>How about a smoothed mesh? OK, I have all the vertices and
>corresponding normals stored in two arrays, but then what? How should
>I proceed to calculate the field vector and intensity at an arbitrary
>point in space?
>
>And yeah, I am talking about POV script here, not C :)

Take your existing vertices and apply Catmull-Rom spline
interpolation.  (Use Catmull-Rom because it makes determining normals
trivial).  Use points from the resulting spline to refine the
triangulation until it is accurate enough to suit you.  Then use your
non-smoothed mesh method.  Just a suggestion off the top of my head.

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

From: Peter Popov
Subject: Re: Please help with some really hard math
Date: 13 Jul 1999 06:30:21
Message: <378c0fe7.2404515@204.213.191.228>
On Mon, 12 Jul 1999 13:00:02 -0700, Josh English
<eng### [at] spiritonecom> wrote:

>A smooth mesh should hold the same positions in space a a non-smoothed
>mesh, so the distance to the surface should be the same.
>I'm not sure how the normal vector would affect an electrostatic field.
>You need to calculate the closest point between the mesh and your
>arbitrary point to determine the strength of the field.
>
>Joshua
>eng### [at] spiritonecom

Distance to the mesh is not a problem. The problem is elsewhere. 

Electrostatic field line start at the surface of the charged object
pointing at the direction of the normal and extend to infinity
retaining their direction (in a closed system, anyway). If the mesh is
unsmoothed this can be represented as infinite straight triangular
prisms starting at the faces of the mesh. Obviously there's no way to
cover the whole space this way unless the faces are infinitesimally
small. This is of course unacceptable.

On the other hand, a closed smooth mesh would generate a continuous
field because the normal blends smoothly (well, more or less). The
intensity of the field at a point A in space depends not on the
distance to the mesh but rather on the distance to that point of the
mesh whose normal points at A. That's what makes it complicated. If it
were a primative then the problem is relatively easily solved by the
Gauss equations. The gradient to a smoothed mesh, however, is
something beyond the scope of my math abilities.

So here I state the problem again, more clearly. Given a closed smooth
mesh M and a pont in space P outside the mesh, find the point(s) on M
whose normal(s) point at P.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Jerry Anning
Subject: Re: Please help with some really hard math
Date: 13 Jul 1999 12:41:53
Message: <378b61f8.7213444@news.povray.org>
On Tue, 13 Jul 1999 10:29:31 GMT, pet### [at] usanet (Peter Popov)
wrote:

>So here I state the problem again, more clearly. Given a closed smooth
>mesh M and a pont in space P outside the mesh, find the point(s) on M
>whose normal(s) point at P.

Here is another intuitive stab at the problem stated this way.
For each (possibly relevant) triangle of the mesh:
  If the normals of the three corners all point east of the target
point (or all point west ..., north..., above..., etc.) then that
triangle is irrelevant.
  For each remaining relevant triangle, there will be several cases:
    If all three vertices have normals pointing at the target, the
whole triangle will, so you will have to integrate over the triangle.
    If two vertices do, integrate over the line between them.
    If only one vertex does, use it.
    If no vertices have normals pointing at the target, and at least
two vertices have normals pointing into different "hemispheres" around
the target as determined above, then by continuity, there will be a
point in or on the triangle that has a normal pointing at the target.
In this case, proceed as follows:
      For each vertex of the triangle, compute a vector pointing at
the target from that point.
      Find the angle between that vector and the given normal at the
vertex (in radians).
      If it is greater than pi, subtract pi.
     Divide the result by pi.  You should have a number between zero
and one.
      Add the three numbers you just calculated together and divide
each one by the sum.  The three numbers will now sum to one, so you
have barycentric coordinates for a point on the triangle.
      Take the coordinates of each vertex (the point itself, not the
normal)  and multiply each component by the barycentric coordinate
calculated for that vertex.
      Add the transformed coordinates for each of the vertices
together componentwise.
      The result should be the coordinates of the appropriate point in
or on that triangle.

I don't have a formal proof that this will work, but give it a shot.

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

From: Peter Popov
Subject: Re: Please help with some really hard math
Date: 14 Jul 1999 14:00:14
Message: <378ccd8a.19372517@204.213.191.228>
On Tue, 13 Jul 1999 16:41:34 GMT, nos### [at] despamcom (Jerry Anning)
wrote:

>Here is another intuitive stab at the problem stated this way.
>For each (possibly relevant) triangle of the mesh:
>  If the normals of the three corners all point east of the target
>point (or all point west ..., north..., above..., etc.) then that
>triangle is irrelevant.

I don't quite get that. The target is a point in space and thus the
chance of any of the normals to point directly at it is
infinitesimally small. Some hidden line removal algorithm will be
useful, if that's what you meant, like ignoring all triangles whose
normals point at the semi-space (about the plane of the triangle) not
containing the target point.

>  For each remaining relevant triangle, there will be several cases:
>    If all three vertices have normals pointing at the target, the
>whole triangle will, so you will have to integrate over the triangle.
>    If two vertices do, integrate over the line between them.
>    If only one vertex does, use it.

As above, I don't quite understand what you mean by pointing at the
target.

>    If no vertices have normals pointing at the target, and at least
>two vertices have normals pointing into different "hemispheres" around

What hemispheres do you have in mind?

>the target as determined above, then by continuity, there will be a
>point in or on the triangle that has a normal pointing at the target.
>In this case, proceed as follows:
>      For each vertex of the triangle, compute a vector pointing at
>the target from that point.
>      Find the angle between that vector and the given normal at the
>vertex (in radians).
>      If it is greater than pi, subtract pi.
>     Divide the result by pi.  You should have a number between zero
>and one.
>      Add the three numbers you just calculated together and divide
>each one by the sum.  The three numbers will now sum to one, so you
>have barycentric coordinates for a point on the triangle.

What are barycentric coordinates?

>      Take the coordinates of each vertex (the point itself, not the
>normal)  and multiply each component by the barycentric coordinate
>calculated for that vertex.
>      Add the transformed coordinates for each of the vertices
>together componentwise.
>      The result should be the coordinates of the appropriate point in
>or on that triangle.

I hope so :)

>I don't have a formal proof that this will work, but give it a shot.

if you would please explain the above items which are quite ambiguous
to my not-so-mathematical and totally coffeeless mind, I'd give it a
shot as you say. Thanks for your help.

>Jerry Anning
>clem "at" dhol "dot" com


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Axel Hecht
Subject: Re: Please help with some really hard math
Date: 14 Jul 1999 16:16:08
Message: <378CF007.E74FAC1D@numerik.uni-kiel.de>
Peter Popov wrote:
> 
> Greetings all.
> 
> Suppose I have a sphere that is electrostatically charged. The
> intensity of its field at any point in space is proportional to the
> reciprocal squared distance, and the vector points away from the
> sphere. For a plane, it's easy. I think I can manage torii, cylinders,
> and cones. Even non-smoothed meshes.
> 
> How about a smoothed mesh? OK, I have all the vertices and
> corresponding normals stored in two arrays, but then what? How should
> I proceed to calculate the field vector and intensity at an arbitrary
> point in space?
> 
> And yeah, I am talking about POV script here, not C :)
> 
> Thanks in advance for any help.
> 
> Peter Popov
> ICQ: 15002700


Uhhhmmmm.......

Peter, are you talking about a meshed representation of a squere? Then
don't bother about the mesh. Or are you trying to compute the electric
field for an arbitrary body given by a mesh? Then don't bother about the
sphere.

The (infinite) plane has a completely different electric field than the
point load. E.g. it is constant. Just image two plates of a condensator,
the field in the middle (just far enough from the egdes) is constant.

I guess, you wan't to do the latter (general body).
The only way I can think of for doing the thing you want is via the
Green's function for electrostatics. This is in principal just the thing
you did above for each and every microscopic charge. Thus, this get's an
integral in the end. And I would use the unsmoothed mesh for that.
The electric field is given by
E = (4\pi\epsilon_0)^{-1} \int \rho (r-r_0)/|r-r_0|^3 dV
This is an integral over the density of the electric charge times the
radial term over the complete space. You than take the distribution of
the charge as a 2D density on the surface of your body,
E = \sum{over all triangles} \int{triangle} \rho_{2d} ()/||^3 dA
which is a sum over integrals over areas.
This cannot be done analytically, at least maple did'nt. So you go for
gaussion quadrature formulae.

These and further explanations on request. I guess you're fate is just
vanishing. And I don't really know how much explanation of physics
and/or algorithms you need

Dipl. Phys. Axel Hecht.

Yes, I have been studying physics. And now I am in scientific computing.
Excuse the long an tough answer.


Post a reply to this message

From: Jerry Anning
Subject: Re: Please help with some really hard math
Date: 14 Jul 1999 16:53:42
Message: <378cf2ef.28132486@news.povray.org>
On Wed, 14 Jul 1999 17:59:10 GMT, pet### [at] usanet (Peter Popov)
wrote:

>On Tue, 13 Jul 1999 16:41:34 GMT, nos### [at] despamcom (Jerry Anning)
>wrote:
>
>>Here is another intuitive stab at the problem stated this way.
>>For each (possibly relevant) triangle of the mesh:
>>  If the normals of the three corners all point east of the target
>>point (or all point west ..., north..., above..., etc.) then that
>>triangle is irrelevant.
>
>I don't quite get that. The target is a point in space and thus the
>chance of any of the normals to point directly at it is
>infinitesimally small. Some hidden line removal algorithm will be
>useful, if that's what you meant, like ignoring all triangles whose
>normals point at the semi-space (about the plane of the triangle) not
>containing the target point.

By "possibly relevant" I mean every triangle some hidden line algo
would show from a camera at the target point.  By the normals part, I
mean: make a triangular prism by extending the normals of the triangle
out further than the distance to the target point.  If the target
point isn't in or on that prism, that triangle is also irrelevant.

>>  For each remaining relevant triangle, there will be several cases:
>>    If all three vertices have normals pointing at the target, the
>>whole triangle will, so you will have to integrate over the triangle.
>>    If two vertices do, integrate over the line between them.
>>    If only one vertex does, use it.
>
>As above, I don't quite understand what you mean by pointing at the
>target.

If that normal, extended enough, would intersect the target point.  As
you say, it is unlikely.  For bulletproofing, the case must be
considered
. 
>>    If no vertices have normals pointing at the target, and at least
>>two vertices have normals pointing into different "hemispheres" around
>
>What hemispheres do you have in mind?

In other words, the case remaining.  The target point is strictly
inside the triangular prism I mentioned above.

>>the target as determined above, then by continuity, there will be a
>>point in or on the triangle that has a normal pointing at the target.
>>In this case, proceed as follows:
>>      For each vertex of the triangle, compute a vector pointing at
>>the target from that point.
>>      Find the angle between that vector and the given normal at the
>>vertex (in radians).
>>      If it is greater than pi, subtract pi.
>>     Divide the result by pi.  You should have a number between zero
>>and one.
>>      Add the three numbers you just calculated together and divide
>>each one by the sum.  The three numbers will now sum to one, so you
>>have barycentric coordinates for a point on the triangle.
>
>What are barycentric coordinates?

given a (convex) n-gon (it doesn't have to be regular), a set of n
numbers that sums to one is a set of barycentric coordinates for that
n-gon.  By multiplying the elements of the  (Cartesian) coordinates of
each vertex of that n-gon by the barycentric coordinate corresponding
to that vertex and adding the n sets of modified coordinates that
result, you get Cartesian coordinates of a point in or on that n-gon.
This is useful for many purposes.  Some POV-related things I have done
with these coordinates are: picking a random point inside a polygon
(to pace an object there) and producing an image of the sinc function
(the "splash with ripples" thing, (sin(x)/x)) with the border
constrained to lie inside a pentagon - without having to use messy csg
or clipping.  Incidentally, if my memory serves (it often doesn't),
this should also work for a convex n-hedron (as, for example, a
triangle mesh with no "dents").

>>      Take the coordinates of each vertex (the point itself, not the
>>normal)  and multiply each component by the barycentric coordinate
>>calculated for that vertex.
>>      Add the transformed coordinates for each of the vertices
>>together componentwise.
>>      The result should be the coordinates of the appropriate point in
>>or on that triangle.
>
>I hope so :)
>
>>I don't have a formal proof that this will work, but give it a shot.
>
>if you would please explain the above items which are quite ambiguous
>to my not-so-mathematical and totally coffeeless mind, I'd give it a
>shot as you say. Thanks for your help.

If (with coffee) this still doesn't make sense, write me direct and
I'll send some doc on barycentric coordinates and try to put together
a demo.


Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

From: Alain CULOS
Subject: Re: Please help with some really hard math
Date: 30 Jul 1999 17:41:11
Message: <37A21C5C.76FE232E@bigfoot.com>
Hi there,

Sorry to butt in so late, but !
IMHO this should really be handled at C level. I know programming is
not that easy. But really what you are talking about is just an iso
surface function. So why not benefit of what the isosurface has to
offer to you.
It's there, already programmed, accessible for whatever purpose : not
just tracing, but evaluating the value at any point you wish.
I hope I'm not wrong in my assumptions, but I really think the answer
is there at your finger tips : use the superpatch.

Cheers,
Al.


Peter Popov wrote:

> Greetings all.
>
> Suppose I have a sphere that is electrostatically charged. The
> intensity of its field at any point in space is proportional to the
> reciprocal squared distance, and the vector points away from the
> sphere. For a plane, it's easy. I think I can manage torii, cylinders,
> and cones. Even non-smoothed meshes.
>
> How about a smoothed mesh? OK, I have all the vertices and
> corresponding normals stored in two arrays, but then what? How should
> I proceed to calculate the field vector and intensity at an arbitrary
> point in space?
>
> And yeah, I am talking about POV script here, not C :)
>
> Thanks in advance for any help.
>
> Peter Popov
> ICQ: 15002700

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :

To answer me, please take out the Z from my address.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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