POV-Ray : Newsgroups : povray.general : REQUEST: Macro fol Scaffold? Server Time
9 Oct 2026 23:09:07 EDT (-0400)
  REQUEST: Macro fol Scaffold? (Message 1 to 19 of 19)  
From: Sven Littkowski
Subject: REQUEST: Macro fol Scaffold?
Date: 28 Jul 2019 23:48:47
Message: <5d3e6c9f$1@news.povray.org>
Hi,

I have a cylinder shape in my scene, but want to build a scaffold around 
it of triangles. Is there any macro or formula that can do that, with me 
specifying thickness of the scaffold poles and the size of the triangles?

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 06:20:01
Message: <web.5d3ec7e24ed4290e4eec112d0@news.povray.org>
Sven Littkowski <wrt### [at] yahoocom> wrote:
> Hi,
>
> I have a cylinder shape in my scene, but want to build a scaffold around
> it of triangles. Is there any macro or formula that can do that, with me
> specifying thickness of the scaffold poles and the size of the triangles?
>
> ---
> Diese E-Mail wurde von AVG auf Viren geprüft.
> http://www.avg.com

Easiest way would be to go around in a circle using r sin z and r cos x and make
a regular polygon.  Step up the side of the cylinder and zig-zag up from your
old polygon to where the new one will be.  Using an even number of sides will
make finding the radius and doing the zig-zags easier I think.

Once you get that worked out, you can likely back-calculate to how large the
triangles are and see if changing that will overcomplicate things.


Post a reply to this message

From: Thomas de Groot
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 07:01:49
Message: <5d3ed21d@news.povray.org>
Op 29/07/2019 om 12:18 schreef Bald Eagle:
> 
> Sven Littkowski <wrt### [at] yahoocom> wrote:
>> Hi,
>>
>> I have a cylinder shape in my scene, but want to build a scaffold around
>> it of triangles. Is there any macro or formula that can do that, with me
>> specifying thickness of the scaffold poles and the size of the triangles?
>>
>> ---
>> Diese E-Mail wurde von AVG auf Viren geprüft.
>> http://www.avg.com
> 
> Easiest way would be to go around in a circle using r sin z and r cos x and make
> a regular polygon.  Step up the side of the cylinder and zig-zag up from your
> old polygon to where the new one will be.  Using an even number of sides will
> make finding the radius and doing the zig-zags easier I think.
> 
> Once you get that worked out, you can likely back-calculate to how large the
> triangles are and see if changing that will overcomplicate things.
> 
> 

Years ago, when I was a temporary resident of Gancaloon, I wrote series 
of macros to generate meshes fro a given heigh_field surface. I include 
the set here for your inspiration; no documentation is available 
however. ;-)

-- 
Thomas


Post a reply to this message


Attachments:
Download 'gridgen.mcr.txt' (9 KB)

From: Sven Littkowski
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 11:09:40
Message: <5d3f0c34$1@news.povray.org>
On 29.07.2019 06:01, Thomas de Groot wrote:
> Years ago, when I was a temporary resident of Gancaloon, I wrote series 
> of macros to generate meshes fro a given heigh_field surface. I include 
> the set here for your inspiration; no documentation is available 
> however. ;-)
> 

Thanks. I looked through it, but your code uses too many features I 
never used before. I admit, I lack understanding, wouldn't know where to 
start to make changes, and how to make changes. I might just have to 
give up. :-)


---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 16:25:01
Message: <web.5d3f54f34ed4290e4eec112d0@news.povray.org>
This is from November 2016, where there was some experimentation with scanning
objects with trace() and building triangles.  Obviously still needs some work.
;)

Also, Jerome Grimbert has some excellent additions that do exactly this in
HgPOV-Ray.

http://wiki.povray.org/content/User:Le_Forgeron/tesselation

===========================================================================

#version 3.7;
global_settings {
 assumed_gamma 1.0
 ambient_light color rgb <1, 1, 1>
}
#include "colors.inc"
#include "math.inc"
#include "transforms.inc"

#declare Camera_Origin = camera {
                            location  <0, 0, 0>
                            right    x*image_width/image_height
                            look_at   <0, 0, 0.01>}

#declare Camera_Angle = camera {
                            location  <0.0 , 0.0, 0.0>
                            right    x*image_width/image_height
                            look_at   <100, 30, 0>}
#declare Camera_Front = camera {
                            location  <2, 5, -30.0>
      //location  <0.0, 12, -10.0>
                            right    x*image_width/image_height
      sky y
                            look_at   <2, 5, 0>}
#declare Camera_Rear = camera {
                            location  <0.0, -100.0, -300.0>
                            right    x*image_width/image_height
                            look_at   <0, 0, 0>}
#declare Camera_Top = camera {
                            location  <0, 25.0, 0>
                            right    x*image_width/image_height
                            look_at   <0, 0, 0>}

#declare Camera_Iso = camera {
                            location  <-50, 0, 0>
                            right    x*image_width/image_height
                            look_at   <0, 0, 0>}

//####################
//camera {Camera_Front}
//####################


light_source{ <50, 50, -100>  color rgb <1, 1, 1>}    // White top

// Create an infinite sphere around scene and allow any pigment on it
sky_sphere{ pigment { gradient <0,1,0>
                      color_map { [0.00 rgb <0.6, 0.7, 1.0>]
                                  [0.35 rgb <0.0, 0.1, 0.8>]
                                  [0.65 rgb <0.0, 0.1, 0.8>]
                                  [1.00 rgb <0.6, 0.7, 1.0>]
                                }
                      scale 2
                    } // end of pigment
          } //end of skysphere -------------------------------------


#declare Cylinder = cylinder {<0, 0, 0>, <0, 10, 0> 2 pigment {Red} }
#declare Sphere = sphere {<0, 0, 0>, 2 pigment {Red} }
#declare Box = box {-1, 1 pigment {Red} }
#declare Cross = union {
 cylinder {<0, 0, 0>, <0, 10, 0> 1 pigment {Red} }
 cylinder {<-5, 5, 0>, <5, 5, 0> 1 pigment {Red} }
}
#declare Cross2 = union {
 cylinder {<0, 0, 0>, <0, 10, 0> 1 pigment {Red} }
 cylinder {<-5, 5, 0>, <5, 5, 0> 1 pigment {Red} }
 cylinder {<0, 5, -5>, <0, 5, 5> 1 pigment {Red} }
}
#declare Torus = torus {3, 0.5 pigment {Red} rotate x*0}

#declare Blob =
 //union {
  blob {
  threshold .65
  sphere { <.5,0,0>, .8, 1 pigment {Blue} }
  sphere { <-.5,0,0>,.8, 1 pigment {Red} }
  finish { phong 1 }
  }

//sphere { <.5,0,0>, .8 pigment { Blue transmit .9 }}
//sphere { <-.5,0,0>, .8 pigment { Red transmit .9 }}
//cylinder {<-1, 0, 0>, <1, 0, 0>, 0.65/2  pigment {color White transmit 0.9}
no_shadow}
//}

#declare Object = object {Cylinder}

object {Cylinder}

// Scan object with a loop of traces

#declare Min = min_extent (Object);
#declare Max = max_extent (Object);

#declare MidHeight = (Min.y + Max.y)/2;

#declare Move = (Max.x*2)+4;
#declare Center = (Min.x + Move)/2;

camera {
        location  <Center, MidHeight, (Min.z*10)>
  //location  <0.0, 12, -10.0>
        right    x*image_width/image_height
  sky y
        look_at   <Center, MidHeight, 0>}

#declare TraceRadius = max (Min.x, Max.x, Min.z, Max.z) * 2;
#declare Step = 0.5;
#declare Arcs = 36;
#declare TraceNormal = <0, 0, 0>;

#declare Degrees = 360/Arcs;
#declare OddShift = Degrees/2;
#declare Levels = (Max.y-Min.y)/Step;
#debug concat( " Levels = ", str(Levels, 3, 1), "\n")

#declare TraceMeshArray = array [Levels+1][Arcs+1];
#declare ArrayY = 0;
#declare ArrayX = 0;


#for (Y, Min.y, Max.y, Step)
 #if (odd(ArrayY))
  #declare Shift = OddShift;
 #else
  #declare Shift = 0;
 #end

 #for (Theta, 0, 360, Degrees)
  #declare MyTransform = transform { rotate  y*(Theta+Shift) };
  #declare TracePoint = vtransform (<TraceRadius, Y, 0>, MyTransform);
  #declare TraceMeshArray[ArrayY][ArrayX] = trace(Object, <0, Y, 0>, TracePoint,
TraceNormal);
  //#debug concat( " Y = ", str(ArrayY, 3, 1),  "     X = ", str(ArrayX, 3, 1),
"     TraceNormal = ", vstr(3, TraceNormal, ", ", 3, 0), "\n")
  cylinder {TracePoint, <0, Y, 0> 0.005 pigment {Blue} }
  #declare TraceNormal = <0, 0, 0>;
  #declare ArrayX = ArrayX+1;
 #end
#declare ArrayX = 0;  // reset X
#declare ArrayY = ArrayY+1;
#end



// plot mesh vertices
#declare ArrayY = 0;
#declare ArrayX = 0;
#declare SphereRadius = 0.03;
#for (Y, Min.y, Max.y, Step)
 #for (Theta, 0, 360, Degrees)
  sphere {TraceMeshArray[ArrayY][ArrayX], SphereRadius pigment {Black} translate
x*Move}
  #declare ArrayX = ArrayX+1;
 #end
#declare ArrayX = 0;  // reset X
#declare ArrayY = ArrayY+1;
#end

// draw mesh edges
#declare SphereRadius = 0.025;
#declare ArrayY = 0;
#declare ArrayX = 0;
#declare SphereRadius = 0.0125;
#for (Y, Min.y, Max.y, Step)
 #for (Theta, 0, 360, Degrees)
  //horizontal edges
  #if (ArrayX >= 1)
   //#debug concat( "TraceMeshArray[ArrayY][ArrayX] = ", vstr(3,
TraceMeshArray[ArrayY][ArrayX], ", ", 3, 3), "
TraceMeshArray[ArrayY][ArrayX-1] = ", vstr(3, TraceMeshArray[ArrayY][ArrayX-1],
", ", 3, 3),"\n")
   cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY][ArrayX-1]+0.001, SphereRadius pigment {Green} translate
x*Move}
  #end

  // diagonal edges
  #if (Y > Min.y)
   cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY-1][ArrayX]+0.001, SphereRadius pigment {Green} translate
x*Move}
   #if (odd(ArrayY))
    #if (ArrayX < Arcs)
     cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY-1][ArrayX+1]+0.001, SphereRadius pigment {Green} translate
x*Move}
    #else
     cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY-1][0]+0.001, SphereRadius pigment {Green} translate
x*Move}
    #end
   #else
    #if (ArrayX > 0)
     cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY-1][ArrayX-1]+0.001, SphereRadius pigment {Green} translate
x*Move}
    #else
     cylinder {TraceMeshArray[ArrayY][ArrayX],
TraceMeshArray[ArrayY-1][0]+0.001, SphereRadius pigment {Green} translate
x*Move}
    #end
   #end
  #end

  #declare ArrayX = ArrayX+1;
 #end
#declare ArrayX = 0;  // reset X
#declare ArrayY = ArrayY+1;
#end


Post a reply to this message

From: Sven Littkowski
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 20:09:59
Message: <5d3f8ad7$1@news.povray.org>
Okay, the scene works now. Thanks!    :-)

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Sven Littkowski
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 29 Jul 2019 20:10:45
Message: <5d3f8b05$1@news.povray.org>
Thanks. At the moment, there seem to be various errors in the code. Some 
errors were caused by wrong line breaks which I was able to correct 
(Internet line format and Pov-Ray line format). But some other errors I 
cannot dissolve at the moment.


---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Mike Horvath
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 30 Jul 2019 12:32:41
Message: <5d407129@news.povray.org>
On 7/28/2019 11:48 PM, Sven Littkowski wrote:
> Hi,
> 
> I have a cylinder shape in my scene, but want to build a scaffold around 
> it of triangles. Is there any macro or formula that can do that, with me 
> specifying thickness of the scaffold poles and the size of the triangles?
> 
> ---
> Diese E-Mail wurde von AVG auf Viren geprüft.
> http://www.avg.com
> 

For cylinders, there was Truss Generator include by Theran Cochran. 
Cannot find a download link anywhere however.


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 30 Jul 2019 13:25:02
Message: <web.5d407d584ed4290e4eec112d0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:

> For cylinders, there was Truss Generator include by Theran Cochran.
> Cannot find a download link anywhere however.

http://www.oocities.org/ccolefax/links.html


http://www.oocities.org/ccolefax/download/truss.zip


Post a reply to this message

From: Thomas de Groot
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 02:24:41
Message: <5d413429$1@news.povray.org>
Op 30/07/2019 om 19:24 schreef Bald Eagle:
> 
> Mike Horvath <mik### [at] gmailcom> wrote:
> 
>> For cylinders, there was Truss Generator include by Theran Cochran.
>> Cannot find a download link anywhere however.
> 
> http://www.oocities.org/ccolefax/links.html
> 
> 
> http://www.oocities.org/ccolefax/download/truss.zip
> 
> 

Careful! Malwarebytes blocked both sites here.

-- 
Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 02:32:40
Message: <5d413608$1@news.povray.org>
Op 31/07/2019 om 08:24 schreef Thomas de Groot:
> Op 30/07/2019 om 19:24 schreef Bald Eagle:
>>
>> Mike Horvath <mik### [at] gmailcom> wrote:
>>
>>> For cylinders, there was Truss Generator include by Theran Cochran.
>>> Cannot find a download link anywhere however.
>>
>> http://www.oocities.org/ccolefax/links.html
>>
>>
>> http://www.oocities.org/ccolefax/download/truss.zip
>>
>>
> 
> Careful! Malwarebytes blocked both sites here.
> 

To be fair, I should add this: 
https://forums.malwarebytes.com/topic/224560-two-false-positives/

-- 
Thomas


Post a reply to this message

From: jr
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 08:45:01
Message: <web.5d418c8a4ed4290e3936914a0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> www.oocities.org/ccolefax/download/truss.zip

tried the included demo scene.  after adding semicolons in various places to
make it work with v3.8, I now get an error:

File 'truss_c.inc' line 47: Parse Error: Domain error in atan2!

no idea why.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 13:35:05
Message: <web.5d41d01e4ed4290e4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > www.oocities.org/ccolefax/download/truss.zip
>
> tried the included demo scene.  after adding semicolons in various places to
> make it work with v3.8, I now get an error:
>
> File 'truss_c.inc' line 47: Parse Error: Domain error in atan2!
>
> no idea why.
>
>
> regards, jr.

That happens when both arguments are 0.

http://news.povray.org/povray.newusers/message/%3Cweb.582cd625ba97f5c181c811d20%40news.povray.org%3E/#%3Cweb.582cd625ba
97f5c181c811d20%40news.povray.org%3E


Post a reply to this message

From: jr
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 16:00:01
Message: <web.5d41f29c4ed4290e3936914a0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > File 'truss_c.inc' line 47: Parse Error: Domain error in atan2!
> > no idea why.
>
> That happens when both arguments are 0.

thanks for the explanation.  I've added a '#debug concat' and see that the
'TG_axis' is <0,78,0> and the x and z components are used in the calculation.
what I do not understand is why.  ie, I cannot believe that the archive was
posted with that bug (the file's header says version 3).  has POV-Ray's handling
of the trig function(s) changed?  did v3.1 allow "wrong" arguments?


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 18:35:01
Message: <web.5d4217884ed4290e4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> thanks for the explanation.

Always glad to pass along the correction of my errors..  :D

> I've added a '#debug concat' and see that the
> 'TG_axis' is <0,78,0> and the x and z components are used in the calculation.

Indeed.  One of the valuable skills I've been improving on is debugging.  I
stilll need TOK or clipka to whack me upside the head from time to time, but I'm
getting better.

> what I do not understand is why.  ie, I cannot believe that the archive was
> posted with that bug (the file's header says version 3).  has POV-Ray's handling
> of the trig function(s) changed?  did v3.1 allow "wrong" arguments?

I doubt it.  We're digging WAY back here, so who knows what happened.   It could
have been a bad copy of v3 that was posted instead of the good one...

I haven't had a chance to run the scene / inc yet - I just dug up the link.


Post a reply to this message

From: Bald Eagle
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 31 Jul 2019 19:25:01
Message: <web.5d4222c54ed4290e4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> what I do not understand is why.

Just add
#declare Epsilon = 0.000001;

after the camera declaration, and then in the atan2 formulas add Epsilon to x.
Once all of the rest of the missing ;'s are added, the scene renders fine.


Post a reply to this message

From: jr
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 1 Aug 2019 07:25:00
Message: <web.5d42cb2f4ed4290e3936914a0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> Just add
> #declare Epsilon = 0.000001;

neat, and easy to add to the TG_axis beforehand.  appreciated.


regards, jr.


Post a reply to this message

From: Thomas de Groot
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 1 Aug 2019 07:49:14
Message: <5d42d1ba$1@news.povray.org>
Op 01/08/2019 om 01:22 schreef Bald Eagle:
> 
> "jr" <cre### [at] gmailcom> wrote:
> 
>> what I do not understand is why.
> 
> Just add
> #declare Epsilon = 0.000001;
> 
> after the camera declaration, and then in the atan2 formulas add Epsilon to x.
> Once all of the rest of the missing ;'s are added, the scene renders fine.
> 
> 

Excellent! Thanks a lot.

Nice little thing to mess around with.

-- 
Thomas


Post a reply to this message

From: John Smith
Subject: Re: REQUEST: Macro fol Scaffold?
Date: 26 Dec 2019 13:15:00
Message: <web.5e04f7cf4ed4290e4cebcecd0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 01/08/2019 om 01:22 schreef Bald Eagle:
> >
> > "jr" <cre### [at] gmailcom> wrote:
> >
> >> what I do not understand is why.
> >
> > Just add
> > #declare Epsilon = 0.000001;
> >
> > after the camera declaration, and then in the atan2 formulas add Epsilon to x.
> > Once all of the rest of the missing ;'s are added, the scene renders fine.
> >
> >
>
> Excellent! Thanks a lot.
>
> Nice little thing to mess around with.
>
> --
> Thomas


Post a reply to this message

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