POV-Ray : Newsgroups : povray.text.scene-files : Levers Server Time
28 Jul 2024 10:14:29 EDT (-0400)
  Levers (Message 1 to 1 of 1)  
From: Michael Andrews
Subject: Levers
Date: 24 Jul 2000 13:25:25
Message: <397C7BCF.454F7910@reading.ac.uk>
/*
This is in reply to the 'Help needed' post on p.b.i

Problem: Given two points and two levers starting at these points, where
do the levers join?

Solution: Find the intersections of two circles in the plane, centred at
the given points with radii of the length of the levers.

The solution I used was from Paul Bourke's pages,
http://www.swin.edu.au/astronomy/pbourke/geometry/2circle/
with a bit of tweaking for my application.

This script draws a wave generator from a water flume that I sometimes
have to demonstrate. P0 is the driving end of the cam. P1 is the hinge
at the bottom of the paddle. P3 is the point calculated for the hinge
between the driving cam and the paddle.

Bye for now,
	Mike Andrews.
*/

// -- start of script -- //

// ==== Standard POV-Ray Includes ====
#include "colors.inc"	// Standard Color definitions
#include "textures.inc"	// Standard Texture definitions
#include "metals.inc"

global_settings { assumed_gamma 1 max_trace_level 15 }

camera
{
  location  <5.0 , 4.0 ,-15.0>
  direction <0, 0, 15>
  look_at   <0.0 , 0.0 , 0.0>
}

#declare C1 = <.175, .75, 0>; // centre of disc
#declare P1 = <.6, 0, 0>; // hinge at bottom of paddle
#declare R3 = 0.17; // radius of rotation of P0
#declare rDisc = 0.2;
#declare R0 = 0.51; // length of top lever
#declare R1 = 0.72; // length of paddle

#declare maxCount = 20;
#declare Cycle = 10;
#declare Count = 6;

#declare Th = Count*360 / Cycle;
#declare P0 = C1 + R3*vrotate(-x, -Th*z);
#declare D0 = P1 - P0;
#declare D = vlength(D0);

#declare A = ((R0*R0)-(R1*R1)+(D*D)) / (2*D);
#declare H = sqrt((R0*R0)-(A*A));

#declare P2 = P0 + (A/D)*D0;
#declare P3 = P2 + (H/D)*vrotate(D0, 90*z);

union {
	union {
		// driving disk
		union {
			cylinder { C1 - 0.025 * z, C1 - 0.015 * z, rDisc }
			cylinder { C1 - 0.03 * z, C1 - 0.01, 0.01 }
			cylinder { C1 - 0.035 * z, C1 - 0.005 * z, 0.005 }
			texture {
				pigment { P_Chrome3 }
				normal { dents 0.2 scale 0.005 rotate -Th*z translate C1 }
				finish { F_MetalB }
			}
		}

		// paddle pivot on base
		cylinder { P1 - 0.15 * z, P1 + 0.15 * z, 0.01 }

		// cam shaft pivot on paddle
		cylinder { P3 - 0.15 * z, P3 + 0.15 * z, 0.02 }

		// cam shaft pivot on driving disk
		cylinder { P0 - 0.03 * z, P0 + 0.01 * z, 0.01 }

		// cam shaft
    #declare vR0 = P3 - P0;
    #declare thR0 = asin(vR0.y / R0);
		union {
	    box { <0.01, -0.01, -0.003>, <R0, 0.01, 0.003> }
			cylinder { <0, 0, -0.003>, <0, 0, 0.003>, 0.02 }
			rotate degrees(thR0) * z translate P0
		}

		// paddle
    #declare vR1 = P3 - P1;
    #declare thR1 = asin(vR1.x / R1);
		union {
	    box { <-0.005, 0.005, -0.14>, <0.005, R1, 0.14> }
			box { <-0.03, 0.03, -0.055>, <0, R1 - .1, -0.045> }
			box { <-0.03, 0.03, 0.045>, <0, R1 - .1, 0.055> }
			rotate degrees(-thR1) * z translate P1
		}

		texture { pigment { color Black } finish { Dull } }
	}

	union {
		difference {
			box { <-0.025, -0.025, -0.175>, <0.855, 0.61, 0.175> }
			box { <0, 0, -.15>, <.83, .62, .15> }
			box { <.82, -.0001, -.1501>, <.865, .585, .1501> }
			box { <-0.03, -0.03, -0.15>, <-0.005, 0.585, 0.15> }
			box { <0, -0.005, -0.18>, <0.83, 0.585, -0.155> }
			box { <0, -0.005, 0.155>, <0.83, 0.585, 0.18> }
		}

		box { <.01, .001, -.14>, <.46, .45, .14> }
		texture {
			pigment { color CornflowerBlue * 2 filter 1 }
			finish { Dull } //fade_distance 0.1 fade_power 1 refraction 1 ior 1.5
}
		}
	}
	translate <-0.43, -0.4, 0>
	rotate 180*y
}

background { color SummerSky*0.4 }

light_source { <-100, 300, -200> color Gray70 }
light_source { <100, 300, -200> color Gray70 }

// -- end of script -- //


Post a reply to this message

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