POV-Ray : Newsgroups : povray.newusers : translation/rotation : Re: translation/rotation Server Time
30 Jul 2024 02:26:09 EDT (-0400)
  Re: translation/rotation  
From: Stephen
Date: 14 Nov 2004 22:37:55
Message: <41982493$1@news.povray.org>
// with a great deal of help from, and thanks to, ChrisB, here's what I was
attempting (basic model only)

// animation command line +kfi0 +kff60
// this doesn't look like much without the animation

camera {location <0, 1,-10> look_at   <0,-2,0>}
light_source { <0, 10, -8>  color rgb <2, 2, 2> }

#include "math.inc"
#include "colors.inc"

#declare CircleRadius = 1.0      ;
#declare rodLength = 5.0     ;
#declare Dia = 0.10       ;


#declare Axis = union
{
        object {cylinder { -CircleRadius*x,  CircleRadius*x,  Dia pigment
{Green}  }}
        object {cylinder { -CircleRadius*y,  CircleRadius*y,  Dia pigment
{Yellow} }}
}

cylinder {<0,0,0><0,0,0.1>,CircleRadius pigment {color rgb <1,1,1>}}

object {cylinder { -CircleRadius*y,  CircleRadius*y,  Dia pigment {Cyan}
translate  x*0.125 translate y*-rodLength }}
object {cylinder { -CircleRadius*y,  CircleRadius*y,  Dia pigment {Cyan}
translate -x*0.125 translate y*-rodLength }}

#declare connectingRod = cylinder {<0,0,0><0,rodLength,0>, Dia}
#declare rotationAngle = clock*360;


#declare rodRotation = asind(sind(rotationAngle)*CircleRadius/rodLength);
#declare rodHeight   =
rodLength*cosd(rodRotation)-CircleRadius*cosd(rotationAngle);

object {Axis  rotate rodRotation*z }

object {connectingRod
        rotate rodRotation*z
        translate -rodHeight*y
//      pigment {color rgb <rotationAngle/360, 1-(rotationAngle/360),
rotationAngle/360>}  //cool
        pigment {Red}
        }





Stephen


>
> I would like to animate a piston type of instrument and am not sure of the
> simplest math to do the translation so I'm asking for help.
>
> If you think of a circle with a connecting rod attached at a point on the
> circumference e.g. 270 degrees or at "west" on a compass circle, and fixed
> along a vertical slider located below the circle (south of south) such
that
> point will move only up and down, then when the circle rotates clockwise
for
> the first 90 degrees (from 270 to 360) the connecting rod will move up at
> the lower end and move up and clockwise at the upper end.
>
> How can the angular movement of the connecting rod be modeled simply?
>
> One answer is to define the end points and calculate for each degree of
the
> circle rotation the new points along the circle and the vertical slider
path
> and redraw the connecting rod at the new points.
>
> Can this be accomplished through rotation/translation of an existing
> connecting rod?
>
>
> -- 
>
> Stephen
> and
> Kathie
> (S+K)
>
>


Post a reply to this message

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