PolyObjectVolume
Section: C Library Functions (3)
Updated: IRIT Version 6.0
Index
Return to Main Contents
NAME
PolyObjectVolume()
SYNOPSIS
geom_lib/geomvals.c:173
double PolyObjectVolume(IPObjectStruct *PObj)
DESCRIPTION
Routine to evaluate the Volume of the given geom object, in object unit.
This routine has a side effect that all non-convex polygons will be
splitted to convex ones.
Algorithm (for each polygon, and let ObjMinY be the minimum OBJECT Y):
V3
1. Set Polygon Area to be zero. /\
Let V(0) be the first vertex, V(n) the last. / \
For i goes from 1 to n-1 form triangles / \V2
by V(0), V(i), V(i+1). V4/ |
For each such triangle di: \ |
1.1. Find the vertex (out of V(0), V(i), V(i+1)) \ |
with the minimum Z - TriMinY. \_______|
1.2. The volume below V(0), V(i), V(i+1) triangle, V0 V1
relative to ObjMinZ level, is the sum of:
1.2.1. volume of V'(0), V'(i), V'(i+1) - the
area of projection of V(0), V(i), V(i+1) on XY parallel
plane, times (TriMinZ - ObjMinZ).
1.2.2. Assume V(0) is the one with the PolyMinZ. Let V"(i) and
V"(i+1) be the projections of V(i) and V(i+1) on the plane
Z = PolyZMin. The volume above 1.2.1. and below the polygon
(triangle!) will be: the area of quadraliteral V(i), V(i+1),
V"(i+1), V"(i), times distance of V(0) for quadraliteral
plane divided by 3.
1.3. If Z component of polygon normal is negative add 1.2. result to
ObjectVolume, else subtract it.
PARAMETERS:
PObj: To compute volume for.
FUNCTION RETURN VALUE
double: Computed volume.
ORIGIN
(C) Copyright 1989/90-95 Gershon Elber, Technion, IIT
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- PARAMETERS:
-
- FUNCTION RETURN VALUE
-
- ORIGIN
-
This document was created by
man2html,
using the manual pages.
Time: 07:26:44 GMT, July 20, 2024