POV-Ray : Newsgroups : povray.advanced-users : Calculating curvature of a surface? Server Time
26 Nov 2024 17:41:20 EST (-0500)
  Calculating curvature of a surface? (Message 1 to 9 of 9)  
From: Chris Huff
Subject: Calculating curvature of a surface?
Date: 2 Dec 1999 19:26:50
Message: <chrishuff_99-21AC9A.19270102121999@news.povray.org>
I am working on a curvature pattern, inspired by the patina thread, 
which would be for textures only(it would return a constant value if 
used in media density). It would return a value depending on the amount 
the surface the evaluation point is on is curving.

I am doing this by getting the normal at the evaluation point, using 
that normal to find a point directly "up" at that point, and firing 
several sample rays at the surface. I can either fire the rays in a ring 
at an equal angle to the normal at the evaluation point, or randomly 
inside a cone.
My question is: what is a good way of calculating the curvature of a 
surface given several points on a surface and normals at those 
points(and of course, the number of samples)?
I am thinking the pattern should work return a value between 0 for 
maximum curvature away from the normal of the evaluation point and 1 for 
maximum curvature toward the normal. But I am not even really sure what 
"maximum curvature" is. :-)

I have considered using the average vdot of the sample normals with the 
normal of the evaluation point, the average distance of the sample 
points from the point the samples are shot from, using parallel sample 
rays instead of rays originating from a point...

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Kevin Wampler
Subject: Re: Calculating curvature of a surface?
Date: 2 Dec 1999 23:38:50
Message: <387028BC.31573882@tapestry.tucson.az.us>
Well, this is mostly a guess, and almost certainly isn't representative of
the actual, mathematical curvature of a surface (or one of the curvature
measurements), especially since, if I remember correctly, the curvature of
a 3-D surface is no simple thing.  It may, however, suffice for the
purposes of a POV pattern.

For each evaluation point, you have found the normals of n other nearby
points, which are s units away from the evaluation point.  For each vector,
the angle between it and the normal vector at the evaluation point is
theta.  One way of finding a representation of the average curvature would
then be:

K=1/n*sigma(theta/s)

If you find the normals at points which are in a circle around the
evaluation point, then s would be constant so you could simplify this a bit
into:

K=1/(n*s)*sigma(theta)

I hope that this works, and I hope that it is helpful.


Chris Huff wrote:

> I am working on a curvature pattern, inspired by the patina thread,
> which would be for textures only(it would return a constant value if
> used in media density). It would return a value depending on the amount
> the surface the evaluation point is on is curving.
>
> I am doing this by getting the normal at the evaluation point, using
> that normal to find a point directly "up" at that point, and firing
> several sample rays at the surface. I can either fire the rays in a ring
> at an equal angle to the normal at the evaluation point, or randomly
> inside a cone.
> My question is: what is a good way of calculating the curvature of a
> surface given several points on a surface and normals at those
> points(and of course, the number of samples)?
> I am thinking the pattern should work return a value between 0 for
> maximum curvature away from the normal of the evaluation point and 1 for
> maximum curvature toward the normal. But I am not even really sure what
> "maximum curvature" is. :-)
>
> I have considered using the average vdot of the sample normals with the
> normal of the evaluation point, the average distance of the sample
> points from the point the samples are shot from, using parallel sample
> rays instead of rays originating from a point...
>
> --
> Chris Huff
> e-mail: chr### [at] yahoocom
> Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Fabian Brau
Subject: Re: Calculating curvature of a surface?
Date: 3 Dec 1999 03:30:41
Message: <38478039.91C3DEE1@umh.ac.be>
> My question is: what is a good way of calculating the curvature of a
> surface given several points on a surface and normals at those
> points(and of course, the number of samples)?

Hello Chris,

first suppose that you have only a 2d curve (any kind of curve, of
line). 
Knowing the normals of some points means that you know the derivative of
the 
curve at these points (the normal will be perpendicular to the
derivative). 
So knowing some point and the derivative of the curve at this point, 
the best you can do is an interpolation (with polynomials for example). 
This also call "spline interpolation". But you cannot be sure that the 
curve you obtain by interpolation is the "real" curve! This is easy to 
understand:

draw some points on a sheet of paper and define the normal of the curve 
at these points, it is easy to see that there are an infinity of curve 
which will pass by these point with the correct normals!

The problem is well defined only if you know what curve it is. For 
example if this is a straight line so knowing two point (without knowing
the derivative) is enough to calculate the equation of the curve. 
if this is a second degree curve (parabola for example). Three point are
needed.
Generally, if this is a polynomial with a degre n you need n+1 point.
But now if the curve is not a polynomial and/or you don't know the kind
of curve,
you can only do an interpolation! If you believe that the curve is quite
smooth,
a quadratic or a cubic spline is good. If not, there are two solution:
take a higher 
degree for the polynomial or take more points.
Povray already do this kind of thing with lathe and bicubic patch.

Now for a 3D surfaces, the problem is technically more difficult. 
I will not explain in detail here but the answer is the same:
if you know some points (even a important number!) and the normal,
in general you cannot know the curve, you must do some interpolation!

I hope this help you.

I have read your proposition to do a .math news group.
If some need help with math (and IF THE ANSWER DON'T TAKE 10 PAGES!!),
you can post with a title like "math question" or e-mail me, I will do 
my best to answer (I am doing a thesis in theoretical physics, and 
there are plenty mathematician at the university :)). I know 
that there many other users of povray that can also give 
a good (or a better) answer. I just propose this to help :). 

Fabian.



Chris Huff wrote:
> 
> I am working on a curvature pattern, inspired by the patina thread,
> which would be for textures only(it would return a constant value if
> used in media density). It would return a value depending on the amount
> the surface the evaluation point is on is curving.
> 
> I am doing this by getting the normal at the evaluation point, using
> that normal to find a point directly "up" at that point, and firing
> several sample rays at the surface. I can either fire the rays in a ring
> at an equal angle to the normal at the evaluation point, or randomly
> inside a cone.
> My question is: what is a good way of calculating the curvature of a
> surface given several points on a surface and normals at those
> points(and of course, the number of samples)?
> I am thinking the pattern should work return a value between 0 for
> maximum curvature away from the normal of the evaluation point and 1 for
> maximum curvature toward the normal. But I am not even really sure what
> "maximum curvature" is. :-)
> 
> I have considered using the average vdot of the sample normals with the
> normal of the evaluation point, the average distance of the sample
> points from the point the samples are shot from, using parallel sample
> rays instead of rays originating from a point...
> 
> --
> Chris Huff
> e-mail: chr### [at] yahoocom
> Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Chris Huff
Subject: Re: Calculating curvature of a surface?
Date: 3 Dec 1999 06:53:56
Message: <chrishuff_99-83F37D.06540703121999@news.povray.org>
In article <387028BC.31573882@tapestry.tucson.az.us>, Kevin Wampler 
<kev### [at] tapestrytucsonazus> wrote:

> For each evaluation point, you have found the normals of n other nearby
> points, which are s units away from the evaluation point.  For each 
> vector,
> the angle between it and the normal vector at the evaluation point is
> theta.  One way of finding a representation of the average curvature 
> would
> then be:
> 
> K=1/n*sigma(theta/s)

Ok, I mostly understood that-but what is sigma, other than a greek 
letter?
If I understand this correctly, I should divide the angle between the 
normal of each sample and the normal at the evaluation point by the 
distance of the sample from the evaluation point, total these up, and 
divide by the number of samples. Um, never mind, easier for me to think 
this way(pseudocode follows):

SPoint = sample point
EPoint = evaluation point
total = 0;
while(taking N samples)
{
   S = distance of SPoint from EPoint 
   theta = angle between normal at SPoint and normal at EPoint
   total += theta/S;
}
result = total/N;

Is this right?

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Kevin Wampler
Subject: Re: Calculating curvature of a surface?
Date: 3 Dec 1999 09:51:41
Message: <3870B85F.5D8D2002@tapestry.tucson.az.us>
Chris Huff wrote:

> Ok, I mostly understood that-but what is sigma, other than a greek
> letter?

I just meant summation, but was unsure how to notate it.

>
> If I understand this correctly, I should divide the angle between the
> normal of each sample and the normal at the evaluation point by the
> distance of the sample from the evaluation point, total these up, and
> divide by the number of samples. Um, never mind, easier for me to think
> this way(pseudocode follows):
>
> SPoint = sample point
> EPoint = evaluation point
> total = 0;
> while(taking N samples)
> {
>    S = distance of SPoint from EPoint
>    theta = angle between normal at SPoint and normal at EPoint
>    total += theta/S;
> }
> result = total/N;
>
> Is this right?

Well, I don't know if the formula itself is right, but you certainly did
understand what I said correctly.  I wonder if there might be a way that
would require less samples though?  Oh well, I'm not going to be able to
find it.


Post a reply to this message

From: Ron Parker
Subject: Re: Calculating curvature of a surface?
Date: 3 Dec 1999 11:15:08
Message: <3847ec8c@news.povray.org>
On Thu, 02 Dec 1999 19:27:01 -0500, Chris Huff wrote:
>I am working on a curvature pattern, inspired by the patina thread, 
>which would be for textures only(it would return a constant value if 
>used in media density). It would return a value depending on the amount 
>the surface the evaluation point is on is curving.

Given what you're trying to do, you only need the maximum curvature at 
that point.  Depending on direction of evaluation, the radius of 
curvature of the surface can vary from zero (a ridge) to infinity (a 
flat surface.)  A cube, for example, will have infinite radius of 
curvature everywhere on its faces, and the edges will have either 
zero or infinite radius of curvature depending on where your sample 
point falls.  The vertices will have zero radius of curvature in all
directions, ideally (though precision errors will give you infinite
radii for them, too.)

For the sake of determining accessibility, the smallest radius of 
curvature is the indicator: it doesn't matter that the surface is
perfectly flat in the X direction if it's so sharply curved in the 
Y direction that you can't get your cleaning implements into the 
groove.

Another consideration is that accessibility depends on which side 
of the surface you're looking at.  You can't clean the outside 
surface of that groove, because it's too narrow to fit your cleaning
tools, but you could clean the inside surface of the groove (i.e.
the other side of the sheet of metal) with any size tools, because
it bulges out from the surrounding surface.  This would generally
be handled by the texture map that's applied to the surface, but
your code may have to consider the possibility that surface normals 
might be inverted (i.e. pointing into the surface) which would cause 
some texturing wierdness.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Kevin Wampler
Subject: Re: Calculating curvature of a surface?
Date: 3 Dec 1999 18:30:19
Message: <387131EF.7D11CAB9@tapestry.tucson.az.us>
I think that for the curvature pattern it might be best to allow the user
to specify the way in which the curvature is evaluated, probably by a
choose from maximum, minimum and average.  For example, you might want the
corners of a rounded cube to return a different curvature than the edges,
in which case returning the maximum  curvature wouldn't work.  On the other
hand, there are times in which you would want to have it return the maximum
curvature.

It might also be useful to have an "accessibility" or "exposed" surface
texture function.  How I would see this working is that at an evaluation
point, several rays would be shot at the object (very much like the
proximity pattern).  A value would then be returned based on what
proportion of them hit the object (with possibly the distance until they
did so factored in as well).  So, the more exposed a part of the object is,
the more of the sampling rays will hit it, and a different value will be
returned.

I also wonder, that if it looks like there might be enough surface based
patterns being added to Pov, if a surface{...} statement might be a good
thing to add, since these patterns are really different from texture and
interior in that they are not defined except at the surface of the object.
But then again, they function in pretty much the same was as texture, so it
might be unnecessary.  Just a thought.

Ron Parker wrote:

> Given what you're trying to do, you only need the maximum curvature at
> that point.  Depending on direction of evaluation, the radius of
> curvature of the surface can vary from zero (a ridge) to infinity (a
> flat surface.)  A cube, for example, will have infinite radius of
> curvature everywhere on its faces, and the edges will have either
> zero or infinite radius of curvature depending on where your sample
> point falls.  The vertices will have zero radius of curvature in all
> directions, ideally (though precision errors will give you infinite
> radii for them, too.)
>
> For the sake of determining accessibility, the smallest radius of
> curvature is the indicator: it doesn't matter that the surface is
> perfectly flat in the X direction if it's so sharply curved in the
> Y direction that you can't get your cleaning implements into the
> groove.
>
> Another consideration is that accessibility depends on which side
> of the surface you're looking at.  You can't clean the outside
> surface of that groove, because it's too narrow to fit your cleaning
> tools, but you could clean the inside surface of the groove (i.e.
> the other side of the sheet of metal) with any size tools, because
> it bulges out from the surrounding surface.  This would generally
> be handled by the texture map that's applied to the surface, but
> your code may have to consider the possibility that surface normals
> might be inverted (i.e. pointing into the surface) which would cause
> some texturing wierdness.


Post a reply to this message

From: Ron Parker
Subject: Re: Calculating curvature of a surface?
Date: 4 Dec 1999 12:00:43
Message: <384a4882.485363348@news.povray.org>
On Mon, 03 Jan 2000 16:34:07 -0700, Kevin Wampler
<kev### [at] tapestrytucsonazus> wrote:

>It might also be useful to have an "accessibility" or "exposed" surface
>texture function.  How I would see this working is that at an evaluation
>point, several rays would be shot at the object (very much like the
>proximity pattern).  A value would then be returned based on what
>proportion of them hit the object (with possibly the distance until they
>did so factored in as well).  So, the more exposed a part of the object is,
>the more of the sampling rays will hit it, and a different value will be
>returned.

Accessibility in the sense that I was using it is not the same.  I was
using it in the sense it is used in a 1994 SIGGRAPH paper by Gavin
Miller.  In that sense, it is the radius of the largest sphere that
can get to the surface at that point, which determines how easy that
point is to clean, and thus how much "dirt" should accumulate there.


Post a reply to this message

From: Abe
Subject: Re: Calculating curvature of a surface?
Date: 4 Dec 1999 14:36:34
Message: <38496D27.D231EF5E@taconic.net>
I'll toss a thought into the ring, although this is a bit out of my
league...

I was thinking about the patina problem too, and with my tendency to shy
away from the 3D math, was considering the possibility of doing a
planetary z-buffer image of the relevant object, differentiating it and
reapplying the result as a texture map. Note that I was not initially
considering a change in the code. However, is it feasible do do
something similar, given that the surface normals have been acquired and
apply a finite-differencing scheme to get the second derivative? (This
may double up on what Kevin Wampler was talking about.)I have no idea
what the implications are in 3D with a non uniform sampling grid. 

One of the caveats of this approach, however, would be sampling density
v. feature frequency resolution trade off.

Anyone tell me how far off the wall I am with this?

Abe


Post a reply to this message

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