ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 26 May 2012 16:14:29 +0200Given a direction vector and a point, how to draw a 3d line?https://ask.sagemath.org/question/9003/given-a-direction-vector-and-a-point-how-to-draw-a-3d-line/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.Sat, 26 May 2012 11:51:13 +0200https://ask.sagemath.org/question/9003/given-a-direction-vector-and-a-point-how-to-draw-a-3d-line/Answer by calc314 for <p>I have a point </p>
<pre><code>(-e^pi, 0, e^pi)
</code></pre>
<p>and a direction vector</p>
<pre><code>tvec = vector((e^t * cos(t) - e^t * sin(t), e^t * sin(t) + e^t * cos(t), e^t))
</code></pre>
<p>How would I draw a 3d line based upon these 2 arguments?</p>
<p>I looked over at the documentation but I couldnt find it.</p>
https://ask.sagemath.org/question/9003/given-a-direction-vector-and-a-point-how-to-draw-a-3d-line/?answer=13617#post-id-13617You 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)Sat, 26 May 2012 16:14:29 +0200https://ask.sagemath.org/question/9003/given-a-direction-vector-and-a-point-how-to-draw-a-3d-line/?answer=13617#post-id-13617