Learn R Programming

Morpho (version 2.1)

cutSpace: separate a 3D-pointcloud by a hyperplane

Description

separate a 3D-pointcloud by a hyperplane

Usage

cutSpace(pointcloud, v1, v2, v3, upper = TRUE)

Arguments

pointcloud
numeric n x 3 matrix
v1
numeric vector of length=3 specifying a point on the separating plane
v2
numeric vector of length=3 specifying a point on the separating plane
v3
numeric vector of length=3 specifying a point on the separating plane
upper
logical specify whether the points above or below the plane are to be reported as TRUE.

Value

  • logical vector of length n. Reporting for each point if it is above or below the hyperplane

Details

As above and below are specified by the normal calculated from $(v2-v1) \times (v3-v1)$, where $\times$ denotes the vector crossproduct. This means the normal points "upward" when viewed from the positon where v1, v2 and v3 are arranged counter-clockwise. Thus, which side is "up" depends on the ordering of v1, v2 and v3.

Examples

Run this code
data(nose)
v1 <- shortnose.lm[1,]
v2 <- shortnose.lm[2,]
v3 <- shortnose.lm[3,]
pointcloud <- vert2points(shortnose.mesh)
upper <- cutSpace(pointcloud, v1, v2, v3)
points3d(pointcloud[upper,])

Run the code above in your browser using DataLab