POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. New inbuilt f_morph2to9fncts(). Server Time
12 Jun 2024 10:34:58 EDT (-0400)
  Function / pattern issues. New inbuilt f_morph2to9fncts(). (Message 1 to 1 of 1)  
From: William F Pokorny
Subject: Function / pattern issues. New inbuilt f_morph2to9fncts().
Date: 19 May 2020 10:51:21
Message: <5ec3f269$1@news.povray.org>
<---------------------- References. Nine previous posts

http://news.povray.org/povray.beta-test.binaries/thread/%3C5eb4b9c6%241%40news.povray.org%3E/

and

http://news.povray.org/povray.beta-test.binaries/thread/%3C5ebe9706%241%40news.povray.org%3E/


Adding the function f_morph2to9fncts() to be able to set up complex 
morph-able shapes. In the attached image, set up 9 torus shapes and then 
started twiddling. Shapes just sort of happen unless you plan ahead for 
some specific morph-able thing.

#declare VrR = 0.05;
#declare Fn00 = function (x,y,z) {
     f_morph2to9fncts(9,-VrR,+VrR/9,
         f_torus(y+0.0,x+0.2,z+0.0,0.5,VrR),
         f_torus(y+0.0,x/5-0.0,z,0.5,VrR),
         f_torus(y-0.0,x-0.2,z-0.0,0.5,VrR),
             f_torus(x+0.2,y+0.0,z+0.0,0.5,VrR),
             f_torus(x+0.0,y/5-0.0,z,0.5,VrR),
             f_torus(x-0.2,y-0.0,z-0.0,0.5,VrR),
                 f_torus(x+0.0,z+0.2,y+0.0,0.5,VrR),
                 f_torus(x+0.0,z/5+0.0,y,0.5,VrR),
                 f_torus(x-0.0,z-0.2,y-0.0,0.5,VrR),
    1/9,2/9,1/9,
    0/9,1/9,0/9,
    1/9,2/9,1/9
    )
}
#declare Persimmon = srgb <0.92549,0.3451,0>;
#declare Iso99 = isosurface {
     function { Fn00(x,y,z) }
...

A whole bunch of knobs / parameters.

---- f_morph2to9fncts
Parameters:

1. Count of value inputs from 2 to 9.

2. Clamp on how negative any given function contribution can be.

3. Clamp on how positive any given function contribution can be.  This 
one more important than (2) because letting any given function's 
positive, outside the shape, values get too large really limits what can 
be accomplished with respect to morphing. In fact, internal to 
f_morph2to9fncts(), the value specified is modified to be 
value/non-zero-weights. In other words, it's normalized at start.

4-12. Input values (function calls) as parameters.

13-21. Weights as portion of the sum of all weights.

Notes. Sums and averages input values according to the weights.  Can 
morph in place or along a gradient. The math to control the morphing - 
set the weights - done outside this function. The weights themselves can 
be set up as 1/function-count or similar. Internally, they get totaled 
and the particular functions contribution is its weight against the total.

A good starting place with the negative and positive clamp values is -1 
and 1 unless you know the max negative values with the torus minor 
radius for example in which case start with +- that value.  If too many 
shapes, or too much of some shapes are disappearing lower the positive 
clamp some more. You can of course set the clamps to large values to 
avoid clamping altogether - most used when morphing from one shape to 
another.

----

In other news; added some other lessor helper functions and pattern 
implementations.

f_cbrt(), f_hypot(), f_onion(), f_sign(), f_sign0(), f_signpow()
and f_signsqrt().

Lastly, The isosurface in the image is intentionally implemented with a
large accuracy, and with the new jitter on, for effect. You can get some
interesting shapes this way (sometimes by accident...).

Bill P.


Post a reply to this message


Attachments:
Download 'morphstory.png' (326 KB)

Preview of image 'morphstory.png'
morphstory.png


 

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