public ICollection <Vector2D> ComputePositionsOnPlane(IEnumerable <Vector3D> positions)
        {
            if (positions == null)
            {
                throw new ArgumentNullException("positions");
            }

            IList <Vector2D> positionsOnPlane = new List <Vector2D>(CollectionAlgorithms.EnumerableCount(positions));

            foreach (Vector3D position in positions)
            {
                Vector3D intersectionPoint;

                if (IntersectionTests.TryRayPlane(Vector3D.Zero, position.Normalize(), _normal, _d, out intersectionPoint))
                {
                    Vector3D v = intersectionPoint - _origin;
                    positionsOnPlane.Add(new Vector2D(_xAxis.Dot(v), _yAxis.Dot(v)));
                }
                else
                {
                    // Ray does not intersect plane
                }
            }

            return(positionsOnPlane);
        }
Esempio n. 2
0
        public void EnumerableCount()
        {
            int[] list = new int[] { 0, 1 };
            Assert.AreEqual(2, CollectionAlgorithms.EnumerableCount(list));

            Dictionary <int, int> dictionary = new Dictionary <int, int>();

            dictionary.Add(0, 0);
            dictionary.Add(1, 1);

            IEnumerable <KeyValuePair <int, int> > enumerable = dictionary;

            Assert.AreEqual(2, CollectionAlgorithms.EnumerableCount(enumerable));
        }
Esempio n. 3
0
        public ICollection <Geodetic2D> ToGeodetic2D(IEnumerable <Vector3D> positions)
        {
            if (positions == null)
            {
                throw new ArgumentNullException("positions");
            }

            IList <Geodetic2D> geodetics = new List <Geodetic2D>(CollectionAlgorithms.EnumerableCount(positions));

            foreach (Vector3D position in positions)
            {
                geodetics.Add(ToGeodetic2D(position));
            }

            return(geodetics);
        }
Esempio n. 4
0
 public void EnumerableCountNull()
 {
     CollectionAlgorithms.EnumerableCount <int>(null);
 }