POV-Ray : Newsgroups : povray.general : Height field to mesh - more resolution : Re: Height field to mesh - more resolution Server Time
17 Jun 2024 04:49:30 EDT (-0400)
  Re: Height field to mesh - more resolution  
From: ingo
Date: 8 Dec 2023 05:20:00
Message: <web.6572edc02c1eda4417bac71e8ffb8ce3@news.povray.org>
"Leroy" <whe### [at] gmailcom> wrote:
> Here's the code, [...]
> Have Fun!

Leroy,

reading onther ones code is always a problem for me. Is the following what you
are doing?


Interpolate image:
create array with the size of the new image

.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .


Fill the array positions with values from image in proper locations (*)

* . . . * . . . * . . . *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* . . . * . . . * . . . *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* . . . * . . . * . . . *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* . . . * . . . * . . . *


Use the values on rows to create a spline.
Use spline to fill gaps (x)

* x x x * x x x * x x x *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* x x x * x x x * x x x *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* x x x * x x x * x x x *
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
.. . . . . . . . . . . . .
* x x x * x x x * x x x *


Use the values on cols to create a spline.
Use spline to fill gaps (y)

* x x x * x x x * x x x *
y y y y y y y y y y y y y
y y y y y y y y y y y y y
y y y y y y y y y y y y y
* x x x * x x x * x x x *
y y y y y y y y y y y y y
y y y y y y y y y y y y y
y y y y y y y y y y y y y
* x x x * x x x * x x x *
y y y y y y y y y y y y y
y y y y y y y y y y y y y
y y y y y y y y y y y y y
* x x x * x x x * x x x *


If so there is an alternative method:

Use the values on cols to create a spline.
Use spline to fill gaps (y)

* x x x * x x x * x x x *
y . . . y . . . y . . . y
y . . . y . . . y . . . y
y . . . y . . . y . . . y
* x x x * x x x * x x x *
y . . . y . . . y . . . y
y . . . y . . . y . . . y
y . . . y . . . y . . . y
* x x x * x x x * x x x *
y . . . y . . . y . . . y
y . . . y . . . y . . . y
y . . . y . . . y . . . y
* x x x * x x x * x x x *


Detail top left

x1y1  x2y1  x3y1  x4y1  x5y1
x1y2  .     .     .     x5y2
x1y3  .     .     .     x5y3
x1y4  .     .     .     x5y4
x1y5  x2y5  x3y5  x4y5  x5y5

for example to fill the centre dot,
construct spline through x3y1, x3y5 and a spline x1y3, x5y3
get the value of both splines for x3y3 and average those.

Is it better? Pff, what is better? Does it give a different result, yes. It is
closer to the algorithms for bicubic image interpolation.

Thanks for your code.


ingo


Post a reply to this message

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