POV-Ray : Newsgroups : povray.binaries.images : Isosurface cylindrical ramp?, cam lift hinge Server Time
16 Nov 2024 18:21:02 EST (-0500)
  Isosurface cylindrical ramp?, cam lift hinge (Message 1 to 7 of 7)  
From: StephenS
Subject: Isosurface cylindrical ramp?, cam lift hinge
Date: 6 Mar 2005 11:41:45
Message: <422b32c9@news.povray.org>
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 :-)

Stephen

#include "functions.inc"
background { color <1.000,1.000,1.000> }

camera {
  location  <    -58.033,     -87.696,      83.175>
  sky       <    0.00000,     0.00000,     1.00000>
  up        <        0.0,         0.0,         1.0>
  right     <    1.33343,         0.0,         0.0>
  angle          2.56896
  look_at   <     -3.480,      -4.962,       4.713>
}

light_source {
  <0.0, 0.0, 0.0>
  color rgb <1.000, 1.000, 1.000>
  translate  <-65.474138, -85.344511, 105.18157>
}

#local fn_A=function{sqrt(x*x+ y*y) - .5};
#local fn_B=function(z){abs(z)-.5};
isosurface {
   function {
      max(fn_A(x,y,z),fn_B(z))
   }
   contained_by {box{
    < -1, -1, -1>,
    <  1,   1,  1>}}
   threshold 0
   accuracy 0.01
   evaluate 1, 10, 0.99
   max_gradient 1
   max_trace 5

pigment{rgb .8}
}


Post a reply to this message


Attachments:
Download 'hinge_camlift.jpg' (8 KB)

Preview of image 'hinge_camlift.jpg'
hinge_camlift.jpg


 

From: Mike Williams
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
Date: 6 Mar 2005 23:24:57
Message: <eqXElEAJe9KCFwzQ@econym.demon.co.uk>
Wasn't it StephenS who 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 :-)
>
>Stephen
>

Here's something that might get you started. I had to swap the axes to
y-upwards because my POV intuition doesn't work in z-upwards mode.

A big problem is that the gradient becomes infinite at the vertical
edge, which means that it takes a nearly infinite amount of time to
render with eval, and doesn't render correctly with any finite value of
max_gradient.

I tried rendering it with a low max_gradient and masking the dodgy edge
with a thin box. That helped, but there are still some bad bits that are
still visible unless I make the box so large that it becomes noticeable.

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <0,0,-10> look_at <0,0,0> angle 50}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}

#include "functions.inc"

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

#declare H=0.5;

#local fn_A=function{sqrt(x*x+ z*z) - .5};
isosurface {
   function {
      max (
        fn_A(x,y,z),
        y-f_th(x,y,z)*H/pi
      )
   }
   contained_by {box{
    < -1, -1, -1>,
    <  1,   1,  1>}}
   max_gradient 20

   pigment{rgb .8}
}

// Try to hide the bits that have infinite gradient
box {<-0.0, -H, 0><0.002, H, -0.5>
  pigment {rgb .8}
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
Date: 6 Mar 2005 23:47:49
Message: <yqeP1CAtz9KCFwWq@econym.demon.co.uk>
Wasn't it Mike Williams who wrote:
>Wasn't it StephenS who 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 :-)
>>
>>Stephen
>>
>

Here's a version that doesn't have the problem of infinite gradients.
I've split the isosurface into two parts each of which POV considers to
have finite gradients. The actual gradients that it thinks it finds are
still a bit weird because the edges are still pathological, so you'll
get warnings suggesting max_gradient values that vary considerably.

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <0,0,-10> look_at <0,0,0> angle 50}
background {rgb 1}
light_source {<-50, 100, -30> color rgb 1}

#include "functions.inc"

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

#declare H=0.5;

#local fn_A=function{sqrt(x*x+ z*z) - .5};

union {
  isosurface {
    function {
      max (
        fn_A(x,y,z),
        y-abs(f_th(x,y,z)*H/pi)
      )
    }
    contained_by {box{< 0, -1, -1>,<  1,   1,  1>}}
    max_gradient 2
  }

  isosurface {
    function {
      max (
        fn_A(x,y,z),
        y+abs(f_th(x,y,z)*H/pi)
      )
    }
    contained_by {box{< -1, -1, -1>,<  0,   1,  1>}}
    max_gradient 2
  }

  cylinder {-y,y,0.35}

  pigment{rgb .8}
  
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Rick Measham
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
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


 

From: Mike Williams
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
Date: 7 Mar 2005 02:41:11
Message: <RnsXWCAiQALCFwrj@econym.demon.co.uk>
Wasn't it Rick Measham who wrote:
>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 don't think that works at all well. When the hinge is part open, the
whole weight of the door is supported on a single point of contact, and
that's going to damage the hinge. Here's a close-up of just the contact
surfaces showing the problem.

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <0,0,-10> look_at <0,0,0> angle 30}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}

#include "colors.inc"


#declare ClosingHinge_Plastic = difference {
        cylinder {
                <0.00,  1.50, 0.00>
                <0.00, -0.50, 0.00>
                0.50
        }
        plane {
                y
                0.01
                rotate z*45
        }
        texture {
                pigment { Grey }
        }
}

#declare Open30 = union {
  object {ClosingHinge_Plastic}
  object {ClosingHinge_Plastic
    rotate z*180
    rotate y*30
    translate <0,-0.23,0>
  }
}

object {Open30 translate -x}
object {Open30 rotate y*180 translate x}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Rick Measham
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
Date: 7 Mar 2005 02:46:56
Message: <422C06F5.30201@nomail>
Mike Williams wrote:
> I don't think that works at all well. When the hinge is part open, the
> whole weight of the door is supported on a single point of contact, and
> that's going to damage the hinge. Here's a close-up of just the contact
> surfaces showing the problem.

Just ran downstairs to check .. only thing I got wrong is the angle. 
Probably closer to 30 than the 45 I put in there. The hinge does indeed 
rest on on that small point.

The plastic part of the hinge is a fairly strong plastic that's not 
going to break too soon as this building is 10+ years old .. and I've 
never seen one of these hinges broken anywhere.

Cheers!
Rick


Post a reply to this message

From: StephenS
Subject: Re: Isosurface cylindrical ramp?, cam lift hinge
Date: 7 Mar 2005 06:28:42
Message: <422c3aea@news.povray.org>
...
> Here's something that might get you started.
 ...
> Mike Williams
> Gentleman of Leisure
That indeed helped. Will look into the second example as time permits.

Stephen


Post a reply to this message


Attachments:
Download 'cylindrical_ramp.jpg' (4 KB)

Preview of image 'cylindrical_ramp.jpg'
cylindrical_ramp.jpg


 

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