POV-Ray : Newsgroups : povray.text.tutorials : Can anyone show me the proper syntax for this... Server Time
12 Nov 2024 10:37:24 EST (-0500)
  Can anyone show me the proper syntax for this... (Message 1 to 3 of 3)  
From: normdoering
Subject: Can anyone show me the proper syntax for this...
Date: 8 Nov 2002 03:10:03
Message: <web.3dcb712a3dbbae33e944edd0@news.povray.org>
I'm trying to use the HF_ functions in shapes.inc to generate a mesh from a
small .png file.

I simply added a new funtion to the example file given in the include files
demo. When I did, I got an error.



//==============================

#declare MyFunction = function{pattern {bumps scale 0.2}}
 // MyFunction above works...

#declare MyTest = function
 { pigment
   { image_map
     {png "testHF.png"
      map_type 0 interpolate 2
     }
    }
  } // <- this replacement produces an error.
    // shapes.inc pops up and marks the bit of code named above


object {
   HF_Square
    ( MyTest, // MyFunction was here, but I replaced it.
      off,
      off,
      <60,60>,
      on,
      "",
      <0.0, 0.1, 0.0>,
      <1.5, 0.5, 1.5>
    )
   texture {
      pigment {color rgb 1}
      finish {ShinyFinish}
   }
   translate <-3.0, 0.0,-3.2>
}

// ===========
// The error that happens pops up shapes.inc and a line in the
// HFCreate_() macro gets marked. See note below.
// ====
  #local J = 1;
   #while (J<=xRes)
      #local K = 1;
      #while (K<=zRes)
         PArr[J][K],   // <-- this code gets highlited in yellow
         #declare K = K+1;
      #end
      #declare J = J+1;
   #end

//====================================

What do I do to get an image file used as a function?

normdoering


Post a reply to this message

From: Warp
Subject: Re: Can anyone show me the proper syntax for this...
Date: 8 Nov 2002 09:59:20
Message: <3dcbd147@news.povray.org>
normdoering <nor### [at] yahoocom> wrote:
> #declare MyFunction = function{pattern {bumps scale 0.2}}
>  // MyFunction above works...

> #declare MyTest = function
>  { pigment
>    { image_map
>      {png "testHF.png"
>       map_type 0 interpolate 2
>      }
>     }
>   } // <- this replacement produces an error.
>     // shapes.inc pops up and marks the bit of code named above

  The macros take functions which return scalars. You are trying to give
it a function which returns colors, so it won't work.
  What you need to do is to make a temporary function which will convert
the color returned by MyTest() to a scalar. For example:

#declare MyTestHeight = function { MyTest(x,y,z).hf }

  Then you can give 'MyTestHeight' as parameter to the macro.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: normdoering
Subject: Re: Can anyone show me the proper syntax for this...
Date: 9 Nov 2002 04:20:06
Message: <web.3dccd2aecac9f97b5c65a5ba0@news.povray.org>
Warp wrote:
>normdoering <nor### [at] yahoocom> wrote:
>> #declare MyFunction = function{pattern {bumps scale 0.2}}
>>  // MyFunction above works...
>
>> #declare MyTest = function
>>  { pigment
>>    { image_map
>>      {png "testHF.png"
>>       map_type 0 interpolate 2
>>      }
>>     }
>>   } // <- this replacement produces an error.
>>     // shapes.inc pops up and marks the bit of code named above
>
>  The macros take functions which return scalars. You are trying to give
>it a function which returns colors, so it won't work.
>  What you need to do is to make a temporary function which will convert
>the color returned by MyTest() to a scalar. For example:
>
>#declare MyTestHeight = function { MyTest(x,y,z).hf }
>
>  Then you can give 'MyTestHeight' as parameter to the macro.

And ".hf" isn't the only dot operator. The others are listed in the
isosurface area. A little re-writting and you could submit two functions to
HF_ macros, one that gives the height information and one for cutting off
unused areas of the square. Maybe the .red, .green and .blue operators
could be used for coding undercuts.

normdoering


Post a reply to this message

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