'Points格式:
'Points(0):X
'Points(1):Y
'Points(2):H
'...公式:Area=1/2*(x1*y2-x2*y1+x2*y3-x3*y2+... ...+xn*x1-x1*yn)
Private Function Area(Points() As Double) As Double '計(jì)算Points()區(qū)域面積
Dim L As Long
L = UBound(Points) - 3
Dim T1 As Long
Dim S As Double
S = 0
For T1 = 0 To L Step 3
S = S + Points(T1) * Points(T1 + 4) - Points(T1 + 1) * Points(T1 + 3)
Next T1
S = S + Points(T1) * Points(1) - Points(T1 + 1) * Points(0)
Area = Abs(S / 2)
End Function
'Points(0):X
'Points(1):Y
'Points(2):H
'...公式:Area=1/2*(x1*y2-x2*y1+x2*y3-x3*y2+... ...+xn*x1-x1*yn)
Private Function Area(Points() As Double) As Double '計(jì)算Points()區(qū)域面積
Dim L As Long
L = UBound(Points) - 3
Dim T1 As Long
Dim S As Double
S = 0
For T1 = 0 To L Step 3
S = S + Points(T1) * Points(T1 + 4) - Points(T1 + 1) * Points(T1 + 3)
Next T1
S = S + Points(T1) * Points(1) - Points(T1 + 1) * Points(0)
Area = Abs(S / 2)
End Function