PolygonMeshEdge (struct)

Structure representing a PolygonMesh edge. An edge connects 2 points, and can be adjacent to one or 2 polygons. As opposed to the points and polygons, the edges cannot be identified by a simple index, but rather a pair of indices.

Edge direction

If the edge is adjacent to 2 polygons, the edge direction (PolygonMesh.getEdgeFirstPoint to PolygonMesh.getEdgeSecondPoint) will be:

  • aligned with the direction of polygon points (counter clockwise) for the polygon of lowest index
  • opposed to the direction of polygon points (clockwise) for the polygon of highest index

PolygonMeshEdge PolygonMeshEdge PolygonMeshEdge

Members

UInt32 polygon a polygon adjacent to the edge (if there are 2 adjacent polygons, will be the polygon of lowest index for consitency; see Edge direction)
UInt32 firstPoint First point of the edge, in the order of PolygonMeshEdge.polygon ‘s points (counter-clockwise)
/*
** Example: PolygonMeshEdge
*/

require Geometry;
  
operator entry() {

      PolygonMesh mesh();
      mesh.createPoints(6);
      mesh.beginStructureChanges();
      mesh.addPolygon(0,1,4,3);
      mesh.addPolygon(1,2,5,4);
      mesh.endStructureChanges();
      
      Size polygonCount = mesh.getPointPolygonCount(1);
      Size edgeCount = mesh.getPointEdgeCount(1);
      
      report("Point 1 has " + polygonCount + " polygons and " + edgeCount + " edges");
      for( Size i = 0; i < edgeCount; ++i ) {
        PolygonMeshEdge edge = mesh.getPointEdge( 1, i );
        Size leftPoly = mesh.getEdgeLeftPolygon( edge );
        Size rightPoly = mesh.getEdgeRightPolygon( edge );
        report("  Edge "+i+": points=(" + mesh.getEdgeFirstPoint( edge ) + ", " + mesh.getEdgeSecondPoint( edge ) +
               "), polygons=(" + (leftPoly == InvalidIndex ? "none" : String(leftPoly) ) + 
                     ", " + (rightPoly == InvalidIndex ? "none" : String(rightPoly) ) + ")" );
      }
  
}

/*
** Output:

Point 1 has 2 polygons and 3 edges
  Edge 0: points=(1, 2), polygons=(1, none)
  Edge 1: points=(1, 4), polygons=(0, 1)
  Edge 2: points=(0, 1), polygons=(0, none)

*/

Methods

  PolygonMeshEdge ( in PolygonMeshEdge other )
  PolygonMeshEdge ()
PolygonMeshEdge clone ? ()
Boolean isInitialized ? ()

Methods in detail

PolygonMeshEdge ( in PolygonMeshEdge other )

copy constructor



PolygonMeshEdge PolygonMeshEdge.clone? ()

clone method


Boolean PolygonMeshEdge.isInitialized? ()

Returns true if the edge has been initialized, however it might not be valid if PolygonMesh‘s structure changed.