New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fractional-Pixel Polygon Rasterizer #1873

Merged
merged 5 commits into from Dec 7, 2016

Conversation

Projects
None yet
2 participants
@jamesmcclain
Member

jamesmcclain commented Dec 5, 2016

In this changeset, a polygon rasterizer which reports partial pixels and the respective fractions of those pixels that are covered by the polygon is presented. The approach used seems to be the most efficient that is practical if sub-pixel geometries are to be supported.

  • Bresenham or similar for generating partial pixels

This resource recommends the same method for volumetric calculation as we are envisioning. I have not found any contradictory resources.

jamesmcclain added some commits Dec 2, 2016

@jamesmcclain jamesmcclain force-pushed the jamesmcclain:feature/fractional-rasterizer branch from 92d3842 to 94aed1d Dec 6, 2016

@jamesmcclain jamesmcclain changed the title from [WIP] Fractional-Pixel Polygon Rasterizer to Fractional-Pixel Polygon Rasterizer Dec 6, 2016

val option = Rasterizer.Options(includePartial = false, sampleType = PixelIsArea)
polygonToEdges(poly, re)
.par

This comment has been minimized.

@lossyrob

lossyrob Dec 6, 2016

Member

We keep parallelization out of core geotrellis, since we promote parallelization via other means (e.g. spark). It's unclear if that's definitely the right choice, but that's the choice the rest of the library has made.

Perhaps there should be an option that defaulted to false for parallelization?

def foreachCellByPolygon(
poly: Polygon,
re: RasterExtent
)(fn: FractionCallback): Unit = {

This comment has been minimized.

@lossyrob

lossyrob Dec 6, 2016

Member

We should use a trait instead of Function3, because Function3 isn't specialized. The way we get around this for tile methods is via macros. We would eventually want to macroize this as well, but that can be a TODO.

): Unit = {
// Screen coordinates
val (x0, y0, x1, y1) = edge
val xmin = min(x0, x1)

This comment has been minimized.

@lossyrob

lossyrob Dec 6, 2016

Member

why call these screen coordinates? The convention in the library is that these are "grid coordinates", and we represent them with col, row, rowMin, etc. This differentiates them from x, y, xmin etc which represent map coordinates.

@jamesmcclain jamesmcclain force-pushed the jamesmcclain:feature/fractional-rasterizer branch from 94aed1d to e54601e Dec 6, 2016

@jamesmcclain jamesmcclain force-pushed the jamesmcclain:feature/fractional-rasterizer branch from e54601e to 30af5a3 Dec 7, 2016

@lossyrob lossyrob merged commit 180e220 into locationtech:master Dec 7, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
ip-validation
Details

@jamesmcclain jamesmcclain deleted the jamesmcclain:feature/fractional-rasterizer branch Dec 7, 2016

@lossyrob lossyrob added this to the 1.1 milestone Mar 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment