Class MxPolygonCellExtract
java.lang.Object
com.openinventor.meshvizxlm.extractors.cell.MxPolygonCellExtract
Utility class for polygon cells.
Utility class that provides a static implementation of the
MiSurfaceCell
interface methods for a polygon cell. This class is
provided to make it easier to create a class that implements the
MiSurfaceCell
interface for a polygon cell.
Localization test
See
isPointInsideCell(MiGeometryI, MiSurfaceCell, double[], double[])
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
getArea
(MiGeometryI meshGeometry, MiSurfaceCell polygonCell) Computes the area of all planar or almost-planar irregular polygon (convex and concave).static double
getLongestEdgeLength
(MiGeometryI meshGeometry, MiSurfaceCell polygonCell) Gets the longest edge of a polygon cell.static SbVec3d
getNormal
(MiGeometryI meshGeometry, MiSurfaceCell polygonCell) Computes the average normal to the given planar or almost-planar polygon cell.static double
getShortestEdgeLength
(MiGeometryI meshGeometry, MiSurfaceCell polygonCell) Gets the shortest edge of a polygon cell.static boolean
isPointInsideCell
(MiGeometryI meshGeometry, MiSurfaceCell polygonCell, double[] point, double[] weights) Checks if a point is inside the given polygon cell.
-
Method Details
-
getNormal
Computes the average normal to the given planar or almost-planar polygon cell.This is done by using Newell's method.
- Parameters:
meshGeometry
- The geometry of the mesh.polygonCell
- The input cell.
-
isPointInsideCell
public static boolean isPointInsideCell(MiGeometryI meshGeometry, MiSurfaceCell polygonCell, double[] point, double[] weights) Checks if a point is inside the given polygon cell.Note: Each node coordinate of the given cell is retrieved in the following way:
for each i with 0 <= i < polygonCell.getNumNodes() nodeIndex = polygonCell.getNodeIndex(i) meshGeometry.getX(nodeIndex) meshGeometry.getY(nodeIndex) meshGeometry.getZ(nodeIndex)
- Parameters:
meshGeometry
- The geometry of the mesh.polygonCell
- The input cell.point
- The input point given in the same space coordinate asmeshGeometry
.weights
- The array into which the weight values are to be stored.This method computes the N values weights[0,N-1], whereN=polygonCell.getNumNodes()
. It assumes the weights array has been already allocated. Its size must be set to N (at least) before calling this method.
-
getLongestEdgeLength
Gets the longest edge of a polygon cell.- Parameters:
meshGeometry
- The geometry of the mesh.polygonCell
- The input cell.- Returns:
- the longest edge
-
getShortestEdgeLength
Gets the shortest edge of a polygon cell.- Parameters:
meshGeometry
- The geometry of the mesh.polygonCell
- The input cell.- Returns:
- the shortest edge
-
getArea
Computes the area of all planar or almost-planar irregular polygon (convex and concave).- Parameters:
meshGeometry
- The geometry of the mesh.polygonCell
- The input cell.- Returns:
- the area
-