Re: How to tilt a cylinder in a precise way
- From: "Adam " <not.real@xxxxxxxxx>
- Date: Mon, 11 Aug 2008 13:27:01 +0000 (UTC)
KCWoo <cassaint@xxxxxxxxxxxx> wrote in message
<8353860.1218304340818.JavaMail.jakarta@xxxxxxxxxxxxxxxxxxxxxx>...
I have created several cylinders to mimic a tube(cy3)with4 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
.
- References:
- How to tilt a cylinder in a precise way
- From: KCWoo
- How to tilt a cylinder in a precise way
- Prev by Date: Incredible error of "<": I can't understand...
- Next by Date: Re: Unable to obtain a handle to a graph legend
- Previous by thread: How to tilt a cylinder in a precise way
- Next by thread: Callbacks don't work 1st time GUI is run
- Index(es):
Relevant Pages
|