我试图从 Meshes.jl 测试源代码中运行一些代码,但它失败了。我错过了什么?
using Meshes
points = P2[(0,0), (1,0), (0,1), (1,1), (0.5,0.5)]
#ERROR: UndefVarError: P2 not defined
#Stacktrace:
# [1] top-level scope
# @ REPL[2]:1
最佳答案
如果您查看 runtests.jl 文件 ( https://github.com/JuliaGeometry/Meshes.jl/blob/bcc08b0b53622f2578c61561fef91153c05c393b/test/runtests.jl#L118 ),P2 被定义为 Point{2, Float64}
的别名。
T = Float64
P1, P2, P3 = Point{1,T}, Point{2,T}, Point{3,T}
如果您运行这两行,您的示例代码将起作用。
或者,您可以将您的点定义为:
points = Point[(0,0), (1,0), (0,1), (1,1), (0.5,0.5)]
关于julia - Meshes.jl 错误 : UndefVarError: P2 not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72340260/