POV-Ray : Newsgroups : povray.newusers : parse error end of file but #end expected, is my code correct? : parse error end of file but #end expected, is my code correct? Server Time
9 Nov 2024 12:32:10 EST (-0500)
  parse error end of file but #end expected, is my code correct?  
From: daisy807
Date: 3 Dec 2017 20:50:00
Message: <web.5a24a9807a067c974df778040@news.povray.org>
global_settings { ambient_light 4 }
//
#include "colors.inc"
#include "shapes.inc"
#include "math.inc"

#macro round_cone_triangle ( p1, p2, p3,  r1, r2, r3, bT, rT, gT, vT)

//Joining lines
//
#local EdgeRadius = 1;

union{
   object{Round_Cone2(p3, r3, p1, r1, EdgeRadius)texture{rT}   }
   object{Round_Cone2(p1, r1, p2, r2, EdgeRadius)texture{bT}   }
   object{Round_Cone2(p2, r2, p3, r3, EdgeRadius)texture{gT}   }

#end
//
//Triangle definitions
//
#declare p1 = <-5,0,0>;
#declare p2 = <5,4,0>;
#declare p3 = <-5,9,0>;
#declare r1 = 5;
#declare r2 = 3;
#declare r3 = 1;

//Colour Textures
#declare bT   = texture{ pigment {  rgb<0,0,1> } }     //Blue
#declare rT   = texture{ pigment {  rgb<1,0,0> } }     //Red
#declare gT   = texture{ pigment {  rgb<0,1,0> } }     //Green
#declare vT   = texture{ pigment {  rgb<0.5,0,1> }}    //Violet

object{round_cone_triangle ( p1, p2, p3,  r1, r2, r3, bT, rT, gT, vT) }
//

#macro
SF_roundtriangleintpoints(Point1,Point2,iNorm,vertA,vertB,vertC,radA,radB,radC)
//
#local vertA = <-5,0,0>;
#local vertB = <5,4,0>;
#local vertC = <-5,9,0>;
#local radA = 5;
#local radB = 3;
#local radC = 1;
//
#if(radA<=0)
  #local iNorm  = 0;
  #local Point1 = vertA;
  #local Point2 = vertA;
#else
  #local AtoB       = vertB - vertA;
  #local ellAB      = vlength(AtoB);
  #if(ellAB>abs(radA-radB))
// May not degenerate to a single roundcone
    #local AtoB       = AtoB/ellAB;
    #local cyl1AB     = vertA + radA*(radA - radB)*AtoB/ellAB;
    #local sinalphaAB = (radA - radB)/ellAB;
// Given the #if condition, 0 < sinalphaAB < 1
    #local cosalphaAB = sqrt(1-sinalphaAB*sinalphaAB);
    #local AtoC       = vertC - vertA;
    #local ellAC      = vlength(AtoC);
    #if(ellAC>abs(radA-radC))
// May not degenerate to a single roundcone
      #local AtoC       = AtoC/ellAC;
      #local cyl1AC     = vertA + radA*(radA - radA)*AtoC/ellAC;
      #local cyl2AC     = vertC + radC*(radA - radC)*AtoC/ellAC;
      #local sinalphaAC = (radA - radC)/ellAC;
// Given the #if condition, 0 < sinalphAC < 1
      #local cosalphaAC = sqrt(1-sinalphaAC*sinalphaAC);
      #local cosbetaABC = vdot(AtoB,AtoC);
      #if(cosbetaABC > 1)
        #local cosbetaABC = 1;
      #end
      #local sinbetaABC = sqrt(1 - cosbetaABC*cosbetaABC);
      #local AtoBperpC  = AtoC - cosbetaABC*AtoB;
      #local lAtoBperpC = vlength(AtoBperpC);
      #if(lAtoBperpC > 0)
        #local AtoBperpC  = AtoBperpC/vlength(AtoBperpC);
      #end
      #local ABCperp    = vcross(AtoB,AtoC);
      #local ABCArea    = vlength(ABCperp);
      #if(ABCArea > 0)
        #local ABCperp    = ABCperp/ABCArea;
        #local yABC       =
radA*((radA-radC)/ellAC-cosbetaABC*(radA-radB)/ellAB)/sinbetaABC;
        #local zABC       = radA*radA - yABC*yABC -
(radA*(radA-radB)/ellAB)*(radA*(radA-radB)/ellAB);
      #else
        #local zABC       = -1;
      #end
      #if(zABC>=0.000000001)
// Didn't degenerate into a single roundcone
        #local zABC   = sqrt(zABC);
        #local iNorm  = 1;
        #local Point1 = cyl1AB + yABC*AtoBperpC + zABC*ABCperp;
        #local Point2 = cyl1AB + yABC*AtoBperpC - zABC*ABCperp;
      #else
        #local iNorm  = -1;
        #local Point1 = vertA;
        #local Point2 = vertA;
      #end
    #else
      #local iNorm  = -1;
      #local Point1 = vertA;
      #local Point2 = vertA;
    #end
  #else
    #local iNorm  = -1;
    #local Point1 = vertA;
    #local Point2 = vertA;
  #end
#end
//

//
object{SF_roundtriangleintpoints(Point1,Point2,iNorm,vertA,vertB,vertC,radA,radB,radC)}

background {color White}
light_source { <20,20,-20> White shadowless}
camera{orthographic location <0,0,-10> look_at <0,0,0> }


Post a reply to this message

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