Sharp triangle - bounding boxes doesn't match real edges

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Sharp triangle - bounding boxes doesn't match real edges

Postby Grobe » Thu Dec 02, 2010 1:20 am

Inkscape 0.48+devel r9931
OS: WIndows XP sp2

The atached screen shot shows a triangle that is zoomed into. It also shows that the bounding box doesn't really match the uttermost edges of the triangle. A result of this is that the Align fuctions doesn't work properly on this object.

Is there any way to get around this issue If I want to perfectly align the edges to another object (straight orthogonal line) without changing (destroy) the edges (milter limit) of the triangle?
Attachments
Inkscape_boundingBoxTriangle.png
Inkscape_boundingBoxTriangle.png (12.22 KiB) Viewed 3427 times
:lol:

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby RobA » Thu Dec 02, 2010 2:47 am

Looks like a known bug. visual bounding box is being calculated assuming a round join rather than a miter join.

There is this closed one: https://bugs.launchpad.net/inkscape/+bug/166659 which fixes the issue, but only for exporting pngs. In that bug report it states:
Calculating correct bbox for stroked paths is very very
expensive. It's difficult to implement and will slow the
program down a lot. I can only hope Cairo will be able to
help this somewhat.


Which is why the displayed bounding box doesn't do this.

I also found this one: https://bugs.launchpad.net/inkscape/+bug/473608 which seems to capture your issue.

-Rob A>

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby ~suv » Thu Dec 02, 2010 3:25 am

I had asked a similar question on the 'inkscape-devel' mailing list after the bounding box calculation for bitmap export was improved earlier this year:
> What is strange now imho: when resizing the page to
> selection, the bounding box of the selected object is smaller
> than the resized page margin (seen with both test cases of
> bug #479964 and #186182) -> does the command (button label)
> need to be rephrased or will the selection bounding box also
> be changed to include long miters / stroke endcaps?

The shown selection bounding box (the dashed rectangle) will not include
stroke endcaps and stuff. Calculating the precise bbox is expensive and
I think should only be done for action that require the precision, and
not for interactive things like the selection cue.

You could file a feature request to use the same improved (more precise) bounding box (from exporting to bitmap) also when aligning objects with the 'Align and Distribute' dialog.

Note that the dialog has another limitation which can be as annoying: Inkscape knows two bounding box modes (Visual: includes the stroke width, and Geometric: only include the centerline geometry). Most commands respect the user setting which bounding box to use, the 'Align and Stroke' dialog however always uses the visual bounding box (ignoring the user setting in 'Inkscape Preferences > Tools > Bounding box to use').
(Discussed earlier in Bug #473608 “Aligning stroked and strokeless items & bounding box issues”)

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby Grobe » Thu Dec 02, 2010 5:46 am

Hi.

I found a pretty simple workaround. Just make a triangle where Stroke Width is zeero or very thin compared to object size.

If I had any programming skills I would have found the positions to bounding boxes by threating the rectangle as a simple triangle, not conserning about Stroke issues. I cannot imagine that would be that difficult.

Thanks
:lol:

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby brynn » Thu Dec 02, 2010 8:29 am

You've probably already thought about this, but just in case -- visual vs geometric bounding box....?

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby Grobe » Fri Dec 03, 2010 3:06 am

brynn wrote:You've probably already thought about this, but just in case -- visual vs geometric bounding box....?
Yes, it's mentioned before in this thread. But that is not the solution for me.

As long I only create custom arrowheads that is without stroke, I'm just fine :D
:lol:

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby prkos » Fri Dec 03, 2010 7:04 am

Does increasing the Miter limit help?
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby Grobe » Fri Dec 03, 2010 11:00 am

prkos wrote:Does increasing the Miter limit help?
No, it doesn't.
:lol:

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Sharp triangle - bounding boxes doesn't match real edges

Postby RobA » Fri Dec 03, 2010 2:21 pm

Grobe wrote:
prkos wrote:Does increasing the Miter limit help?
No, it doesn't.


..because it assumes rounded corners (for speed) when calculating the visual bounding box. The miters are completely ignored.

-Rob A>


Return to “Discuss Software Issues”