POV-Ray : Newsgroups : povray.text.scene-files : Obvious joins Server Time
1 Nov 2024 03:17:03 EDT (-0400)
  Obvious joins (Message 1 to 3 of 3)  
From: Rob Brown-Bayliss
Subject: Obvious joins
Date: 5 Oct 2001 07:41:52
Message: <3bbd9c80@news.povray.org>
Hi, I have a macro (follows) that I am useing to try and make corogated
sheets with.

The problem is there are obvoius joins along the sheets, how can I remove
these so that it actually looks like a single sheet?


Thanks...

//	Corogate Macro
	
#macro Corogate(Length, Width, Radius, T)
	
	#local Bsq = (Radius/2) * (Radius/2)
	#local Csq = Radius*Radius
	#local Asq = Csq - Bsq
	#local Chord = sqrt(Asq)
	#local StartPos = 0 - (Chord/2) //-((Width/2) - (Chord/2))  // So sheet starts on
edge of width
	
	#debug "\n\n##\n##  My Debug Output is here\n##\n\n\n"
	
	#debug concat("Bsq = ",str(Bsq,0,-1),"\n")
	#debug concat("Csq = ",str(Csq,0,-1),"\n")
	#debug concat("Asq = ",str(Asq,0,-1),"\n")
	#debug concat("Chord = ",str(Chord,0,-1),"\n")
	
	#debug "\n\n##\n##  My Debug Output ends here\n##\n\n\n"
	
	#local Outer = union
	{
		#local XPos = (Chord/2)
		difference
		{
			cylinder { <XPos,0,-(Length/2)>,<XPos,0,(Length/2)>, Radius}
			box {<XPos-Radius-T,-Radius-T,-Length>, <XPos+Radius+T,(Radius-T)/2,Length>}
			cylinder { <XPos,0,-(Length)>,<XPos,0,(Length)>, Radius-T }
		}	
	}
	
	#local Coro =	union
	{
		object{Outer}
		object
		{
			Outer 
			rotate <0,0,180> 
			translate <(3*(Chord))-(T/2),Radius-T,0> 
		}
	}
	
	#local Sheet = difference
	{
		union
		{
			#local Count = 0
			#local CoroLen = (Chord*2) - (T/2)
			#local TotLen = (Chord*2) 
		
			#while (TotLen < Width)
			#render concat("TotLen = ",str(TotLen,0,-1),"\n")
				object 
				{
					Coro
					translate <(CoroLen * Count),0,0>
				}
				#local TotLen = TotLen + CoroLen
				#local Count = Count + 2
			#end
		}
		// Sheet might run over width so trim it.
		box {<(Width),-Radius-T,-Length>, <Width,Radius+T,Length>}		
	}
	
	object {Sheet}
#end


-- 

  Rob Brown-Bayliss
 ---======o======---


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Obvious joins
Date: 8 Oct 2001 20:15:20
Message: <3BC241CF.7D263ECD@hotmail.com>
Rob Brown-Bayliss wrote:
> 
> Hi, I have a macro (follows) that I am useing to try and make 
> corogated sheets with.
> 
> The problem is there are obvoius joins along the sheets, how can I
> remove these so that it actually looks like a single sheet?
>...

Below is a macro I just made that will work in 
a similar way as yours. And I think that it
doesn't have the same problems as yours.

It got quite big and kind of ugly, so I have
tried to comment it a bit (in case you want to
have a closer look at it).

The macro takes an extra parameter that is the
angle that the "upper" and "lower" parts of
the waves runs trough. (Hmmm... Bad explanation
- Try the different settings below to see how
it works.)


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// By Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#version 3.1;

#include "colors.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#macro WavySheet(Length, Width, T, Radius, Angle)

  #local O = // O-shape
  difference {
    cylinder { -z*Length/2, z*Length/2, Radius + T/2 }
    cylinder { -z*Length,   z*Length,   Radius - T/2 }
  }
  #local U = // U-shape 
  difference { // Make it by cutting in the O-shape
    object { O } 
    #switch (Angle) // Decide what to cut away
      #case (0)         // Remove all
        cylinder { -z*Length, z*Length, Radius + T }
        #break
      #case (180)       // Remove half
        plane { x, 0 }
        #break
      #range (0, 180)   // Remove more than half
        plane {  x, 0 }
        plane { -x, 0 rotate Angle*z }
        #break
      #case (360)       // Remove nothing
        #break
      #range (180, 360) // Remove less than half
        intersection {
          plane {  x, 0 }
          plane { -x, 0 rotate Angle*z }
        }
        #break
      #else // The angle is less than 0 or greater than 360 degrees
        #error "Macro WavySheet: Angle out of range"
    #end // switch
    translate Radius*y // "Elevate" it so that the "rim" touches origo
    rotate -Angle/2*z // Tilt sideways so that the U lies horizontal
  }
  #local S = // S-shape
  union { // Make it from two U-shapes that both "starts" at origo
    object { U }
    object { U rotate 180*z }
  }
  #local vP = vrotate(Radius*y, -Angle/2*z);
  #local W = 4*vP.x;            // "Width" of the S-shape
  #local H = 2*(Radius - vP.y); // "Heigth" of the S-shape
  #declare Nr = int(Width/W); // Number of S-shapes to add to each side
  #if (Nr <= 0) // Only one S-shape is required
    #local Waves = object { S }
  #else         // More than one S-shape is required 
    #local Waves = 
    union {
      object { S } // So put one in the middle
      #local Cnt = 1;
      #while (Cnt <= Nr) // And then add some more to each side
        object { S translate -Cnt*W*x }
        object { S translate  Cnt*W*x }
        #local Cnt = Cnt + 1;
      #end // while
    }
  #end // if

  object { 
    Waves
    clipped_by {
      box {
        -<Width, H + T, Length>,
         <Width, H + T, Length>
         scale <1, 1, 1 + 1E-6>/2
      }
    }
    bounded_by { clipped_by }
  }

#end // macro WavySheet

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#declare LENGTH = 6;
#declare WIDTH = 8;
#declare THICKNESS = 0.3;
#declare RADIUS = 2;
#declare ANGLE = 70;

/*
// Uncomment to see antoher wave shape
#declare LENGTH = 4;
#declare WIDTH = 10;
#declare THICKNESS = 0.2;
#declare RADIUS = 2;
#declare ANGLE = 210;
*/

/*
// And then a quite different shape
#declare LENGTH = 0.5;
#declare WIDTH = 14;
#declare THICKNESS = 0.1;
#declare RADIUS = 3;
#declare ANGLE = 345;
*/


object {
  WavySheet(LENGTH, WIDTH, THICKNESS, RADIUS, ANGLE)
  pigment { color White }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

light_source { <1, 2, -3>*100 color White }

camera {
  location <0, 0, -10>
  look_at <0, 0, 0>
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =


Post a reply to this message

From: Rob Brown-Bayliss
Subject: Re: Obvious joins
Date: 14 Oct 2001 23:39:06
Message: <3bca5a5a@news.povray.org>
> Below is a macro I just made that will work in a similar way as yours.
> And I think that it doesn't have the same problems as yours.
> 
> It got quite big and kind of ugly, so I have tried to comment it a bit
> (in case you want to have a closer look at it).
> 
> The macro takes an extra parameter that is the angle that the "upper"
> and "lower" parts of the waves runs trough. (Hmmm... Bad explanation -
> Try the different settings below to see how it works.)

Thanks, I've just had a quick look and it seems to be real good.  It's
big though :o)


Post a reply to this message

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