Learn R Programming

ptinpoly (version 2.8)

cube: Sample Data: Simple Cube

Description

This is sample data that defines a simple cube: eight vertices, and twelve triangles that make up the six faces.

Also included is an example matrix queries of five test points. The first test point is contained within the cube, the second through fourth test points lie exactly on the surface of the cube, and the fifth test point lies outside the cube.

Usage

data(verts)
data(faces)
data(queries)

Arguments

Format

verts is an 8 by 3 matrix containing the XYZ coordinates of the vertices of a simple cube.

faces is a 12 by 3 matrix containing the indices of the vertices defining the twelve triangular faces making up the surface of the cube.

queries is a 5 by 3 matrix containing the XYZ coordinates of five test points to be tested for containment within the cube.

Examples

Run this code
# NOT RUN {
# Load sample data defining a simple cube. 
data(verts)
data(faces)

# Also load sample data for five test points.
data(queries)

# Test whether each point in 'queries' is contained in
# the simple cube defined by 'verts' and 'faces'.
# This should return "1  0  0  0 -1".
containment = pip3d(verts,faces,queries);
# }

Run the code above in your browser using DataLab