How to convert xml coordinates to fit CDF

  • 28 February 2023
  • 0 replies
  • 15 views

Userlevel 1
Badge +1

The coordinates of a document in CDF are normalized. In a normalized document, it has (0,0) coordinates in the upper left corner and (1,1) coordinates in the right bottom corner.

Convert xml coordinates to normalized coordinates

To convert xml coordinates to normalized coordinates you need to divide X coordinates with the width of the page and the Y coordinates with the height of the page.

 If the xml Y coordinate is 0 at the bottom of the page and the <height> is at the top of the page, the Y coordinate should be flipped as below.

Normalized Y = 1- Normalized Y

Once the coordinates are flipped;

NewMinY = 1 - OldMaxY

NewMaxY = 1 - OldMinY

 

Example scenario

If a user would like to add manual annotations to a P&ID file in CDF the user should convert the xml coordinates of the file to normalized coordinates.

 


0 replies

Be the first to reply!

Reply