|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Does anyone know (preferably have a macro they could send me) how to find
the surface normal of an isosurface at an arbitrary <x,y,z>? If I remember
correctly, a macro that returns <g'(x),h'(y),i'(z)> where f(x,y,z) =
<g(x),h(y),i(z)> and x, y, and z are specified will suffice. The catch is
of course that f() would be an arbitrary function, and I don't know how to
find numeric derivatives. Did I miss something in the standard includes
that would do this? Has anyone else done this? Rune? Thanks
Barron
p.s. For extra credit, is there a way to determine how far a point is from
the nearest point on the surface of an isosurface?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Barron Gillon who wrote:
>Does anyone know (preferably have a macro they could send me) how to find
>the surface normal of an isosurface at an arbitrary <x,y,z>? If I remember
>correctly, a macro that returns <g'(x),h'(y),i'(z)> where f(x,y,z) =
><g(x),h(y),i(z)> and x, y, and z are specified will suffice. The catch is
>of course that f() would be an arbitrary function, and I don't know how to
>find numeric derivatives. Did I miss something in the standard includes
>that would do this? Has anyone else done this? Rune? Thanks
Use trace().
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
not trace! I need to find the normal at an arbitrary point that
_may_or_may_not be on the surface. Trace finds an intersection with a
surface and then returns the normal at the intersection, but I need the
normal from an arbitrary point given an arbitrary function. Trace is good,
but not quite what I'm looking for. Thanks anyway.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Barron Gillon wrote:
> not trace! I need to find the normal at an arbitrary point that
> _may_or_may_not be on the surface.
If it is not a surface, how can it have a normal? I think you don't mean
this... but I can't understand it.
--
Jaime Vives Piqueres
La Persistencia de la Ignorancia
http://www.ignorancia.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Jaime Vives Piqueres" wrote:
> If it is not a surface, how can it have a normal?
> I think you don't mean this... but I can't understand it.
Not exactly a normal, but the gradient has a direction. I have no idea how
to find it though...
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Barron Gillon" wrote:
> Has anyone else done this? Rune? Thanks
Sorry, advanced function math is not my domain...
> p.s. For extra credit, is there a way to determine
> how far a point is from the nearest point on the
> surface of an isosurface?
I think this can only be determined by taking lots of samples, which is
*very* slow...
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
To calculate the normal vector of the function you need to know the
derivative of the function with respect to each parameter. The derivative
of a function is too complicated to calculate with pov-script, so you'll
have to provide these derivatives yourself.
That is, if your function is f(x,y,z), you need to calculate the
derivatives df/dx, df/dy and df/dz.
After this the normal vector is pretty simple: <df/dx, df/dy, df/dz>
Here is an example scene which demonstrates this:
camera { location -z*10 look_at 0 angle 35 }
light_source { <100,200,-300>, 1 }
#declare F = function { .5*x^2+y^2+z^2-1 }
#declare dFdx = function { x }
#declare dFdy = function { 2*y }
#declare dFdz = function { 2*z }
#macro nF(P)
vnormalize(<dFdx(P.x,P.y,P.z), dFdy(P.x,P.y,P.z), dFdz(P.x,P.y,P.z)>)
#end
isosurface
{ function { F(x,y,z) }
contained_by { box { <-2,-1,-1>,<2,1,1> } }
max_gradient 2.352
pigment { rgb x } finish { specular .5 }
}
union
{ #declare Pnt = <-.4,.4,-1>;
cylinder { Pnt, Pnt+nF(Pnt), .1 }
#declare Pnt = <.8,.6,-1>;
cylinder { Pnt, Pnt+nF(Pnt), .1 }
#declare Pnt = <.1,-.6,-1>;
cylinder { Pnt, Pnt+nF(Pnt), .1 }
pigment { rgb y } finish { specular .5 }
}
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Barron Gillon who wrote:
>not trace! I need to find the normal at an arbitrary point that
>_may_or_may_not be on the surface. Trace finds an intersection with a
>surface and then returns the normal at the intersection, but I need the
>normal from an arbitrary point given an arbitrary function. Trace is good,
>but not quite what I'm looking for. Thanks anyway.
If the point isn't on the surface, then there's obviously no normal at
that point.
Do you mean that you want to know if its possible to determine the
direction of the Grad vector of an arbitrary scalar field?
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Barron Gillon who wrote:
>not trace! I need to find the normal at an arbitrary point that
>_may_or_may_not be on the surface. Trace finds an intersection with a
>surface and then returns the normal at the intersection, but I need the
>normal from an arbitrary point given an arbitrary function. Trace is good,
>but not quite what I'm looking for. Thanks anyway.
Actually you can still use "trace()". What you have to do is declare a
temporary isosurface which is the same as the original one, but has a
different value of "threshold". The value of "threshold" to use is the
value of the function at the point you are interested in.
E.g. suppose you have an arbitrary function F(x,y,z) and you want to
find the "normal" at the point P, then you can temporarily declare
#declare Temp =
isosurface {function {F(x,y,z)}
threshold F(P.x,P.y,P.z)
...
}
and perform a "trace()" on that.
[We know that the function evaluates to F(P.x,P.y,P.z) at the point P,
and the Temp isosurface is the set of all points for which the function
evaluates to that value, so the Temp isosurface contains the point P]
Since we don't ever render the Temp isosurfaces, they shouldn't pose too
much of a processing overhead.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams <mik### [at] nospamplease> wrote:
: If the point isn't on the surface, then there's obviously no normal at
: that point.
I think that the idea is that if the "threshold value" was set so that the
surface for that function would pass through that point, then what would be
the normal vector. It's the normal vector to the equipotential surface of
that function which passes through that point (or something similar). It is
a well-defined concept.
(And I answered the original question in another article.)
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|