Log in or register to post comments

Virtual buttons coordinates

February 3, 2017 - 4:22pm #1

Tell me please where I have a mistake?

$size_orig = array(1500, 1050);
  $size_target = array(247, 173);
  $point_old = array(90, 850);

  echo "Point1: <pre>" . print_r($point_old, 1) . "</pre>";

  $point_new = array(
   (-1 + 2 * $point_old[0] / $size_orig[0]) * $size_target[0],
   (-1 + 2 * (1 - $point_old[1] / $size_orig[1])) * $size_target[1]
  );

  echo "Point2: <pre>" . print_r($point_new, 1) . "</pre>";

result:

Point1:
Array
(
    [0] => 90
    [1] => 850
)
Point2:
Array
(
    [0] => -217.36
    [1] => -107.09523809524
)

Correct answer is (-108.68, -53.52) 

https://library.vuforia.com/articles/Solution/How-To-Implement-Virtual-Buttons

https://developer.vuforia.com/forum/creating-ar-trackables/virtual-button-scaled-coordinate#comment-23641

Virtual buttons coordinates

February 3, 2017 - 4:26pm #2

hmm

-217.36 / 2 = -108.68

-107.09 / 2 = -53.54

Log in or register to post comments