質問

アークのセットから円のサイズを計算する方法は?

具体的には、サークルを描くこのSVGパス定義を持っています。

<path clip-path="url(#SVGID_2_)" fill="#99C44C" d="M334.293,56.846c0-4.782,3.88-8.659,8.665-8.659c4.78,0,8.66,3.877,8.66,8.659
    c0,4.783-3.88,8.661-8.66,8.661C338.173,65.507,334.293,61.629,334.293,56.846"/>
.

あなたの情報のために、円は 'd'属性に描かれます。M334.293,56.846このx、y位置に移動すると、Cコマンドは曲線です。

カーブ:

曲線の先頭の制御点として(X1、Y1)を使用して、現在の点から(x、y)までキュービックBézier曲線を描画し、曲線の終わりの制御点として(x2、y2)。C(大文字)絶対座標が従うことを示します。C(小文字)相対座標が続くことを示します。

relative curves
c0-4.782,3.88-8.659,8.665-8.659
c4.78,0,8.66,3.877,8.66,8.659
c0,4.783-3.88,8.661-8.66,8.661

absolute curve
C338.173,65.507,334.293,61.629,334.293,56.846
.

役に立ちましたか?

解決

At this juncture you have two possibilites:

You can treat the bezier curve as a circle (which is, as commented, wrong; it's just really circle-looking). To calculate the area, determine the radius and use π * r^2 as usual.

If you want to calculate generally the area enclosed by a path element; that requires some moderate calculus, and is not for the faint of heart.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top