public EllipsoidTangentPlane(Ellipsoid ellipsoid, IEnumerable <Vector3> positions) { if (ellipsoid == null) { throw new ArgumentNullException("ellipsoid"); } if (positions == null) { throw new ArgumentNullException("positions"); } if (!CollectionAlgorithms.EnumerableCountGreaterThanOrEqual(positions, 1)) { throw new ArgumentOutOfRangeException("positions", "At least one position is required."); } AxisAlignedBoundingBox box = new AxisAlignedBoundingBox(positions); _origin = ellipsoid.ScaleToGeodeticSurface(box.Center); _normal = ellipsoid.GeodeticSurfaceNormal(_origin); _d = -_origin.Dot(_origin); _yAxis = _origin.Cross(_origin.MostOrthogonalAxis).Normalize(); _xAxis = _yAxis.Cross(_origin).Normalize(); }