Class ShapeSimilarity


  • public class ShapeSimilarity
    extends java.lang.Object
    Ported to Java from C code from http://www8.cs.umu.se/kurser/TDBAfl/VT06/algorithms/WEBSITE/IMPLEMEN/TURN/IMPLEMEN.HTM May only be used for non-commercial purposes. Implementation of "An Efficiently Computable Metric for Comparing Polygonal Shapes," by Arkin, Chew, Huttenlocher, Kedem, and Mitchel (undated). This expands a little on the cited reference to achieve O(n) space and O(mn log n) run time. This could be improved to O(min m,n) and O(mn log min m,n) by selecting the smallest of the 2 polys to create the initial event heap. See init_events(). Variable names match the article. Implementation (c) Eugene K. Ressler 91, 92 This source may be freely distributed and used for non-commercial purposes, so long as this comment is attached to any code copied or derived from it.
    Author:
    Ruida Cheng
    • Field Detail

      • bufferReader

        private java.io.BufferedReader bufferReader
      • n_events

        public static int n_events
    • Constructor Detail

      • ShapeSimilarity

        public ShapeSimilarity()
    • Method Detail

      • tr_n

        public double tr_n​(TURN_REP tr)
      • tr_i

        public double tr_i​(TURN_REP tr,
                           int i)
      • tr_len

        public double tr_len​(TURN_REP tr,
                             int i)
      • tr_s

        public double tr_s​(TURN_REP tr,
                           int i)
      • tr_smt

        public double tr_smt​(TURN_REP tr,
                             int i,
                             double t)
      • tr_theta

        public double tr_theta​(TURN_REP tr,
                               int i)
      • sqr

        public double sqr​(double x)
      • min

        public int min​(int x,
                       int y)
      • ilog2

        public int ilog2​(int x)
      • turn

        public double turn​(double a,
                           double base)
      • poly_to_turn_rep

        void poly_to_turn_rep​(poly p,
                              TURN_REP t)
      • init_vals

        void init_vals​(TURN_REP f,
                       TURN_REP g,
                       double[] ht0_rtn,
                       double[] slope_rtn,
                       double[] a_rtn)
      • reinit_vals

        public void reinit_vals​(TURN_REP f,
                                TURN_REP g,
                                int fi,
                                int gi,
                                double[] ht0_rtn,
                                double[] slope_rtn)
      • add_event

        public void add_event​(TURN_REP f,
                              TURN_REP g,
                              int fi,
                              int gi)
      • next_event

        public EVENT next_event()
      • next_t

        public double next_t()
      • h_t0min

        public double h_t0min​(TURN_REP f,
                              TURN_REP g,
                              double hc0,
                              double slope,
                              double alpha,
                              int d_update,
                              double[] theta_star_rtn,
                              EVENT[] e_rtn,
                              double[] hc0_err_rtn,
                              double[] slope_err_rtn)
      • comparePolygon

        public void comparePolygon​(poly pg,
                                   poly pf,
                                   double[] result)
      • test

        public void test​(java.lang.String[] args)
      • read_poly

        int read_poly​(poly polygon)