/********************************************************************* * CONNECTIONS include file for the Persistance of Vision Ray Tracer * * part of the ELECTRONICS set * ********************************************************************* * * Created by Mark Hanford, December 2001 * * * Dependencies * electronics.inc - mainly for some constants * * Optimisation options: * There's not much to optimise on this object yet, this may change... * * Base units: millimetres *************************************************************************/ /******************************************** * Check for and set some default variables * ********************************************/ #ifdef(View_POV_Include_Stack) #debug "including connections.inc\n" #end #ifdef (MH_Connections_Inc_Temp) //do nothing #else #declare MH_Connections_Inc_Temp=1; #include "electronics.inc" /************ * Textures * ************/ #declare T_Wire= texture{ pigment{color rgb 0.7} } /************* * Constants * *************/ #declare WireRadius = 0.25; #declare WireCornerRadius = 0.4; #declare WireCutJitter = seed(5535); #macro WireCorner() intersection{ torus{WireCornerRadius, WireRadius} box{<0, -WireRadius-0.1, 0>, } rotate 90*z texture{T_Wire} } #end /************************************************ * A straight connecting wire with chopped ends * ************************************************/ #macro WireStraight(Length) cylinder{<0,0,-Length/2>,<0,0,Length/2>,WireRadius texture{T_Wire}} #end /************************************************************************ * A wire with two bends in it, such as a horizontally mounted resistor * ************************************************************************/ #macro WireBent(PinPitch, Height) union{ object{WireCorner() rotate -90*x translate <0, -WireCornerRadius, -PinPitch/2+WireCornerRadius>} object{WireCorner() rotate 0*x translate <0, -WireCornerRadius, PinPitch/2-WireCornerRadius>} cylinder{<0, -WireCornerRadius,-PinPitch/2>, <0, -Height, -PinPitch/2>, WireRadius} //near riser cylinder{<0, 0,-PinPitch/2+WireCornerRadius>, <0, 0, PinPitch/2-WireCornerRadius>, WireRadius} //top bar cylinder{<0, -WireCornerRadius, PinPitch/2>, <0, -Height, PinPitch/2>, WireRadius} //far riser texture{T_Wire} } #end /************************************************************************ * A looped-over wire, such as needed for a vertically mounted resistor * ************************************************************************/ #macro WireRecurve(PinPitch, Height) union{ object{WireCorner() rotate 180*x translate <0, WireCornerRadius, -Height/2+WireCornerRadius>} //bottom curve object{WireCorner() rotate -90*x translate <0, PinPitch-WireCornerRadius, -Height/2+WireCornerRadius>} //top curve cylinder{<0, WireCornerRadius, -Height/2>, <0, PinPitch-WireCornerRadius, -Height/2>, WireRadius} //vertical bar cylinder{<0, 0, -Height/2+WireCornerRadius>, <0, 0, Height/2>, WireRadius} //top bar cylinder{<0, PinPitch, -Height/2+WireCornerRadius>, <0, PinPitch, Height/2>, WireRadius} //top bar texture{T_Wire} } #end /********************************************************************* * A pair of parallel wires, such as those coming out of a capacitor * *********************************************************************/ #macro WireParallel(PinPitch, Height) union{ cylinder{< PinPitch/2, 0, 0>, < PinPitch/2, -Height, 0>, WireRadius} cylinder{<-PinPitch/2, 0, 0>, <-PinPitch/2, -Height, 0>, WireRadius} texture{T_Wire} } #end /********************************************************************************** * A pair of parallel wires, such as those coming out of a capacitor, with a bend * **********************************************************************************/ #macro WireParallelBent(PinPitch, Height, BendAt) union{ object{WireCorner() rotate 180*x translate < PinPitch/2, -BendAt+WireCornerRadius, WireCornerRadius>} object{WireCorner() rotate 180*x translate <-PinPitch/2, -BendAt+WireCornerRadius, WireCornerRadius>} cylinder{< PinPitch/2, 0, 0>, < PinPitch/2, -BendAt+WireCornerRadius, 0>, WireRadius} cylinder{< PinPitch/2, -BendAt, WireCornerRadius>, < PinPitch/2, -BendAt, Height>, WireRadius} cylinder{<-PinPitch/2, 0, 0>, <-PinPitch/2, -BendAt+WireCornerRadius, 0>, WireRadius} cylinder{<-PinPitch/2, -BendAt, WireCornerRadius>, <-PinPitch/2, -BendAt, Height>, WireRadius} texture{T_Wire} } #end // ------------------------------------------------------------------------------------------------ #macro LinkWire(PointA, PointB) #local x1 = PointA.x; #local x2 = PointB.x; #local z1 = PointA.z; #local z2 = PointB.z; #local NewOrigin = ; #local LenZ = z2-z1; #local LenX = x2-x1; #local LenH = LenZ/(sin(atan2(LenZ,LenX))); object{ ComponentLinearWire(LenH, 0) rotate degrees(atan2(LenX, LenZ))*y translate NewOrigin } #end /********** * Finish * **********/ #end