# [C++ SDK] Adobe FixedPoint and FixedRect to cartesian coordinate mapping

Community Beginner ,
May 27, 2020 May 27, 2020

Copied

I am trying to understand the equivalency of some structure in the SDK and how they relate to a Cartesian coordinate system. I feel like some of these questions are dumb, but I don’t want to make assumption and continue with a false sense of understanding of the how the structures maps. In an attempt to express my confusion clearly, I have broken down these into multiple questions.

Question 1. How does an ASFixedPoint map to x and y?

Given an ASFixedPoint, is it safe to assume that:

• h ---> x
• v ---> y

I took to assume that h was short for horizontal, and v for vertical

Question 2. How does a rectangle expressed as [left top right bottom] map to an ASFixedQuad?

Here’s the source of my confusion: in the PDF Reference V1.7, Section 3.8.4, a rectangle is said to be specified by an array that takes the form:

[ll_x, ll_y, ur_x, ur_y]

where

ll_x is lower-left x,

ll_y is lower-left y,

ur_x is upper-right x,

ur_y is upper-right y

The passage also states specifying the other set of opposite is okay.

The rectangle structure is also allowed to be specified as [left, top, right, bottom] (this is what the ASFixedRect are specified as)

My question is, what is the mapping of these coordinates?

Is the following correspondence correct:

left -> upper left x,

Top -> upper left y

Right -> lower right x,

Bottom -> lower right y

----

I know this question might be super simple, but I don't want to make assumptions about the SDK as I have in the past.

Thanks

TOPICS
Acrobat SDK and JavaScript

Views

203

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
2 Replies 2
LEGEND ,
May 27, 2020 May 27, 2020

Copied

Fixed point values are not integers or floating point and must not be typecast to them (Not what you ask, but a common error). The types in the API are often derived from info in a PDF but may be an abstraction. Never assume correspondence unless explicitly documented. h and v are horizontal and vertical, so x and y respectively.  ASFixedQuad values may not be rectangles. The API would often use ASFixedRect in the case where a value is an axis aligned rectangle.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 29, 2020 May 29, 2020

Copied

LATEST

Do what I do, try it and see.

I've written endless test plug-ins for Acrobat. It's the only way to really know.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more