RPTools.net

Discussion and Support

Skip to content

It is currently Mon Nov 20, 2017 12:49 am 




Forum rules


PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)



Reply to topic  [ 38 posts ]  Go to page 1, 2, 3  Next

Previous topic | Next topic 

  Print view

Author Message
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 364
 Post subject: Rotating objects does not align?
PostPosted: Thu Dec 05, 2013 1:01 am 
I have been trying to get double doors to align properly with a rotation rather than with a flip. I can of course flip an object and it will stay aligned with a duplicate of the non flipped object. But why does rotating an object cause it to be a fraction of a pixel misaligned with the other non flipped object?

I've verified this by editing the graphic in Photoshop, making sure that the top half is exactly the same as the bottom half and each half is centered correctly.

Here is a screenshot where the top doors are not aligned because one was rotated. The bottom doors were flipped rather than rotated and are aligned properly. If you were to zoom in on the MT map, the top doors are less than a pixel off. The further out you zoom, the more they look misaligned.

Attachment:
doors.jpg
doors.jpg [ 134.83 KiB | Viewed 799 times ]


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1705
Location: Chicagoland
 Post subject: Re: Rotating objects does not align?
PostPosted: Thu Dec 05, 2013 1:09 pm 
Is the graphic an odd or even number of pixels high? I would imagine the door should be an odd number of pixels to have an exact middle to rotate on otherwise that may be the source of the issue?

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
More information here: MapTool Nerps! Fork | TokenTool Nerps! Fork
Custom TokenTool (version 1.0b33): TokenTool.exe


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 364
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 12:04 am 
The pixels being even or odd shouldn't matter since flipping after the rotation should put the image in the exact same position (only because the top and bottom halves of the image are exact duplicates).

Basically, the point between the 2 middle horizontal pixels is your center point. Which is where MT should be rotating. But even rotating from a "center" point one pixel higher or lower should still give proper results if you then flip the image after rotating it.

I made a new door with a black line to make an odd pixel count like you suggested (not that it will have any effect in this instance). The result is still the same as expected. But here are 3 screenshots zoomed at different distances.

Up close, you can see the pixels and see that the doors are misaligned a fraction of a pixel. There is no way to nudge them up or down to align correctly because the rotation does not seem to rotate around a pixel count.

The farther you zoom out, the more they look misaligned.

BTW, the only reason I'm bringing this up rather than flipping them instead of rotating then flipping them is because I'm using them with Wolph42's BoT double animated doors macro with attached VBL. It requires the 2nd door to rotate for the VBL to be placed correctly. But now it looks like my MT doors are glitched. :p

Attachment:
doors1.jpg
doors1.jpg [ 252.98 KiB | Viewed 776 times ]

Attachment:
doors2.jpg
doors2.jpg [ 192.03 KiB | Viewed 776 times ]

Attachment:
doors3.jpg
doors3.jpg [ 102.99 KiB | Viewed 776 times ]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 1:50 am 
I guessed this had to do with the bot. And I can confirm this issue (pixels not aligning).

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7947
Location: Bay Area
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 4:48 am 
Is this a problem in b89, or the custom build? I recall a very strange error (totally unrelated) where a person could move his token in to certain squares with snap to grid. I loaded his campaign and sure enough, it would just skip right over certain squares. Then I looked at the x,y coords.. about 1mill+ I figured the math was breaking down when at extreme x,y coordinates.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 6:04 am 
aliasmask wrote:
Is this a problem in b89, or the custom build? I recall a very strange error (totally unrelated) where a person could move his token in to certain squares with snap to grid. I loaded his campaign and sure enough, it would just skip right over certain squares. Then I looked at the x,y coords.. about 1mill+ I figured the math was breaking down when at extreme x,y coordinates.


I know that the math breaks for getTokenX/Y for extreme (e.g. 650) coordinates as in that case it returns a higher (651) value. But i don't know if thats related to this issue.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 6:16 am 
I take my earlier confirmation back. I did a more thorough test this time and create one token of 50x50 px with alternating red and white. Then I placed it in a 50px grid maptool map and copied a 180 rotated token next to it:
Attachment:
Px alignment.png
Px alignment.png [ 21.91 KiB | Viewed 760 times ]

as you can see, they align perfectly.

and just to be thorough, here a 'door' of 2 px thck in a 50px token. (I tested this on size medium and size large, but that result in the same picture.)
Attachment:
px alignment door.jpg
px alignment door.jpg [ 51.91 KiB | Viewed 760 times ]


zoomed out:
Attachment:
px align zoomed out.jpg
px align zoomed out.jpg [ 92.3 KiB | Viewed 760 times ]


I also checked these at extreme coords (20,000+ RMC+) but no difference.

and finally I flipped them both horizontally, but again: same picture. So the only conclusion that can be derived from this is that the 'door' or Oryan is not in dead centre.

I think (but not tested) that the issue lies with e.g. a door image of 101x101 px which is then forced on a 50px grid. I can imagine that some pixel shift will take place and since its a half px its impossible to align on a 50px grid. edit: tested and nope, then too the line aligns perfectly.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 364
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 2:06 pm 
My maps and doors are set at 100px grid size. Would that make a difference? Also, as I said, the closer you zoom in, the better aligned it looks. So you can zoom in close enough where it looks correct. The farther you zoom out, the worse it looks.

The left doors in your last example still look misaligned. The bounding boxes do not look lined up, which is the same effect I get when rotating objects (can't align a rotated bounding box by nudging because it is always off by less than a pixel).

My door graphics are 400x100. As I said earlier, for testing, I used Photoshop to copy the bottom half of the door, delete the top half, pasted and flipped the other half and positioned it so that both sides are exactly the same. It is centered along the horizontal middle. When I place it in MT, I set the size to gargantuan (100px grid map) so that the door appears to be large (fits in 2 squares).

Could it be a graphics card issue where it just appears to be misaligned in MT?

Here is a door if anyone wants to test it:
Attachment:
Door1.png
Door1.png [ 28.02 KiB | Viewed 751 times ]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Fri Dec 06, 2013 2:32 pm 
I'll check out your door later.the bounding box looks disaligned because of the red colors I used. But believe me I checked all kinds of zoom levels.

edit: AH Now I get it. I can confirm your issue. This issue happens when you 'unsnap' the tokens and then move them. In that case its impossible to align them. This is also the case for the tests I did earlier.
The workaround is to snap them, set them up and unsnap them. That way they stay aligned correctly.

I don't know if the devs can fix this issue as the disalignment is very tiny: her you can see the effect:
Attachment:
px align test 3.jpg
px align test 3.jpg [ 28.94 KiB | Viewed 743 times ]
. As you can see the token on the right is rotated 180 degrees and is a tiny bit disaligned to the grid. The effect switches with each zoom level.
and if anyone else wishes to test, here's the token:
Attachment:
test.png
test.png [ 2.78 KiB | Viewed 743 times ]

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 364
 Post subject: Re: Rotating objects does not align?
PostPosted: Sun Dec 08, 2013 4:50 pm 
wolph42 wrote:
I can confirm your issue. This issue happens when you 'unsnap' the tokens and then move them. In that case its impossible to align them. This is also the case for the tests I did earlier.
The workaround is to snap them, set them up and unsnap them. That way they stay aligned correctly.

I'm trying that trick but the door still ends up misaligned.

I turn snapping on, drop a door from my library, copy/paste a 2nd door, rotate it, flip it vertical, and it is misaligned.

Anyway, it doesn't seem like we are getting much feedback about this issue. :p
As a graphics guy, this is a very irritating visual to see on a map.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Sun Dec 08, 2013 5:00 pm 
indeed ! which is funny, cause try my trick with this door:
Attachment:
door (2).png
door (2).png [ 9.6 KiB | Viewed 722 times ]


edit: i compared your door and this one on the same map next to eachother and noticed that the black line you drew was 1pixel ABOVE the grid, so obviously it disaligns!! Try this on a 50px grid, its also noticeable on a 100px grid but barely. Anyway its more then one issue. There's an issue with unsnapped tokens that cannot be aligned properly to the grid when rotated and apparently there is an issue with your door, cause with my door attached here I can only replicate your issue unsnapped.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 364
 Post subject: Re: Rotating objects does not align?
PostPosted: Sun Dec 08, 2013 6:45 pm 
wolph42 wrote:
edit: i compared your door and this one on the same map next to eachother and noticed that the black line you drew was 1pixel ABOVE the grid, so obviously it disaligns!!

No, the black line is 2 pixels tall. So one pixel black line is above the center line and the other one pixel black line is below the center line. It was created in Photoshop on a 100px grid.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Rotating objects does not align?
PostPosted: Mon Dec 09, 2013 12:52 am 
I know,but just try this in Maptool.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12103
Location: Tampa, FL
 Post subject: Re: Rotating objects does not align?
PostPosted: Tue Jan 14, 2014 10:37 pm 
This is very interesting. I'm not a graphics guy (in terms of writing fancy-pants graphics handling code) but I can't think of any reason why a rotated image might not line up.

Each token has a couple of (x,y) coordinates in it for when it's snapped to the grid and when it's not. Those coordinates are interpreted differently when the token is on the Token layer vs. when it's on the Object layer. I'd need to think about this a bit and perhaps work out some of the matrix transforms myself to see what happens to the coordinates when rotating them, but it's certainly a fascinating problem!

I would think that an image with an odd number of pixels (w,h) would rotate more accurately with the pixel in the center sitting still. So when there's an even number of pixels maybe there's some kind of round off error getting in the way? The transforms should be done in double precision arithmetic which I would expect to be plenty accurate enough but maybe that's where the issue lies?

No promises that I'll get this fixed though; I remember digging into that code previously and keeping track of the transforms (in my head) while reading the code got tricky.


Top
 Profile  
 
User avatar  Offline
Kobold
 
Joined: Wed Aug 02, 2017 1:58 am
Posts: 12
Location: Santa Clara, CA
 Post subject: Re: Rotating objects does not align?
PostPosted: Thu Aug 10, 2017 1:23 am 
I can confirm the same issue as the original poster. Been driving me nuts trying to fix it, but I don't think the issue is with the images.

I also ran into this when trying to get double doors to line up properly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 38 posts ]  Go to page 1, 2, 3  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 7 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman