POV-Ray : Newsgroups : povray.advanced-users : Two blob questions Server Time
23 Dec 2024 15:23:12 EST (-0500)
  Two blob questions (Message 1 to 3 of 3)  
From: SharkD
Subject: Two blob questions
Date: 7 Nov 2008 21:55:01
Message: <web.4914ff00bd9e522d8d1a2c50@news.povray.org>
I have two questions regarding blobs.

1) How can I color (or add media to) a blob based on its strength? I would like
the blob to be "denser" where the blob is greatest.

2) Would someone please provide a parametric formula for a blob object? I need
it for another, non-POV-Ray-related project, but would like to use POV-Ray to
create a "proof-of-concept" and make sure all my math is correct.

Thanks!

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Two blob questions
Date: 8 Nov 2008 02:05:00
Message: <web.4915391feca3f9819ac114520@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I have two questions regarding blobs.
>
> 1) How can I color (or add media to) a blob based on its strength? I would like
> the blob to be "denser" where the blob is greatest.
>
> 2) Would someone please provide a parametric formula for a blob object? I need
> it for another, non-POV-Ray-related project, but would like to use POV-Ray to
> create a "proof-of-concept" and make sure all my math is correct.
>
> Thanks!
>
> -Mike

I guess I'm not being particularly clear. I would like to plot random points
that that lie inside a blob/isosurface. How do I accomplish this, generally
speaking?


Post a reply to this message

From: SharkD
Subject: Re: Two blob questions
Date: 8 Nov 2008 03:25:00
Message: <web.49154bfceca3f981288f25570@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I have two questions regarding blobs.
>
> 1) How can I color (or add media to) a blob based on its strength? I would like
> the blob to be "denser" where the blob is greatest.
>
> 2) Would someone please provide a parametric formula for a blob object? I need
> it for another, non-POV-Ray-related project, but would like to use POV-Ray to
> create a "proof-of-concept" and make sure all my math is correct.
>
> Thanks!
>
> -Mike

I think I got it. In the example below, the spheres are supposed to be more
common where the strength of the field is greater. Please correct me if I am
wrong.

#declare Blob_threshold = 0.01;
#declare Blobs = array[2][4]
{
 {+1/4,+1/4,+1/4,+1/2},
 {-1/4,-1/4,-1/4,+1/2}
}
#declare Bound_width = 4;
#declare Polkadot_radius = 1/10;

#declare fn_A = function { sqrt(pow(x+Blobs[0][0],2) + pow(y+Blobs[0][1],2) +
pow(z+Blobs[0][2],2)) - Blobs[0][3] };
#declare fn_B = function { sqrt(pow(x+Blobs[1][0],2) + pow(y+Blobs[1][1],2) +
pow(z+Blobs[1][2],2)) - Blobs[1][3] };

#local fn_Blob_b = function
{
 (1+Blob_threshold)
 - pow(Blob_threshold, fn_A(x,y,z))
 - pow(Blob_threshold, fn_B(x,y,z))
}
#local Max_strength = (1 + Blob_threshold) - pow(Blob_threshold, -Blobs[0][3]) -
pow(Blob_threshold, -Blobs[1][3]);

#local R1 = seed(12345);
#local iCount = 0;
#local iMax = 1000;
#while (iCount < iMax)
 #local varA = (rand(R1)-1/2) * Bound_width;
 #local varB = (rand(R1)-1/2) * Bound_width;
 #local varC = (rand(R1)-1/2) * Bound_width;
 #local varD = rand(R1);
 #local fnResult = fn_Blob_b(varA,varB,varC);
 #local Strength_ratio = fnResult/Max_strength;

 #if (varD <= Strength_ratio)
  sphere
  {
   <varA,varB,varC>, 1/100
  }
  #debug concat(str(fnResult,0,-1),"\n")
  #local iCount = iCount + 1;
 #end
#end


Post a reply to this message

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