Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cutSpace

separate a 3D-pointcloud by a hyperplane


Description

separate a 3D-pointcloud by a hyperplane

Usage

cutSpace(pointcloud, v1, v2 = NULL, v3 = NULL, normal = NULL,
  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

normal

plane normal (overrides specification by v2 and v3)

upper

logical specify whether the points above or below the plane are to be reported as TRUE.

Details

As above and below are specified by the normal calculated from (v2-v1) x (v3-v1), where x 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.

Value

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

Examples

data(nose)
v1 <- shortnose.lm[1,]
v2 <- shortnose.lm[2,]
v3 <- shortnose.lm[3,]
pointcloud <- vert2points(shortnose.mesh)
upper <- cutSpace(pointcloud, v1, v2, v3)
## Not run: 
require(rgl)
normal <- crossProduct(v2-v1,v3-v1)
zeroPro <- points2plane(rep(0,3),v1,normal)
## get sign of normal displacement from zero
sig <- sign(crossprod(-zeroPro,normal))
d <- sig*norm(zeroPro,"2")
planes3d(normal[1],normal[2],normal[3],d=d)
points3d(pointcloud[upper,])

## End(Not run)

Morpho

Calculations and Visualisations Related to Geometric Morphometrics

v2.8
GPL-2
Authors
Stefan Schlager [aut, cre, cph], Gregory Jefferis [ctb], Dryden Ian [cph]
Initial release
2020-02-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.