Ticket #5230 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

[with patch, positive review] implement boundary_style parameter for parametric 3d plots

Reported by: was Owned by: wcauchois
Priority: major Milestone: sage-3.4.1
Component: graphics Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

Basically make it easy to create plots like this but in 1 line:

u, v = var('u,v')
G = parametric_plot3d((cos(u), sin(u) + cos(v), sin(v)), (u, 0, pi), (v, 0, pi), opacity=0.9)    
C = parametric_plot3d((cos(0), sin(0) + cos(v), sin(v)), (v, 0, pi), color='black', thickness=2)    
D = parametric_plot3d((cos(pi), sin(pi) + cos(v), sin(v)), (v, 0, pi), color='black', thickness=2)
E = parametric_plot3d((cos(u), sin(u) + cos(0), sin(0)), (u, 0, pi), color='black', thickness=2)    
F = parametric_plot3d((cos(u), sin(u) + cos(pi), sin(pi)), (u, 0, pi), color='black', thickness=2)
K = G + C + D + E + F

Input would probably be like this (dictionary):

u, v = var('u,v')
parametric_plot3d((cos(u), sin(u) + cos(v), sin(v)), (u, 0, pi), (v, 0, pi),
      boundary_style={'color':'black', 'thickness':2})    

Attachments

boundary-style.patch Download (3.4 KB) - added by wcauchois 4 years ago.
trac_5230-referee.patch Download (2.2 KB) - added by was 4 years ago.
trac5230-rebased.patch Download (3.7 KB) - added by wcauchois 4 years ago.

Change History

comment:1 Changed 4 years ago by wcauchois

  • Owner changed from was to wcauchois
  • Status changed from new to assigned

Changed 4 years ago by wcauchois

comment:2 Changed 4 years ago by wcauchois

  • Summary changed from implement boundary_style parameter for parametric 3d plots to [with patch, needs review] implement boundary_style parameter for parametric 3d plots

comment:3 Changed 4 years ago by was

  • Summary changed from [with patch, needs review] implement boundary_style parameter for parametric 3d plots to [with patch, positive review] implement boundary_style parameter for parametric 3d plots

REFEREE REPORT:

It works perfectly.

  • Add to " boundary_style -- (default: None, no boundary) a dict that describes

how to draw boundaries of regions"

that the dict just gives the options that are passed to the line3d command.

  • Put a space after the doctest:
     	105	        sage: parametric_plot3d((cos(u), sin(u) + cos(v), sin(v)), (u, 0, pi), (v, 0, pi), boundary_style={"color": "black", "thickness": 2}) 
     	106	    Any options you would normally use to specify the appearance of a curve are valid 
     	107	    as entries in the boundary_style dict. 
    

I attached a patch that makes these trivial changes. With this, positive review.

NOTE: This patch will have to be rebased for 3.4.alpha because of the ReST transition. It applies fine to 3.3 though.

Changed 4 years ago by was

comment:4 Changed 4 years ago by mabshoff

  • Summary changed from [with patch, positive review] implement boundary_style parameter for parametric 3d plots to [with patch, positive review, needs rebase] implement boundary_style parameter for parametric 3d plots

This needs to be rebased, as mentioned in the comment:

mabshoff@sage:/scratch/mabshoff/sage-3.4.alpha1/devel/sage$ patch -p1 < trac_5230_boundary-style.patch 
patching file sage/plot/plot3d/parametric_plot3d.py
Hunk #1 succeeded at 10 with fuzz 2 (offset 1 line).
Hunk #2 FAILED at 39.
Hunk #3 FAILED at 100.
Hunk #4 succeeded at 492 (offset 106 lines).
Hunk #5 succeeded at 537 with fuzz 2 (offset 107 lines).
Hunk #6 succeeded at 565 (offset 108 lines).

So I am changing the summary properly so I won't find it out that way again :)

Cheers,

Michael

comment:5 Changed 4 years ago by mabshoff

  • Summary changed from [with patch, positive review, needs rebase] implement boundary_style parameter for parametric 3d plots to [with patch, needs rebase] implement boundary_style parameter for parametric 3d plots

Changed 4 years ago by wcauchois

comment:6 Changed 4 years ago by wcauchois

  • Summary changed from [with patch, needs rebase] implement boundary_style parameter for parametric 3d plots to [with patch, needs review] implement boundary_style parameter for parametric 3d plots

Please apply ONLY trac5230-rebased.patch! It should apply fine to Sage 3.4 now.

comment:7 Changed 4 years ago by was

  • Summary changed from [with patch, needs review] implement boundary_style parameter for parametric 3d plots to [with patch, positive review] implement boundary_style parameter for parametric 3d plots

comment:8 Changed 4 years ago by was

  • Milestone changed from sage-3.4.2 to sage-3.4.1

comment:9 Changed 4 years ago by mabshoff

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged in Sage 3.4.1.rc2.

Cheers,

Michael

Note: See TracTickets for help on using tickets.