fitCircle: Fitting circle into point configuration

View source: R/fitCircle.R

fitCircleR Documentation

Fitting circle into point configuration

Description

Utility function for fitting a circle into 2D point configurations.

Usage

fitCircle(x, y)

Arguments

x

Vector with x-coordinates

y

Vector with y-coordinates

Value

cx

x-coordinate center

cy

y-coordinate center

radius

circle radius

References

Pratt, V. (1987). Direct least-squares fitting of algebraic surfaces. Computer Graphics, Vol. 21, pages 145-152.

Examples

## Dataset on Schwartz values:
require(plotrix)
valsD <- 1 - cor(indvalues)
fit <- mds(valsD)
plot(fit, main = "MDS Value Circle")
circle <- fitCircle(fit$conf[,1], fit$conf[,2])
draw.circle(circle$cx, circle$cy, radius = circle$radius, border = "gray") 

smacof documentation built on Oct. 10, 2024, 5:09 p.m.