Jump to content
Sign in to follow this  
Guest luissa

LWM and VTP Point coordinates

Recommended Posts

Guest luissa

Hi,For TMF scenery (landclasses, meshes, ... ) each data point coincides with the grid of the LOD system. So, for example, a LOD5 landclass BGL has 257x257 entries and each of these entries is centered, so to speak, on a LOD13 grid. In the following picture the crossing blue lines represent the LOD13 grid and the class textures are centered on them.http://forums.avsim.net/user_files/63855.jpgBut, on LWM masks (and also on VTP polygons and lines), points have coordinates that range from 0x0 to 255x255. This means that if they sit on a LOD21 grid the mask can not cover a complete Area (or LOD13 square). In the following pictures I have 2 LWM 1X1 AreaFills that I want to code as 4-point Polygons. In the first case my "Snap to Grid" routine shifts the points right and down by half of LOD21. http://forums.avsim.net/user_files/63856.gifIn the second case no such shift is apllied. The coverage is not complete in both cases and I am with difficulties in choosing between the 2 cases.http://forums.avsim.net/user_files/63857.gifAs I was writing this, I remembered that when using VTP2 photo tiles, some blurred black lines appeared on the edges of the LOD13 tiles. I forgot about that, since I assumed that the problem was due to mipping mechanism of the textures which I could not control. But, right now, I am wondering if, instead of using:; VTPm2Custom.scm SCASM macroVTPPoly( 2 4 0 ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 255 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 255 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 255 + 4335 ] ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 255 + 4335 ] )I had used:VTPPoly( 2 4 0 ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 256 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 256 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 256 + 4335 ] ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 256 + 4335 ] )the problem would go way.I appreciate any comments. The pictures used in the post were taken from a tool that I am working on. As soon as I have time to write some documentation on it I can make it available.Regards, Luis

Share this post


Link to post
Share on other sites
Guest jimkeir

Hi.The display code I used in LWMViewer is available for download on my website at http://www.jimkeir.co.uk . In brief, the mapping functions are== For LWM ========================================lx = ((Poly->wCol * 256.0)+((Pts2->bX-MSAdjust) * 256.0)/(255.0-MSAdjust) + xoff) * scale; ly = ((Poly->wRow * 256.0)+((Pts2->bY-MSAdjust) * 256.0)/(255.0-MSAdjust) + yoff) * scale;===================================================== For VTP ========================================(xoff+((P2->uX-4080)*256)/255) * scale(yoff+((P2->uY-4080)*256)/255) * scale===================================================The routines you would need to look at are "DrawLWM" and "DrawVTP" . For LWMs, the 'MSAdjust' variable is set to either 1 or 0. The default MS files only use coords running from 1 to 255; if MSAdjust is 1, I scale the entire LWM LOD13 area up. That's why 255.0 and 256.0 are used, to force conversion to floating point for the scaling process.In another project where I'm creating these datafiles, I generate coords from 0 to 255 and they're displayed correctly in FS.Of course, there's no guarantee that these are *correct*, but they seem to work OK :) BTW, although most of it's OK there are known display bugs in the version of the code that's downloadable...Good luck with your new tool :)Regards,Jim Keir

Share this post


Link to post
Share on other sites
Guest luissa

Hello,Thank you for your input! Unfortunatly I only know to programme in VB :-( . But I could understand that you strecht (scale) the regions to fill the LOD13 area. It was also curious to know that MS do not like 0 as a coordinate! In the case of a polygon that spans more than one LOD13 it would leave an empty edge, I imagine ...I think that I will stick to consider the points in a "LOD21 grid shifted down and right by a LOD22 edge". For display may be I surround the polygons by a border with a thickness of LOD22.Regards, Luis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...