POV-Ray : Newsgroups : povray.advanced-users : distance varying density file Server Time
24 Nov 2024 09:39:48 EST (-0500)
  distance varying density file (Message 1 to 2 of 2)  
From: Antonio Ferrari
Subject: distance varying density file
Date: 1 Oct 2007 11:15:00
Message: <web.47010df9dc71dfa84e64f15d0@news.povray.org>
Prerequisites:

1) Having a generic closed object O;
2) Being able to apply inside(O,V) operator for a generic vector V
3) Being able to write DF3 files using povray language, maybe applying the
patch "Extended Density File"

What I'm looking for:

I'm looking for a macro for generating a DF3 file in output for the interior
of the object O passed to the macro. I'd like that the density is a function
of the minimal distance of V from the external surface of O: for V internal,
density[V] = density_function(minimal_distance(O,V)). In particular I'd like
a function the make the density greater when moving toward the interior of
O, where the increment could be linear, exponential, logarithmic, etc.

Is there a function for calculating the minimal distance of an internal
point V from the contour of O?

Have you any idea?

Do you think that only a patch could give me the expected result?

Some time ago I had the following idea: calculating the dimensions X, Y and
Z of the box containing O. Subdivide both X, Y and Z into n segments. Use
of 3 innested loops for x, y and z axis in order to cycle the segments and
see if the are or are not part of the interior of O. This is a sort of
sampling method. The greater n is, the more accurate the samples are.

Then I needed an algorithm for finding interior points at first level,
second level, third level, etc. The greater the level, the higher the
density, for example.

Oh these are just ideas. I don't know if I'm on the right way.

Bye,
A.


Post a reply to this message

From: Alain
Subject: Re: distance varying density file
Date: 1 Oct 2007 15:40:55
Message: <47014d47$1@news.povray.org>
Antonio Ferrari nous apporta ses lumieres en ce 2007/10/01 11:10:
> Prerequisites:
> 
> 1) Having a generic closed object O;
> 2) Being able to apply inside(O,V) operator for a generic vector V
> 3) Being able to write DF3 files using povray language, maybe applying the
> patch "Extended Density File"
> 
> What I'm looking for:
> 
> I'm looking for a macro for generating a DF3 file in output for the interior
> of the object O passed to the macro. I'd like that the density is a function
> of the minimal distance of V from the external surface of O: for V internal,
> density[V] = density_function(minimal_distance(O,V)). In particular I'd like
> a function the make the density greater when moving toward the interior of
> O, where the increment could be linear, exponential, logarithmic, etc.
> 
> Is there a function for calculating the minimal distance of an internal
> point V from the contour of O?
> 
> Have you any idea?
> 
> Do you think that only a patch could give me the expected result?
> 
> Some time ago I had the following idea: calculating the dimensions X, Y and
> Z of the box containing O. Subdivide both X, Y and Z into n segments. Use
> of 3 innested loops for x, y and z axis in order to cycle the segments and
> see if the are or are not part of the interior of O. This is a sort of
> sampling method. The greater n is, the more accurate the samples are.
> 
> Then I needed an algorithm for finding interior points at first level,
> second level, third level, etc. The greater the level, the higher the
> density, for example.
> 
> Oh these are just ideas. I don't know if I'm on the right way.
> 
> Bye,
> A.
> 
> 
If you can deffine your object as an isosurface, then, you can use the same 
function for your density. You may need to invert the function for your purpose. 
To change the "maping", you can use sqr() exp() log() pow(x,y) and other to 
change the way the density react to the function.

-- 
Alain
-------------------------------------------------
OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime


Post a reply to this message

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