Given a two-dimensional polygon, this generates a three-dimensional extrusion of the shape by triangulating the polygon and creating a cylinder with that shape as the end faces.

extrude3d(x, y = NULL, thickness = 1, smooth = FALSE, ...)

## Arguments

x, y

A polygon description in one of the forms supported by triangulate.

thickness

The extrusion will have this thickness.

smooth

logical; should normals be added so that the edges of the extrusion appear smooth?

...

Other parameters to pass to tmesh3d when constructing the mesh.

## Details

The extrusion is always constructed with the polygon in the xy plane at z = 0 and another copy at z = thickness. Use the transformation functions (e.g. rotate3d) to obtain other orientations and placements.

## Value

A mesh object containing a triangulation of the polygon for each face, and quadrilaterals for the sides.

## Author

Duncan Murdoch

polygon3d for a simple polygon, triangulate for the triangulation, turn3d for a solid of rotation.

## Examples

x <- c(1:10, 10:1)
y <- rev(c(rep(c(0, 2), 5), rep(c(1.5, -0.5), 5)))
plot(x, y, type = "n")
polygon(x, y)

open3d()
shade3d( extrude3d(x, y), col = "red" )

{"x":{"material":{"color":"#000000","alpha":1,"lit":true,"ambient":"#000000","specular":"#FFFFFF","emission":"#000000","shininess":50,"smooth":true,"front":"filled","back":"filled","size":3,"lwd":1,"fog":true,"point_antialias":false,"line_antialias":false,"texture":null,"textype":"rgb","texmipmap":false,"texminfilter":"linear","texmagfilter":"linear","texenvmap":false,"depth_mask":true,"depth_test":"less","isTransparent":false,"polygon_offset":[0,0],"margin":"","floating":false,"tag":""},"rootSubscene":494,"objects":{"500":{"id":500,"type":"triangles","material":{},"vertices":"0","colors":"2","centers":"3","normals":"1","ignoreExtent":false,"flags":32771},"501":{"id":501,"type":"quads","material":{},"vertices":"4","colors":"6","centers":"7","normals":"5","ignoreExtent":false,"flags":32771},"498":{"id":498,"type":"light","vertices":[[0,0,1]],"colors":[[1,1,1,1],[1,1,1,1],[1,1,1,1]],"viewpoint":true,"finite":false},"497":{"id":497,"type":"background","material":{},"colors":"8","centers":"9","sphere":false,"fogtype":"none","fogscale":1,"flags":32768},"499":{"id":499,"type":"background","material":{"lit":false,"back":"lines"},"colors":"10","centers":"11","sphere":false,"fogtype":"none","fogscale":1,"flags":32768},"494":{"id":494,"type":"subscene","par3d":{"antialias":8,"FOV":30,"ignoreExtent":false,"listeners":494,"mouseMode":{"none":"none","left":"trackball","right":"zoom","middle":"fov","wheel":"pull"},"observer":[0,0,18.1480979919434],"modelMatrix":[[1,0,0,-5.5],[0,0.342020153999329,0.939692616462708,-0.726361393928528],[0,-0.939692616462708,0.342020153999329,-17.6143379211426],[0,0,0,1]],"projMatrix":[[3.73205089569092,0,0,0],[0,3.73205089569092,0,0],[0,0,-3.86370277404785,-65.4217910766602],[0,0,-1,0]],"skipRedraw":false,"userMatrix":[[1,0,0,0],[0,0.342020143325668,0.939692620785909,0],[0,-0.939692620785909,0.342020143325668,0],[0,0,0,1]],"userProjection":[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],"scale":[1,1,1],"viewport":{"x":0,"y":0,"width":1,"height":1},"zoom":1,"bbox":[1,10,-0.5,2,0,1],"windowRect":[0,0,256,256],"family":"sans","font":1,"cex":1,"useFreeType":true,"fontname":"NULL","maxClipPlanes":2147483647,"glVersion":"NA","activeSubscene":0},"embeddings":{"viewport":"replace","projection":"replace","model":"replace","mouse":"replace"},"objects":[499,500,501,498],"subscenes":[],"flags":33027}},"crosstalk":{"key":[],"group":[],"id":[],"options":[]},"width":480,"height":480,"context":{"shiny":false,"rmarkdown":null},"buffer":{"accessors":[{"bufferView":0,"componentType":5126,"count":108,"type":"VEC3"},{"bufferView":1,"componentType":5120,"count":108,"type":"VEC3"},{"bufferView":2,"componentType":5121,"count":1,"type":"VEC4"},{"bufferView":3,"componentType":5126,"count":36,"type":"VEC3"},{"bufferView":4,"componentType":5126,"count":80,"type":"VEC3"},{"bufferView":5,"componentType":5126,"count":80,"type":"VEC3"},{"bufferView":6,"componentType":5121,"count":1,"type":"VEC4"},{"bufferView":7,"componentType":5126,"count":20,"type":"VEC3"},{"bufferView":8,"componentType":5126,"count":1,"type":"VEC4"},{"bufferView":9,"componentType":5121,"count":1,"type":"VEC3"},{"bufferView":10,"componentType":5121,"count":1,"type":"VEC4"},{"bufferView":11,"componentType":5121,"count":1,"type":"VEC3"}],"bufferViews":[{"buffer":0,"byteLength":1296,"byteOffset":0},{"buffer":0,"byteLength":324,"byteOffset":1296},{"buffer":0,"byteLength":4,"byteOffset":1620},{"buffer":0,"byteLength":432,"byteOffset":1624},{"buffer":0,"byteLength":960,"byteOffset":2056},{"buffer":0,"byteLength":960,"byteOffset":3016},{"buffer":0,"byteLength":4,"byteOffset":3976},{"buffer":0,"byteLength":240,"byteOffset":3980},{"buffer":0,"byteLength":16,"byteOffset":4220},{"buffer":0,"byteLength":3,"byteOffset":4236},{"buffer":0,"byteLength":4,"byteOffset":4239},{"buffer":0,"byteLength":3,"byteOffset":4243}],"buffers":[{"byteLength":4246,"bytes":"AACAQAAAwD8AAIA/AACAQAAAAEAAAIA/AABAQAAAAAAAAIA/AACAQAAAwD8AAIA/AACgQAAA\nAL8AAIA/AACAQAAAAEAAAIA/AACgQAAAAL8AAIA/AACgQAAAAAAAAIA/AACAQAAAAEAAAIA/\nAACgQAAAAL8AAIA/AADAQAAAwD8AAIA/AACgQAAAAAAAAIA/AADAQAAAwD8AAIA/AADAQAAA\nAEAAAIA/AACgQAAAAAAAAIA/AABAQAAAAAAAAIA/AABAQAAAAL8AAIA/AACAQAAAwD8AAIA/\nAABAQAAAAAAAAIA/AAAAQAAAwD8AAIA/AABAQAAAAL8AAIA/AADAQAAAwD8AAIA/AADgQAAA\nAAAAAIA/AADAQAAAAEAAAIA/AADAQAAAwD8AAIA/AADgQAAAAL8AAIA/AADgQAAAAAAAAIA/\nAADgQAAAAL8AAIA/AAAAQQAAAEAAAIA/AADgQAAAAAAAAIA/AADgQAAAAL8AAIA/AAAAQQAA\nwD8AAIA/AAAAQQAAAEAAAIA/AAAAQQAAwD8AAIA/AAAQQQAAAAAAAIA/AAAAQQAAAEAAAIA/\nAABAQAAAAAAAAIA/AAAAQAAAAEAAAIA/AAAAQAAAwD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