我怎样才能重现该网站背景中的球体?

我怎样才能重现该网站背景中的球体?

我正在尝试重新创建这个

在此处输入图片描述 嘎嘎

但看看这个元问题提供的唯一代码没有给出该输出

%!TEX TS-program = xelatex
\documentclass{minimal}
\usepackage{pst-solides3d}

\begin{document} 

\psset{viewpoint=50 20 10 rtp2xyz,Decran=50}
\psset{unit=0.75}
\begin{pspicture}(-5,-5)(5,5)
\psSolid[object=sphere,r=4,action=draw*,ngrid=9 9,resolution=720]%
\defFunction[algebraic]{helicespherique}(t)%
  {4*cos(10*t)*cos(t)}%
  {4*sin(10*t)*cos(t)}%
  {4*sin(t)}
\psSolid[object=courbe,linecolor=blue,
        resolution=720,range=pi -2 div pi 2 div,
       function=helicespherique,r=0.05]
%\gridIIID[Zmin=-4,Zmax=4](-4,4)(-4,4)
\end{pspicture}

\end{document} 

在此处输入图片描述

但我对 PSTricks 一无所知

我怎样才能重现该网站背景中的球体?

我正在寻找代码(在 TikZ、MetaPost、Asymptote 或 PStricks 中)来重现图像。重要的是在后面球应该在另一层(更薄或灰色)。就像这个网站上的图片一样。

无论如何,这就是我最终对代码进行的一些修改

\documentclass{standalone}
\usepackage{pst-solides3d}

\begin{document} 

\psset{viewpoint=50 20 40 rtp2xyz,Decran=50}
\psset{unit=0.75}
\begin{pspicture}(-5,-5)(5,5)
\psSolid[object=sphere,r=4,fillcolor=white,ngrid=14 14,resolution=720,linewidth=.1pt,linecolor=gray]%
\defFunction[algebraic]{helicespherique}(t)%
  {4*cos(2*t)*cos(t)}%
  {4*sin(2*t)*cos(t)}%
  {4*sin(t)}
\psSolid[object=courbe,linecolor=black,
        resolution=720,range=pi -2 div pi 2 div,
       function=helicespherique,r=0.0001]
\end{pspicture}

\end{document} 

在此处输入图片描述

答案1

(原始)图像是使用派克斯(可从加拿大运输安全局)。 来源sphere.xp可以使用以下方式编译

elaps <options> sphere.xp

生产

在此处输入图片描述

sphere.xp

/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

const double k(2*M_PI/(360*sqrt(3))); // assume "degrees" mode

double exp_cos(double t) { return exp(k*t)*Cos(t); }
double exp_sin(double t) { return exp(k*t)*Sin(t); }
double minus_exp_cos(double t) { return -exp_cos(t); }
double minus_exp_sin(double t) { return -exp_sin(t); }

int main()
{
  picture(P(-1,-1), P(1,1), "2.5 x 2.5in");

  begin();
  degrees(); // set angle units
  camera.at(P(1, 2.5, 3));

  sphere(); // draw unit sphere's horizon

  pen(Blue(1.6)); // hidden portions of loxodromes
  backplot_N(exp_cos, exp_sin, -540, 540, 180);
  backplot_N(minus_exp_cos, minus_exp_sin, -540, 540, 180);

  pen(Red(1.6));
  backplot_N(exp_sin, minus_exp_cos, -540, 540, 180);
  backplot_N(minus_exp_sin, exp_cos, -540, 540, 180);

  pen(Black(0.3)); // coordinate grid

  for (int i=0; i<=12; ++i) {
    latitude(90-15*i, 0, 360);
    longitude(30*i, 0, 360);
  }

  bold(Blue()); // visible portions of loxodromes
  frontplot_N(exp_cos, exp_sin, -540, 540, 360);
  frontplot_N(minus_exp_cos, minus_exp_sin, -540, 540, 360);

  pen(Red());
  frontplot_N(exp_sin, minus_exp_cos, -540, 540, 360);
  frontplot_N(minus_exp_sin, exp_cos, -540, 540, 360);

  end();
}

可能的输出:

答案2

最小工作解决方案

\documentclass[pstricks,margin=1mm]{standalone}
\usepackage{pst-solides3d}

\psset{viewpoint=50 70 50 rtp2xyz,Decran=50,linewidth=0.5\pslinewidth}

\defFunction[algebraic]{helicespherique}(t)
        {0.5*cos(10*t)*cos(t)}
        {0.5*sin(10*t)*cos(t)}
        {0.5*sin(t)}    

\begin{document}
\begin{pspicture*}(-0.5,-0.5)(0.5,0.5)
    \psSolid
    [
        object=sphere,
        fillcolor=gray,
        opacity=.25,
        strokeopacity=.25,
        ngrid=30 30,
        r=0.5,
        grid=false,
    ]
    \psSolid
    [
        object=courbe,
        linewidth=0.05pt,
        range=pi -.5 mul 0.5 pi mul,
        function=helicespherique,
        r=0.005,
        grid=false,
    ]
\end{pspicture*}
\end{document}

在此处输入图片描述

答案3

pst-rubans 包在物体(圆柱体、圆锥体、圆环面、抛物面、球体)上绘制螺旋带。

pst-rubans – 绘制三维丝带

\documentclass{article}
\usepackage{pst-rubans}
\begin{document}
\begin{center}
\begin{pspicture}(-5,-5)(5,5)
\psframe*(-5,-5)(5,5)
\psset{viewpoint=50 20 40,Decran=50,resolution=720,lightsrc=viewpoint}
\psSphericalSpiral[incolor=yellow!20,R=4,fillcolor=orange,grid,dPHI=8]
\end{pspicture}
\end{center}
\end{document} 

在此处输入图片描述

答案4

使用带有 epix 的代码,请找到一个(非优化的)Asymptote 版本。

size(10cm);
import three;
import graph3;
import math;
import solids;
settings.render=0; 
settings.prc=false; // on se restreint à une vue 2d


currentprojection=orthographic(1,2.5,3);

real  k=2*pi/(360*sqrt(3));

real  exp_cos(real t) { return exp(k*t)*Cos(t); }
real  exp_sin(real t) { return exp(k*t)*Sin(t); }
real minus_exp_cos(real t) { return -exp_cos(t); }
real minus_exp_sin(real t) { return -exp_sin(t); }

triple f1(real t)
{
  real ss;
  triple ff;
  ss=exp_cos(t)^2+exp_sin(t)^2+1;
  ff=(2*exp_cos(t)/ss,2*exp_sin(t)/ss,(ss-2)/ss);
  return ff;
}


triple f2(real t)
{
  real ss;
  triple ff;
  ss=minus_exp_cos(t)^2+minus_exp_sin(t)^2+1;
  ff=(2*minus_exp_cos(t)/ss,2*minus_exp_sin(t)/ss,(ss-2)/ss);
  return ff;
}

triple f3(real t)
{
  real ss;
  triple ff;
  ss=exp_sin(t)^2+minus_exp_cos(t)^2+1;
  ff=(2*exp_sin(t)/ss,2*minus_exp_cos(t)/ss,(ss-2)/ss);
  return ff;
}


triple f4(real t)
{
  real ss;
  triple ff;
  ss=minus_exp_sin(t)^2+exp_cos(t)^2+1;
  ff=(2*minus_exp_sin(t)/ss,2*exp_cos(t)/ss,(ss-2)/ss);
  return ff;
}


revolution r=sphere(O,1);
draw(r,9,gray,longitudinalpen=nullpen,backpen=nullpen);
draw(r.silhouette());


for(int k=-2; k<5;++k) 
  draw(rotate(k*30,(0,0,1))*rotate(-90,(1,0,0))*r,1,gray,
       longitudinalpen=nullpen,backpen=nullpen);
int nbpts=280;
real step=1080/nbpts;


draw(graph(f1,-540,540,280,Spline),blue+gray);
draw(graph(f2,-540,540,280,Spline),blue+gray);
draw(graph(f3,-540,540,280,Spline),red+gray);
draw(graph(f4,-540,540,280,Spline),red+gray);


triple[] P1=new triple[nbpts];
triple[] P2=new triple[nbpts];
triple[] P3=new triple[nbpts];
triple[] P4=new triple[nbpts];

for(int i=0; i < nbpts; ++i) {
  real t=-540+i*step;
  P1[i]=f1(t);
  P2[i]=f2(t);
  P3[i]=f3(t);
  P4[i]=f4(t);

}

bool[] front1=new bool[nbpts];
bool[] front2=new bool[nbpts];
bool[] front3=new bool[nbpts];
bool[] front4=new bool[nbpts];


for(int i=0; i < nbpts; ++i) {
  front1[i]=dot(P1[i],currentprojection.camera) > 0;
  front2[i]=dot(P2[i],currentprojection.camera) > 0;
  front3[i]=dot(P3[i],currentprojection.camera) > 0;
  front4[i]=dot(P4[i],currentprojection.camera) > 0;
}
draw(segment(P1,front1,operator ..),blue+1bp);
draw(segment(P2,front2,operator ..),blue+1bp);
draw(segment(P3,front3,operator ..),red+1bp);
draw(segment(P4,front4,operator ..),red+1bp);

结果如下。

在此处输入图片描述

相关内容