# Assets positioning

For asset we have following attributes:

attribute description range
x left position of the marker’s top-left corner [-0.5:0.5]
y top position of the marker’s top-left corner [-0.5:0.5]
width asset’s width [0:1]
height asset’s height [0:1]

Assets size and position values are relative to marker’s longest size.

That’s if we have a marker `width=200px` and `height=400px` all the assets’ attributes will be relative to marker’s height (`400px` in our case). Here are some helpful formulas (W-markers width, H-marker’s height, w-asset’s width, h-asset’s height):

Position x y
top left corner of the marker x = -0.5 * min(W/H, 1) y = -0.5 * min(H/W, 1)
top right corner of the marker x = 0.5 * min(W/H, 1) y = 0.5 * min(H/W, 1)
bottom left corner of the marker x = -0.5 * min(W/H, 1) y = -0.5 * min(H/W, 1)
bottom right corner of the marker x = 0.5 * min(W/H, 1) y = 0.5 * min(H/W, 1)

### Mobile side positioning¶

#### Automatic z coordinate calculation¶

We have a problem for 2D assets with rendering assets with the same z coordinate (assets blinking). To avoid this we’ve decided to calculate z coordinate automatically by adding 0.5 to next asset in a set (ordered by zorder).

Note: This works for all 2D assets without is_3d_context and is_vertical flags. Vertical 2D assets (any NON 3D asset with is_vertical==1) For those assets z coordinate calculated front end side using following formula:

``````z = 320 * (absolute(sinus(alpha)) * [asset height in px]/2 + [altitude in px]) / [marker width in px]
``````
where altitude is a distance (in pixels) between marker and bottom of the asset

Back altitude calculation from the z coordinate:

``````altitude = z*[marker width in px] / 320- absolute(sinus(alpha)) * [asset height in px]/2
``````

#### Mobile side rendering¶

• For 3d context asset – assets rendering by z_order (from low to high)
• For plane assets – assets rendering by z coord, from high to low
• For vertical assets – nothing changes, assets rendering by z coord, from high to low
{"ft_lang_label":"__label__en","ft_lang_prob":0.6547852,"math_prob":0.9916685,"size":1919,"snap":"2023-40-2023-50","text_gpt3_token_len":564,"char_repetition_ratio":0.14412533,"word_repetition_ratio":0.2173913,"special_character_ratio":0.3069307,"punctuation_ratio":0.103535354,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98382723,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-22T01:02:18Z\",\"WARC-Record-ID\":\"<urn:uuid:a69c75dc-dc81-445e-9c8e-5620fcf92612>\",\"Content-Length\":\"40014\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b4950834-4c72-4d88-be42-ac9f49dece92>\",\"WARC-Concurrent-To\":\"<urn:uuid:bf7ad97f-99f8-409a-988a-5e5692ec3261>\",\"WARC-IP-Address\":\"104.21.69.26\",\"WARC-Target-URI\":\"https://docs.ar-go.co/developers/apis/ARGOplay/assets_positioning/\",\"WARC-Payload-Digest\":\"sha1:JVLI5OQRGBSWASNDU3XEY6EEB33GHUVY\",\"WARC-Block-Digest\":\"sha1:3JAUPUP4MFRJQEWALIV2J6CB5FV33WJV\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506320.28_warc_CC-MAIN-20230922002008-20230922032008-00482.warc.gz\"}"}