Class MappedPolygon2D

java.lang.Object
mgui.morph.sections.MappedPolygon2D
All Implemented Interfaces:
java.lang.Cloneable

public class MappedPolygon2D
extends java.lang.Object
implements java.lang.Cloneable
Implements a node mapping between two Polygon2D shapes. Mapping uses radial representation to assign similarity weights to node pairs, and maps between nodes based upon these weights. This allows mappings between polygons with unequal node counts. The algorithm:
  • Gets the radial representation of each polygon
  • Assigns weights to node pairs based upon angle similarity
  • First maps nMin nodes, where nMin = min(nA, nB), ensuring that each node gets mapped at least once
  • Secondly maps remaining unmapped nodes based upon their weights and positions relative to already mapped nodes (ensuring that node order is preserved)
Author:
Andrew Reid
See Also:
RadialRepresentation
  • Field Details

    • isReversed

      public boolean isReversed
    • isMapped

      public boolean isMapped
    • A

      public Polygon2D A
    • B

      public Polygon2D B
    • prevSect

      public int prevSect
    • nextSect

      public int nextSect
  • Constructor Details

    • MappedPolygon2D

      public MappedPolygon2D()
    • MappedPolygon2D

      public MappedPolygon2D​(Polygon2D a, Polygon2D b, int psect, int nsect)
      Constructor passing a source (A) and target (B) polygon.
      Parameters:
      a - Source polygon
      b - Target polygon
  • Method Details

    • setPolygons

      public void setPolygons​(Polygon2D a, Polygon2D b)
      Parameters:
      a -
      b -
    • getOrderedA

      public Polygon2D getOrderedA()
    • getOrderedB

      public Polygon2D getOrderedB()
    • getA

      public Polygon2D getA()
    • getB

      public Polygon2D getB()
    • mapPolygons

      public void mapPolygons​(double threshold)
    • setNodeList

      public void setNodeList​(MappedPolygon2D prevMap)
      Sets the nodes in nodesA or nodesB from the previous polygon map in this series.
      Parameters:
      prevMap -
    • removeNodeByCount

      public int removeNodeByCount​(double minAngle)
    • removeNodeByCount

      public int removeNodeByCount​(double minAngle, double minLength)
      Remove a node from A, selected by the criteria that its target has a maximum source count (i.e., multiple source (A) nodes mapped to a single target (B) node), and is attached to a minimal length edge.
      Parameters:
      minAngle - the minimum node angle at which a node remove a node is allowed (may no longer be necessary...)
    • removeNode

      public void removeNode​(int i)
    • clone

      public java.lang.Object clone()
      Overrides:
      clone in class java.lang.Object
    • printWeights

      public void printWeights​(double[][] weights)
    • printMap

      public void printMap()