找到封闭的GeneralPath所包含的区域 [英] Find the area enclosed by a closed GeneralPath
问题描述
$ b如何计算java.awt.geom.Area的面积?
$ b
我不知道该如何开始,希望有人可以帮忙?
我有一个关闭的 java.awt.geom.GeneralPath
,我尝试测量 squarepixel 中的平方(区域 code> point ^ 2 ))。
GeneralPath implements Shape
,您可以计算次数 contains()
是<$ c对于 Rectangle
中由 getBounds()
返回的每个像素,$ c> true 。如果需要,可以通过 AffineTransform
的 createTransformedShape()
方法进行扩展。
Possible Duplicate:
How to calculate the area of a java.awt.geom.Area?
I don't know how to start on this and I hope someone can help ?
I have a closed java.awt.geom.GeneralPath
and I try to measure the square ( area in squarepixel ( point ^ 2
) ).
Because GeneralPath
implements Shape
, you can count the number times contains()
is true
for each pixel in the Rectangle
returned by getBounds()
. If need be, you can scale via the createTransformedShape()
method of AffineTransform
.
这篇关于找到封闭的GeneralPath所包含的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!