|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I am using the function VAngleD(V1, V2) to orient some rigging on my USS
Niagara WIP. However, I am getting some unexpected results. Here is my code:
union{
//Spanker Boom Guy
#declare X1 = 286.21;
#declare Z1 = 0;
#declare Y1 = 1472.4;
#declare X2 = cos(radians(BoomRotate))*10554.5;
#declare Z2 = sin(radians(BoomRotate))*10554.5;
#declare Y2 = sin(radians(2))*10554.5;
#declare X3 = sin(radians(BoomRotate))*150;
#declare Z3 = cos(radians(BoomRotate))*150;
#declare Y3 = 0;
#declare X4 = X1+X2-X3;
#declare Z4 = Z1+Z2+Z3;
#declare Y4 = Y1+Y2-Y3;
union{
cylinder{<-12.5,0,25>,<-12.5,0,50>, 12.5 }
cylinder{<0,0,0>,<0,0,50>, 12.5 }
torus{50,12.5 scale<0.5,1,1>
rotate<0,0,0>translate<0,0,75> }
object{DHookBlock12mm rotate<90,0,-90>
translate<0,0,400>}
cylinder{<-30,40,300>,<-12.5,40,1200>, 12.5 }
#declare Length = VDist(<-X4-4000,Y4,Z4>,
<-15000,75,2435>);
sphere{<0,0,Length>,50 pigment{Green}}
texture{WhiteRopeTexture rotate<90,0,0>}
rotate VAngleD(<-X4-4000,Y4,Z4>, <-15000,75,2435>)
translate<-X4-4000,Y4,Z4>
}
}
If I understand the function correctly, the line
rotate VAngleD(<-X4-4000,Y4,Z4>, <-15000,75,2435>)
should orient point from vector <-X4-4000,Y4,Z4> to vector <-15000,75,2435>.
The documentation is sparse. Could someone let me know if I am using the
vector function correctly. If not, I would appreciate some sample code
showing how it is used.
Thanks,
Tim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3d321330@news.povray.org>,
"Tim McMurdo" <tmc### [at] prodigynet> wrote:
> If I understand the function correctly, the line
>
> rotate VAngleD(<-X4-4000,Y4,Z4>, <-15000,75,2435>)
>
> should orient point from vector <-X4-4000,Y4,Z4> to vector <-15000,75,2435>.
>
> The documentation is sparse. Could someone let me know if I am using the
> vector function correctly. If not, I would appreciate some sample code
> showing how it is used.
You misunderstood it, or you misunderstood angles. The VAngleD() macro
returns the angle in degrees between two vectors. In your code, the
angle gets expanded to a vector (< angle, angle, angle>) which doesn't
come close to doing the job. You need to rotate around the correct axis,
which would be perpendicular to the two vectors. The VRotation() macros
might also help here.
It looks like you are trying to do things the hard way though...looks
like you are doing rotation calculations using sin() and cos() functions
instead of vrotate(), and for your orientation problem, I think the
Reorient_Trans() macro in transforms.inc might be better for what you
want.
--
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Let's see if I can understand what is going on here.
I first need to determine the axis that is perpendicular to the plane formed
by the two vectors using:
#declare Axis = VPerp_To_Plane(<X4,Y4,Z4>, <-15000,75,2435>);
Then I need to determine the angle on this axis that would point from
<X4,Y4,Z4> to <-15000,75,2435> using:
#declare Angle = VAngleD(<X4,Y4,Z4>, <-15000,75,2435>)
And finally I need to perform the rotation
Axis_Rotate_Trans(Axis, Angle)
Still not getting the proper results...You are right I am missing something
completely here.
I tried
VRotation(<X4,Y4,Z4>, <-15000,75,2435>, Axis)
but still I don't get the expected results
Help!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3d335e4a@news.povray.org>,
"Tim McMurdo" <tmc### [at] prodigynet> wrote:
> Then I need to determine the angle on this axis that would point from
> <X4,Y4,Z4> to <-15000,75,2435> using:
>
> #declare Angle = VAngleD(<X4,Y4,Z4>, <-15000,75,2435>)
The VAngle() macros give the postive angle between the two vectors, not
the rotation from one two the other. You may need to reverse the sign of
Angle, or use the VRotation() macros.
> I tried
>
> VRotation(<X4,Y4,Z4>, <-15000,75,2435>, Axis)
>
> but still I don't get the expected results
VRotation() gives results in radians, VRotationD() in degrees.
--
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|