POV-Ray : Newsgroups : povray.binaries.images : Isosurface cylindrical ramp?, cam lift hinge : Re: Isosurface cylindrical ramp?, cam lift hinge Server Time
9 Aug 2024 09:07:30 EDT (-0400)
  Re: Isosurface cylindrical ramp?, cam lift hinge  
From: Rick Measham
Date: 7 Mar 2005 02:16:15
Message: <422BFFC3.1090804@nomail>
StephenS wrote:
> I would like to add the cam part to my hinge. A ramp that wraps around the
> pin. I'm thinking that a cylinder isosurface whose height changes with the
> angle should work. Looking up the parts on f_ph and f_th don't seem to help
> me understand them any better. I can get a cylinder but the change in height
> is giving me a head ache. Some help would be appreciated :-)

G'day Stephen,
I went to the toilet downstairs earlier and noticed it had the sort of 
hinges you're trying to do. The slope you're searching for is just a 
flat plane. No need for twist or anything, just a cylinder minus a plane.

I've attached a scene of the hinge I've written. Code is below. 
Animation is in p.b.a (if I can work out how to make it small enough)

The ClosingHinge() macro takes three parameters:
	Scale
		-- Really should remove as it can be done elsewhere
	DoorAngle
		-- The angle at which the door is CURRENTLY
		   0   = hinge is flat
		   180 = hinge is folded completely
	PreferredAngle
		-- The angle at which the door would sit if let to swing

Cheers!
Rick



// Persistence of Vision Ray Tracer Scene Description File
// File: ClosingHinge.pov
// Vers: 3.6
// Desc: Shows a closing hinge
// Date: 2005-03-07
// Lic.: LGPL
// Auth: Rick Measham

#version 3.6;

#include "colors.inc"
#include "metals.inc"

global_settings {
   assumed_gamma 1.0
}

// ----------------------------------------

#declare FrontCam = camera {
   location  <0.0, 0.5, -13.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

#declare BackCam = camera {
   location  <-4.0, 0.5, 4.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

#declare TopCam = camera {
   location  <0.0, 8.0, 0.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
   pigment {
     gradient y
     color_map {
       [0.0 rgb <0.6,0.7,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

light_source {
   <0, 0, 0>            // light's position (translated below)
   color rgb <1, 1, 1>  // light's color
   translate <-30, 30, -30>
}

// ----------------------------------------

plane {
   z, 14
   pigment { color rgb <0.7,0.5,0.3> }
}

#declare ClosingHinge_Hole = union {
  	cylinder {
  		<0.00, 0.00, 0.24>
  		<0.00, 0.00, 0.51>
  		0.15
  	}
  	cone {
  		<0.00, 0.00, 0.38>
  		0.15
  		<0.00, 0.00, 0.249>
  		0.25	
  	}
}	

#declare ClosingHinge_Part = union {
	difference {
		union {
			difference {
				box {
					<-2.00, -2.00, 0.25>
					<-0.00,  2.00, 0.50>
					
				}
				object {
					ClosingHinge_Hole
					translate <-1.3, -1.3, 0.0>
				}
				object {
					ClosingHinge_Hole
					translate <-1.5,  0.0, 0.0>
				}
				object {
					ClosingHinge_Hole
					translate <-1.3,  1.3, 0.0>
				}
			}
			cylinder {
				<0.00,  0.50, 0.00>
				<0.00,  2.00, 0.00>
				0.50
			}
			difference {
				box {
					<-0.75,  0.50, 0.00>
					< 0.00,  2.00, 0.50>
				}
				cylinder {
					<-0.75,  0.49, 0.00>
					<-0.75,  2.01, 0.00>
					0.25
				}
			}
		}	
		cylinder {
			<0.00,  0.49, 0.00>
			<0.00,  2.01, 0.00>
			0.30
		}
		cylinder {
			<0.00,  0.50, 0.00>
			<0.00, -2.01, 0.00>
			0.60
		}
	}	
  	cylinder {
		<0.00, 2.00, 0.00>
		<0.00, 1.95, 0.00>
		0.29
  	}
	texture { T_Chrome_4A }
}
#declare ClosingHinge_Plastic = difference {
	cylinder {
		<0.00,  0.50, 0.00>
		<0.00, -0.50, 0.00>
		0.50
	}
	plane {
		y
		0.01
		rotate z*45
	}
	texture {
		pigment { Grey }
	}
}

#macro ClosingHinge( Scale, Angle, PreferredAngle )
#declare ClosingHinge_LeftHeight = abs(Angle - PreferredAngle) / 180;
union {
	object {
		ClosingHinge_Part
		rotate y * -Angle
		translate y*ClosingHinge_LeftHeight
	}
	object {
		ClosingHinge_Plastic
		rotate y * -Angle
		rotate y * (PreferredAngle/2)
		translate y*ClosingHinge_LeftHeight
	}
	object {
		ClosingHinge_Part
		rotate z*180
	}
	object {
		ClosingHinge_Plastic
		rotate z*180
		rotate y * -(PreferredAngle/2)
	}
	cylinder {
		<0.00, -1.90, 0.00>
		<0.00,  1.90, 0.00>
		0.20
		texture { T_Chrome_4A }
	}
	scale Scale
}
#end

object {	
	ClosingHinge(1.0, 90*clock, 45)
	translate x*2.5
         rotate x*90
}
object {	
	ClosingHinge(1.0, 90*clock, 45)
	translate x*-2.5
}

camera { FrontCam }


Post a reply to this message


Attachments:
Download 'closinghinge.jpg' (14 KB)

Preview of image 'closinghinge.jpg'
closinghinge.jpg


 

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