Describes a bounding volume determined by finding the points spaced the farthest apart on the x-, y-, and z-axes.
예제 #1
0
        /// <summary>
        /// Initializes a new instance tangent to <paramref name="ellipsoid"/> at 
        /// the center of a bounded set of <paramref name="positions"/>.
        /// </summary>
        /// <param name="ellipsoid">The ellipsoid .</param>
        /// <param name="positions"></param>
        public EllipsoidTangentPlane(Ellipsoid ellipsoid, IList<Cartesian> positions)
        {
            if (ellipsoid == null)
            {
                throw new ArgumentNullException("ellipsoid");
            }

            if (positions == null)
            {
                throw new ArgumentNullException("positions");
            }

            if (positions.Count < 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();
        }
        public void Simple()
        {
            Cartesian min = new Cartesian(-1, -1, -1);
            Cartesian max = new Cartesian(1, 1, 1);

            IList<Cartesian> positions = new List<Cartesian>();
            positions.Add(min);
            positions.Add(max);

            AxisAlignedBoundingBox box = new AxisAlignedBoundingBox(positions);
            Assert.AreEqual(min, box.Minimum);
            Assert.AreEqual(max, box.Maximum);
            Assert.AreEqual(Cartesian.Zero, box.Center);
        }
 public void Empty()
 {
     AxisAlignedBoundingBox box = new AxisAlignedBoundingBox(new List<Cartesian>());
     Assert.AreEqual(new Cartesian(double.MinValue, double.MinValue, double.MinValue), box.Minimum);
     Assert.AreEqual(new Cartesian(double.MaxValue, double.MaxValue, double.MaxValue), box.Maximum);
 }