Meshes.jl ERROR: UndefVarError: P2 not defined

Meshes.jl ERROR: UndefVarError: P2 not defined

我正在尝试 运行 来自 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

代码来自这里: https://github.com/JuliaGeometry/Meshes.jl/blob/bcc08b0b53622f2578c61561fef91153c05c393b/test/mesh.jl#L176

如果您查看 runtests.jl 文件 (https://github.com/JuliaGeometry/Meshes.jl/blob/bcc08b0b53622f2578c61561fef91153c05c393b/test/runtests.jl#L118),P2 被定义为 Point{2, Float64}.[=14 的别名=]

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)]