Learn R Programming

PlaneGeometry (version 1.6.0)

EllipseEquationFromFivePoints: Ellipse equation from five points

Description

The coefficients of the implicit equation of an ellipse from five points on this ellipse.

Usage

EllipseEquationFromFivePoints(P1, P2, P3, P4, P5)

Value

A named numeric vector.

Arguments

P1, P2, P3, P4, P5

the five points

Details

The implicit equation of the ellipse is Ax² + Bxy + Cy² + Dx + Ey + F = 0. This function returns A, B, C, D, E and F.

Examples

Run this code
ell <- Ellipse$new(c(2,3), 5, 4, 30)
set.seed(666)
pts <- ell$randomPoints(5, "on")
cf1 <- EllipseEquationFromFivePoints(pts[1,],pts[2,],pts[3,],pts[4,],pts[5,])
cf2 <- ell$equation() # should be the same up to a multiplicative factor
all.equal(cf1/cf1["F"], cf2/cf2["F"])

Run the code above in your browser using DataLab