Skip to content

2D 对象图鉴 ​

每个主题都是一个可以直接打开的独立项目,包含完整、可编辑的 Eidolang 源码。预览图由同一份源码通过实际运行时渲染;它是初始状态,完整交互请打开项目。

在 Eidograph 中使用顶部的打开或拖入下载文件,之后可以拖动自由点、调整参数并用另存为保存自己的版本。在查看器中打开可直接在浏览器查看;Viewer 用于观察与播放,编辑请使用已安装的应用。

也可以查看 3D 对象图鉴、基础示例和动画示例。

点与线性对象 ​

对比自由点 A、B、绑定点 P 与派生中点 M,以及线段、直线、射线、向量、平行线和垂线。拖动 A 或 B,观察依赖对象一起更新。

点与线性对象

下载 2d-lines.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
# Free, bound and derived points; four kinds of linear objects.
point A -3 -1
point B 1 1
segment base A B
point P on base at 0.35
midpoint M A B
line axis (-3,3) (1,3)
ray beam (-3,-3) (1,-2)
vector arrow (2,-1) (4,1)
parallel offset (0,2) base
perpendicular upright B base
style offset stroke #8b949e dash 6 4
style upright stroke #8b949e dash 6 4
label base text "segment"
label axis text "line"
label beam text "ray"
label arrow text "vector"

三角形、圆与中心 ​

一个三角形同时展示外接圆、内切圆、内心、外心、垂心、重心和内角平分线。拖动三个顶点,对比各个中心的移动方式。

三角形、圆与中心

下载 2d-triangle.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
# Drag A, B or C to update circles, centers and the angle bisector.
point A -3 -2
point B 3 -2
point C -1 3
polygon triangle A B C
circumcircle outer A B C
incircle inner A B C
point I = incenter(A,B,C)
point O = circumcenter(A,B,C)
point H = orthocenter(A,B,C)
point G = centroid(A,B,C)
angle_bisector bis B A C
style triangle fill #4c8dff opacity 0.2
style outer stroke #8b949e dash 6 4
style inner stroke #3fb68b width 2
style bis stroke #d9a53f
label I text "incenter"
label O text "circumcenter"
label H text "orthocenter"
label G text "centroid"

圆、圆弧与圆锥曲线 ​

并排展示圆、三点圆弧、焦点椭圆、焦点与准线定义的抛物线、双曲线,以及圆上的切线和法线。灰色虚线标出辅助法线。

圆、圆弧与圆锥曲线

下载 2d-conics.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
circle round (-5,2) radius 1.3
arc bow (-6,-2) (-5,-1) (-4,-2)
ellipse oval (-1,2) (1,2) through (0,2.7)
point F 4 2
line directrix (3,0) (5,0)
parabola bowl F directrix directrix from -2 to 2
hyperbola branches (-1,-3) (1,-3) through (0.6,-3) from -1.3 to 1.3
tangent touch round at 45deg
normal radial round at 45deg
style touch stroke #d9a53f
style radial stroke #8b949e dash 6 4
label round text "circle"
label bow text "arc"
label oval text "ellipse"
label bowl text "parabola"
label branches text "hyperbola"

Bézier 与插值样条 ​

四个控制点定义三次 Bézier,灰色线段显示两端控制柄;下方的样条经过给定点,中间还有闭合样条。拖动 A、B、C、D 或绑定点 P,观察曲线与切线、法线。

Bézier 与插值样条

下载 2d-smooth-curves.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
point A -4 1
point B -2 4
point C 1 -1
point D 4 2
bezier cubic A B C D
segment handleA A B
segment handleB C D
spline interpolated (-4,-2) (-2,-1) (0,-3) (2,-1) (4,-2)
spline closedLoop (-1,1) (0,2.5) (1,1) (0,0) closed
point P on cubic at 0.5
tangent touch cubic at 0.5
normal radial cubic at 0.5
style handleA stroke #8b949e dash 6 4
style handleB stroke #8b949e dash 6 4
style interpolated stroke #3fb68b width 2
style closedLoop stroke #b58cf2 width 2
style touch stroke #e0447c
style radial stroke #8b949e dash 6 4
label cubic text "Bezier"
label interpolated text "spline"
label closedLoop text "closed spline"

多边形与填充区域 ​

展示正六边形、三角形、扇形、弓形、两个圆的交集和不等式区域。前两行的形状可用精确几何构造;不等式按定义域采样。

多边形与填充区域

下载 2d-regions.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
# Domain corners also keep the sampled regions inside the initial fitted view.
point domainMin 2.5 -3.5
point domainMax 5.5 3.5
hide domainMin
hide domainMax
regular_polygon hex (-4,2) (-2.5,2) sides 6
polygon tri (0,1) (2,1) (1,3)
sector wedge (4,1.5) radius 1.6 from 0 to 120deg
circular_segment cap (-4,-2) radius 1.6 from 0 to 140deg
circle leftDisk (-0.6,-2) radius 1.3
circle rightDisk (0.6,-2) radius 1.3
region lens = intersection(leftDisk,rightDisk)
inequality patch ((x-4)^2+(y+2)^2 <= 1.8) domain 2.5 5.5 -3.5 -0.5
style hex fill #d9a53f opacity 0.65
style tri fill #4c8dff opacity 0.6
style wedge fill #3fb68b opacity 0.6
style cap fill #e0447c opacity 0.6
style lens fill #b58cf2 opacity 0.8
style patch fill #5bbcbf opacity 0.7
label hex text "regular polygon"
label wedge text "sector"
label cap text "circular segment"
label lens text "intersection"
label patch text "inequality"

函数、参数、极坐标与隐式曲线 ​

同一画布上对比函数图像、李萨如参数曲线、极坐标玫瑰线和隐式椭圆。调整参数 a 改变上方正弦图像的振幅;更多动态练习见函数与方程。

函数、参数、极坐标与隐式曲线

下载 2d-plots.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
param a 1 range 0.5 1.5
fn wave(x) = a*sin(x)+2.5
plot graph wave domain -5 5
curve loop (-3+1.4*cos(t),-1+sin(2*t)) t from 0 to 2pi samples 120
polar rose (1.5*cos(3*t)) t from 0 to 2pi samples 180
equation oval (x-3)^2/2+(y+1)^2 = 1 domain 1 5 -3 1
label graph text "plot"
label loop text "parametric curve"
label rose text "polar curve"
label oval text "implicit equation"

路径片段、路径连接与轨迹 ​

红色粗线是圆的一段 subpath,下方绿色折线由 pathjoin 连接两个线段,右侧紫色圆是动点 Q 的 locus。调整 u,观察 P 与 Q 一起沿各自路径运动。

路径片段、路径连接与轨迹

下载 2d-paths.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
param u 0.7 range 0 2pi
circle carrier (-2,0) radius 2
subpath highlight carrier from 20deg to 140deg
point P on carrier at u
point Q = translate(P,(4,0))
locus trail Q driver u samples 100
segment link P Q
segment first (-4,-3) (0,-3)
segment second (0,-3) (2,-2)
pathjoin route first second
hide first
hide second
style carrier stroke #8b949e dash 6 4
style highlight stroke #e0447c width 4
style trail stroke #b58cf2 width 2
style route stroke #3fb68b width 3
label highlight text "subpath"
label trail text "locus"
label route text "pathjoin"

坐标架、变换与标注 ​

坐标架驱动蓝色三角形,同时展示旋转、平移、缩放的结果,以及直角标记、等长刻线、标签和文本框。拖动 X 改变坐标架方向与尺度。

坐标架、变换与标注

下载 2d-frames-and-labels.eido · 在查看器中打开

完整 Eidolang 源码
txt
space plane
point O -3 -1
point X -1 -1
frame local O X
point A in local 0 0
point B in local 1 0
point C in local 1 1
polygon original A B C
rotate turned original around O by 60deg
translate shifted original by (5,0)
scale enlarged original around O by 1.6
mark right A B C
segment lower A B
segment side B C
mark tick lower
mark tick side
label shifted text "translate"
hide A
hide B
textbox note -4 4 width 8 height 1.5 text "Drag X to change the local frame. Marks and labels follow the geometry."
style original stroke #4c8dff fill #4c8dff opacity 0.65
style turned stroke #3fb68b fill #3fb68b opacity 0.4
style shifted stroke #e0447c fill #e0447c opacity 0.4
style enlarged stroke #d9a53f opacity 0.5