POV-Ray : Newsgroups : povray.newusers : translation/rotation Server Time
4 Nov 2024 19:19:11 EST (-0500)
  translation/rotation (Message 1 to 4 of 4)  
From: Stephen
Subject: translation/rotation
Date: 14 Nov 2004 08:52:23
Message: <41976317$1@news.povray.org>
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

From: Tor Olav Kristensen
Subject: Re: translation/rotation
Date: 14 Nov 2004 09:54:30
Message: <419771a6$1@news.povray.org>
Stephen wrote:
> 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?

To find the upper fastening point of the rod when the
lower fastening point is fixed, you can draw a circle
around the lower fastening point. The radius of this
circle should be the equal to the length of the rod.

Now the upper fastening point is where the two circles
intersect. You'll find 0, 1 or 2 intersecting points,
so you might have to choose (the right) one.

-- 
Tor Olav
http://subcube.net
http://subcube.com


Post a reply to this message

From: Chris B
Subject: Re: translation/rotation
Date: 14 Nov 2004 15:49:02
Message: <4197c4be$1@news.povray.org>
"Stephen" <pen### [at] shawca> wrote in message
news:41976317$1@news.povray.org...
>
> 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?
>

Hi Stephen,

You can calculate the rotation and translation using the sin and cos
functions. The math.inc file includes these functions in degrees (whereas
the built in functions use radians).

I don't know how your trigonometry is, but if you think of a line from the
centre of your circular path to the point on the circumference, then the
horizontal distance of the point from the y axis is given by
circleRadius*sin(rotationAngle), where the rotationAngle is the angle
between straight up (+Y) and your radial line (sine of an angle in a right
angle triangle = length of opposite edge/ length of hypotenuse).

The same horizontal distance is the distance the top of your connecting rod
is from the y axis, so it's also equal to rodLength*sin(rodRotation), where
the rodRotation is the angle between straight up and your connecting rod.

So ... rodLength*sin(rodRotation)=circleRadius*sin(rotationAngle), and
therefore ... rodRotation =
arcsin(sin(rotationAngle)*circleRadius/rodLength.

You can use cosines to work out the distance from the centre of the circle
to the bottom of the connecting rod because the y component of the rodLength
is rodLength*cos(rodRotation) and the y component of the point on the
circumference is given by circleRadius*cos(rotationAngle).

So ... rodHeight = rodLength*cos(rodRotation) -
circleRadius*cos(rotationAngle).

Here's a simple example:

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

#include "math.inc"

#declare circleRadius = 0.7;
#declare rodLength = 1.8;

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

#declare connectingRod = cylinder {<0,0,0><0,rodLength,0>,0.01}


#declare rotationAngle = 5;
#while (rotationAngle < 360)
  #declare rodRotation = asind(sind(rotationAngle)*circleRadius/rodLength);
  #declare rodHeight   =
rodLength*cosd(rodRotation)-circleRadius*cosd(rotationAngle);

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

  #declare rotationAngle = rotationAngle + 20;
#end


Post a reply to this message

From: Stephen
Subject: Re: translation/rotation
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.