pjelpl_c |
Table of contents
Procedurepjelpl_c ( Project ellipse onto plane ) void pjelpl_c ( ConstSpiceEllipse * elin, ConstSpicePlane * plane, SpiceEllipse * elout ) AbstractProject an ellipse onto a plane, orthogonally. Required_ReadingELLIPSES PLANES KeywordsELLIPSE GEOMETRY MATH Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- elin I A SPICE ellipse to be projected. plane I A plane onto which elin is to be projected. elout O A SPICE ellipse resulting from the projection. Detailed_Inputelin, plane are, respectively, a SPICE ellipse and a SPICE plane. The geometric ellipse represented by elin is to be orthogonally projected onto the geometric plane represented by plane. Detailed_Outputelout is a SPICE ellipse that represents the geometric ellipse resulting from orthogonally projecting the ellipse represented by inel onto the plane represented by plane. ParametersNone. Exceptions1) If the input plane is invalid, an error is signaled by a routine in the call tree of this routine. 2) The input ellipse may be degenerate--its semi-axes may be linearly dependent. Such ellipses are allowed as inputs. 3) The ellipse resulting from orthogonally projecting the input ellipse onto a plane may be degenerate, even if the input ellipse is not. FilesNone. ParticularsProjecting an ellipse orthogonally onto a plane can be thought of finding the points on the plane that are `under' or `over' the ellipse, with the `up' direction considered to be perpendicular to the plane. More mathematically, the orthogonal projection is the set of points Y in the plane such that for some point X in the ellipse, the vector Y - X is perpendicular to the plane. The orthogonal projection of an ellipse onto a plane yields another ellipse. Examples1) With center = { 1., 1., 1. }, vect1 = { 2., 0., 0. }, vect2 = { 0., 1., 1. }, normal = { 0., 0., 1. } the code fragment nvc2pl_c ( normal, 0., plane ); cgv2el_c ( center, vect1, vect2, elin ); pjelpl_c ( elin, plane, elout ); el2cgv_c ( elout, prjctr, prjmaj, prjmin ); returns prjctr = { 1., 1., 0. }, prjmaj = { 2., 0., 0. }, prjmin = { 0., 1., 0. } 2) With vect1 = { 2., 0., 0. }, vect2 = { 1., 1., 1. }, center = { 0., 0., 0. }, normal = { 0., 0., 1. }, the code fragment nvc2pl_c ( normal, 0., plane ); cgv2el_c ( center, vect1, vect2, elin ); pjelpl_c ( elin, plane, elout ); el2cgv_c ( elout, prjctr, prjmaj, prjmin ); returns prjctr = { 0., 0., 0. }; prjmaj = { -2.227032728823213, -5.257311121191336e-1, 0. }; prjmin = { 2.008114158862273e-1, -8.506508083520399e-1, 0. }; 3) An example of actual use: Suppose we wish to compute the distance from an ellipsoid to a line. Let the line be defined by a point P and a direction vector DIRECT; the line is the set of points P + t * DIRECT, where t is any real number. Let the ellipsoid have semi- axis lengths A, B, and C. We can reduce the problem to that of finding the distance between the line and an ellipse on the ellipsoid surface by considering the fact that the surface normal at the nearest point to the line will be orthogonal to DIRECT; the set of surface points where this condition holds lies in a plane, and hence is an ellipse on the surface. The problem can be further simplified by projecting the ellipse orthogonally onto the plane defined by < X, DIRECT > = 0. The problem is then a two dimensional one: find the distance of the projected ellipse from the intersection of the line and this plane (which is necessarily one point). A `paraphrase' of the relevant code is: #include "SpiceUsr.h" . . . /. Step 1. Find the candidate ellipse cand. normal is a normal vector to the plane containing the candidate ellipse. The ellipse must exist, since it's the intersection of an ellipsoid centered at the origin and a plane containing the origin. For this reason, we don't check inedpl_c's "found flag" found below. ./ normal[0] = direct[0] / (a*a); normal[1] = direct[1] / (b*b); normal[2] = direct[2] / (c*c); nvc2pl_c ( normal, 0., &candpl ); inedpl_c ( a, b, c, &candpl, cand, &found ); /. Step 2. Project the candidate ellipse onto a plane orthogonal to the line. We'll call the plane prjpl and the projected ellipse prjel. ./ nvc2pl_c ( direct, 0., &prjpl ); pjelpl_c ( &cand, &prjpl, &prjel ); /. Step 3. Find the point on the line lying in the projection plane, and then find the near point pjnear on the projected ellipse. Here prjpt is the point on the input line that lies in the projection plane. The distance between prjpt and pjnear is dist. ./ vprjp_c ( linept, &prjpl, prjpt ); npelpt_c ( &prjel, prjpt, pjnear, &dist ); /. Step 4. Find the near point pnear on the ellipsoid by taking the inverse orthogonal projection of PJNEAR; this is the point on the candidate ellipse that projects to pjnear. Note that the output dist was computed in step 3. The inverse projection of pjnear is guaranteed to exist, so we don't have to check found. ./ vprjpi_c ( pjnear, &prjpl, &candpl, pnear, &found ); /. The value of dist returned is the distance we're looking for. The procedure described here is carried out in the routine npedln_c. ./ RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) Version-CSPICE Version 1.0.1, 24-AUG-2021 (JDR) Edited the header to comply with NAIF standard. -CSPICE Version 1.0.0, 02-SEP-1999 (NJB) Index_Entriesproject ellipse onto plane |
Fri Dec 31 18:41:10 2021