Obtain the angles of the skewed polygon to determine the shortest distance between conductors.

edited April 22 in Ruby Scripting

Hello,
I want to get the shortest distance between conductors and determine whether the conductors intersect, But for the skewed polygons, I can only get the the coordinates of the bottom-left and top-right corners. It might effect my judge for these boxes. I found the oblique polygons have eight points, how can I read them and Is there a simpler method to determine the shortest distance between these boxes or polygons?

There is my Traversal function:

[*(0..30)].each do |level|
   shape_count = 0
   box_count = 0
   # Traversal
   top_cell.shapes(level).each do |shape|
     if shape.is_box?
       bbox = shape.bbox
       shape_id = id_counter
      id_counter += 1
      shape_info = ShapeInfo.new(shape_id, [], [])
       shape_infos << shape_info
  # Array used to save shape  
      rectangles << { box: shape.box, layer: level }
      id_to_rectangle[shape_id] = { box: shape.box, layer: level }
       box_count += 1
      # test
       puts "box: #{shape_id}"
      count_shape += 1    # shape' counts
     elsif shape.is_polygon? || shape.is_path?
      # Deal with the polygon and path 
      bbox = shape.bbox
       shape_id = id_counter
       id_counter += 1
       shape_info = ShapeInfo.new(shape_id, [], [])
      shape_infos << shape_info
  # Array used to save shape  
      rectangles << { box: bbox, layer: level }
       id_to_rectangle[shape_id] = { box: bbox, layer: level }
       count_shape += 1
      # test
      puts "bbox: #{shape_id}"
     end
     shape_count += 1
   end

   if shape_count > 0
    puts "Level #{level}: find #{shape_count} shapes, #{box_count} boxes。"
  else
     puts "Level #{level}: can't find any shape in this layer, step it."
   end
 end

Thinks,

Luan

Comments

  • edited April 22

    Before I get these boxes and polygons, I remove WELL and other layers with manual operations, so don't worry about capture them.

  • You mean you want to find the shortest distance between the shapes in your design?

    Maybe here is your solution: https://www.klayout.de/forum/discussion/2299/bisection-of-drc-checks-to-find-min-distance#latest

    Matthias

  • edited April 23

    Thank you for your response. But I'm sorry to say that's not the case. To be honest, I'm currently design a process to derive a defect list based on netlists and defect models. Now I've achieved most of the functionality. During program execution, it needs to traverse all shapes and determine whether the minimum distance between any two shapes is less than a preset value. In my previous work, I could accurately calculate this value for any two vertically or horizontally aligned shapes, but it was difficult to determine accurately for diagonal shapes because I could only obtain their left, right, bottom, and top coordinates.

    Just like in this diagram, based on the parameters I obtained for this shape, I've drawn what it looks like in my function's judgment.

    Therefore, I'm wondering if there's a better way to measure the distance between diagonal shapes and other shapes, or obtaining more parameters about this shape for subsequent calculations.
    Thanks,

    Luan

  • So, you mean, you have two polygons and want to have the closest distance, any two points on those two curves have?

    If you want to check such a condition against a preset value, the DRC feature can be used. Like this:

    poly1 = RBA::Polygon::new(RBA::Box::new(0, 0, 1000, 1000)) # first Polygon object
    poly2 = RBA::Polygon::new(RBA::Box::new(1500, 1500, 2500, 2500)) # second Polygon object
    
    # distance in database units (with DBU=1nm, 600 is 0.6µm)
    dist = 600
    
    # 'errors' is a collection of error markers indicating the position where the space between
    # the two polygons is less than 'dist':
    errors = RBA::Region::new(poly1).separation_check(RBA::Region::new(poly2), dist)
    

    If the distance is always the same however, this is a trivial case for a DRC application.

    Matthias

  • Thank you for your response, I will have a try.

    Luan

Sign In or Register to comment.