POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. New f_labsweep. : Function / pattern issues. New f_labsweep. Server Time
6 May 2024 04:12:28 EDT (-0400)
  Function / pattern issues. New f_labsweep.  
From: William F Pokorny
Date: 26 Apr 2020 07:37:41
Message: <5ea57285$1@news.povray.org>
<---------------------- References. Five previous posts

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

and

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

---
Many years ago Tor Olav Kristensen posted a method to create sphere 
capped cone isosurfaces from point a to point b. I've extracted the 
point to point linear sweep embedded in his approach to create a 
function called f_labsweep(), linear a b sweep with the idea of sweeping 
much more than spheres.

It is called once for x,y and z. For example:

#declare ptA = <0,-0.4,0>;
#declare ptB = <0,+0.4,0>;
#declare R = 0.45;

#declare Ax = ptA.x;
#declare Ay = ptA.y;
#declare Az = ptA.z;
#declare Bx = ptB.x;
#declare By = ptB.y;
#declare Bz = ptB.z;

#declare Fn00 = function (x,y,z,r,ax,ay,az,bx,by,bz) {
     f_cone(
         f_labsweep(x,y,z,0,ax,ay,az,bx,by,bz),
         f_labsweep(x,y,z,1,ax,ay,az,bx,by,bz)/1.5,
         f_labsweep(x,y,z,2,ax,ay,az,bx,by,bz),
         r)
}

-------------
// Parameters: x, y, z
// Seven extra parameter required:
// 1. If 0, return new x.
//    If 1, return new y.
//    If 2, return new z.
// 2. 3D point A x value.
// 3. 3D point A y value.
// 4. 3D point A x value.
// 5. 3D point B x value.
// 6. 3D point B y value.
// 7. 3D point B x value.
// Note. This does a linear sweep of a function about the origin
// from point A to point B returning only the modified x, y
// or z value. This enables us to code either directly on the function
// about origin call, which can see modifiers. Or, we can code up each
// as its own X,Y or X function to which we can apply pattern modifiers.
// In testing the former simpler to code, less flexible and slower. The
// latter, approach more difficult to code, more flexible and about 20%
// faster when using the same modifiers for the same result.

Attaching a few images using the new function (f_cone is new too) along 
with other pattern/function updates previously posted to this newsgroup.

Oh, the upper right images uses 'inverse' which is a new pattern wave 
modifier which works both for the traditional 0-1 pattern interval and 
the new -1 to 1 function_interval.

Bill P.


Post a reply to this message


Attachments:
Download 'story_f_labsweep.png' (385 KB)

Preview of image 'story_f_labsweep.png'
story_f_labsweep.png


 

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