v2d.h File Reference

Interface for r2d rasterization routines. More...

#include "r2d.h"

Go to the source code of this file.

Functions

void r2d_rasterize (r2d_poly *poly, r2d_dvec2 ibox[2], r2d_real *dest_grid, r2d_rvec2 d, r2d_int polyorder)
 Rasterize a polygon to the destination grid. More...
 
void r2d_clamp_ibox (r2d_poly *poly, r2d_dvec2 ibox[2], r2d_dvec2 clampbox[2], r2d_rvec2 d)
 Get the minimal box of grid indices for a polygon, given a grid cell spacing, also clamping it to a user-specified range while clipping the polygon to that range. More...
 
void r2d_get_ibox (r2d_poly *poly, r2d_dvec2 ibox[2], r2d_rvec2 d)
 Get the minimal box of grid indices for a polygon, given a grid cell spacing. More...
 

Detailed Description

Interface for r2d rasterization routines.

Author
Devon Powell
Date
15 October 2015

Function Documentation

◆ r2d_clamp_ibox()

void r2d_clamp_ibox ( r2d_poly poly,
r2d_dvec2  ibox[2],
r2d_dvec2  clampbox[2],
r2d_rvec2  d 
)

Get the minimal box of grid indices for a polygon, given a grid cell spacing, also clamping it to a user-specified range while clipping the polygon to that range.

Parameters
[in]polyThe polygon for which to calculate the index box and clip.
[in,out]iboxMinimal range of grid indices covered by the polygon.
[in,out]clampboxRange of grid indices to which to clamp and clip ibox and poly, respectively.
[in]dThe cell spacing of the grid. The origin of the grid is assumed to lie at the origin in space.

◆ r2d_get_ibox()

void r2d_get_ibox ( r2d_poly poly,
r2d_dvec2  ibox[2],
r2d_rvec2  d 
)

Get the minimal box of grid indices for a polygon, given a grid cell spacing.

Parameters
[in]polyThe polygon for which to calculate the index box.
[out]iboxMinimal range of grid indices covered by the polygon.
[in]dThe cell spacing of the grid. The origin of the grid is assumed to lie at the origin in space.

◆ r2d_rasterize()

void r2d_rasterize ( r2d_poly poly,
r2d_dvec2  ibox[2],
r2d_real dest_grid,
r2d_rvec2  d,
r2d_int  polyorder 
)

Rasterize a polygon to the destination grid.

Parameters
[in]polyThe polygon to be rasterized.
[in]iboxMinimum and maximum indices of the polygon, found with r2d_get_ibox(). These indices are from a virtual grid starting at the origin.
[in,out]dest_gridThe rasterization buffer. This grid is a row-major grid patch starting at d*ibox[0] and ending at d*ibox[1]. Must have size of at least (ibox[1].i-ibox[0].i)*(ibox[1].j-ibox[0].j)*(ibox[1].k-ibox[0].k)*R2D_NUM_MOMENTS(polyorder)`.
[in]dThe cell spacing of the grid.
[in]polyorderOrder of the polynomial density field to rasterize. 0 for constant (1 moment), 1 for linear (3 moments), 2 for quadratic (6 moments), etc.