Skip to content

3D 对象图鉴 ​

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

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

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

含无限直线或平面的范例,请在 Viewer 中先点击重置视图,再环绕或缩放查看有限对象。

空间点、线、平面与坐标架 ​

组合 point3、segment3、line3、ray3、vector3、三点平面、空间三角形和 frame3 绑定点。打开后环绕相机,查看同一组对象的空间位置。

空间点、线、平面与坐标架

下载 3d-lines-and-planes.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
point3 O -2 -1 0
point3 X 0 -1 0
point3 Y -2 1 0
frame3 local O X Y
point3 P in local 0.5 0.5 1
segment3 leg O P
vector3 arrow (1,-1,0) (2,0,2)
line3 axis (-3,2,0) (1,2,1)
ray3 beam (1,1,0) (2,1,1)
plane sheet O X Y
polygon3 triangle (1,-2,0) (3,-2,0) (2,-2,2)
style sheet stroke #4c8dff fill #4c8dff opacity 0.12
style triangle stroke #3fb68b fill #3fb68b opacity 0.55
label P text "frame point"
label leg text "segment3"
label arrow text "vector3"
label axis text "line3"
label beam text "ray3"

空间圆、椭圆与曲线 ​

前排展示不同法向的圆、圆弧、椭圆,后排展示螺旋参数曲线和空间轨迹。P 绑定在螺旋线上;调整 u 让 Q 沿紫色轨迹移动。

空间圆、椭圆与曲线

下载 3d-space-curves.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
circle3 orbit (-3,0,1) normal (0,0,1) radius 1.4
arc3 bow (0,0,1) normal (0,1,0) radius 1.4 from 0 to 140deg
ellipse3 oval (3,0,1) normal (0,1,1) radii 1.6 0.8
curve3 helix (1.2*cos(t),4+1.2*sin(t),t/3) t from 0 to 4pi samples 120
point3 P on helix at 2pi
param u 1 range 0 2pi
point3 Q = (-3+cos(u),4+sin(u),1+0.5*sin(2*u))
locus3 trail Q driver u samples 100
style helix stroke #e0447c width 2
style trail stroke #b58cf2 width 2
label orbit text "circle3"
label bow text "arc3"
label oval text "ellipse3"
label helix text "curve3"
label trail text "locus3"

多面体家族 ​

并排展示长方体、三棱柱、四棱锥、棱台,以及由四个三角形面组合的自定义四面体。辅助底面与各个独立面隐藏后,保留完整实体供观察。

多面体家族

下载 3d-polyhedra.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
box block (-5,-2,0) dims 2 2 2
prism wedge (-1,-2,0) (1,-2,0) (0,0,0) extrude (0,0,2)
pyramid peak (3,-2,0) (5,-2,0) (5,0,0) (3,0,0) apex (4,-1,2.5)
polygon3 base (-5,3,0) (-3,3,0) (-3,5,0) (-5,5,0)
pyramid_frustum truncated base top (-4,4,2) scale 0.5
hide base
polygon3 faceA (-1,3,0) (1,3,0) (0,5,0)
polygon3 faceB (-1,3,0) (0,4,2) (1,3,0)
polygon3 faceC (1,3,0) (0,4,2) (0,5,0)
polygon3 faceD (0,5,0) (0,4,2) (-1,3,0)
polyhedron tetra faceA faceB faceC faceD
hide faceA
hide faceB
hide faceC
hide faceD
style block stroke #4c8dff fill #4c8dff opacity 0.45
style wedge stroke #3fb68b fill #3fb68b opacity 0.45
style peak stroke #e0447c fill #e0447c opacity 0.45
style truncated stroke #d9a53f fill #d9a53f opacity 0.5
style tetra stroke #b58cf2 fill #b58cf2 opacity 0.5
label block text "box"
label wedge text "prism"
label peak text "pyramid"
label truncated text "pyramid frustum"
label tetra text "polyhedron"

圆柱、圆锥与圆台 ​

三个实体共用高度参数 h,半径保持不变。调整 h,对比圆柱、圆锥和圆台的外形;环绕相机查看上下底面与侧面。

圆柱、圆锥与圆台

下载 3d-round-solids.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
param h 2.5 range 1.5 3.5
cylinder tube (-4,0,0) (-4,0,h) radius 1
cone peak (0,0,0) apex (0,0,h) radius 1.3
frustum taper (4,0,0) (4,0,h) radii 1.3 0.65
style tube stroke #4c8dff fill #4c8dff opacity 0.55
style peak stroke #3fb68b fill #3fb68b opacity 0.55
style taper stroke #e0447c fill #e0447c opacity 0.55
label tube text "cylinder"
label peak text "cone"
label taper text "frustum"

球与球体部分 ​

从左到右是完整球、球冠、半球、球带和球扇形。后四个都由同半径的隐藏参考球构造,便于比较截平面封闭、球面部分和连接球心的锥面。

球与球体部分

下载 3d-sphere-parts.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
sphere ball (-6,0,1.2) radius 1.2
sphere capSource (-3,0,1.2) radius 1.2
sphere halfSource (0,0,1.2) radius 1.2
sphere bandSource (3,0,1.2) radius 1.2
sphere radialSource (6,0,1.2) radius 1.2
sphere_cap cap capSource normal (0,0,1) height 0.8 samples 16
hemisphere half halfSource normal (0,0,1) samples 16
sphere_zone band bandSource normal (0,0,1) from -0.5 to 0.5 samples 16
sphere_sector radial radialSource normal (0,0,1) height 0.8 samples 16
hide capSource
hide halfSource
hide bandSource
hide radialSource
style ball stroke #4c8dff fill #4c8dff opacity 0.55
style cap stroke #3fb68b fill #3fb68b opacity 0.6
style half stroke #e0447c fill #e0447c opacity 0.6
style band stroke #d9a53f fill #d9a53f opacity 0.6
style radial stroke #b58cf2 fill #b58cf2 opacity 0.6
label ball text "sphere"
label cap text "cap"
label half text "hemisphere"
label band text "zone"
label radial text "sector"

带孔面的拉伸与截面 ​

将带方孔的平面多边形向上拉伸,粉色截面保留内部孔洞。调整 h 移动截平面,观察截面始终落在实体内;可以在源码中改变拉伸向量。

带孔面的拉伸与截面

下载 3d-extrusion-and-section.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
param h 1.5 range 0.5 2.5
polygon3 outer (-2,-2,0) (2,-2,0) (2,2,0) (-2,2,0)
polygon3 hole (-1,-1,0) (1,-1,0) (1,1,0) (-1,1,0)
polygon3 ring outer holes hole
extrude hollow ring by (0,0,3)
plane slicing (0,0,h) normal (0,0,1)
section cut hollow by slicing
hide outer
hide hole
hide ring
style hollow stroke #4c8dff fill #4c8dff opacity 0.25
style slicing stroke #d9a53f fill #d9a53f opacity 0.1
style cut stroke #e0447c fill #e0447c opacity 0.8
label cut text "section with a hole"

旋转曲面与部分旋转实体 ​

左侧线段绕直线整周旋转生成曲面,右侧封闭多边形旋转 270° 生成带封口的实体。黄色线段是生成曲线;旋转轴仍显示以便理解构造。

旋转曲面与部分旋转实体

下载 3d-revolution.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
line3 axis (-3,0,0) (-3,0,1)
segment3 profile (-1.7,0,0) (-2.2,0,3)
revolve skin profile around axis samples 24
polygon3 panel (2.5,0,0) (4,0,0) (3.5,0,2.5) (2.5,0,2.5)
line3 secondAxis (2,0,0) (2,0,1)
revolve body panel around secondAxis from 0 to 270deg samples 24
hide panel
style skin stroke #3fb68b fill #3fb68b opacity 0.5
style body stroke #e0447c fill #e0447c opacity 0.5
style profile stroke #d9a53f width 3
label skin text "revolved curve"
label body text "partial revolved solid"

函数曲面、参数曲面与隐式曲面 ​

从左到右是二元函数曲面、参数方程定义的环面,以及隐式方程定义的椭球。调整 a 改变波浪振幅。范例使用适中的采样数,可以直接在 Viewer 中查看。

函数曲面、参数曲面与隐式曲面

下载 3d-surfaces.eido · 在查看器中打开

完整 Eidolang 源码
txt
space solid
param a 0.7 range 0.3 1.2
fn wave(x,y) = a*(sin(x+5)+cos(y))+1.5
surface graph wave domain -7 -3 -2 2 samples 12
parametric_surface torus ((1+0.35*cos(v))*cos(u),(1+0.35*cos(v))*sin(u),1.5+0.35*sin(v)) domain 0 2pi 0 2pi samples 12
equation3 ellipsoid ((x-5)^2/2+y^2+(z-1.5)^2-1) domain 3 7 -1.5 1.5 0 3 samples 12
style graph stroke #4c8dff fill #4c8dff opacity 0.55
style torus stroke #3fb68b fill #3fb68b opacity 0.55
style ellipsoid stroke #e0447c fill #e0447c opacity 0.55
label graph text "function surface"
label torus text "parametric surface"
label ellipsoid text "implicit surface"