--- title: "design - textures package" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{design} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ## Design Both **quad()** and **quad_texture()** return 'mesh3d' objects that may be plotted directly with rgls `plot3d()`, `shade3d()`, `persp3d()`, `wire3d()`, or `dot3d()`. * All coordinates are in `x [0, 1]` and `y [0, 1]` and default to "y-up" (begin at 0) * Quad indexes are counter-clockwise, as required by rgl (see `material3d` `back` argument). * `ydown` flips the orientation so that y coordinates begin at 1 and count down, and ensures that quad indexes are reversed and correctly counter-clockwise. ### R functions using src/ * `break_mesh()` - removes topology from mesh3d, by expanding every coordinate from vertex array * `quad()` generate mesh3d, a rectangular array of quads in the plane in 0,1 * `quad_texture()` - extension of quad() to include image texture, all geometry and texture has identical x-y plane coordinates in 0,1 ### Rcpp package using quad.h These are callable from R. ```C++ IntegerVector quad_index_cpp(IntegerVector nx, IntegerVector ny, LogicalVector ydown) NumericVector quad_vertex_cpp(IntegerVector nx, IntegerVector ny, LogicalVector ydown, LogicalVector zh) NumericVector quad_vertex_matrix_cpp(IntegerVector nx, IntegerVector ny, LogicalVector ydown, LogicalVector zh) ``` ### Headers `quad_ib` and `quad_vb` both return flat vectors, `quad_matrix_vb` returns a matrix (with optionally z and h). `./inst/include/quad/quad.h` namespace `quad` ```C++ IntegerVector quad_ib(IntegerVector nx, IntegerVector ny, LogicalVector ydown, LogicalVector zh); NumericVector quad_vb(IntegerVector nx, IntegerVector ny, LogicalVector ydown, LogicalVector zh); NumericVector quad_matrix_vb(IntegerVector nx, IntegerVector ny, LogicalVector ydown, LogicalVector zh); ```