
Muscle Wrapping over an cylinder  Shortest path
Dear all,
I have two points, between which I want to calculate the shortest path along the surface of an ellipsoid. In order to obtain the shortest line between P1 and P2 around a cylinder, tangent points R1 and R2 must be calculated. The cylinder is defined by its central axis with position vector O and unit direction vector d, and by its radius r. The shortest line, including P1, P2, R1 and R2 is assumed to be in one plane.
There are several articles published on muscle wrapping, I use the following equations:
* Normal vector n: n = (P1P2) x d x (P1P2) (Eq 1)
* Vector Nr1, perpendicular to the central axis and through R, can be calculated by the following three equations:
(1) dx*Nr1x + dy*Nr1y + dz*Nr1z = 0 (Eq 2)
(2) P1x*Nr1x + P1y*Nr1y + P1z*Nr1z + 1 = 0 (Eq 3)
(3) Ox*Nr1x + Oy*Nr1y + Oz*Nr1z + r + 1 = 0 (Eq 4)
* Tangent Point R1 = P1 + Lambda1* L1 (Eq 5)
* Direction vector L1 = n x Nr1 (Eq 6)
* R1 is on the surface of the cylinder, which is described by:
[(RxOx)dy  (RyOy)dz]^2 + [(RyOy)dz  (RzOz)dy]^2 + [(RzOz)dx  (RxOx)dz]^2  r^2 =0 (Eq 7)
lambda 1 is calculated by substituting Eq5 in Eq 7, and so R1 can be calculated. R2 can be calculated similarly.

Now, my code, when I plot R1 and R2, this is not correct. I hope someone can help me detect my mistake and maybe can tell me how to correctly plot the geodesic between R1 and R2.

X1=[1 1 1]; % Startpoint cylinder
X2=[41 5 10]; % End point cylinder
r=5; % Radius
P1=[30,8,5];P2=[17,10,0];
scatter3(P1(1,1),P1(1,2),P1(1,3))
hold on
scatter3(P2(1,1),P2(1,2),P2(1,3))
d=(X2X1); %
d=d(:).'/norm(d) % directional vector
O=X1; % position vector
N1 = [0;0;0]; % Werkt voor aMCL, pop Ten,pmcl
options = optimset('Display','iter','Algorithm',{'levenbergmarquardt',.005},'MaxIter',600,'MaxFunEvals',1400);% Werkt voor aMCL/pmcl,Werkt voor pop Ten
[N]=fsolve(@SolveCylinder, N1,options,P1,d,r,O);
n=cross(cross((P1P2),d),(P1P2)); % Normal vector n
n=n(:).'/norm(n);
L1 = cross(n,N);
lambda=[0;0;0]; % Startvalues lambda
options = optimset('Display','iter','Algorithm',{'levenbergmarquardt',.005},'MaxIter',600,'MaxFunEvals',1400);% Werkt voor aMCL/pmcl,Werkt voor pop Ten
[LL]=fsolve(@SolveCylinderR1, lambda,options,P1,L1,d,O,r);
LL
R1x=P1(1,1)+LL(1)*L1(1,1)
R1y=P1(1,2)+LL(2)*L1(1,2)
R1z=P1(1,3)+LL(3)*L1(1,3)
scatter3(R1x,R1y,R1z,'*','r')
plot3([P1(1,1) R1x],[P1(1,2) R1y],[P1(1,3) R1z],'r' )
plot3([P1(1,1) P2(1,1)],[P1(1,2) P2(1,2)],[P1(1,3) P2(1,3)],'r' )
options = optimset('Display','iter','MaxIter',600);
[N]=fsolve(@SolveCylinder, N1,options,P2,d,r,O);
L1 = cross(n,N);
N
options = optimset('Display','iter','Algorithm',{'levenbergmarquardt',.005},'MaxIter',600,'MaxFunEvals',1400);% Werkt voor aMCL/pmcl,Werkt voor pop Ten
[LL]=fsolve(@SolveCylinderR1, lambda,options,P2,L1,d,O,r);
R2x=P2(1,1)+LL(1)*L1(1,1)
R2y=P2(1,2)+LL(2)*L1(1,2)
R2z=P2(1,3)+LL(3)*L1(1,3)
scatter3(R2x,R2y,R2z,'*','r')
plot3([P2(1,1) R2x],[P2(1,2) R2y],[P2(1,3) R2z],'r' )
R1=[R1x,R1y,R1z];
R2=[R2x,R2y,R2z];


0




Reply

Els

6/3/2010 1:06:04 PM 

See related articles to this posting
I forgot to add the two equation solver functions. Still hope someone can help me.
A lot of thanks in advance.
Best wishes,
Els
_________________________
function [F] = SolveCylinderR1(lambda,P1,L1,d,O,r)
F = (((((P1(1,1)+lambda(1)*L1(1,1))O(1,1))*d(1,2))(((P1(1,2)+lambda(2)*L1(1,2))O(1,2))*d(1,1)))^2 + ((((P1(1,2)+lambda(2)*L1(1,2))O(1,2))*d(1,3))(((P1(1,3)+lambda(3)*L1(1,3))O(1,3))*d(1,2)))^2 + ((((P1(1,3)+lambda(3)*L1(1,3))O(1,3))*d(1,1))(((P1(1,1)+lambda(1)*L1(1,1))O(1,1))*d(1,3)))^2 r^2 );
_____________________________
function [F] = SolveCylinder(N1,P1,d,r,O)
F = [ ((P1(1,1)*N1(1))+ (P1(1,2)*N1(2)) +(P1(1,3)*N1(3))+1);
(d(1,1)*N1(1)+ d(1,2)*N1(2) +d(1,3)*N1(3));
((O(1,1)*N1(1))+ (O(1,2)*N1(2)) +(O(1,3)*N1(3))+r+1)];


0




Reply

Els

6/4/2010 9:00:30 AM


Sorry to post here again, but the deadline of my project is approaching, and I still do not see what I am doing wrong. Tried all the  and + thing, but haven't found it.
Sorry, I am a bit desperite.


0




Reply

Els

6/4/2010 3:27:04 PM


"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hu89bs$ito$1@fred.mathworks.com>...
> I have two points, between which I want to calculate the shortest path along the surface of an ellipsoid. In order to obtain the shortest line between P1 and P2 around a cylinder, tangent points R1 and R2 must be calculated. The cylinder is defined by its central axis with position vector O and unit direction vector d, and by its radius r. The shortest line, including P1, P2, R1 and R2 is assumed to be in one plane.
> ........
         
I don't understand your reasoning involving what appear to be two discretely separated points P1 and P2 on a cylinder. Also I don't know what you mean by the two "tangent points" R1 and R2, unless perhaps you mean the points at the ends of unitlength tangent vectors.
However, I do know that the geodesic on a strictly circular cylindrical surface is always a helical path spiraling around the cylinder, and that is not a curve that is contained in any plane. In particular the statement "the shortest line, including P1, P2, R1 and R2 is assumed to be in one plane" is incorrect.
Demonstrating this fact involves reasoning on the infinitesimal level and is actually a problem in the calculus of variations. A basic principle for any geodesic on a surface is that the curve's normal  that is the direction of change of its unitlength tangent vector  must always be parallel to the cylinder's surface normal. In this case that forces the angle of the cylindrical coordinates to be a linear function of the axial coordinate, and that necessarily defines a helix. It is rather easy to show if the above principle is properly applied.
Roger Stafford


0




Reply

Roger

6/5/2010 7:12:06 AM


Dear Roger,
Thanks for your complete response, very clear.
P1 and P2 are no points on a cylinder, they are random points in space. The R1 and R2 are tangent points on the surface of the cylinder. So there will come a straight line from P1 to R1, then a geodesic over the surface of the cylinder from R1 to R2 and then again a straight line from R2 to P2. Resulting in the shortest path from P1 to P2.
To get this, you have to make some assumptions, in the article I got from my Professor, was stated that the 4 points should be assumed to be in one plane.
You stated that it was easy to show the above, did you mean my code, or your principle?
Best wishes, Els


0




Reply

Els

6/5/2010 9:34:05 AM


"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hud5md$sg3$1@fred.mathworks.com>...
> Dear Roger,
>
> Thanks for your complete response, very clear.
>
> P1 and P2 are no points on a cylinder, they are random points in space. The R1 and R2 are tangent points on the surface of the cylinder. So there will come a straight line from P1 to R1, then a geodesic over the surface of the cylinder from R1 to R2 and then again a straight line from R2 to P2. Resulting in the shortest path from P1 to P2.
>
> To get this, you have to make some assumptions, in the article I got from my Professor, was stated that the 4 points should be assumed to be in one plane.
>
> You stated that it was easy to show the above, did you mean my code, or your principle?
>
> Best wishes, Els
        
If R1 and R2 are points on the cylinder connected by a geodesic curve on the cylinder, and if P1R1 and P2R2 are lines pointing out along the two geodesic tangent directions at R1 and R2, respectively, then no, the two lines P1R1 and P2R2 cannot be assumed to lie in a common plane. Go to the extreme of a helix that has wrapped halfway around the cylinder and you can easily see that this would be impossible.
In answer to your question, I was stating that, given the principle that a geodesic curve's normal direction should always be parallel to the surface normal at every point, then the geodesic on a cylinder must be a helix. That is comparatively easy to show. I confess I didn't study your code carefully because the initial assumption of a common plane was apparently false.
To show that the geodesic must be a helix, do the following. Cartesian coordinates, r, t, and z (where t is short for theta) are related to cartesian coordinates by:
x = r*cos(t)
y = r*sin(t)
z = z
Letting s be the arc length along a geodesic, we have
ds = sqrt(dx^2 + dy^2 + dz^2) = sqrt((dx/dz)^2+(dy/dz)^2+1)*dz =
sqrt(r^2*(dt/dz)^2+1)*dz
Therefore the unit tangent is
[dx/ds , dy/ds , dz/ds] = [dx/dz , dy/dz , 1]*dz/ds =
[dx/dz , dy/dz , 1]*/sqrt(r^2*(dt/dz)^2+1) =
[r*sin(t)*dt/dz , r*cos(t)*dt/dz , 1]/sqrt(r^2*(dt/dz)^2+1)
The geodesic normal is the derivative with respect to s of this unit tangent vector, and it must always be parallel to the surface normal which is [cost) , sin(t) , 0]. The derivative of the third component of the unit tangent will have a factor of d(dt/dz)/dz and since this component is zero in the surface normal, this second derivative must also be zero. That shows that dt/dz is a constant, and t is therefore a linear function of z. Hence the geodesic must be a helix.
Roger Stafford


0




Reply

Roger

6/5/2010 5:06:04 PM


Dear Roger,
The assumption of the fact that P1,P2,R1 and R2 are in one plane is correct, because is is about muscle wrapping, and the muscles do not wrap around the whole cylinder, but only have real small part arc length on the cylinder its self. I tried to understand your explanation further, but I must admit, that it is too difficult for me. The dx, dy, dz....are that the distances between R1 and R2? But I do not have R1 and R2, I want to calculate them. The only distance I know on forehand is the distance between P1 and P2, and the position and direction of the axis of the cylinder.
Hope I do not frustrate you, because I do appriciate your help very much. So thanks again a lot.
Best Wishes,
Els


0




Reply

Els

6/5/2010 7:34:03 PM


"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hue8rb$80i$1@fred.mathworks.com>...
> Dear Roger,
>
> The assumption of the fact that P1,P2,R1 and R2 are in one plane is correct, because is is about muscle wrapping, and the muscles do not wrap around the whole cylinder, but only have real small part arc length on the cylinder its self. I tried to understand your explanation further, but I must admit, that it is too difficult for me. The dx, dy, dz....are that the distances between R1 and R2? But I do not have R1 and R2, I want to calculate them. The only distance I know on forehand is the distance between P1 and P2, and the position and direction of the axis of the cylinder.
>
> Hope I do not frustrate you, because I do appriciate your help very much. So thanks again a lot.
>
> Best Wishes,
>
> Els
No, I must firmly disagree with you. Even with a very small travel along a helix, the two lines R1P1 and R2P2 will not be coplanar. I only asked you to envision things halfway around because the statement should be glaringly obvious in that case. If you doubt this, try plugging some numbers into those formulae I gave you for a much smaller separation and check if the four points are coplanar. Four points, [x1,y1,z1], [x2,y2,z2], [x3,y3,z3], [x4,y4,z4], are coplanar if and only if the determinant
det([x1,x2,x3,x4;y1,y2,y3,y4;z1,z2,z3,z4;1,1,1,1])
is equal to zero.
However, your intuition ought to tell you that if the points are not colinear when the rotation is half way around the cylinder, that situation is not likely to suddenly clear up even if they are only part way around the cylinder. Actually they can't be coplanar unless P1 and P2 are the same points, or else the angle around the helix is some multiple of 2*pi (360 degrees).
Roger Stafford


0




Reply

Roger

6/5/2010 10:32:04 PM


Ok, and now I do have the two points on the surface. How do I calculate the distance between them? Because the problem is that my cylinder is rotated along a line, and that I can't use the calculation below.

If P1 and P2 have rectangular coordinates (x1,y1,z1) and (x2,y2,z2), their cylindrical
coordinates are (r*cos(t1),r*sin(t1),z1) and (r*cos(t2),r*sin(t2),z2), where t1 and t2 are in
radians. If we now unroll the cylinder onto the plane x=r, P1 goes to Q1 and P2 goes to
Q2. The rectangular coordinates of Q1 and Q2 are
Q1=(r,r*t1,z1)
Q2=(r,r*t2,z2)
The distance d from P1 to P2, on the cylinder, is equal to the distance from Q1 to Q2,
namely,
d = sqrt[ (r*t1  r*t2)^2 + (z1z2)^2 ]



0




Reply

Els

6/6/2010 2:23:04 PM


"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hugb08$ns6$1@fred.mathworks.com>...
> Ok, and now I do have the two points on the surface. How do I calculate the distance between them? Because the problem is that my cylinder is rotated along a line, and that I can't use the calculation below.
>
> 
>
> If P1 and P2 have rectangular coordinates (x1,y1,z1) and (x2,y2,z2), their cylindrical
> coordinates are (r*cos(t1),r*sin(t1),z1) and (r*cos(t2),r*sin(t2),z2), where t1 and t2 are in
> radians. If we now unroll the cylinder onto the plane x=r, P1 goes to Q1 and P2 goes to
> Q2. The rectangular coordinates of Q1 and Q2 are
> Q1=(r,r*t1,z1)
> Q2=(r,r*t2,z2)
>
> The distance d from P1 to P2, on the cylinder, is equal to the distance from Q1 to Q2,
> namely,
>
> d = sqrt[ (r*t1  r*t2)^2 + (z1z2)^2 ]
> 
Yes, that last formula is indeed the best way to calculate the kind of cylindrical "distance" you are seeking. It should however be modified a bit. Something like this:
d = sqrt((r*(mod(t2t1+pi,2*pi)pi))^2+(z1z2)^2)
The unrolled cylinder has to be conceived as having at least two other unrolled copies rather than just the one extending from 0 to 2*pi*r, and you need to select the shortest straight line path between the copies of P1 and P2. The mod operation above does that.
As for making use of this method, you first have to do a translation of some point on your axis line over to the origin and bring P1 and P2 along with it. Then you have to rotate this translated axis so as to lie along the zaxis, again rotating P1 and P2 along with it. I think you've had advice in the past about how to do this rotation. Next you convert the new P1 and P2 cartesian coordinates to cylindrical coordinates. Then finally you can use the above method.
By the way, this method of unrolling a cylinder should be a powerful indicator that indeed the geodesics on circular cylinders are the helices (except of course when the angles are equal and they are straight lines, or when the z coordinates are equal and they are circles.)
Roger Stafford


0




Reply

Roger

6/6/2010 4:46:03 PM


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hugjcb$23v$1@fred.mathworks.com>...
> "Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hugb08$ns6$1@fred.mathworks.com>...
> > Ok, and now I do have the two points on the surface. How do I calculate the distance between them? Because the problem is that my cylinder is rotated along a line, and that I can't use the calculation below.
> >
> > 
> >
> > If P1 and P2 have rectangular coordinates (x1,y1,z1) and (x2,y2,z2), their cylindrical
> > coordinates are (r*cos(t1),r*sin(t1),z1) and (r*cos(t2),r*sin(t2),z2), where t1 and t2 are in
> > radians. If we now unroll the cylinder onto the plane x=r, P1 goes to Q1 and P2 goes to
> > Q2. The rectangular coordinates of Q1 and Q2 are
> > Q1=(r,r*t1,z1)
> > Q2=(r,r*t2,z2)
> >
> > The distance d from P1 to P2, on the cylinder, is equal to the distance from Q1 to Q2,
> > namely,
> >
> > d = sqrt[ (r*t1  r*t2)^2 + (z1z2)^2 ]
> > 
>
> Yes, that last formula is indeed the best way to calculate the kind of cylindrical "distance" you are seeking. It should however be modified a bit. Something like this:
>
> d = sqrt((r*(mod(t2t1+pi,2*pi)pi))^2+(z1z2)^2)
>
> The unrolled cylinder has to be conceived as having at least two other unrolled copies rather than just the one extending from 0 to 2*pi*r, and you need to select the shortest straight line path between the copies of P1 and P2. The mod operation above does that.
>
> As for making use of this method, you first have to do a translation of some point on your axis line over to the origin and bring P1 and P2 along with it. Then you have to rotate this translated axis so as to lie along the zaxis, again rotating P1 and P2 along with it. I think you've had advice in the past about how to do this rotation. Next you convert the new P1 and P2 cartesian coordinates to cylindrical coordinates. Then finally you can use the above method.
>
> By the way, this method of unrolling a cylinder should be a powerful indicator that indeed the geodesics on circular cylinders are the helices (except of course when the angles are equal and they are straight lines, or when the z coordinates are equal and they are circles.)
>
> Roger Stafford
Dear Roger,
For my understanding, you are implying that I have to rotate and translate the axis of the cylinder. And do the same with points P1 and P2. Then I can calculate the cylindrical coordinates and use your formula.
Concerning the ellipsoids, you gave me the following code to do the rotation:

% Calculate necessary rotation data
t = t/norm(t); % Make t a unit vector
u = [1,0,0]; % Unit vector along the positive xaxis
w = cross(u,t); % The axis of rotation
cosa = dot(u,t); % Cosine of the angle of rotation
sina = norm(w); % Sine of the angle of rotation
w = w/sina; % Make w a unit vector
v = cross(w,u); % Unit vector orthogonal to u and w
% Proceed with the rotation transformation
n = numel(x); % Number of points in surface
p = [x(:),y(:),z(:)]; % Create n x 3 array of ellipsoid surface points
u = repmat(u,n,1); % Match sizes of u, v, and w to that of p
v = repmat(v,n,1);
w = repmat(w,n,1);
wp = cross(w,p,2);
q = dot(p,w,2)*w + cosa*cross(wp,w,2) + sina*wp; % Rotate p
xr = q(:,1); yr = q(:,2); zr = q(:,3); % Extract components
xr = reshape(xr,size(x)); % These are the rotated coordinates
yr = reshape(yr,size(x)); % in mesh format again
zr = reshape(zr,size(x));
% Now plot the rotated surface
surf(xr,yr,zr)

But if I am correct, I have to rotate now over 3 axis, to get the axis of my cylinder on the origin. The translation is simple, but the rotation afterwards I still don't get in Matlab. As for the above code, t should be the vector from the origin to the point on the zaxis which corresponds with the length of the cylinder (t=[0 0 LengthCylinder]) and u should be [0,0,1], still my cylinder is pointed along the original (but translated) axis.
Best Wishes,
Els


0




Reply

y.e.t.reeuwijk (10)

6/6/2010 5:29:04 PM



10 Replies
314 Views
Similar Articles
[PageSpeed]
13

Similar Artilces:
Cylinder wrapping... what am I doing wrong?Hi,
I'm making a crayon. I removed and scanned the crayon wrapper
into PS. It's 1:1.
I made a cylinder. It's 1:1. The "ends" are a different
surface so that the texture doesn't try and "wrap" over the ends.
The image stretches, and I can't seem to get it to wrap
correctly. I know I've done this in the past without any problems, but
this time it's just not happening. What am I missing about wrapping a
cylinder? I can post the objects and image, but really this is it.
Thanks for any help...
Mike Tripoli
Mike,
Be sure that you are map... wrap Spiral on cylinderThis is the way to wrap circle on cylinder
"If you use cylindric coordinates (where R is the radius of the cylinder):
x=R*cos(phi)
y=R*sin(phi)
z=z
and r is the radius of the circle then
Sqr(R)*Sqr(phi) + Sqr(z)=Sqr(r)
is the equation of your curve, or in cartesian coordinates:
x=R*cos(phi)
y=R*sin(phi)
z=+/Sqrt(Sqr(r)  Sqr(R)*Sqr(phi))
with r/R<=phi<=r/R"
could you show me how to wrap Spiral ?
where n  is a counter = PPR*R
P pitch
PPR points per revolution
R  number of revolutions
... Wrap Logo Around Cylinder?What tool would you use to do this?
Customer supplies a logon in Illustrator format and wants it wrapped
around a cylinder in Photoshop.
It's actually a machine but the face is a cylinder.
Adobe Dimensions was perfect for this sort of thing  probably you have a
copy somewhere. Shame it didn't survive (or any of the other simple vector 3D
programs).
Otherwise, you'll either need a 3D modelling tool of some sort, or to do a
fancy bit of redrawing in Illustrator or FreeHand. In the past I've actually
printed such out, wrapped it into a cylinder, photographed that and then... How to handle path inside a wrapped applicationHi All,
I am using VTCL to build a simple application which is wrapped up
using Active State's TclApp utility. In order to make it work I had to
correct all the directory path in the generated output file and I
wonder if this is required.
I had to use the following procedure to make it work:
On the VTCL main.tcl output file I add:
set scripthome [file dirname [info script]]
to the beginning of the file. I then use this variable when I source
any files like in:
source [file join $scripthome procs.tcl]
The application is using buttons with images which are in the original
file like:
... [ANN] Bottle/cylinder wrap plugin for Photoshop & IllustratorI've released plugins for Illustrator and Photoshop which wrap artwork
(e.g. a label) around a bottle or cylinder, showing the front
elevation. They are geometrically accurate and produce high quality
results.
An example may be seen here:
http://www.telegraphics.com.au/sw/info/cylinderdistort.html
Note that the Illustrator plugin does an accurate vector distortion of
paths, but not placed images; to distort a layout with images, the
Photoshop plugin can be used (after rasterising if necessary).
Both plugins are available for US$9 each via PayPal; a download link
is emailed immediately ... To wrap or not to wrap?Hi,
In my personal development efforts, I frequently wrap basic java
functionality. For example, I have a
String MyIO.urlToString(String url)
or
byte[] MIO.urlToBytes(String url)
etc. These functions catch exceptions and return null if something
goes wrong. I have other functoins that, for example, load database
queries into maps.
My gereneral questions are these. Does everybody pretty much end up
writing convenience wrappers like these for themselves?. If yes, why
aren't utilities like these commonly available as more or less
standard libraries? And if no  why not? Is it a bad idea... Not a Path and path to string to path conversionWiring a Not a Path constant to Path to String and wiring that to String to Path gives a valid path containing the text "<Not a Path>". I found that very unexpected. Is this intentional? If so, is there any string that can be converted to a path data type that is an actual Not a Path? It seems to happen in 7.1, 8.0, and 8.20.
NotAPath.png:
http://forums.ni.com/attachments/ni/170/247943/1/NotAPath.png
NotAPath.vi:
http://forums.ni.com/attachments/ni/170/247943/2/NotAPath.vi
I agree that this behavior is confusing. The important thing to note here is that the Not a N... path PATH in tcshHi,
I am using tcsh under AIX. Though both PATH and path variable are
defined, i find system uses just 'path' for searching. I was under
impression that all environmental variables are full caps (PATH) rather
than in small letters (path). Does anyone has an idea why it uses
'path' rather than 'PATH'
Regards,
Karthik
karthik167@gmail.com writes:
> I am using tcsh under AIX. Though both PATH and path variable are
> defined, i find system uses just 'path' for searching. I was under
> impression that all environmental variables are full caps (PATH) rath... ksh: add path to $PATH only when ot yet in $PATHhi there
how can i add a path (like "." or "/Users/Shared/bin") to the $PATH
environment var only when its not yet in there?
the nicest would be something where i can give the two new paths in one
string as input (eg. ".:/Users/Shared/bin") and $PATH as another input.
any idea?
thanks,leo
"leo" <halloleo@noospaam.myrealbox.com> writes:
> how can i add a path (like "." or "/Users/Shared/bin") to the $PATH
> environment var only when its not yet in there?
>
> the nicest would be something where i can give the... os.path and PathIn my continuing quest for Python Mastery (and because I felt like it ;)
I decided to code a Path object so I could dispense with all the
os.path.join and os.path.split and os.path.splitext, etc., etc., and so
forth.
While so endeavoring a couple threads came back and had a friendly
little chat in my head:
Thread 1: "objects of different types compare unequal"
self: "nonsense! we have the power to say what happens in __eq__!"
Thread 2: "objects that __hash__ the same *must* compare __eq__!"
self: "um, what? ... wait, only immutable objects has... Paths, gentleman, pathsI have this bit of code in the beginning of an application I'm writing
(in main.rb):
require 'pathname'
p = Pathname.new($0)
if p.basename.to_s == 'main.rb'
Dir.chdir p.parent.to_s
end
require 'gui/main_window'
... # (rest of requires, application itself)
The check whether it's "main.rb" or not is so this doesn't happen for
Rake. Now, it works well, but it's ugly. The reason I don't just go
ahead and use ':' is that I use glade, as well as some other files which
I need to be able to find. This is currently i... bash : PATH and pathHi,
I just came from csh to bash. It seems to me BASH only takes "PATH"
variable, I mean when it looks for executable, it does not consider
"path".
Is there any meaning of "path" in BASH?
THanks!
On Sat, 26 Mar 2005 at 00:18 GMT, clinton__bill@hotmail.com wrote:
> Hi,
> I just came from csh to bash. It seems to me BASH only takes "PATH"
> variable, I mean when it looks for executable, it does not consider
> "path".
>
> Is there any meaning of "path" in BASH?
Only what you assign it.

Chris F.... How to set path for .M files. How to include, and verify a file in the MATLAB path. In other words I wish to learn how to setup the path for .M file in MATLAB path? Thanks.undefined
... 3D cylinder to cylinder distanceDoes anyone have a way to calculate the distance between two
cylinders given the centers of each cylinder end (x,y,z) and the
diameters?
Thanks and regards,
Van
In article <ef10939.1@webx.raydaftYaTP>,
"Van Brackin" <PLEASEDONTSPAMvanb@rocketmail.com> wrote:
> Does anyone have a way to calculate the distance between two
> cylinders given the centers of each cylinder end (x,y,z) and the
> diameters?
I was hoping someone else would provide a better answer.
When all else fails, break out the sledge hammer.
Its an optimization problem, in 6 unknowns. Paramete... Text::Wrap::wrap differenceHi.
I have moved from a Solaris box (running perl 5.6.0) to an Intel Linux
box (running perl 5.8.0).
I have a script that processes msgs I get from certain mailing lists
(which procmail kindly puts into files for me). It wordwraps the msgs
(since some of them have ridiculously long lines) and replaces certain
encoded chars by their plain text equivalents. It looks like this
%<%<%<%<cut here%<%<%<
use Text::Wrap;
$Text::Wrap::columns = 79;
while (<>) {
s/\c]/\"/g;
s/\cA//g;
s/\cS//g;
s/\cY/\... relative path / absolute pathGreetings:
What is the best way to resolve paths within a document regardless of what
path it is opened under? For example: I have x.php and it contains <img
src="images...">, (amongst other things, like php code), which resolves the
correct image path when opened under / but when x.php is read into a file
under /dir the image no longer resolves, for obvious reasons. With absolute
paths, this isn't an issue but it is with relative paths. Although I can
think of a kludge, or two, I figure that there is a more elegant solution.
Thanks in advance.

Regards,
... How to check if a path *could* be a legal path?Hi,
I have a string.
This string is to be used as a path for a new file.
I would like to check if this string *could be* a valid file name,
*before* I try to create the file itself.
In other words, I would like to know whether some string violates the
underlying OS's policies (or maybe some more restriced policies, but
portable) considering file paths.
Example:
1.
s = 'C:\file.txt'
the above is potentially a valid path on my system.
2.
s = 'cc:/^ =#jk\kj+.+?! :)'
the above is rather invalid and I would like to check it somehow before
I even try to create the fil... server path to web path
I need to spider a servers subdirectories and pull files to write web
links.
I seem to recall some php function that would convert a server path
to it's path from the web document root. How do I do this (easily). Ie,
subtract the $_SERVER['DOCUMENT_ROOT'] part. I can't seem to find a
string difference function either, but perhaps I've overlooked it as
there are a lot string functions!
I used to have a file with my php notes in it, but unfortunately this
wasn't a file that survive my boot drive crash. I'll try not to ask to
many questions I should... Deform path to a bezier pathGreetings,
What I would like to do is take a bezier path and deform it to follow
the contour of another bezier path. The problem is illustrated here:
http://abeall.com/files/temp/deform_to_path.gif
I would like:
1) To be able to stretch the shape along the contour, however long the
contour is.
2) Allow the contour to have dramatic turns, or even self intersect,
if reasonably doable.
3) If reasonably possible, I want to introduce points to the bezier
shape as necessary to allow it to conform to the deformation contour.
Any help would be appreciated. Thanks!
 aaron
Aaron Beall wrote:
> ... Path or stitched path selectionHello,
Does anyone have a way to select all the metal and vias to a path that
is already drawn? Basically if a path is drawn in one design and
needs to be exactly the same in another, is there a way to select all
of the metal layers and wire for that path?
Thank you in advance for any and all help,
Eric
Hi,
Sorry but I'd like to slip in a question regarding this as well  if
anyone has the answer to the original question, could you tell how
virtuoso recognises the via & metal connectivity? Is it using the
'viaLayers()' in the skill techfile?
The only way I've managed... Circumscribed Cylinder and Inscribed Cylinderclc
clear all
n = 50;
h = rand(n,1)*100;
r = 10+(rand(n,1)0.9)*3;
theta = 360*rand(n,1);
x=r.*cos(theta);
y=r.*sin(theta);
X=ones(n,3);
for i=1:n
X(i,1)=x(i,1);
X(i,2)=y(i,1);
X(i,3)=h(i,1);
end
figure(1)
% plot3(X(:,1),X(:,2),X(:,3),'*&... Path PEP: What should Path(None) do?Currently it returns Path('None'). This means I have to do a check on
input before pathifying it to make sure it is not None.
Perhaps it should throw ValueError?

Michael Hoffman
Michael Hoffman wrote:
> Currently it returns Path('None'). This means I have to do a check on
> input before pathifying it to make sure it is not None.
>
> Perhaps it should throw ValueError?
The problem is that Path() currently acts like str() and will therefore
accept almost anything that has a string representation.
We can do two things: 1) restrict Path.__new__ arguments to b... wrapping C++, how to wrap an object?Hi,
i just read everything that i found for writing modules
and interfacing to C/C++.
I'd like to write some wrapper code for some C++ class.
For this i want to store an object of this class in
Python somehow.
how can i store a memory region (the object) in a Python
data type?
Best regards,
Torsten.
"Torsten Mohr" <tmohr@s.netic.de> wrote in message
news:c2equb$4la$2@schleim.qwe.de...
> Hi,
>
> i just read everything that i found for writing modules
> and interfacing to C/C++.
>
> I'd like to write some wrapper code for some C++ class.
> Fo... csh/bash : path/PATHHi,
I posted some questions about csh path and thanks for the replies I
think I understand how it works now.
Now I come to bash, I think there is some difference between csh and
bash here. Could you confirm my understanding?
In csh $PATH and $path are basically identical, update $path will
automatically get $PATH updated. Although they have different format,
$PATH is one string of which the elements are seperated by ";", while
$path is a list of strings, they have same functional meaning. I mean
when csh looks for executable, it will check $path. From this sense
$path is also... How to set path for .M files. How to include, and verify a file in the MATLAB path. In other words I wish to learn how to setup the path for .M file in MATLAB path? Thanks. #2undefined
...



