Re: How to tilt a cylinder in a precise way



KCWoo <cassaint@xxxxxxxxxxxx> wrote in message
<8353860.1218304340818.JavaMail.jakarta@xxxxxxxxxxxxxxxxxxxxxx>...
I have created several cylinders to mimic a tube(cy3)with
4 electrodes(belec1,2,3,4)in a large container(cy2). So far
i wanna "Tilt"the tube(cy3).I mean..How to set up an origin
and set an "angle" to "tilt" the tube(cy3)
&electrodes(belec1,2,3,4) with an axis? Cause i've tried
several method.including changing the direction Vector
several times...but never meet the demand!


Not sure what you're doing, but rotation is done with
rotation matrices.

Reference:
http://mathworld.wolfram.com/RotationMatrix.html

You'll be using eq 4, 5, 6 (I call these rotX, rotY, rotZ)

[X Y Z] = cylinder(R, N); % using built-in function

Then we need to build this in to a matrix
M = [X(:) Y(:) Z(:)].';

to rotate around one axis
rotM = rotX * M;

to rotate around more axis
rotM = rotY * rotX * M;

it does these sequentially (rotates around X, then around
Y), so that's different than...
rotM = rotX * rotY * M;
which rotates around Y, then around X

then you need to reshape at the end
xOut = reshape(rotM(1,:), [2 N+1]);
yOut = reshape(rotM(2,:), [2 N+1]);
zOut = reshape(rotM(3,:), [2 N+1]);

whew
~Adam
.



Relevant Pages

  • Re: newbie: rotating meshes
    ... The problems I noticed, were if you for example rolled the ship, then tried ... not the rolled x axis, which says to me that the math for matrix ... concatenation doesnt rotate the values of the matrix correctly is some ... which meant the y roation rotated the models x axis whereas the z rotation ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Calculate parcel size in PHP
    ... store orientation of A and B ... rotate A around Y axis, ...
    (comp.lang.php)
  • Re: Calculate parcel size in PHP
    ... store orientation of A and B ... rotate A around Y axis, ...
    (comp.lang.php)
  • Re: Really understanding the Rattleback
    ... When resting on a flat surface, if it is given a push to make it rotate around its point of surface contact, it has the characteristic of moving smoothly in that direction of rotation but if given a push to rotate in the other direction, it will start to turn but then, with a rocking motion, come to a stop and begin rotating in the direction it somehow prefers. ... Take something rectangular like a pack of cards or cigarette packet, ideally something with uniform mass distribution and the 3 axes different lengths. ... even one tumble on the intermediate axis is enough to have it coming down rotated partly on another axis. ... Unfortunately since this is a rectangle it would need to be pivoted and attached to pivot with a couple of springs, or a curved surface added and rocked on the ground. ...
    (rec.puzzles)
  • Re: Object rotation
    ... > need to translate back to the origin first, then rotate, then translate to ... For example rotations are ALWAYS around an axis so if you ... then moves on the new x axis after the Z rotation. ...
    (microsoft.public.win32.programmer.directx.managed)