Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: coordinates of a 3D line
Replies: 2   Last Post: Dec 2, 2012 4:39 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Javier

Posts: 61
Registered: 4/26/11
Re: coordinates of a 3D line
Posted: Dec 2, 2012 10:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Javier " <javsanzperez@gmail.com> wrote in message <k9frj8$dsu$1@newscl01ah.mathworks.com>...
> Hi,
>
> I'm starting with 3D and I want to plot a line in 3D which start in one point P1 and finishes in another P2, and obtain all the coordinates points of the line with a resolution R. Could I do something similar to the following:
> I don?t know the value for t:
> P1=[-1 5 2];
> P2=[0 0 0]
> resol = 0.1;
> x0 = P1(1);
> y0 = P1(2);
> z0 = P1(3);
> t=-1:resol:1
> dx = P2(:,1)-P1(:,1)
> dy = P2(:,2)-P1(:,2)
> dz = P2(:,3)-P1(:,3)
>
> x = x0 + t*dx
> y = y0 + t*dy
> z = z0 + t*dz
>
> plot3(x,y,z,'b')
> Better said, I need a function to define a segment of line knowing a point, the slop and the distance.
> Thanks very much




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.