• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to check if a coordinate of this rectangle is on that...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 14298
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to check if a coordinate of this rectangle is on that rectangle

Phuong Truong
Phuong Truong over 5 years ago

Dear all,

I'm new beginner. I want to compare 2 locations each other. Please help me on this.
Thanks a lot. 

Example:

location A = ((0.00075 0.00525) (0.01025 0.00875))

location B = ((0.0125 0.00475) (0.0155 0.00775))

if location A in location B ==> pass

if location A not in location B ==> fail


  • Cancel
  • Phuong Truong
    Phuong Truong over 5 years ago

    2 locations is the same layer

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Phuong Truong
    Phuong Truong over 5 years ago

    Dear all,

    I am a new beginner. I want to check if a coordinate of rectangle A is on rectangle B.

    Have any simple example code for this? Any help is appreciated.


    Thanks a lot.

    Example:

    Rectangle A : ((1 2) (3 4))

    Rectangle B: ((2 2) (5 6))

    If coordinate of rectangle A is on rectangle B is pass.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to Phuong Truong

    I merged your duplicate questions together to avoid confusion (the first one was not very clearly asked). What do you mean by "on"? Do you mean they overlap? Or do y ou mean that rectangle A is entirely inside B?

    Anyway, these two functions do what you want (I think - you should double check my logic as I threw this together and didn't check it thoroughly):

    procedure(CCFrectOverlap(rectA rectB)
      destructuringBind(((Allx Ally) (Aurx Aury)) rectA
        destructuringBind(((Bllx Blly) (Burx Bury)) rectB
          (Allx>=Bllx && Ally>=Blly && Allx<=Burx && Ally<=Bury) ||
          (Aurx>=Bllx && Aury>=Blly && Aurx<=Burx && Aury<=Bury)
        )
      )
    )
    
    procedure(CCFrectInside(rectA rectB)
      destructuringBind(((Allx Ally) (Aurx Aury)) rectA
        destructuringBind(((Bllx Blly) (Burx Bury)) rectB
          (Allx>=Bllx && Ally>=Blly && Allx<=Burx && Ally<=Bury) &&
          (Aurx>=Bllx && Aury>=Blly && Aurx<=Burx && Aury<=Bury)
        )
      )
    )
    

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Phuong Truong
    Phuong Truong over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thanks so much for your reply.

    I mean that rectangle A is entirely inside rectangle B or a part or an edges of rectangle B.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information