POV-Ray : Newsgroups : povray.general : L-Systems in Povray Server Time
11 May 2024 05:27:08 EDT (-0400)
  L-Systems in Povray (Message 21 to 30 of 64)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: ingo
Subject: Re: L-Systems in Povray
Date: 5 Jun 2023 13:25:00
Message: <web.647e1a39453cebfc17bac71e8ffb8ce3@news.povray.org>
"ingo" <nomail@nomail> wrote:
>
> ---%<------%<------%<---
> Pov-Ray    : 3.8
> Scene File : lsys.pov
> Author     : Ingo Janssen
> Date       : 2023-06-04
>
> #version 3.8;
>
> global_settings{ assumed_gamma 1.0 }
> #default{ finish{ ambient 0.1 diffuse 0.9 }}
>
> //build rules
> #declare BuildRules = dictionary;

A little bit of code to stick to the end of the lsys.pov scene file, render and
have a look in your source directory.

Just for fun and again, a little crude:

---%<------%<------%<---

#declare Height = 10;
#declare Width = 10;
#declare StrokeWidth = 0.3;
#declare FileName = "SVGfile.svg";

#fopen SVG FileName write
#write (SVG concat("<svg xmlns=\"http://www.w3.org/2000/svg\" height='",
str(Height,0,0), "' width='", str(Width,0,0), "' fill='blue' stroke='blue'
stroke-width='", str(StrokeWidth,0,3),"'>\n"))

#for(i, 0, dimension_size(Vertices,1)-2)
  #declare Line = concat("<line x1='", str(Vertices[i].x,0,1),"'
y1='",str(Vertices[i].y,0,1),"' x2='",str(Vertices[i+1].x,0,1),"'
y2='",str(Vertices[i+1].y,0,1),"'/>\n") ;
  #write(SVG Line)
#end
#fclose SVG

---%<------%<------%<---


Post a reply to this message

From: jr
Subject: Re: L-Systems in Povray
Date: 5 Jun 2023 15:55:00
Message: <web.647e3d46453cebfcb49d80446cde94f1@news.povray.org>
hi,

"ingo" <nomail@nomail> wrote:
> "ingo" <nomail@nomail> wrote:
> >
> > ---%<------%<------%<---
> > Pov-Ray    : 3.8
> > Scene File : lsys.pov
> > Author     : Ingo Janssen
> > Date       : 2023-06-04

have copied the code and run once, but not yet investigated.  looking forward to
that, though :-).


> A little bit of code to stick to the end of the lsys.pov scene file, render and
> have a look in your source directory.

missing the closing '</svg>'.  size too is .. suspect, I see only a small part
of the curve.  (sorry, hope to find some time tomorrow)


regards, jr.


Post a reply to this message

From: ingo
Subject: Re: L-Systems in Povray
Date: 5 Jun 2023 16:20:00
Message: <web.647e4364453cebfc17bac71e8ffb8ce3@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> missing the closing '</svg>'.  size too is .. suspect, I see only a small part
> of the curve.  (sorry, hope to find some time tomorrow)

Ah, good catch on the closing tag.
I didn't scale it. Havingthe origin at the top left point of the screen always
makes my brain hurt.

ingo


Post a reply to this message

From: Droj
Subject: Re: L-Systems in Povray
Date: 6 Jun 2023 09:20:00
Message: <web.647f3222453cebfcf62c2adc3b2af915@news.povray.org>
"ingo" <nomail@nomail> wrote:
> "Droj" <803### [at] drojde> wrote:
>
>
> > I would love to see how you implement the third dimension!
> >
>
> Go ahead Droj,
>
> grab the code and experiment. I abused the vector to make it work for 2d + angle
> in a single data container. For 3, or more, dimensions, you have to separate
> angle and position. Use two separate vectors or arrays. Or use a dictionary that
> contains the pos and angle and other stuff you want to add in the future. For
> example a LIFO array as a stack for push and pop operations.
>
> #macro F(Pos, Angle)
>   ....
> #end
>
> For me it was a proof of concept and I'll keep it that way. No new rabbit hole
> for me at the moment.
>
> Cheers,
>
> ingo

Ingo,

thanks for your advice. It will all take a WHILE. Have to learn coding first.

Cheers

Droj


Post a reply to this message

From: jr
Subject: Re: L-Systems in Povray
Date: 6 Jun 2023 13:25:00
Message: <web.647f6b04453cebfcb49d80446cde94f1@news.povray.org>
hi,

"Droj" <803### [at] drojde> wrote:
> "ingo" <nomail@nomail> wrote:
> > "Droj" <803### [at] drojde> wrote:
> > > I would love to see how you implement the third dimension!
> > grab the code and experiment. ...
>
> thanks for your advice. It will all take a WHILE. Have to learn coding first.

heh, don't beat yourself up.  since you've been "using Povray (as a bloody user
of course) for more than 35 years", I'm pretty sure you won't .. faint at the
sight of a '#while' :-).


regards, jr.


Post a reply to this message

From: Droj
Subject: Re: L-Systems in Povray
Date: 6 Jun 2023 16:20:00
Message: <web.647f90f4453cebfcf62c2adc3b2af915@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Droj" <803### [at] drojde> wrote:
> > "ingo" <nomail@nomail> wrote:
> > > "Droj" <803### [at] drojde> wrote:
> > > > I would love to see how you implement the third dimension!
> > > grab the code and experiment. ...
> >
> > thanks for your advice. It will all take a WHILE. Have to learn coding first.
>
> heh, don't beat yourself up.  since you've been "using Povray (as a bloody user
> of course) for more than 35 years", I'm pretty sure you won't .. faint at the
> sight of a '#while' :-).
>
>
> regards, jr.

Hi jr,

not faint at the sight of a #while but of (a) 35 years WHILE I've been missing
crucial things in Povray :-)).

Being a _bloody_user_only (starting with Povray 2.? and Moray 1.5, MS DOS
versions) now 'wasted WHILE time' strikes back.

I feel like Ingo got me by the 'short hair': I am able to use a macro (most of
the times), sometimes adapt something (happy when it works, if not: depressed),
understanding the concept (sometimes - more or less - not 'word by word') but
separating positions and angles for 3D / creating a LIFO array - that's way
beyond me.

I'll try to do my best but to cover that gap is a huge thing. At least I could
add something to Ingo's code to produce the 'Pentaplexity' (still crude using
Ingo's words).

Thanks for cheering me up

Cheers, Droj


Post a reply to this message


Attachments:
Download 'lsys6.png' (771 KB)

Preview of image 'lsys6.png'
lsys6.png


 

From: ingo
Subject: Re: L-Systems in Povray
Date: 7 Jun 2023 00:55:00
Message: <web.64800d44453cebfc17bac71e8ffb8ce3@news.povray.org>
"Droj" <803### [at] drojde> wrote:

> I feel like Ingo got me by the 'short hair':


Pos is an 'abused' vector. <x,y,angle>. Instead I could have used:
#local Pos2D = <x, y>;
#local Angle = 25;

Now angle and location are separated.

So
#macro F(Pos)
  <Pos.x + cos(Pos.z), Pos.y + sin(Pos.z), Pos.z> // <x, y, angle>
#end
#declare BuildRules["F"] = 70; //chr(70) = F

becomes

#macro F(Pos, Angle)
  <Pos2D.x + cos(Angle), Pos2D.y + sin(Angle)> // <x, y>
  //the angle is fixed
#end
#declare BuildRules["F"] = 70; //chr(70) = F



#macro Plus(Pos)
  <Pos.x, Pos.y, Pos.z + (pi/2)>
#end
#declare BuildRules["+"] = 43;

#macro Plus(Angle)
  Angle + (pi/2)
#end
#declare BuildRules["+"] = 43;


And
    #ifdef (BuildRules[CurrentSymbol])
      #switch (BuildRules[CurrentSymbol])
        #case(70)
          #local Pos = F(Pos);
        #break
        #case(43)
          #local Pos = Plus(Pos);
        #break

becomes

    #ifdef (BuildRules[CurrentSymbol])
      #switch (BuildRules[CurrentSymbol])
        #case(70)
          #local Pos = F(Pos, Angle);
        #break
        #case(43)
          #local Pos = Plus(Angle);
        #break


now the Pos vector and angle are separated. The next step is to turn them into
3D vectors. You can use a 3D vector for the three angles too.
(untested code)


Post a reply to this message

From: jr
Subject: Re: L-Systems in Povray
Date: 7 Jun 2023 15:45:00
Message: <web.6480ddb8453cebfcb49d80446cde94f1@news.povray.org>
hi,

"Droj" <803### [at] drojde> wrote:
> ...
> not faint at the sight of a #while but of (a) 35 years WHILE I've been missing
> crucial things in Povray :-)).
> Being a _bloody_user_only (starting with Povray 2.? and Moray 1.5, MS DOS
> versions) now 'wasted WHILE time' strikes back.

looking at the image posted, methinks thou protest too much.  </grin>  v nice.


> I feel like Ingo got me by the 'short hair': I am able to use a macro (most of
> the times), sometimes adapt something (happy when it works, if not: depressed),
> understanding the concept (sometimes - more or less - not 'word by word') but
> separating positions and angles for 3D / creating a LIFO array - that's way
> beyond me.
> I'll try to do my best but to cover that gap is a huge thing. At least I could
> add something to Ingo's code to produce the 'Pentaplexity' (still crude using
> Ingo's words).

re LIFOs, have a look at 'queues.inc'.  (even though the demos suck)


regards, jr.


Post a reply to this message

From: Droj
Subject: Re: L-Systems in Povray
Date: 8 Jun 2023 16:30:00
Message: <web.648235b3453cebfc9f5def123b2af915@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Droj" <803### [at] drojde> wrote:
> > ...
> > not faint at the sight of a #while but of (a) 35 years WHILE I've been missing
> > crucial things in Povray :-)).
> > Being a _bloody_user_only (starting with Povray 2.? and Moray 1.5, MS DOS
> > versions) now 'wasted WHILE time' strikes back.
>
> looking at the image posted, methinks thou protest too much.  </grin>  v nice.
>
>
> > I feel like Ingo got me by the 'short hair': I am able to use a macro (most of
> > the times), sometimes adapt something (happy when it works, if not: depressed),
> > understanding the concept (sometimes - more or less - not 'word by word') but
> > separating positions and angles for 3D / creating a LIFO array - that's way
> > beyond me.
> > I'll try to do my best but to cover that gap is a huge thing. At least I could
> > add something to Ingo's code to produce the 'Pentaplexity' (still crude using
> > Ingo's words).
>
> re LIFOs, have a look at 'queues.inc'.  (even though the demos suck)
>
>
> regards, jr.

Hi,

that was the 'piece-of-cake' part for the 'bloody user'.

I tried Ingo's advice separating location and angle. Whatever I did Povray
complained ("Float expected, but ... found instead" or "Bad operand for dot
expression"). Now I know why he warned me with <untested code>.
Will still investigate where I took the wrong turn.

I had a look at your 'queues.inc'. I'm still goggle-eyed with my mouth agape!
</)):-o>

I wouldn't say the demos suck - maybe a bit too 'academic' or not 'descriptive'.

Still I have to chew on LIFO and maybe can digest it - not sure - that's for
sure.

But I will not give up.

My objective is to get that Lparser thing working with Povray (or die). Forget
the last words.

regards, Droj


Post a reply to this message

From: Bald Eagle
Subject: Re: L-Systems in Povray
Date: 8 Jun 2023 18:55:00
Message: <web.64825c2e453cebfc1f9dae3025979125@news.povray.org>
"Droj" <803### [at] drojde> wrote:

> I tried Ingo's advice separating location and angle. Whatever I did Povray
> complained ("Float expected, but ... found instead" or "Bad operand for dot
> expression"). Now I know why he warned me with <untested code>.
> Will still investigate where I took the wrong turn.

Quote the line and post the exact error.   We run into these things all the
time, and sometimes they're a bit hard to decipher without help.

> I had a look at your 'queues.inc'. I'm still goggle-eyed with my mouth agape!
> </)):-o>

Yeah - jr's code isn't exactly readable for those not well-versed with
dictionaries, and his unique style of coding.  He does code up some amazing
stuff though.  And document it like a BOSS.


> Still I have to chew on LIFO and maybe can digest it - not sure - that's for
> sure.

WTH is "LIFO" ?

>
> But I will not give up.

That's the spirit.


- BW


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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