On Monday, July 10, 2017 at 11:49:50 AM UTC+2, HG wrote:
>
> Hi,
> This is a mathematica example, but I am not able to do something 
> ressembling this yin yang grid a challenger ?
> https://github.com/aishenri/sage/blob/master/gridyy.pdf
> the cdf and noteboob are on the same dir.
> As sagemath seems to be an alternative would be great ?
> Regards
> Henri
>

You could probably clean up the code a bit, but I think the sage 
construction is more straightforward:


var("r,theta,phi");
def coordfunc(r,theta,phi,switch,shift=0):
    if switch=="yin":
        return 
(r*sin(theta)*cos(phi)+shift,r*sin(theta)*sin(phi),r*cos(theta))
    else:
        return 
(-r*sin(theta)*cos(phi)+shift,r*cos(theta),r*sin(theta)*sin(phi))
        
yin=(parametric_plot3d(coordfunc(1,theta,phi,"yin",1),(theta,pi/4,3*pi/4),(phi,-3*pi/4,3*pi/4))+
  
parametric_plot3d(coordfunc(0.6,theta,phi,"yin",1),(theta,pi/4,3*pi/4),(phi,-3*pi/4,3*pi/4),color="yellow")+
   
parametric_plot3d(coordfunc(r,theta,-3*pi/4,"yin",1),(r,0.6,1),(theta,pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,theta,3*pi/4,"yin",1),(r,0.6,1),(theta,pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,pi/4,phi,"yin",1),(r,0.6,1),(phi,-3*pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,3*pi/4,phi,"yin",1),(r,0.6,1),(phi,-3*pi/4,3*pi/4))
  )
yang=(parametric_plot3d(coordfunc(1,theta,phi,"yang",-1),(theta,pi/4,3*pi/4),(phi,-3*pi/4,3*pi/4))+
  
parametric_plot3d(coordfunc(0.6,theta,phi,"yang",-1),(theta,pi/4,3*pi/4),(phi,-3*pi/4,3*pi/4),color="yellow")+
   
parametric_plot3d(coordfunc(r,theta,-3*pi/4,"yang",-1),(r,0.6,1),(theta,pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,theta,3*pi/4,"yang",-1),(r,0.6,1),(theta,pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,pi/4,phi,"yang",-1),(r,0.6,1),(phi,-3*pi/4,3*pi/4))+
   
parametric_plot3d(coordfunc(r,3*pi/4,phi,"yang",-1),(r,0.6,1),(phi,-3*pi/4,3*pi/4))
  )
(yin+yang).show(viewer="threejs") 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to