Class MxPolygonCellExtract


  • public class MxPolygonCellExtract
    extends java.lang.Object
    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 Detail

      • getNormal

        public static SbVec3d getNormal​(MiGeometryI meshGeometry,
                                        MiSurfaceCell polygonCell)
        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 as meshGeometry.
        weights - The array into which the weight values are to be stored.This method computes the N values weights[0,N-1], where N=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

        public static double getLongestEdgeLength​(MiGeometryI meshGeometry,
                                                  MiSurfaceCell polygonCell)
        Gets the longest edge of a polygon cell.
        Parameters:
        meshGeometry - The geometry of the mesh.
        polygonCell - The input cell.
        Returns:
        the longest edge
      • getShortestEdgeLength

        public static double getShortestEdgeLength​(MiGeometryI meshGeometry,
                                                   MiSurfaceCell polygonCell)
        Gets the shortest edge of a polygon cell.
        Parameters:
        meshGeometry - The geometry of the mesh.
        polygonCell - The input cell.
        Returns:
        the shortest edge
      • getArea

        public static double getArea​(MiGeometryI meshGeometry,
                                     MiSurfaceCell polygonCell)
        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