Skip to content

Commit 45eef91

Browse files
committed
ConicalFrustum: define centroid function
1 parent 8658243 commit 45eef91

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/primitives/ConicalFrustum.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ function volume(x::ConicalFrustum)
176176
pi * lengthVal * ( baseRadiusVal ^ 2 + baseRadiusVal * topRadiusVal + topRadiusVal ^ 2 ) / 3
177177

178178
end # function
179+
180+
"""
181+
Computes the centroid of a frustum: the mean between the base and top centers.
182+
"""
183+
centroid(x::ConicalFrustum) = (baseCenter(x) + topCenter(x)) / 2

0 commit comments

Comments
 (0)