pc2pt: Compute co-planar coordinates given plane equation...

View source: R/geom_dist.R

pc2ptR Documentation

Compute co-planar coordinates given plane equation coefficients

Description

Given plane equation coefficients this function returns a set of 3 points that lie on the plane. The points will be located close to the point on the plane that is closest to the origin, but for all practical purposes they can be considered to be arbitrary points.

Note that the signs of the individual coefficients may be inverted (either all or none), but the result is the same

Usage

pc2pt(p.coefs)

Arguments

p.coefs

A vector of length 4 giving plane equation coefficients a, b, c, d describing a plane as ax + by + cz + d = 0.

Value

A 3x3 matrix containing points (one per row) located on the plane. Note that the first point is the point closest to the origin.

Note

Based on answer given by ja72 on https://math.stackexchange.com/questions/1755856/calculate-arbitrary-points-from-a-plane-equation

Author(s)

Cornel M. Pop

Examples

library(rgl)
p = data.frame(x=c(1, 3, 4), y=c(0,2,1), z=c(3,4,5))
p.coefs = planeCoefs(p)
p2 = pc2pt(p.coefs)
p2.coefs = planeCoefs(p2)
points3d(p2, color="red")
points3d(p, color="green")
planes3d(p.coefs[1], p.coefs[2], p.coefs[3], p.coefs[4], color="blue",
         alpha=0.5)

cornelmpop/Lithics3D documentation built on Feb. 10, 2024, 11:54 p.m.