[Logo] VUE Users Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Login] Login 
If this is your first visit to the new VUE forums, you can login using the same username and password you currently use on VUE's website. If you need an account, please create one through VUE's website. If you have problems, please contact us via the contact form on http://vue.tufts.edu
Proposal : Slight modification to Chevron and Rhombus shapes  XML
Forum Index » Developers' Corner
Author Message
jason m


Joined: 08/08/2008 11:36:13
Messages: 22
Offline

I would like to proposal that a change to the layout of Chevron and Rhombus shape algorithms.

At the moment the layout algorithm simply calculates and offset to the bounding rectangle. This has the effect of changing the angles relative to the size of the bounding rectangle.

Sometimes when aligning Chevrons in a row (eg to represent time stage gates) it is desirable to have chevrons of different sizes. With the current mechanism this looks somewhat messy as each chevron has different angles.

I proposal that the angle be fixed to a constant. (say at 45 degrees).

I have attached a screenshot of some working code for consideration.

One issue I have at the moment is that when the shape is stretched along the y axis it will not center and enclose the Content Node.
I have tried to modify RectanglarPoly2d.contains to detect this so that growShapeUntilContainsContent() works correctly but so far no luck.

Thoughts and tips welcome.

jason


[Thumb - VUE New layout algorithm.png]
 Filename VUE New layout algorithm.png [Disk] Download
 Description
 Filesize 43 Kbytes
 Downloaded:  1 time(s)

Brian Goodmon


Joined: 03/18/2009 10:38:09
Messages: 154
Offline

Hi Jason,

We (VUE team at Tufts) agree with you about the constant angle; it would be an improvement. Make it so, and thanks for your work!

The issue about the text not being contained properly is an existing one and I don't think your change to the angles will make it horribly worse, but if you would be willing to continue to look into a fix, that would be very appreciated. It sounds like you're on the right track although I haven't had a chance to dig into the code myself. It looks like the calculation that's being done is overly cautious on the pointy end of the chevron and not cautious enough on the forked end. I think the behavior of limiting the minimum size of the node is working fine, but the calculation of the minimum size and how to center the text needs to be fixed. You're looking at the right code. I'm guessing that having a constant angle might make that calculation simpler, so it would be a double win.

Thanks very much for your contributions to VUE!

Regards,

Brian Goodmon
Software Engineer
University Information Technology (UIT)
Tufts University
Brian Goodmon


Joined: 03/18/2009 10:38:09
Messages: 154
Offline

PS -- I think that once you get those calculations fixed you'll see a desirable behavior that when you stretch the node vertically such that the text would start to fall outside the chevron, that the node will automatically get wider to make the text fit. At least, that's what I would expect. Or maybe what will happen is that the node will stop growing vertically even though you're still pulling on the resize point. Either one of those behaviors seems reasonable.

Let us know how it goes and thanks again.

Regards,
Brian
jason m


Joined: 08/08/2008 11:36:13
Messages: 22
Offline

Patch contains modifications which:
* Fix the angle (60 degrees) of Rhombus and Chevron shapes.
* Improve the shape sizing algorithm to better enclose Rhombus and Chevron shapes when they are autosized.
* Small change to log output format to make it visually easier to see width and height values.

jason
 Filename patch8.txt [Disk] Download
 Description
 Filesize 11 Kbytes
 Downloaded:  3 time(s)

Brian Goodmon


Joined: 03/18/2009 10:38:09
Messages: 154
Offline

Hi Jason,

I like the way it looks now -- the constant angle is nice. I see a problem though:

Stretching the node taller vertically makes the room for the text get smaller, so at some point the text will extend beyond the outline of the shape for both the rhombus and the chevron. I think what would work in that case is to force the node to get wider as it gets taller once it has reached the point where the text no longer fits. Either that or don't allow the node to get taller until the user also has made it wider.

Would you like to take a shot at fixing this problem? it might be a bit challenging -- I don't think any other shapes would need to work that way so I'm not sure there's any existing mechanism to make nodes get wider as they get taller. As the node gets wider I think it should stay centered -- so the text would not move horizontally. What do you think?

Thanks,
Brian
jason m


Joined: 08/08/2008 11:36:13
Messages: 22
Offline

Hi Brian,

Yep, this was a behaviour that I had some trouble with. It only happened when someone pushed the extremes and it was easily controllable by the end user. That said, it was a shoddy behaviour.

I have attached another patch which attempts to grow the node shape to always fit the content. It seems to work however there is a slight side effect.
If you take the node shape diamond, then insert another shape, say a rectangle then leave the node in min size so auto sizing works.
In this configuration select a corner drag point of the contained rectangle and drag it around. You'll notice that as you drag it the node doesn't seem to resize quite the way one might expect, it sort of slides around. I think it is related to the way vue always tries to centre the content node. The user experience is not that unpleasant, IMHO, but try it out and see what you think.

Regards, Jason
 Filename patch10.txt [Disk] Download
 Description
 Filesize 22 Kbytes
 Downloaded:  2 time(s)

Brian Goodmon


Joined: 03/18/2009 10:38:09
Messages: 154
Offline

Hi Jason,

I'm looking at the patch now. I see the node-within-node resizing behavior that you mentioned. It's clearly wrong, but I don't think it's a side effect of your patch; I think that problem existed before your changes. Try it in an older version of VUE and tell me if you agree.

The rhombuses seem to be working nicely. The chevrons aren't quite right, but again, part of the problem I'm seeing existed before your changes; the text should be more to the right because it extends beyond the outline of the shape on the left-hand side, and I see that problem even in older versions of VUE.

I'll take a look at the code and see if I can tell where the chevron problem is happening.

Thanks again for your work on this. I think it's a nice improvement from the way it was.

Regards,
Brian
jason m


Joined: 08/08/2008 11:36:13
Messages: 22
Offline

Hi Brian,
I checked out a clean repo version and ran a few tests.
I don't think we are seeing the same thing. The repo copy works ok for most shapes however the chevron is really wrong. To me it appears to be jumping between positions. I've attached a patch of my current working copy. Please don't consider this a submission. I've attached the patch so you can apply it and hopefully rerun the test to see the difference. The chevron should work well, smoothly with no out of container drawing. (failing that I'm going to have to post a video).

To experience the problem I'm seeing place a rectangle in a circle node and drag the rectangle. The scaling should still be smooth and content always contained but the there's something odd in the way height and width scales.

jason


 Filename patch11.txt [Disk] Download
 Description
 Filesize 37 Kbytes
 Downloaded:  1 time(s)

Brian Goodmon


Joined: 03/18/2009 10:38:09
Messages: 154
Offline

Hi Jason,

Thanks for pursuing this. I've been looking into it also, but I haven't had enough time to devote to it to really get to the bottom of anything yet.

One thing that is exactly right are your changes to the computeVertices() methods in RectangularPoly2D. Those are working perfectly, which you already know. I'm convinced that the automatic resizing methods don't really need to be changed and that they will work as-is once we add a few more changes to those RectangularPoly2D subclasses -- I think we need to override the contains() method's behavior. Both of these shapes are concave (more obvious with the chevron, but also true in spirit if not in definition for the rhombus), which is to say that they have vertices or midpoints of sides that fall within the bounding box. I think there's a note in that method that says:


// todo: this will work to check the corners for entirely concave regular polygons
// but will need to check crossings to support irregular polygons
// (e.g. a star or cross)


I think that the author meant "convex" there instead of "concave". So I think we need to work on this angle a little. I might be wrong, but I feel that we should be able to make this work with a few dozen lines of code instead of a few hundred.

I checked in a few small fixes that don't implement your new 60 degree geometry yet -- I noticed that EAST and WEST were reversed in both RectangularPoly2D and LWNode. It worked, because it was wrong on both sides; but it was confusing.

Thanks again. I'll keep working on this as I find a minute here and there but I'm also busy with some other priorities.

Regards,
Brian
jason m


Joined: 08/08/2008 11:36:13
Messages: 22
Offline

Hi Brian,

I initially went down the path of just tweaking the shape and I also noticed the comment around the contains() method.
I even tried another contains algorithm but the change didn't work out.

One of the reasons for such significant work in the growShapeUntilContainsContent() method was that when the content was at the extremes (ie very tall but narrow or very wide but short) it would blow the 1000 loop threshold. Then the shape would never tighten around the content. I suspect this problem will remain even if the contains() method is improved.

One observation I would make around the existing contains() method is that it works unmodified within the last patch I sent you which suggests the algorithm is ok for the chevron shape (and other simple concave polygons).

Anyway if you find a simpler approach I'll be interested to see, I'm just a hobby coder :).

If you don't come up with something soonish what are the chances of taking my code and using that (until so optimisation is done)? It seems to work for me, I'd be interested to know if your testing comes out differently.


jason


izzy brown


Joined: 03/16/2012 08:18:42
Messages: 1
Offline

jason m wrote:
I would like to proposal that a change to the layout of Chevron and Rhombus shape algorithms.




This one is a good proposal.It is graet if it will be implemented.

This message was edited 1 time. Last update was at 03/31/2012 04:51:05


Chiropractic Toronto
[WWW]
 
Forum Index » Developers' Corner
Go to:   
Powered by JForum 2.1.8 © JForum Team