Ask Your Question
0

Given a direction vector and a point, how to draw a 3d line?

asked 2012-05-26 11:51:13 +0100

dnizetic gravatar image

updated 2015-01-14 11:00:27 +0100

FrédéricC gravatar image

I have a point

(-e^pi, 0, e^pi)

and a direction vector

tvec = vector((e^t * cos(t) - e^t * sin(t), e^t * sin(t) + e^t * cos(t), e^t))

How would I draw a 3d line based upon these 2 arguments?

I looked over at the documentation but I couldnt find it.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2012-05-26 16:14:29 +0100

calc314 gravatar image

You can introduce a new parameter s that will parametrize the line. With p=(-e^pi,0,e^pi), the line is then p+s*tvec(t=t0) for some fixed value t0 of the parameter t.

Then, the line can be drawn as follows.

var('s,t')
p=vector([-exp(pi),0,exp(pi)])
tvec = vector((e^t * cos(t) - e^t * sin(t), e^t * sin(t) + e^t * cos(t), e^t))
parametric_plot3d(p+s*tvec(t=pi/2),(s,0,5),thickness=3)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-26 11:51:13 +0100

Seen: 1,164 times

Last updated: May 26 '12