Sage: Ticket #2859: [with patch, positive review] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow
https://trac.sagemath.org/ticket/2859
<p>
Try the following:
</p>
<pre class="wiki">plot(vector((0,0,-1)))
</pre><p>
The resulting vector points up, but should point down.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/2859
Trac 1.1.6jasonTue, 08 Apr 2008 21:38:09 GMTsummary changed
https://trac.sagemath.org/ticket/2859#comment:1
https://trac.sagemath.org/ticket/2859#comment:1
<ul>
<li><strong>summary</strong>
changed from <em>plotting the vector (0,0,-1) really plots (0,0,1)</em> to <em>arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em>
</li>
</ul>
<p>
The problem is in arrow3d:
</p>
<pre class="wiki">sage: arrow3d((0,0,0), (0,0,-1))
*points up*
</pre>
TicketjasonTue, 08 Apr 2008 22:16:54 GMT
https://trac.sagemath.org/ticket/2859#comment:2
https://trac.sagemath.org/ticket/2859#comment:2
<p>
All right, this was because we were taking the cross product with (0,0,1) and using that to decide whether or not to rotate the vector, ignoring the case that we point in the opposite direction (but still have a cross product of zero).
</p>
<p>
Patch will be attached. I'm marking this a blocker since it gives a *wrong* result and William said that wrong results should be marked as blockers.
</p>
TicketjasonTue, 08 Apr 2008 22:17:01 GMTpriority changed
https://trac.sagemath.org/ticket/2859#comment:3
https://trac.sagemath.org/ticket/2859#comment:3
<ul>
<li><strong>priority</strong>
changed from <em>major</em> to <em>blocker</em>
</li>
</ul>
TicketjasonTue, 08 Apr 2008 22:17:59 GMTsummary changed
https://trac.sagemath.org/ticket/2859#comment:4
https://trac.sagemath.org/ticket/2859#comment:4
<ul>
<li><strong>summary</strong>
changed from <em>arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em> to <em>[with patch, needs review] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em>
</li>
</ul>
TicketmabshoffWed, 09 Apr 2008 01:22:37 GMT
https://trac.sagemath.org/ticket/2859#comment:5
https://trac.sagemath.org/ticket/2859#comment:5
<p>
Jason,
</p>
<p>
how does this ticket related to <a class="closed ticket" href="https://trac.sagemath.org/ticket/1777" title="defect: jmol up/down metaphor confusing in the "View" right-click menu (closed: fixed)">#1777</a>? [also opened by you]
</p>
<p>
Cheers,
</p>
<p>
Michael
</p>
TicketjasonWed, 09 Apr 2008 01:33:33 GMT
https://trac.sagemath.org/ticket/2859#comment:6
https://trac.sagemath.org/ticket/2859#comment:6
<p>
It doesn't relate.
</p>
<p>
In this ticket, the arrow is actually wrong (the assumption in the code is that "parallel to (0,0,1)" == "pointing in the same direction as (0,0,1)", which is just wrong.
</p>
<p>
The issue in <a class="closed ticket" href="https://trac.sagemath.org/ticket/1777" title="defect: jmol up/down metaphor confusing in the "View" right-click menu (closed: fixed)">#1777</a> is a cosmetic issue related to the menus in JMOL.
</p>
TicketddrakeWed, 09 Apr 2008 07:19:48 GMTsummary changed
https://trac.sagemath.org/ticket/2859#comment:7
https://trac.sagemath.org/ticket/2859#comment:7
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, needs review] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em> to <em>[with patch, positive review pending] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em>
</li>
</ul>
<p>
The patch works as advertised and the code looks good to me. Positive review for the code, and I'll give it full positive review once you sort out this minor complaint about the doctest: instead of "A downward pointing arrow should have a transformation scaling the points to their negatives" do you mean to say something like "a downward-pointing arrow <em>corresponds</em> to a transformation <em>which reverses the z-coordinates</em> of points"?
</p>
<p>
Mostly I'm confused because when you give me a vector in R<sup>3</sup> and ask me what linear transformation of R<sup>3</sup> to itself that it's describing, I naturally think of reflection across the perpendicular plane. The vector (0,0,-1) doesn't say "take (x,y,z) to (-x,-y,-z)" to me...but maybe this is just me, and perhaps it's more an issue with <code>get_transformation</code> than with <code>arrow3d</code>.
</p>
<p>
At any rate, if you're a bit more clear in that description, you'll be good to go.
</p>
TicketjasonWed, 09 Apr 2008 08:00:06 GMT
https://trac.sagemath.org/ticket/2859#comment:8
https://trac.sagemath.org/ticket/2859#comment:8
<p>
Arrows are always constructed pointing up in the z direction from the origin, and then rotated/translated into place. This works for every arrow direction except the -z direction. I take care of the issue by testing to see if the arrow should point in the -z direction, and if it should, just scaling the constructed arrow by -1 (i.e., every point is sent to its negative). The scaled arrow then points downwards. The doctest just tests that the scale of -1 is applied to the arrow. I'm not sure how to make it clearer.
</p>
TicketjasonWed, 09 Apr 2008 08:52:59 GMTattachment set
https://trac.sagemath.org/ticket/2859
https://trac.sagemath.org/ticket/2859
<ul>
<li><strong>attachment</strong>
set to <em>trac-2859-arrow3d.patch</em>
</li>
</ul>
TicketjasonWed, 09 Apr 2008 08:53:34 GMT
https://trac.sagemath.org/ticket/2859#comment:9
https://trac.sagemath.org/ticket/2859#comment:9
<p>
I put up a new patch with the above explanation above the doctest.
</p>
TicketmabshoffWed, 09 Apr 2008 09:05:27 GMTsummary changed
https://trac.sagemath.org/ticket/2859#comment:10
https://trac.sagemath.org/ticket/2859#comment:10
<ul>
<li><strong>summary</strong>
changed from <em>[with patch, positive review pending] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em> to <em>[with patch, positive review] arrow3d((0,0,0), (0,0,-1)) plots an *upward* pointing arrow</em>
</li>
</ul>
<p>
Looks good to me. I like the added explanation. Positive review.
</p>
<p>
Cheers,
</p>
<p>
Michael
</p>
TicketmabshoffWed, 09 Apr 2008 10:01:04 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/2859#comment:11
https://trac.sagemath.org/ticket/2859#comment:11
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Merged in Sage 3.0.alpha3
</p>
Ticket