POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
29 May 2024 07:36:18 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: yesbird
Date: 15 Feb 2023 06:30:00
Message: <web.63ecc08a43a1dd8868fd655b10800fb2@news.povray.org>
Not work for me:

"C:\Projects\povplay\__tests\height_field\scale_y_shift.pov" line 36: Possible
Parse Error: Suspicious identifier found in function! If you want to call a
function make sure the function you call has been declared. If you call an
internal function, make sure you have
included 'functions.inc'.

Script:
--------------------------------------------------------------------------
#include "colors.inc"
#include "functions.inc"

#version 3.8;
global_settings { assumed_gamma 1 }

//
// Axis textures
//
#declare fin_axis = finish { phong 1 reflection {0.10 metallic 0.4 }}
#declare tex_axis_common = texture {
           pigment { rgb <0.70, 0.70, 0.70> }
           finish  { fin_axis }}
#declare tex_axis_x = texture { pigment { rgb x} finish { fin_axis }}
#declare tex_axis_y = texture { pigment { rgb y} finish { fin_axis }}
#declare tex_axis_z = texture { pigment { rgb z} finish { fin_axis }}

//
// Axis
//
#macro axis_base( len, rad, tex_odd, tex_even )
union{
    cylinder { <0, -len, 0>,<0, len, 0>, rad
               texture{ checker texture{ tex_odd } texture{ tex_even }
               translate <0.1, 0, 0.1> }}

    cone{<0, len, 0>, rad * 2, <0, len + rad * 7, 0>, 0 texture{tex_even} }}
#end

#macro axis_xyz( len_x, len_y, len_z, rad, tex_common, tex_x, tex_y, tex_z)
union{
    #if (len_x != 0) object { axis_base(len_x, rad, tex_common, tex_x) rotate<
0, 0,-90>} #end
    #if (len_y != 0) object { axis_base(len_y, rad, tex_common, tex_y) rotate<
0, 0,  0>} #end
    #if (len_z != 0) object { axis_base(len_z, rad, tex_common, tex_z) rotate<
90, 0,  0>} #end }
#end

#macro axis(len_x, len_y, len_z, rad)
    axis_xyz( len_x, len_y, len_z, rad, tex_axis_common, tex_axis_x, tex_axis_y,
tex_axis_z)
#end

//
// Perspective camera
//
#macro camp (_x, _y, _z, _lx, _ly, _lz, _ang)
camera
  { perspective
    location < _x,  _y,  _z>
    look_at  <_lx, _ly, _lz>
    angle _ang
  }
#end

//
// Orthographic camera
//
#macro camo (_x, _y, _z, _lx, _ly, _lz, _ang)
camera
  { orthographic
    location <_x,  _y,   _z>
    look_at  <_lx, _ly, _lz>
    angle _ang
  }
#end

//
// Lights
//
#declare br = 0.8;
light_source {<0,  10, 0>, rgb <1,1,1> * br }
light_source {<0, -10, 0>, rgb <1,1,1> * br }

light_source {< 10, 0, 0>, rgb <1,1,1> * br }
light_source {<-10, 0, 0>, rgb <1,1,1> * br }

light_source {<0, 0,  10>, rgb <1,1,1> * br }
light_source {<0, 0, -10>, rgb <1,1,1> * br }


// Axis
axis (3,3,3,0.02)

// Cameras
camo (10,0,0,0,0,0,45)

#declare FnChkVals = function (x) {
     select(((x<0.0) | (x>1.0)),
         0,
         0,
         f_boom(x,2,3,4,5,6)
     )
}

#declare HF_Poly0_2_2 = height_field {
     function 800, 800 { FnPoly0_2(x,y,z) }
     scale   <2, 2, 2>
     pigment {Red}}

object { HF_Poly0_2_2 }
------------------------------------------------------------------------
YB


Post a reply to this message

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