AtoG {fitConic} | R Documentation |
A Set Of Functions To Convert Among Various Conic-Section-Defining Parameter Sets.
Description
AtoG
Convert from full quadratic "ABCDEF" to focus, axis, angle "hvab theta" parameters.
GtoA
Convert from "hvab theta" to "ABCDEF" parameters.
parab3toA
Simple conversion from a + bx + cx^2 to "ABCDEF" parameters.
FEDtoA
Convert focus, eccentricity, and directrix to "ABCDEF" parameters.
Usage
AtoG(parA, tol = 1e-06)
GtoA(parG, conicType = c("e", "h"))
parab3toA(ADF, theta = 0)
FEDtoA(focus = c(0, 0), directrix = c(1, 0, 1), eccentricity = 0.5)
Arguments
parA |
The six coefficients in the quadratic Ax^2 + Bxy + Cy^2 +Dx + Ey +F = 0 |
tol |
A small value, used to check whether small coefficient values might be actually zero. See "Details." |
parG |
a five-element vector "h,v,a,b,theta" . See "Details" for the standard equation form for this. |
conicType |
Because the 'hvab' equation has a sign difference for ellipses vs. hyperbolas, it is necessary to indicate which kind of input is intended. See "Details." |
focus |
location of the conic sections focus. |
directrix |
the 3-element directrix. |
eccentricity |
the eccentricity of the conic section. |
ADF |
The A,D,F coeffients in the standard quadratic. Thus, the x^2 term, the x term, and the constant term. |
theta |
An angle by which the entire parabola is to be rotated. |
Details
The tol
input for AtoG
checks two conditions. First, is B practically zero, in which case B is set to exactly zero, implying no rotation of the conic section. Second, is B^2 - 4*A*C almost zero, implying that the conic is probably a parabola, and conversion to 'hvab' form is not useful.
The "hvab" form for describing an ellipse or a hyperbola looks like [Center(1:2), Axes(1:2)/2] angle A, to fill the equation
((x-h)cosA +(y-v)sinA)^2/a^2 + ((x-h)sinA-(y-v)cosA)^2/b^2 = 1 The length of the axes are 2*a, 2*b .
A discussion of the focus/directrix/eccentricity form of a conic section is rather lengthy and not presented here. One short introduction can be found at https://en.wikipedia.org/wiki/Conic_section#Eccentricity,_focus_and_directrix
Value
for AtoG
,
parG |
c(h,v,a,b,theta) |
exitCode |
a value used in fitConic. 1,2, or 3 for ellipse, hyperbola, parabola |
conicType |
matching exitCode with a char "e", "h", or "p" |
for GtoA
parA |
the ABCDEF coefficients of the general quadratic |
exitCode |
a value used in fitConic. 1,2, or 3 for ellipse, hyperbola, parabola |
conicType |
matching exitCode with a char "e", "h", or "p" |
for FEDtoA
, the ABCDEF coefficients of the general quadratic
for parab3toA
,
parA |
the ABCDEF coefficients of the general quadratic |
exitCode |
always numeric 3, a value used in fitConic |
conicType |
always char "p" |
.