![如何在 Asymptote 中创建“空”点?](https://linux22.com/image/338415/%E5%A6%82%E4%BD%95%E5%9C%A8%20Asymptote%20%E4%B8%AD%E5%88%9B%E5%BB%BA%E2%80%9C%E7%A9%BA%E2%80%9D%E7%82%B9%EF%BC%9F.png)
我在 tiz-euclide 中画了几幅图,并将点画成如下形式:
现在我已切换到 3D 图表。我正在用 Asymptote 制作它们,因为这是本论坛的最佳建议,它可以制作 3D 路径的交点。问题是如何使 3D 中的点看起来相同以使文档统一。
2D 中的点使用以下样式定义:
\tikzset{point/.style={circle, thick, %
draw=black,fill=white, inner sep=0pt,minimum size=3pt}}
Asymptote 中的裸“点”产生这样的效果:
\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
settings.outformat = "pdf";
settings.render = 0;
import three;
size(10cm, 0);
currentprojection=orthographic((5,2,2));
pen dot_style=makepen(scale(3pt)*unitcircle);
real a=3;
real b=4;
real c=4;
triple A=(0,0,a);
triple B=(0,b,0);
triple C=(c,0,0);
draw(A--B--C--A,linewidth(1));
draw(O--A^^O--B^^O--C,dashed);
path3 p=O--(6,6*c/b,0);
path3 q=B--C;
path3 p1=O--(6,0,6*c/a);
path3 q1=A--C;
triple H1=intersectionpoint(p,q);
triple H2=intersectionpoint(p1,q1);
path3 h1=A--H1;
path3 h2=B--H2;
triple H=intersectionpoint(h1,h2);
draw(h1);
draw(h2);
draw(O--H);
dot(Label("$H_1$",align=W),H2,dot_style);
dot(Label("$H_2$",align=S),H1,dot_style);
dot(Label("$H$",align=NE),H,dot_style);
dot(Label("$A$",align=N),A,dot_style);
dot(Label("$B$",align=E),B,dot_style);
dot(Label("$C$",align=W),C,dot_style);
dot(Label("$O$",align=S),O,dot_style);
\end{asy}
\end{document}
输出:
我觉得它很丑,我想让这些空点的大小相同。我觉得这很容易。有什么想法可以修改
pen dot_style=makepen(scale(3pt)*unitcircle);
? 谢谢。
答案1
简短回答:在 Asymptote 2D 中,此功能可用,如以下示例所示:
dot((2/3, 2/3), filltype=FillDraw(fillpen=white, drawpen=black));
不幸的是,这不能延续到 3d。
长答案:至少如果可以的话settings.render=0
(就你的情况而言),这是可以做到的,但你基本上必须dot
从中重建功能three_surface.asy
。这是我的尝试:
settings.outformat = "pdf";
settings.prc = false; // IMPORTANT
settings.render = 0; // IMPORTANT
import three;
size(10cm, 0);
currentprojection=orthographic((5,2,2));
void opendot(picture pic=currentpicture, triple v, material p=currentpen,
light light=nolight, string name="", render render=defaultrender)
{
pen q=(pen) p;
pen fillpen = light.background;
if (invisible(fillpen)) fillpen = currentlight.background;
if (invisible(fillpen)) fillpen = white;
real size=0.5*linewidth(dotsize(q)+q);
pic.add(new void(frame f, transform3 t, picture pic, projection P) {
triple V=t*v;
assert(!is3D(), "opendot() not supported unless settings.prc == false and settings.render != 0");
if(pic != null)
dot(pic,project(V,P.t),filltype=FillDraw(fillpen=fillpen, drawpen=q));
},true);
triple R=size*(1,1,1);
pic.addBox(v,v,-R,R);
}
void opendot(picture pic=currentpicture, Label L, triple v, align align=NoAlign,
string format=defaultformat, material p=currentpen,
light light=nolight, string name="", render render=defaultrender)
{
Label L=L.copy();
if(L.s == "") {
if(format == "") format=defaultformat;
L.s="("+format(format,v.x)+","+format(format,v.y)+","+
format(format,v.z)+")";
}
L.align(align,E);
L.p((pen) p);
opendot(pic,v,p,light,name,render);
label(pic,L,v,render);
}
dotfactor *= 2; // Make dots twice as big as they are by default.
real a=3;
real b=4;
real c=4;
triple A=(0,0,a);
triple B=(0,b,0);
triple C=(c,0,0);
draw(A--B--C--A,linewidth(1));
draw(O--A^^O--B^^O--C,dashed);
path3 p=O--(6,6*c/b,0);
path3 q=B--C;
path3 p1=O--(6,0,6*c/a);
path3 q1=A--C;
triple H1=intersectionpoint(p,q);
triple H2=intersectionpoint(p1,q1);
path3 h1=A--H1;
path3 h2=B--H2;
triple H=intersectionpoint(h1,h2);
draw(h1);
draw(h2);
draw(O--H);
opendot(Label("$H_1$",align=W),H2);
opendot(Label("$H_2$",align=S),H1);
opendot(Label("$H$",align=NE),H);
opendot(Label("$A$",align=N),A);
opendot(Label("$B$",align=E),B);
opendot(Label("$C$",align=W),C);
opendot(Label("$O$",align=S),O);