gpt4 book ai didi

haskell - 如何让线条和圆一样粗?

转载 作者:行者123 更新时间:2023-12-02 11:03:11 25 4
gpt4 key购买 nike

我想画一条宽度等于圆直径的圆线。经过多次尝试和错误,这似乎产生了想要的输出。

import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine
main = mainWith example

path = fromVertices [p2 (0,0), p2 (3,0)] # lw 80

example :: Diagram B
example = atPoints [p2 (0,0)] n
<> (path # lineCap LineCapRound . lineJoin LineJoinRound)
<> atPoints [p2 (3,0)] n
<> square 10 # lw none # fc white
where
n =[circle 1 # fc green # lw none]

但是感觉不对。我希望 lw 2 对应于 circle 1,因为 2 是半径的两倍,但肯定不是 lw 80?!
为什么它可以与 80 一起使用?假设我错过了一些东西,如何制作一条与圆一样宽的圆线?

最佳答案

您需要lwL,它代表“线宽,局部”,并使用与长度相同的线宽单位。

更多详情请参见the manual ,以下是相关摘录:

local units are the most straightforward to explain. Values in local units are interpreted in the context of the local vector space, just as most other length measurements (e.g. arguments to functions like circle and square). For example, square 1 # lwL 0.2 specifies a square which is drawn with lines one fifth as wide as its sides are long—and will always be, even if it is scaled: the line width scales right along with the square. (The L in lwL stands for "Local".)

关于haskell - 如何让线条和圆一样粗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52189911/

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