Learn R Programming

uniformly (version 0.5.0)

makeHexahedron: Make hexahedron

Description

Make a hexahedron for usage in runif_in_hexahedron and other functions.

Usage

makeHexahedron(p0, p1, p2, p3, p4, p5, p6, p7)

Value

A matrix with eight columns, the vertices.

Arguments

p0, p1, p2, p3, p4, p5, p6, p7

the eight vertices of the hexahedron, as in the figure shown below

Details

A hexahedron is a polyhedron having six quad faces. Its eight vertices must be placed as in the figure below.

hexahedron

See Also

The function plotHexahedron is useful to check the hexahedron.

Examples

Run this code
library(uniformly)
# a non-convex hexahedron
hexahedron <- makeHexahedron(
  p0 = c(1.5, 1.5, 0),
  p1 = c(2, 0, 0),
  p2 = c(2, 2, 0),
  p3 = c(0, 2, 0),
  p4 = c(0, 2, 2),
  p5 = c(0, 0, 2),
  p6 = c(2, 0, 2),
  p7 = c(2, 2, 2)
)
plotHexahedron(hexahedron)

Run the code above in your browser using DataLab