Skip to content

insidepoly has trouble with points at the boundary #2527

@kilir

Description

@kilir

For some grain maps, checkInside does not return the correct values when using setMTEXpref('insidepoly',true) when used with 'includeBoundary'. However, this does not occur on all maps and it always is the side with the largest X-values of vertices of grains. No issue with inpolygon, setting setMTEXpref('insidepoly',false).

Example:

load('grains.mat')

setMTEXpref('insidepoly',true)

plot(grains)
hold on
plot(grains(grains.isOuterBoundary('delta',1)),'FaceColor','k','lineColor','w')
hold off


setMTEXpref('insidepoly',false)

plot(grains)
hold on
plot(grains(grains.isOuterBoundary('delta',1)),'FaceColor','k','lineColor','w')
hold off

It seems that using a "much" larger tolerance might help

ontol = 1e-9*max(Pxmax-Pxmin,Pymax-Pymin);

but however, than points at the boundary seem to be always inside - even if not desired.

grains.zip

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions