@@ -686,7 +686,7 @@ void get_connections_in_layer
686
686
// first compute the Minkowski difference
687
687
get_minkowski_difference (minkowski_diff , position_info_ptr , i_x , i_y );
688
688
// if two rectangles interconnect with each other, Minkowski difference should contain the origin point (0, 0)
689
- if (minkowski_diff [0 ] == 0 || minkowski_diff [1 ] == 0 || minkowski_diff [2 ] == 0 || minkowski_diff [3 ] == 0 )
689
+ if (fabs ( minkowski_diff [0 ]) < EPSILON || fabs ( minkowski_diff [1 ]) < EPSILON || fabs ( minkowski_diff [2 ]) < EPSILON || fabs ( minkowski_diff [3 ]) < EPSILON )
690
690
{
691
691
// furthermore, it should cross the origin point
692
692
if (minkowski_diff [0 ] * minkowski_diff [2 ] + minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
@@ -698,14 +698,14 @@ void get_connections_in_layer
698
698
new_connection .node1_layer = layer_index ;
699
699
new_connection .node2_layer = layer_index ;
700
700
// Find the interconnect length
701
- if (minkowski_diff [0 ] * minkowski_diff [2 ] == 0 )
701
+ if (fabs ( minkowski_diff [0 ] * minkowski_diff [2 ]) < EPSILON )
702
702
{
703
703
if (layer_type == 1 || layer_type == 2 || layer_type == 3 )
704
704
continue ;
705
705
new_connection .value = (fabs (minkowski_diff [1 ])<=fabs (minkowski_diff [3 ])) ? fabs (minkowski_diff [1 ]) : fabs (minkowski_diff [3 ]);
706
706
new_connection .direction = 1 ; //two nodes interconect in direction x
707
707
}
708
- else if (minkowski_diff [1 ] * minkowski_diff [3 ] == 0 )
708
+ else if (fabs ( minkowski_diff [1 ] * minkowski_diff [3 ]) < EPSILON )
709
709
{
710
710
if (layer_type == 1 || layer_type == 3 )
711
711
continue ;
@@ -770,24 +770,26 @@ void get_connections_between_layer
770
770
// first compute Minkowski difference
771
771
get_minkowski_difference (minkowski_diff , position_info_ptr , i_x , i_y );
772
772
// Minkowski difference should contain the origin point (0, 0) if two cells have overlap area
773
- if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
774
- {
775
- // add the connection information to the connections variable
776
- Connection_t new_connection ;
777
- connection_init (& new_connection );
778
- new_connection .node1 = i_x ;
779
- new_connection .node2 = i_y ;
780
- new_connection .node1_layer = layer_index - 1 ;
781
- new_connection .node2_layer = layer_index ;
782
-
783
- // overlap area is the minum area
784
- new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
785
-
786
- new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
787
- // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
788
- // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
789
- // add the connection information to the connections variable
790
- connection_list_insert_end (connections_list , & new_connection );
773
+ if (fabs (minkowski_diff [0 ] * minkowski_diff [2 ]) > EPSILON && fabs (minkowski_diff [1 ] * minkowski_diff [3 ]) > EPSILON ){
774
+ if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
775
+ {
776
+ // add the connection information to the connections variable
777
+ Connection_t new_connection ;
778
+ connection_init (& new_connection );
779
+ new_connection .node1 = i_x ;
780
+ new_connection .node2 = i_y ;
781
+ new_connection .node1_layer = layer_index - 1 ;
782
+ new_connection .node2_layer = layer_index ;
783
+
784
+ // overlap area is the minum area
785
+ new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
786
+
787
+ new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
788
+ // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
789
+ // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
790
+ // add the connection information to the connections variable
791
+ connection_list_insert_end (connections_list , & new_connection );
792
+ }
791
793
}
792
794
}
793
795
}
@@ -806,24 +808,26 @@ void get_connections_between_layer
806
808
// first compute Minkowski difference
807
809
get_minkowski_difference (minkowski_diff , position_info_ptr , i_x , i_y );
808
810
// Minkowski difference should contain the origin point (0, 0) if two cells have overlap area
809
- if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
810
- {
811
- // add the connection information to the connections variable
812
- Connection_t new_connection ;
813
- connection_init (& new_connection );
814
- new_connection .node1 = i_x ;
815
- new_connection .node2 = i_y ;
816
- new_connection .node1_layer = layer_index - 1 ;
817
- new_connection .node2_layer = layer_index ;
818
-
819
- // overlap area is the minum area
820
- new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
821
-
822
- new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
823
- // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
824
- // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
825
- // add the connection information to the connections variable
826
- connection_list_insert_end (connections_list , & new_connection );
811
+ if (fabs (minkowski_diff [0 ] * minkowski_diff [2 ]) > EPSILON && fabs (minkowski_diff [1 ] * minkowski_diff [3 ]) > EPSILON ){
812
+ if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
813
+ {
814
+ // add the connection information to the connections variable
815
+ Connection_t new_connection ;
816
+ connection_init (& new_connection );
817
+ new_connection .node1 = i_x ;
818
+ new_connection .node2 = i_y ;
819
+ new_connection .node1_layer = layer_index - 1 ;
820
+ new_connection .node2_layer = layer_index ;
821
+
822
+ // overlap area is the minum area
823
+ new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
824
+
825
+ new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
826
+ // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
827
+ // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
828
+ // add the connection information to the connections variable
829
+ connection_list_insert_end (connections_list , & new_connection );
830
+ }
827
831
}
828
832
}
829
833
}
@@ -844,24 +848,26 @@ void get_connections_between_layer
844
848
// first compute Minkowski difference
845
849
get_minkowski_difference (minkowski_diff , position_info_ptr , i_x , i_y );
846
850
// Minkowski difference should contain the origin point (0, 0) if two cells have overlap area
847
- if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
848
- {
849
- // add the connection information to the connections variable
850
- Connection_t new_connection ;
851
- connection_init (& new_connection );
852
- new_connection .node1 = i_x ;
853
- new_connection .node2 = i_y ;
854
- new_connection .node1_layer = layer_index - 1 ;
855
- new_connection .node2_layer = layer_index ;
856
-
857
- // overlap area is the minum area
858
- new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
859
-
860
- new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
861
- // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
862
- // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
863
- // add the connection information to the connections variable
864
- connection_list_insert_end (connections_list , & new_connection );
851
+ if (fabs (minkowski_diff [0 ] * minkowski_diff [2 ]) > EPSILON && fabs (minkowski_diff [1 ] * minkowski_diff [3 ]) > EPSILON ){
852
+ if (minkowski_diff [0 ] * minkowski_diff [2 ] < 0 && minkowski_diff [1 ] * minkowski_diff [3 ] < 0 )
853
+ {
854
+ // add the connection information to the connections variable
855
+ Connection_t new_connection ;
856
+ connection_init (& new_connection );
857
+ new_connection .node1 = i_x ;
858
+ new_connection .node2 = i_y ;
859
+ new_connection .node1_layer = layer_index - 1 ;
860
+ new_connection .node2_layer = layer_index ;
861
+
862
+ // overlap area is the minum area
863
+ new_connection .value = get_overlap_area (minkowski_diff , position_info_ptr , i_x , i_y );
864
+
865
+ new_connection .direction = 0 ; //connect direction is Z(=0) for two nodes in different layers;
866
+ // printf("Node%d in layer %d <-> Node%d in layer %d\n", new_connection.node1, new_connection.node1_layer, new_connection.node2, new_connection.node2_layer) ;
867
+ // printf("Direction %d, Value %f\n", new_connection.direction, new_connection.value) ;
868
+ // add the connection information to the connections variable
869
+ connection_list_insert_end (connections_list , & new_connection );
870
+ }
865
871
}
866
872
}
867
873
}
0 commit comments