Ticket #8838 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

make "arrow()" take 3d vectors

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-4.6
Component: graphics Keywords: beginner
Cc: kcrisman, ryan Work issues:
Report Upstream: N/A Reviewers: Jason Grout
Authors: Ryan Grout Merged in: sage-4.6.alpha1
Dependencies: Stopgaps:

Description

A convention we have is that graphics commands do the right thing depending on if 2d or 3d input is passed. We should make arrow() take 3-tuples to produce a 3d plot (by calling arrow3d).

Attachments

trac_8838_arrow2d_3d.patch Download (3.8 KB) - added by ryan 3 years ago.
make arrow() behave more like line()
trac_8838_arrow2d_arrow3d.patch Download (3.6 KB) - added by ryan 3 years ago.
Updated patch (with Sage 4.5.3)

Change History

comment:1 Changed 3 years ago by jason

  • Keywords beginner added

comment:2 Changed 3 years ago by kcrisman

  • Cc kcrisman added

comment:3 Changed 3 years ago by jason

  • Cc ryan added

In other words, this should work:

sage: arrow(vector([1,2,3]), vector([2,3,4]))

and should draw a 3d arrow.

Changed 3 years ago by ryan

make arrow() behave more like line()

comment:4 Changed 3 years ago by ryan

  • Status changed from new to needs_review

here is a patch that changes the behavior of arrow() to be more like line().

If 2d coordinates are passed, arrow() returns an arrow2d() (the old arrow() function). If 3d coordinates are passed, arrow() will now return an arrow3d().

comment:5 Changed 3 years ago by jason

  • Status changed from needs_review to needs_work

This looks great. However, for backwards compatibility, could you name the arguments to arrow() "tailpoint" and "headpoint". Now, this command won't work, whereas before it would:

arrow(tailpoint=(0,1), headpoint=(2,3))

We should keep our API unless there is a very good reason to change it.

Changed 3 years ago by ryan

Updated patch (with Sage 4.5.3)

comment:6 Changed 3 years ago by ryan

  • Status changed from needs_work to needs_review

comment:7 Changed 3 years ago by jason

  • Status changed from needs_review to positive_review

Looks good! Thanks!

Apply only trac_8838_arrow2d_arrow3d.patch

comment:8 Changed 3 years ago by jason

  • Reviewers set to Jason Grout
  • Authors set to Ryan Grout

comment:9 Changed 3 years ago by jason

Note that this is Ryan's first contribution (along with #9199 and #7154)

comment:10 Changed 3 years ago by mpatel

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.6.alpha1
Note: See TracTickets for help on using tickets.