POV-Ray : Newsgroups : povray.general : finding points after a transform Server Time
5 Nov 2024 18:24:53 EST (-0500)
  finding points after a transform (Message 1 to 6 of 6)  
From: Rob
Subject: finding points after a transform
Date: 6 Feb 2003 15:33:57
Message: <3e42c6b5$1@news.povray.org>
Ok, I have this problem where I have a couple cylinders that get rotated and
moved durring an animation.  What I need to do is find the ends of the
cylinders after the transforms so I can use them as a reference for another
object.  I have no clue where to start on this and I'd appreciate any help.

Thanks in advance,
  Rob


Post a reply to this message

From: gonzo
Subject: Re: finding points after a transform
Date: 6 Feb 2003 16:25:03
Message: <web.3e42d27c3d6c529a0c272b50@news.povray.org>
Rob wrote:
>Ok, I have this problem where I have a couple cylinders that get rotated and
>moved durring an animation.  What I need to do is find the ends of the
>cylinders after the transforms so I can use them as a reference for another
>object.  I have no clue where to start on this and I'd appreciate any help.
>
>Thanks in advance,
>  Rob
>

I had a similar problem stringing some telephone wires on poles that were
randomly moved and rotated in a loop.  Look in the docs: 7.9.2 Vector
functions and macros, look up VRotation & VRotationD.

Worked great for me.

RG


Post a reply to this message

From: Rob
Subject: Re: finding points after a transform
Date: 6 Feb 2003 17:00:12
Message: <3e42daec@news.povray.org>
Nope that won't do it. VRotation and VRotationD return the angle I need the
point.  Allow me to illustrate.

cylinder{
  <0,0,0>,<5,0,0>,1
rotate <0,40+clock*50,0>
}

I need to know where the ends of the cylinder are after the rotation.
However now that you pointed me tword those functions I can see that vrotate
will help.

Thanks,
  Rob

"gonzo" <rgo### [at] lansetcom> wrote in message
news:web.3e42d27c3d6c529a0c272b50@news.povray.org...
> Rob wrote:
> >Ok, I have this problem where I have a couple cylinders that get rotated
and
> >moved durring an animation.  What I need to do is find the ends of the
> >cylinders after the transforms so I can use them as a reference for
another
> >object.  I have no clue where to start on this and I'd appreciate any
help.
> >
> >Thanks in advance,
> >  Rob
> >
>
> I had a similar problem stringing some telephone wires on poles that were
> randomly moved and rotated in a loop.  Look in the docs: 7.9.2 Vector
> functions and macros, look up VRotation & VRotationD.
>
> Worked great for me.
>
> RG
>


Post a reply to this message

From: Warp
Subject: Re: finding points after a transform
Date: 6 Feb 2003 18:12:23
Message: <3e42ebd7@news.povray.org>
Rob <avi### [at] prairielakescom> wrote:
> Nope that won't do it. VRotation and VRotationD return the angle

  Which angle? Where did you get this impression?

  By the way, the vtransform() macro is a more generic vector transformation.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Greg M  Johnson
Subject: Re: finding points after a transform
Date: 6 Feb 2003 23:03:27
Message: <3e43300f$1@news.povray.org>
Perhaps a better solution is

cyl_Transform1=transform{rotate <0,40+clock*50,0>}
cyl_Transform2=transform{translate 5*x  rotate <0,40+clock*50,0>
blahblah}

this is how many people make arm joints, for example....


Post a reply to this message

From: Rob
Subject: Re: finding points after a transform
Date: 10 Feb 2003 21:41:58
Message: <3e4862f6$1@news.povray.org>
>   Which angle? Where did you get this impression?

VRotation(V1, V2, Axis), VRotationD(V1, V2, Axis).Compute the rotation angle
from V1 to V2 around Axis. Axis should be perpendicular to both V1 and V2.
The output will be in the range between -pi and pi radians or between -180
degrees and 180 degrees if you are using the degree version.

as I said you may have ment VRotate in any case that's what I needed.
vrotate(A,B) Rotate A about origin by B. Given the x,y,z coordinates of a
point in space designated by the vector A, rotate that point about the
origin by an amount specified by the vector B. Rotate it about the x-axis by
an angle specified in degrees by the float value B.x. Similarly B.y and B.z
specify the amount to rotate in degrees about the y-axis and z-axis. The
result is a vector containing the new x,y,z coordinates of the point.

Here's some code that should explain what I needed to do (specifically the
last object the polygon).  However my project actually consisted of 16
cylinders.

#declare Cyl1_End1 = <0,0,0>;
#declare Cyl1_End2 = <5,0,0>;
#declare Cyl1_Location = <2,2,-3>;
#declare Cyl1_Rotation = <0,45 + (45 * clock),0>

#declare Cyl2_End1 = <0,0,0>;
#declare Cyl2_End2 = <5,0,0>;
#declare Cyl2_Location = <1,2,-3>;
#declare Cyl2_Rotation = <0,45 + (30 * clock),0>

cylinder{Cyl1_End1,Cyl1_End2,0.3
texture{pigment{color Red}}
rotate Cyl1_Rotation
translate Cyl1_Location
}

cylinder{Cyl2_End1,Cyl2_End2,0.3
texture{pigment{color Red}}
rotate Cyl2_Rotation
translate Cyl2_Location
}

#declare Poly_P1 = vrotate(Cyl1_End1,Cyl1_Rotation) + Cyl1_Location;
#declare Poly_P1 = vrotate(Cyl1_End2,Cyl1_Rotation) + Cyl1_Location;
#declare Poly_P1 = vrotate(Cyl2_End2,Cyl2_Rotation) + Cyl2_Location;
#declare Poly_P1 = vrotate(Cyl2_End1,Cyl2_Rotation) + Cyl2_Location;

polygon{
4,Poly_P1,Poly_P2,Poly_P3,Poly_P4
texture{pigment{color White}}
}



"Warp" <war### [at] tagpovrayorg> wrote in message
news:3e42ebd7@news.povray.org...
> Rob <avi### [at] prairielakescom> wrote:
> > Nope that won't do it. VRotation and VRotationD return the angle
>
>   Which angle? Where did you get this impression?
>
>   By the way, the vtransform() macro is a more generic vector
transformation.
>
> --
> #macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb
x]
> [1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
> -1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// -
Warp -


Post a reply to this message

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