gpt4 book ai didi

julia - Meshes.jl 错误 : UndefVarError: P2 not defined

转载 作者:行者123 更新时间:2023-12-05 01:51:19 24 4
gpt4 key购买 nike

我试图从 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} 的别名。

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com