POV-Ray : Newsgroups : povray.bugreports : #write : Re: #write Server Time
20 Apr 2024 05:20:52 EDT (-0400)
  Re: #write  
From: Anthony D  Baye
Date: 1 Mar 2016 01:25:00
Message: <web.56d533aba95e761bfd6b6fe10@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 29.02.2016 um 07:20 schrieb Anthony D. Baye:
>
> > Well, I don't really have time for a rebuild right now, but it says
> > 3.7.0-unofficial when I do povray --version
>
> Now that's a bit older than last August; virtually everything since
> August 2014 identifies as "3.7.X-alpha.XXXXXXX".
>
> > I don't know how you find anything with sparse comments and God functions
> > pushing a thousand lines long plus macros.
>
> Yeah, the inherited stuff isn't ideal, and the parser is the worst part
> of it all.

Rebuilt using the latest master.  Bug's still there.
remove the closing paren at line 180 and try rendering.  It gives me a segfault.

Regards,
A.D.B.

#version 3.7;

#include "math.inc"
#include "functions.inc"
#include "kolors.inc"
#include "metals.inc"
#include "stones.inc"

#default {
    pigment { rgb <0.07,0.37,0.75> }
    finish { ambient 0 }
    }

/* !- Global Switches -! */
#declare RAD = off      ;
#declare PHO = off      ;
/* --------------------- */

global_settings {
#if(RAD)
    radiosity {
        pretrace_start 0.04
        pretrace_end   0.005
        count 300

        nearest_count 10
        error_bound 0.110
        recursion_limit 2

        low_error_factor 0.2
        gray_threshold 0.2
        minimum_reuse 0.015
        brightness 0.618
        normal on

        adc_bailout 0.01/2
       }
#end

#if (PHO)
    photons {
        count 20000
        autostop 0
        jitter 0.4
        media 50, 30
        }
#end
     assumed_gamma 1.0
     max_trace_level 15
     }

light_source { <3.0, 6.0, -7.0> rgb 1 }
camera {
    perspective
//    location <0.0, 4.0, -5.0>
    location <0.0, 5.0, -15.0>
    up y
    right x*(image_width/image_height)
//    look_at <0.0, 3.0, 0.0>
    look_at 5*y
//    focal_point <0.0, 5.0, 0.0>
//    aperture 0.3
//    blur_samples 20
    }

// curtesy of Tim Atwood
#declare Cast_Metal =
texture {
   pigment{Gray05}
   normal{facets coords 1 scale 0.1}
   finish {
      ambient 0.10
      brilliance 2
      diffuse 0.4
      metallic
      specular 0.50
      roughness 5/60
      reflection 0.1
   }
   scale 0.35
}

// plane { y, 0 pigment { rgb 1 } }

//#include "column.inc"

#declare unit_hex_major =
prism {
    linear_spline
    0.0, 1.0, 7
    #local T = 30;
    #while(T <= 390)
        <sind(T), cosd(T)>
    #local T = T + 60;
    #end
    }

// A hexagon measuring one unit from the center to the center of each face.
#declare unit_hex_minor =
object { unit_hex_major scale 1/<cosd(30), 1, cosd(30)> }

#declare hex_pig =
pigment {
        object { unit_hex_major color Black color Red }
    }

#macro ply_header(FMT, VRS, ATH, DSC, VCT)
array[9] {
    "ply\r\n",
    concat("format " FMT, " ", str(VRS,1,1), "           { ascii/binary, format
version number }\r\n"),
    concat("comment made by ", ATH, "     { comments keyword specified, like all
lines }\r\n"),
    concat("comment ", DSC, "\r\n"),
    concat("element vertex ", str(VCT, 0,0), "          { define \"vertex\"
element, ", str(VCT,0,0), " of them in file }\r\n"),
    "property float x           { vertex contains float \"x\" coordinate }\r\n",
    "property float y           { y coordinate is also a vertex property }\r\n",
    "property float z           { z coordinate, too }\r\n",
    "end_header                 { delimits the end of the header }\r\n"
    }
#end

#declare f_sagitta = function(x,y,z,R,P) { 2 * R * pow( sin(pi / (2*P)), 2) }
#declare f_apothem = function(x,y,z,R,P) { R - f_sagitta(x,y,z,R,P) }
#declare f_part_01 = function(x,y,z,R) { R*sin(pi/3 + mod(f_th(x,y,z), pi/3)) }
#declare f_part_02 = function(x,y,z,R) { f_part_01(x,y,z,R) -
f_apothem(x,y,z,R,6) }
#declare r_fun = function(x,y,z,R) { R - f_part_02(x,y,z,R) / sin(pi/3 +
mod(f_th(x,y,z), pi/3)) }
#declare f_hex_face = function { sqrt( x*x + z*z ) - r_fun(x,y,z,1) }
#declare hex_fn = function { pigment { hex_pig } }
#declare p_fn_x = function(x,y,z,O) { x - O }

#macro write_ply(FILENAME, HEADER, DATA)
    #fopen pCloudFile FILENAME write
        #for(L,0,dimension_size(HEADER,1)-1,1)
            #write(pCloudFile, HEADER[L])
        #end
        #for(P,0,dimension_size(DATA,1)-1,1)
            #write(pCloudFile, vstr(3, DATA[P], " ",0,6), "\r\n")
        #end
    #fclose pCloudFile
#end

#local R0 = 1;      // circumradius
#local N = 6;
#local P = 1/5;
#local sagitta = 2 * R0 * pow( sin( pi / (2 * N) ), 2 );
#local apothem = R0 - sagitta;      // inradius
#local r = 360 / N;
#local l = 90 - r/2;
#local dS = 0.0625;      // S = RT --> T = S/R  tf. dT = dS/R
#local pC = 0;
#local heightMax = 10;
#local heightDelta = 0.03125;
#local pointDelta = 3;
#local DStore = array[(360/pointDelta)*(heightMax/heightDelta + 1)]
#local layercount = 0;
//#write(pCloudFile, "0.000000 0.000000 0.000000\r\n")
#for(H,0,heightMax,heightDelta)
union {
    #for(T,0,360-pointDelta,pointDelta)
        #local p1 = R0*(sind(l + mod(T, r)));
        #local p2 = p1 - apothem;
        #local R1 = R0 - p2/sind(l + mod(T, r));
        #local v0 = vrotate(<R1,H,0>, (T + degrees((H*P*pi)))*y);
        sphere { v0 0.015625 }

        #local DStore[pC] = v0;

        #local pC = pC + 1;
    #end
    }
    #local layercount = layercount + 1;
#end
#debug concat("pC: " str(pC,0,0) "\n")
#debug concat("layers: " str(layercount,0,0) "\n")
#local header = ply_header("ascii", 1.0, "Anthony D. Baye", "A twisted ed
hexagonal column", pC)
#fopen pCloudFile "pointCloud2.ply" write
    #for(L,0,dimension_size(header,1)-1,1)
        #write(pCloudFile, header[L])
    #end
    #for(P,0,pC-1,1)
        #write(pCloudFile, vstr(3, DStore[P], " ",0,6), "\r\n")
    #end
#fclose pCloudFile

#for(A,0,360,60)
cylinder { R0*x, <R0, 10.0, 0.0> 0.015626 pigment { Orange } rotate A*y }
#end


Post a reply to this message

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