I'm having a little trouble figuring out a method for calculating the distance between the marker and the camera in NyARToolkit. Because the meshses are scaled according to the size of the marker (and the marker pattern is described as a specific scale), I figured that by knowing the size of the marker, you could calculate its distance in the frustum.
I know they set a minimum and maximum length of the frustum(1cm - 10m).
I know that an NyARSquare will give you the center of the square in 2D screen-coordinate space, as well as 4 points (1 for each corner).
I know that you can calculate the transform from the points to make an actual 2D square.
I know that you can calculate the transformed square's distance from the camera if you know the size.
But I DON'T know how to put all of this together, because I don't know NyARToolkit well enough to pull the proper information (such as where to pull the information from the NyARSquare and where to access the frustum information.)
So if anyone can answer where in the "SingleARMarkerDirect3D" sample project provided in the NyARToolkit, I may go to properly access all of the needed information and calculate the marker's distance, it would be greatly appreciated!